# HG changeset patch
# User hgs
# Date 1276157261 -28800
# Node ID 2883a5458389cbccd6c306938b40dd4d49de369e
# Parent 22d3abee08daf5706f9605fcfade09c8e5229304
201023
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/image/qgn_menu_note.svg
--- a/controlpanelplugins/themeplugin/image/qgn_menu_note.svg Tue May 25 04:10:19 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-
-
-
\ No newline at end of file
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/image/themePreview.nvg
Binary file controlpanelplugins/themeplugin/image/themePreview.nvg has changed
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/image/themePreview.png
Binary file controlpanelplugins/themeplugin/image/themePreview.png has changed
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/image/themePreview.svg
--- a/controlpanelplugins/themeplugin/image/themePreview.svg Tue May 25 04:10:19 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-
-
-
\ No newline at end of file
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/src/cpthemechanger.cpp
--- a/controlpanelplugins/themeplugin/src/cpthemechanger.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemechanger.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -17,10 +17,10 @@
#include "cpthemechanger.h"
#include "cpthemechanger_p.h"
+#include "cpthemelistmodel.h"
/*!
@alpha
- @hbcore
\class CpThemeChanger
\brief CpThemeChanger provides an interface for changing the current
@@ -46,8 +46,8 @@
QAbstractItemModel& CpThemeChanger::model()
{
Q_D(CpThemeChanger);
-
- return d->model;
+
+ return d->mModel;
}
@@ -83,13 +83,17 @@
const CpThemeChanger::ThemeInfo& CpThemeChanger::currentTheme() const
{
Q_D(const CpThemeChanger);
-
+
return d->currentTheme();
}
+/*
+ * Returns index of theme from the theme list (not the model).
+ */
int CpThemeChanger::indexOf(const ThemeInfo& theme) const
{
Q_D(const CpThemeChanger);
+
return d->indexOf(theme);
}
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/src/cpthemechanger.h
--- a/controlpanelplugins/themeplugin/src/cpthemechanger.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemechanger.h Thu Jun 10 16:07:41 2010 +0800
@@ -19,6 +19,7 @@
#define CPTHEMECHANGER_H
#include
+
#include
#include
@@ -36,8 +37,12 @@
explicit CpThemeChanger(QObject* parent=0);
~CpThemeChanger();
- struct ThemeInfo
- {
+ enum ThemeListUserRole {
+ PortraitPreviewRole = Qt::UserRole,
+ LandscapePreviewRole
+ };
+
+ struct ThemeInfo{
QString name;
HbIcon icon;
HbIcon portraitPreviewIcon;
@@ -50,11 +55,6 @@
}
};
- enum ThemeListUserRole {
- PortraitPreviewRole = Qt::UserRole,
- LandscapePreviewRole
- };
-
QAbstractItemModel& model();
const ThemeInfo& currentTheme() const;
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/src/cpthemechanger_p.cpp
--- a/controlpanelplugins/themeplugin/src/cpthemechanger_p.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemechanger_p.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -17,35 +17,50 @@
#include "cpthemechanger.h"
#include "cpthemechanger_p.h"
+#include "cpthemelistmodel.h"
+#include "cpthemeclient_p.h"
+#include "cpthemecommon_p.h"
+
#include
#include
#include
#include
-#include
+#include
+#include
+
#include
#include
-#include "cpthemeclient_p.h"
-#include "cpthemecommon_p.h"
-#ifdef Q_OS_SYMBIAN
-#include "cpthemeclientsymbian_p.h"
-#else
-#include "cpthemeclientqt_p.h"
-#endif
-namespace {
+
#if !defined(Q_OS_SYMBIAN)
#include
static const char* KThemePathKey = "HB_THEMES_DIR";
#endif
-
- static const QString KDefaultTheme = "hbdefault";
-}
+ static const QString KDefaultTheme = "sfblacktheme";
+ static const QString KDefaultThemeIcon = ":/image/themePreview.nvg";
+ static const QString KPreviewThumbnailNVG = "/scalable/qtg_graf_theme_preview_thumbnail.nvg";
+ static const QString KPreviewThumbnailSVG = "/scalable/qtg_graf_theme_preview_thumbnail.svg";
+
+ static const QString KPreviewPrtNVG = "/scalable/qtg_graf_theme_preview_prt.nvg";
+ static const QString KPreviewLscNVG = "/scalable/qtg_graf_theme_preview_lsc.nvg";
+ static const QString KPreviewPrtSVG = "/scalable/qtg_graf_theme_preview_prt.svg";
+ static const QString KPreviewLscSVG = "/scalable/qtg_graf_theme_preview_lsc.svg";
+
+ static const QString KBackgroundPrtNVG = "/scalable/qtg_graf_screen_bg_prt.nvg";
+ static const QString KBackgroundLscNVG = "/scalable/qtg_graf_screen_bg_lsc.nvg";
+ static const QString KBackgroundPrtSVG = "/scalable/qtg_graf_screen_bg_prt.svg";
+ static const QString KBackgroundLscSVG = "/scalable/qtg_graf_screen_bg_lsc.svg";
+
+ static const QString KBackgroundPrtPNG = "/pixmap/qtg_graf_screen_bg_prt.png";
+ static const QString KBackgroundLscPNG = "/pixmap/qtg_graf_screen_bg_lsc.png";
+
+
CpThemeChangerPrivate::CpThemeChangerPrivate(CpThemeChanger* qq):
q_ptr(qq),
- themeClient(CpThemeClient::global()),
- fileWatcher(new QFileSystemWatcher(qq)),
- model(this, qq)
+ mThemeClient(CpThemeClient::global()),
+ mFileWatcher(new QFileSystemWatcher(qq)),
+ mModel(this, qq)
{
Q_Q(CpThemeChanger);
@@ -53,26 +68,26 @@
// Figure out where our themes are. This is platform-dependent,
// but not worth breaking out into platform-private implementations
// at the moment. Ideally, this would be given to us by the theme server,
- #ifdef Q_OS_WIN
- static char* _path=NULL;
- static size_t _size=0;
+#ifdef Q_OS_WIN
+ static char* _path = NULL;
+ static size_t _size = 0;
_dupenv_s(&_path, &_size, KThemePathKey);
- themeRootPath = QString(_path);
- themeRootPathPostfix = QString();
+ mThemeRootPath = QString(_path);
+ mThemeRootPathPostfix = QString();
free(_path);
- #elif defined(Q_OS_SYMBIAN)
- themeRootPath = "c:\\resource\\hb";
- themeRootPathPostfix = "resource\\hb";
- #elif defined(Q_OS_UNIX)
- themeRootPath = QString(getenv(KThemePathKey));
- themeRootPathPostfix = QString();
- #elif defined(Q_OS_MACX)
- themeRootPath = QDir::homePath() + '/' + "Library" + QString("hb");
- themeRootPathPostfix = QString();
- #else
- themeRootPath = "c:\\resource\\hb";
- themeRootPathPostfix = QString();
- #endif
+#elif defined(Q_OS_SYMBIAN)
+ mThemeRootPath = "c:\\resource\\hb";
+ mThemeRootPathPostfix = "resource\\hb";
+#elif defined(Q_OS_MACX)
+ mThemeRootPath = QDir::homePath() + '/' + "Library" + QString("hb");
+ mThemeRootPathPostfix = QString();
+#elif defined(Q_OS_UNIX)
+ mThemeRootPath = QString(getenv(KThemePathKey));
+ mThemeRootPathPostfix = QString();
+#else
+ mThemeRootPath = "c:\\resource\\hb";
+ mThemeRootPathPostfix = QString();
+#endif
// Get our current state
if (HbInstance::instance()) {
@@ -81,21 +96,40 @@
mCurrentTheme.name = hbTheme->name();
}
}
- updateThemeList(mCurrentTheme.name);
-
+
// Watch for changes to the theme directory in flash.
// This may change once we start offering a model.
- fileWatcher->addPath(themeRootPath+"/themes/");
- q->connect(fileWatcher, SIGNAL(directoryChanged(const QString&)),
+#if defined(Q_OS_SYMBIAN)
+ QFileInfoList driveInfoList = QDir::drives();
+ foreach (const QFileInfo &driveInfo, driveInfoList) {
+ const QString drive = driveInfo.absolutePath();
+ mThemesPathList << drive + mThemeRootPathPostfix;
+ }
+#else
+ mThemesPathList << mThemeRootPath;
+#endif
+ foreach (const QString &path, mThemesPathList) {
+ QDir themeDir;
+ themeDir.setPath( path ) ;
+ QStringList list = themeDir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name);
+ if(list.contains("themes", Qt::CaseSensitive )) {
+ mFileWatcher->addPath(themeDir.path() + "/themes/");
+ }
+ }
+
+ q->connect(mFileWatcher, SIGNAL(directoryChanged(const QString&)),
q, SLOT(_q_themeDirectoryChanged(const QString&)));
+ updateThemeList(mCurrentTheme.name);
+
// Connect to the theme server
connectToServer();
}
CpThemeChangerPrivate::~CpThemeChangerPrivate()
{
- themeClient->releaseInstance();
+ mThemeClient->releaseInstance();
+ mThemeClient = 0;
}
const CpThemeChanger::ThemeInfo& CpThemeChangerPrivate::currentTheme() const
@@ -110,50 +144,33 @@
int CpThemeChangerPrivate::indexOf(const CpThemeChanger::ThemeInfo& theme) const
{
- return themeList.indexOf(theme);
+ return mThemeList.indexOf(theme);
}
void CpThemeChangerPrivate::updateThemeList(const QString& newThemeName)
{
- if(!themeList.isEmpty()) {
- themeList.clear();
+ if(!mThemeList.isEmpty()) {
+ mThemeList.clear();
}
mCurrentTheme.name = newThemeName.isEmpty() ? KDefaultTheme : newThemeName;
- // Get the list of Drives here
- QStringList themesPathList;
-
-#if defined(Q_OS_WIN32)
- themesPathList << themeRootPath;
-#elif defined(Q_OS_SYMBIAN)
- QFileInfoList driveInfoList = QDir::drives();
- foreach (const QFileInfo &driveInfo, driveInfoList) {
- const QString drive = driveInfo.absolutePath();
- themesPathList << drive + themeRootPathPostfix;
- }
-#elif defined(Q_OS_UNIX)
- themesPathList << themeRootPath;
-#elif defined(Q_OS_MACX)
- themesPathList << themeRootPath;
-#endif
-
- foreach (const QString &path, themesPathList) {
+ foreach (const QString &path, mThemesPathList) {
QDir themeDir;
themeDir.setPath( path ) ;
QStringList iconthemeslist;
QStringList list = themeDir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name);
CpThemeChanger::ThemeInfo nameIconPair;
- if(list.contains("themes",Qt::CaseSensitive )) {
+ if(list.contains("themes", Qt::CaseSensitive )) {
QDir root(themeDir.path());
- themeDir.setPath(root.path()+"/themes/icons/") ;
- iconthemeslist=themeDir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name);
+ themeDir.setPath(root.path() + "/themes/icons/") ;
+ iconthemeslist = themeDir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name);
foreach(QString themefolder, iconthemeslist) {
- QDir iconThemePath(root.path()+"/themes/icons/"+themefolder);
+ QDir iconThemePath(root.path() + "/themes/icons/" + themefolder);
if(iconThemePath.exists("index.theme") &&
(iconThemePath.exists("scalable") || iconThemePath.exists("pixmap") )) {
- QSettings iniSetting(iconThemePath.path()+"/index.theme",QSettings::IniFormat);
+ QSettings iniSetting(iconThemePath.path() + "/index.theme", QSettings::IniFormat);
iniSetting.beginGroup("Icon Theme");
QString hidden = iniSetting.value("Hidden").toString();
QString name = iniSetting.value("Name").toString();
@@ -164,89 +181,90 @@
continue;
}
- QString fullPathToIcon(iconThemePath.path() + iconPath);
-
- if(iconPath.isEmpty()|| !QFileInfo(fullPathToIcon).exists()){
-
- //Set thumbnail
- if(QFileInfo(fullPathToIcon + "/scalable/qtg_graf_theme_preview_thumbnail.svg").exists()){
- nameIconPair.icon = HbIcon(fullPathToIcon + "/scalable/qtg_graf_theme_preview_thumbnail.svg");
- }else if(QFileInfo(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.svg").exists()){
- QPixmap px(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.svg");
- QIcon scaledIcon(px.scaled(QSize(64, 64)));
- nameIconPair.icon = HbIcon(scaledIcon);
- nameIconPair.icon.setIconName(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.svg");
-
- } else if(QFileInfo(fullPathToIcon + "/pixmap/qtg_graf_screen_bg_prt.png").exists()){
- QPixmap px(fullPathToIcon + "/pixmap/qtg_graf_screen_bg_prt.png");
- QIcon scaledIcon(px.scaled(QSize(64, 64)));
- nameIconPair.icon = HbIcon(scaledIcon);
- nameIconPair.icon.setIconName(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.png");
-
- } else{
- nameIconPair.icon = HbIcon(":/image/themePreview.svg");
+ QString fullPathToIcon(iconThemePath.path());
+
+ if(iconPath.isEmpty()|| !QFileInfo(fullPathToIcon + iconPath).exists()){
+ //Set thumbnail
+ if(QFileInfo(fullPathToIcon + KPreviewThumbnailNVG).exists()){
+ nameIconPair.icon = HbIcon(fullPathToIcon + KPreviewThumbnailNVG);
+ }else if(QFileInfo(fullPathToIcon + KPreviewThumbnailSVG).exists()){
+ nameIconPair.icon = HbIcon(fullPathToIcon + KPreviewThumbnailSVG);
+ }else if(QFileInfo(fullPathToIcon + KBackgroundPrtNVG).exists()){
+ nameIconPair.icon = HbIcon(fullPathToIcon + KBackgroundPrtNVG);
+ } else if(QFileInfo(fullPathToIcon + KBackgroundPrtSVG).exists()){
+ nameIconPair.icon = HbIcon(fullPathToIcon + KBackgroundPrtSVG);
+ } else if(QFileInfo(fullPathToIcon + KBackgroundPrtPNG).exists()){
+ nameIconPair.icon = HbIcon(fullPathToIcon + KBackgroundPrtPNG);
+ }else{
+ nameIconPair.icon = HbIcon(KDefaultThemeIcon);
}
+
} else {
- nameIconPair.icon = HbIcon(fullPathToIcon);
+ nameIconPair.icon = HbIcon(fullPathToIcon + iconPath);
}
//Portrait preview
- QString fullPathToPreviewPrt = (iconThemePath.path() + previewPathPrt );
- if(previewPathPrt.isEmpty() || !QFileInfo(fullPathToPreviewPrt).exists()) {
+ if(previewPathPrt.isEmpty() || !QFileInfo(fullPathToIcon + previewPathPrt).exists()) {
- if(QFileInfo(fullPathToPreviewPrt + "/scalable/qtg_graf_theme_preview_prt.svg").exists()){
- nameIconPair.portraitPreviewIcon = HbIcon(fullPathToPreviewPrt + "/scalable/qtg_graf_theme_preview_prt.svg");
- }else if(QFileInfo(fullPathToPreviewPrt + "/scalable/qtg_graf_screen_bg_prt.svg").exists()){
- nameIconPair.portraitPreviewIcon = HbIcon(fullPathToPreviewPrt + "/scalable/qtg_graf_screen_bg_prt.svg");
- } else if(QFileInfo(fullPathToPreviewPrt + "/pixmap/qtg_graf_screen_bg_prt.png").exists()){
- nameIconPair.portraitPreviewIcon = HbIcon(fullPathToPreviewPrt + "/pixmap/qtg_graf_screen_bg_prt.png");
+ if(QFileInfo(fullPathToIcon + KPreviewPrtNVG).exists()){
+ nameIconPair.portraitPreviewIcon = HbIcon(fullPathToIcon + KPreviewPrtNVG);
+ }else if(QFileInfo(fullPathToIcon + KPreviewPrtSVG).exists()){
+ nameIconPair.portraitPreviewIcon = HbIcon(fullPathToIcon + KPreviewPrtSVG);
+ }else if(QFileInfo(fullPathToIcon + KBackgroundPrtNVG).exists()){
+ nameIconPair.portraitPreviewIcon = HbIcon(fullPathToIcon + KBackgroundPrtNVG);
+ } else if(QFileInfo(fullPathToIcon + KBackgroundPrtSVG).exists()){
+ nameIconPair.portraitPreviewIcon = HbIcon(fullPathToIcon + KBackgroundPrtSVG);
+ } else if(QFileInfo(fullPathToIcon + KBackgroundPrtPNG).exists()){
+ nameIconPair.portraitPreviewIcon = HbIcon(fullPathToIcon + KBackgroundPrtPNG);
} else{
- nameIconPair.portraitPreviewIcon = HbIcon(":/image/themePreview.svg");
+ nameIconPair.portraitPreviewIcon = HbIcon(KDefaultThemeIcon);
}
}
else {
- nameIconPair.portraitPreviewIcon = HbIcon(fullPathToPreviewPrt);
+ nameIconPair.portraitPreviewIcon = HbIcon(fullPathToIcon + previewPathPrt);
}
//Landscape preview
- QString fullPathToPreviewLsc = (iconThemePath.path() + previewPathLsc );
-
- if(previewPathLsc.isEmpty() || !QFileInfo(fullPathToPreviewLsc).exists()) {
-
- if(QFileInfo(fullPathToPreviewLsc + "/scalable/qtg_graf_theme_preview_lsc.svg").exists()){
- nameIconPair.landscapePreviewIcon = HbIcon(fullPathToPreviewLsc + "/scalable/qtg_graf_theme_preview_lsc.svg");
- }else if(QFileInfo(fullPathToPreviewLsc + "/scalable/qtg_graf_screen_bg_lsc.svg").exists()){
- nameIconPair.landscapePreviewIcon = HbIcon(fullPathToPreviewLsc + "/scalable/qtg_graf_screen_bg_lsc.svg");
- } else if(QFileInfo(fullPathToPreviewLsc + "/pixmap/qtg_graf_screen_bg_lsc.png").exists()){
- nameIconPair.landscapePreviewIcon = HbIcon(fullPathToPreviewLsc + "/pixmap/qtg_graf_screen_bg_lsc.png");
+
+ if(previewPathLsc.isEmpty() || !QFileInfo(fullPathToIcon + previewPathLsc).exists()) {
+ if(QFileInfo(fullPathToIcon + KPreviewLscNVG).exists()){
+ nameIconPair.landscapePreviewIcon = HbIcon(fullPathToIcon + KPreviewLscNVG);
+ }else if(QFileInfo(fullPathToIcon + KPreviewLscSVG).exists()){
+ nameIconPair.landscapePreviewIcon = HbIcon(fullPathToIcon + KPreviewLscSVG);
+ }else if(QFileInfo(fullPathToIcon + KBackgroundLscNVG).exists()){
+ nameIconPair.landscapePreviewIcon = HbIcon(fullPathToIcon + KBackgroundLscNVG);
+ } else if(QFileInfo(fullPathToIcon + KBackgroundLscSVG).exists()){
+ nameIconPair.landscapePreviewIcon = HbIcon(fullPathToIcon + KBackgroundLscSVG);
+ } else if(QFileInfo(fullPathToIcon + KBackgroundLscPNG).exists()){
+ nameIconPair.landscapePreviewIcon = HbIcon(fullPathToIcon + KBackgroundLscPNG);
} else{
- nameIconPair.landscapePreviewIcon = HbIcon(":/image/themePreview.svg");
+ nameIconPair.landscapePreviewIcon = HbIcon(KDefaultThemeIcon);
}
}
else {
- nameIconPair.landscapePreviewIcon = HbIcon(fullPathToPreviewLsc);
+ nameIconPair.landscapePreviewIcon = HbIcon(fullPathToIcon + previewPathLsc);
}
nameIconPair.name = name;
- themeList.append(nameIconPair);
+ mThemeList.append(nameIconPair);
if (name == mCurrentTheme.name) {
mCurrentTheme = nameIconPair;
}
iniSetting.endGroup();
- if((hidden == "true") ||( hidden == "")||(name!=themefolder) ) {
+ if((hidden == "true") ||( hidden == "")||(name != themefolder) ) {
iconthemeslist.removeOne(themefolder);
- if(!themeList.isEmpty()) {
- themeList.removeLast();
+ if(!mThemeList.isEmpty()) {
+ mThemeList.removeLast();
}
}
} else {
iconthemeslist.removeOne(themefolder);
- if(!themeList.isEmpty()) {
- themeList.removeLast();
+ if(!mThemeList.isEmpty()) {
+ mThemeList.removeLast();
}
}
}
@@ -258,8 +276,8 @@
// Include default
CpThemeChanger::ThemeInfo def;
def.name = KDefaultTheme;
- def.icon = HbIcon(":/image/themePreview.svg");
- themeList.append(def);
+ def.icon = HbIcon(KDefaultThemeIcon);
+ mThemeList.append(def);
mCurrentTheme = def;
}
@@ -268,12 +286,12 @@
const QList& CpThemeChangerPrivate::themes() const
{
- return themeList;
+ return mThemeList;
}
bool CpThemeChangerPrivate::connectToServer()
{
- return themeClient->connectToServer();
+ return mThemeClient->connectToServer();
}
/**
@@ -281,7 +299,7 @@
*/
bool CpThemeChangerPrivate::isConnected() const
{
- return themeClient->isConnected();
+ return mThemeClient->isConnected();
}
/**
@@ -291,13 +309,14 @@
{
bool result = false;
// Skip doing this if the request is for the current theme
- if (newTheme.isEmpty() || newTheme == mCurrentTheme.name) return result;
+ if (newTheme.isEmpty() || newTheme == mCurrentTheme.name) {
+ return result;
+ }
- // Make sure it's a valid theme name
+ // Make sure it's a valid theme name and set the current theme.
bool exists = false;
- QList themeList = themes();
QList::const_iterator i;
- for (i = themeList.constBegin(); i != themeList.constEnd(); ++i) {
+ for (i = mThemeList.constBegin(); i != mThemeList.constEnd(); ++i) {
if ( newTheme == i->name) {
exists = true;
break;
@@ -305,8 +324,10 @@
}
if (exists) {
- result = themeClient->changeTheme(newTheme);
- updateThemeList(newTheme);
+ result = mThemeClient->changeTheme(newTheme);
+ if(result) {
+ mCurrentTheme = *i;
+ }
}
return result;
}
@@ -316,88 +337,6 @@
updateThemeList();
}
-/*
- HbThemeChangerModel provides an interface to the data contained in the
- HbThemeChanger using QAbstractListModel.
-*/
-/*
- Constructor
-*/
-HbThemeListModel::HbThemeListModel(CpThemeChangerPrivate *dd, QObject* parent)
- : QAbstractListModel(parent)
- , mThemeChangerPrivate(dd)
-{
- connect(dd->fileWatcher, SIGNAL(directoryChanged(const QString&)),
- this, SLOT(themeListChanged()));
-}
-
-/*
- Destructor
-*/
-HbThemeListModel::~HbThemeListModel()
-{
-
-}
-
-/*
- Reimplemented from QAbstractListModel.
-*/
-int HbThemeListModel::rowCount(const QModelIndex&) const
-{
- return mThemeChangerPrivate->themeList.size();
-}
-
-/*
- Reimplemented from QAbstractListModel. Provides the data for Qt::DisplayRole and
- Qt::DecorationRole.
-*/
-QVariant HbThemeListModel::data(const QModelIndex& index, int role) const
-{
- QVariant retVal = QVariant();
-
- if (index.isValid()) {
- switch (role) {
- case Qt::DisplayRole:
- retVal = mThemeChangerPrivate->themeList.at(index.row()).name;
- break;
-
- case Qt::DecorationRole:
- retVal = mThemeChangerPrivate->themeList.at(index.row()).icon;
- break;
-
- case Qt::SizeHintRole:
- retVal = mThemeChangerPrivate->themeList.at(index.row()).icon.size();
- break;
- case CpThemeChanger::PortraitPreviewRole:
- retVal = mThemeChangerPrivate->themeList.at(index.row()).portraitPreviewIcon;
- break;
- case CpThemeChanger::LandscapePreviewRole:
- retVal = mThemeChangerPrivate->themeList.at(index.row()).landscapePreviewIcon;
-
- default:
- // do nothing
- qt_noop();
- }
- }
-
- return retVal;
-}
-
-/*
- Responds appropriately when the underlying data in the theme changer is modified.
-
- Unfortunately the directory watcher from QFileWatcher only says when something changed
- not what changed. Therefore the model is considered reset rather than having rows
- with dataChanged.
-*/
-void HbThemeListModel::themeListChanged()
-{
- beginResetModel();
-
- mThemeChangerPrivate->themes();
-
- endResetModel();
-}
// End of file
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/src/cpthemechanger_p.h
--- a/controlpanelplugins/themeplugin/src/cpthemechanger_p.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemechanger_p.h Thu Jun 10 16:07:41 2010 +0800
@@ -22,39 +22,17 @@
#include
-#include
-#include
-#include
-#include
-#include
-
#include "cpthemechanger.h"
+#include "cpthemelistmodel.h"
QT_BEGIN_NAMESPACE
+class QString;
+class QStringList;
class QFileSystemWatcher;
QT_END_NAMESPACE
class CpThemeClient;
-class HbThemeListModel : public QAbstractListModel
-{
- Q_OBJECT
-
-public:
-
- HbThemeListModel(CpThemeChangerPrivate* dd, QObject *parent = 0);
- virtual ~HbThemeListModel();
-
- virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
- virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
-
-public slots:
- void themeListChanged();
-
-private:
- CpThemeChangerPrivate *mThemeChangerPrivate;
-};
-
class CpThemeChangerPrivate
{
CpThemeChanger* q_ptr;
@@ -80,14 +58,15 @@
CpThemeChanger::ThemeInfo mCurrentTheme;
- QString themeRootPath;
- QString themeRootPathPostfix;
+ QString mThemeRootPath;
+ QString mThemeRootPathPostfix;
+ QStringList mThemesPathList;
- CpThemeClient* themeClient;
- QFileSystemWatcher* fileWatcher;
- QList themeList;
- HbThemeListModel model;
- friend class HbThemeChangerModel;
+ CpThemeClient* mThemeClient;
+ QFileSystemWatcher* mFileWatcher;
+ QList mThemeList;
+ CpThemeListModel mModel;
+ friend class CpThemeListModel;
};
#endif /* HBTHEMECHANGER_P_H */
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/src/cpthemeclient_p.cpp
--- a/controlpanelplugins/themeplugin/src/cpthemeclient_p.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemeclient_p.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -16,12 +16,7 @@
*/
#include "cpthemeclient_p.h"
-
-#ifdef Q_OS_SYMBIAN
-#include "cpthemeclientsymbian_p.h"
-#else
-#include "cpthemeclientqt_p.h"
-#endif
+#include "cpthemeclient_p_p.h"
static CpThemeClient *clientInst=0;
@@ -39,12 +34,14 @@
bool CpThemeClient::connectToServer()
{
Q_D(CpThemeClient);
+
return d->connectToServer();
}
bool CpThemeClient::isConnected()
{
- Q_D(CpThemeClient);
+ Q_D(const CpThemeClient);
+
return d->isConnected();
}
@@ -54,22 +51,20 @@
bool CpThemeClient::changeTheme(const QString& newtheme)
{
Q_D(CpThemeClient);
+
return d->changeTheme(newtheme);
}
-
-
/**
* CpThemeClient::~CpThemeClient()
*/
CpThemeClient::~CpThemeClient()
{
Q_D(CpThemeClient);
+
delete d;
}
-
-
/**
* CpThemeClient::global()
*/
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/src/cpthemeclient_p.h
--- a/controlpanelplugins/themeplugin/src/cpthemeclient_p.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemeclient_p.h Thu Jun 10 16:07:41 2010 +0800
@@ -19,8 +19,6 @@
#define CPTHEMECLIENT_P_H
#include
-#include
-
class CpThemeClientPrivate;
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/src/cpthemeclient_p_p.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/themeplugin/src/cpthemeclient_p_p.h Thu Jun 10 16:07:41 2010 +0800
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0""
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#ifndef CPTHEMECLIENT_P_P_H
+#define CPTHEMECLIENT_P_P_H
+
+#include
+#include "cpthemecommon_p.h"
+
+#ifdef Q_OS_SYMBIAN
+#include
+#endif
+
+class QSizeF;
+#ifndef Q_OS_SYMBIAN
+class QLocalSocket;
+#endif
+
+class CpThemeClientPrivate :
+#ifdef Q_OS_SYMBIAN
+public RSessionBase
+#else
+public QObject
+#endif
+{
+#ifndef Q_OS_SYMBIAN
+ Q_OBJECT
+#endif
+
+public:
+ CpThemeClientPrivate();
+ bool connectToServer();
+ bool isConnected() const;
+ bool changeTheme(const QString& newTheme);
+ ~CpThemeClientPrivate();
+
+#ifndef Q_OS_SYMBIAN
+public slots:
+ void changeTheme();
+#endif
+
+public:
+ bool clientConnected;
+
+private:
+#ifdef Q_OS_SYMBIAN
+ TVersion Version() const;
+ TInt StartServer();
+ TInt CreateServerProcess();
+#endif
+
+private:
+#ifdef Q_OS_SYMBIAN
+ friend class CThemeListenerPrivate;
+#else
+ QLocalSocket* localSocket;
+#endif
+};
+
+#endif // HBTHEMECLIENT_P_P_H
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/src/cpthemeclientqt_p.cpp
--- a/controlpanelplugins/themeplugin/src/cpthemeclientqt_p.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemeclientqt_p.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -15,7 +15,7 @@
*
*/
-#include "cpthemeclientqt_p.h"
+#include "cpthemeclient_p_p.h"
#include
#include
#include
@@ -28,8 +28,6 @@
#define WAIT_TIME_TO_CONNECT_TO_SERVER 500
#define WAIT_TIME_TO_START_SERVER 5000
-//static const QString SERVERFILEPATH = QLatin1String(HB_BIN_DIR) + QDir::separator() + QLatin1String("hbthemeserver");
-
/**
* Constructor
*/
@@ -87,7 +85,7 @@
/**
* isConnected
*/
-bool CpThemeClientPrivate::isConnected()
+bool CpThemeClientPrivate::isConnected() const
{
return clientConnected;
}
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/src/cpthemeclientqt_p.h
--- a/controlpanelplugins/themeplugin/src/cpthemeclientqt_p.h Tue May 25 04:10:19 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0""
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef CPTHEMECLIENTQT_P_H
-#define CPTHEMECLIENTQT_P_H
-
-#include
-#include "cpthemecommon_p.h"
-
-class QString;
-class QSizeF;
-class QLocalSocket;
-
-class CpThemeClientPrivate : public QObject
-{
- Q_OBJECT
-
-public:
- CpThemeClientPrivate();
- bool connectToServer();
- bool isConnected();
-
- bool changeTheme(const QString& newtheme);
-
- ~CpThemeClientPrivate();
-
-public slots:
- void themeChanged();
-
-public:
- bool clientConnected;
-
-private:
- void handleThemeChangeRequest(QDataStream &dataStream);
-
-private:
- QLocalSocket* localSocket;
- QString themeName;
-};
-
-#endif // HBTHEMECLIENTQT_P_H
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.cpp
--- a/controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -15,7 +15,7 @@
*
*/
-#include "cpthemeclientsymbian_p.h"
+#include "cpthemeclient_p_p.h"
#include "cpthemesymbiancommon_p.h"
#include
@@ -40,7 +40,7 @@
/**
Indicates a connection to the server
*/
-bool CpThemeClientPrivate::isConnected()
+bool CpThemeClientPrivate::isConnected() const
{
return true;
}
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.h
--- a/controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.h Tue May 25 04:10:19 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0""
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef CPTHEMECLIENTSYMBIAN_P_H
-#define CPTHEMECLIENTSYMBIAN_P_H
-
-#include
-#if !defined(__E32BASE_H__)
-#include
-#endif
-
-class CpThemeClientPrivate
-{
-public:
- CpThemeClientPrivate();
-
- bool connectToServer();
-
- bool changeTheme(const QString& newtheme);
-
- bool isConnected();
-
- ~CpThemeClientPrivate();
-};
-
-#endif /* CPTHEMECLIENTSYMBIAN_P_H */
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/src/cpthemecontrol.cpp
--- a/controlpanelplugins/themeplugin/src/cpthemecontrol.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -30,12 +30,10 @@
#include
#include
-#include
-#include
#include
#include
-#include
#include
+#include
#include
#include
@@ -45,7 +43,9 @@
#include "cpthemelistview.h"
#include "cpthemepreview.h"
-static const QString KPlaceholderPreview = ":/image/themePreview.svg";
+#include
+#include
+
/*!
Helper function to fetch the main window.
@@ -68,10 +68,10 @@
mThemeChanger(0),
mListModel(0),
mSortModel(0),
- mIdleTimer(0)
+ mThemeChangeFinished(false),
+ mWaitDialog(0)
{
mThemeChanger = new CpThemeChanger();
-
QTranslator *translator = new QTranslator(this);
QString lang = QLocale::system().name();
@@ -79,14 +79,11 @@
translator->load("control_panel_" + lang, path);
qApp->installTranslator(translator);
- mIdleTimer = new QTimer(this);
- connect(mIdleTimer, SIGNAL(timeout()), this, SLOT(themeChangeTimeout()));
connect(hbInstance->theme(),SIGNAL(changeFinished()), this, SLOT(themeChangeFinished()));
}
-
/*!
destorys the list view, preview and theme changer objects.
*/
@@ -100,6 +97,9 @@
delete mThemePreview;
mThemePreview = 0;
+
+ delete mWaitDialog;
+ mWaitDialog = 0;
}
/*!
@@ -142,8 +142,9 @@
CpBaseSettingView* CpThemeControl::themeListView()
{
//If the view was removed before by control panel app, create it again.
- if(!mThemeListView)
+ if(!mThemeListView) {
createThemeList();
+ }
return mThemeListView;
}
@@ -219,8 +220,7 @@
} else {
mThemePreview->setThemeInfo(themeInfo);
}
- //TODO: use qtTrId(text_id).
- mThemePreview->setTitle(tr("Control Panel"));
+ mThemePreview->setTitle(hbTrId("txt_cp_title_control_panel"));
mWindow->setCurrentView(mThemePreview);
@@ -240,14 +240,16 @@
mThemeChanger->changeTheme(theme);
emit themeUpdated(mThemeChanger->currentTheme().name, mThemeChanger->currentTheme().icon);
}
+
+ //Start a timer. If theme change takes more than 1 seconds,
+ //we will show a dialog (mWaitDialog) until theme change
+ //is done (themeChangeFinished is called).
+ QTimer::singleShot(1000, this, SLOT(themeWaitTimeout()));
+
+ mThemeChangeFinished = false;
+
+}
- //Go back to control panel view. Close theme preview.
- previewClosed();
- //ask the themelistview to close. Control Panel will
- //take care of removing it from window.
- triggerThemeListClose();
-
-}
/*!
Slot called when the theme preview view is closed.
*/
@@ -289,16 +291,49 @@
void CpThemeControl::themeChangeTimeout()
{
- //qDebug() << "ThemeChangeTimeout " ;
- mIdleTimer->stop();
- QThread::currentThread()->setPriority(QThread::NormalPriority);
-
+ //Theme change is finished and idle timer has timed out,
+ //so revert back the application priority to normal
+ //and go back to control panel view.
+ if(mWaitDialog && mWaitDialog->isVisible()) {
+ mWaitDialog->hide();
+ }
+
+ previewClosed();
+ //ask the themelistview to close. Control Panel will
+ //take care of removing it from window.
+ triggerThemeListClose();
+
+ QThread::currentThread()->setPriority(QThread::NormalPriority);
+}
+
+void CpThemeControl::themeWaitTimeout()
+{
+ //If after this timeOut, theme change is still in progress,
+ //show a processing dialog.
+ if(!mThemeChangeFinished)
+ {
+ if(!mWaitDialog) {
+ mWaitDialog = new HbDialog();
+ mWaitDialog->setModal(false);
+ mWaitDialog->setDismissPolicy(HbPopup::NoDismiss);
+ //TODO: need localized text for Hb Dialog
+ // Create and set HbLabel as content widget.
+ HbLabel *label = new HbLabel("Processing ...");
+ label->setAlignment(Qt::AlignCenter);
+ mWaitDialog->setContentWidget(label);
+ }
+ // as we do not need any signals, calling show() instead of open()
+ mWaitDialog->show();
+ }
}
void CpThemeControl::themeChangeFinished()
{
- //qDebug() << "ThemeChangeFinished " ;
- mIdleTimer->start(0);
+ //Theme change is done. Start an idle timer to let the UI
+ //finish remaining tasks.
+ QTimer::singleShot(0, this, SLOT(themeChangeTimeout()));
+ mThemeChangeFinished = true;
+
}
/*!
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/src/cpthemecontrol.h
--- a/controlpanelplugins/themeplugin/src/cpthemecontrol.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.h Thu Jun 10 16:07:41 2010 +0800
@@ -20,7 +20,6 @@
#include
#include
-#include
#include "cpthemechanger.h"
#include
@@ -31,6 +30,7 @@
class QSortFilterProxyModel;
QT_END_NAMESPACE
+class HbDialog;
class CpThemeListView;
class CpThemePreview;
class CpBaseSettingView;
@@ -57,6 +57,7 @@
void themeApplied(const QString& theme);
void themeListClosed();
void themeChangeTimeout();
+ void themeWaitTimeout();
void themeChangeFinished();
private:
@@ -70,7 +71,8 @@
CpThemeChanger* mThemeChanger;
QAbstractItemModel* mListModel;
QSortFilterProxyModel* mSortModel;
- QTimer* mIdleTimer;
+ bool mThemeChangeFinished;
+ HbDialog* mWaitDialog;
};
#endif //CPTHEMECONTROL_H
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -0,0 +1,108 @@
+/*
+ * ============================================================================
+ * Name : cpthemelistmodel_p.cpp
+ * Part of : LibHb / theme
+ * Description : Private implementation of the theme listmodel.
+ * Version : %version: 1 % << Don't touch! Updated by Synergy at check-out.
+ *
+ * Copyright (c) 2008-2009 Nokia. All rights reserved.
+ * This material, including documentation and any related computer
+ * programs, is protected by copyright controlled by Nokia. All
+ * rights are reserved. Copying, including reproducing, storing,
+ * adapting or translating, any or all of this material requires the
+ * prior written consent of Nokia. This material also contains
+ * confidential information which may not be disclosed to others
+ * without the prior written consent of Nokia.
+ * ============================================================================
+ */
+
+#include "cpthemelistmodel.h"
+#include "cpthemechanger_p.h"
+#include
+
+/*
+ CpThemeChangerModel provides an interface to the data contained in the
+ CpThemeChanger using QAbstractListModel.
+*/
+
+/*
+ Constructor
+*/
+CpThemeListModel::CpThemeListModel(CpThemeChangerPrivate *dd, QObject* parent)
+ : QAbstractListModel(parent)
+ , mThemeChangerPrivate(dd)
+{
+ connect(dd->mFileWatcher, SIGNAL(directoryChanged(const QString&)),
+ this, SLOT(themeListChanged()));
+}
+
+/*
+ Destructor
+*/
+CpThemeListModel::~CpThemeListModel()
+{
+
+}
+
+/*
+ Reimplemented from QAbstractListModel.
+*/
+int CpThemeListModel::rowCount(const QModelIndex&) const
+{
+ return mThemeChangerPrivate->mThemeList.size();
+}
+
+/*
+ Reimplemented from QAbstractListModel. Provides the data for Qt::DisplayRole and
+ Qt::DecorationRole.
+*/
+QVariant CpThemeListModel::data(const QModelIndex& index, int role) const
+{
+ QVariant retVal = QVariant();
+
+ if (index.isValid()) {
+ switch (role) {
+ case Qt::DisplayRole:
+ retVal = mThemeChangerPrivate->mThemeList.at(index.row()).name;
+ break;
+
+ case Qt::DecorationRole:
+ retVal = mThemeChangerPrivate->mThemeList.at(index.row()).icon;
+ break;
+
+ case Qt::SizeHintRole:
+ retVal = mThemeChangerPrivate->mThemeList.at(index.row()).icon.size();
+ break;
+
+ case CpThemeChanger::PortraitPreviewRole:
+ retVal = mThemeChangerPrivate->mThemeList.at(index.row()).portraitPreviewIcon;
+ break;
+
+ case CpThemeChanger::LandscapePreviewRole:
+ retVal = mThemeChangerPrivate->mThemeList.at(index.row()).landscapePreviewIcon;
+ break;
+
+ default:
+ // do nothing
+ qt_noop();
+ }
+ }
+
+ return retVal;
+}
+
+/*
+ Responds appropriately when the underlying data in the theme changer is modified.
+
+ Unfortunately the directory watcher from QFileWatcher only says when something changed
+ not what changed. Therefore the model is considered reset rather than having rows
+ with dataChanged.
+*/
+void CpThemeListModel::themeListChanged()
+{
+ beginResetModel();
+
+ mThemeChangerPrivate->themes();
+
+ endResetModel();
+}
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/src/cpthemelistmodel.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/themeplugin/src/cpthemelistmodel.h Thu Jun 10 16:07:41 2010 +0800
@@ -0,0 +1,46 @@
+/*
+* ============================================================================
+* Name : cpthemelistmodel_p.h
+* Part of : LibHb / theme
+* Description : CpThemeListModel class definition
+* Version : %version: 1 % << Don't touch! Updated by Synergy at check-out.
+*
+* Copyright (c) 2008-2009 Nokia. All rights reserved.
+* This material, including documentation and any related computer
+* programs, is protected by copyright controlled by Nokia. All
+* rights are reserved. Copying, including reproducing, storing,
+* adapting or translating, any or all of this material requires the
+* prior written consent of Nokia. This material also contains
+* confidential information which may not be disclosed to others
+* without the prior written consent of Nokia.
+* ============================================================================
+*/
+
+#ifndef CP_THEME_LIST_MODEL_P_H
+#define CP_THEME_LIST_MODEL_P_H
+
+#include
+#include
+#include
+
+class CpThemeChangerPrivate;
+
+class CpThemeListModel : public QAbstractListModel
+{
+ Q_OBJECT
+
+public:
+ CpThemeListModel(CpThemeChangerPrivate* dd, QObject *parent = 0);
+ virtual ~CpThemeListModel();
+
+ virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
+ virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
+
+public slots:
+ void themeListChanged();
+
+private:
+ CpThemeChangerPrivate *mThemeChangerPrivate;
+};
+
+#endif //CP_THEME_LIST_MODEL_P_H
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/src/cpthemelistview.cpp
--- a/controlpanelplugins/themeplugin/src/cpthemelistview.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemelistview.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -22,6 +22,7 @@
#include
#include
#include
+#include
#include "cpthemelistview.h"
@@ -45,17 +46,17 @@
//Create a layout with a heading "Select theme" at top and the list below it.
HbWidget* contentWidget = new HbWidget(this);
QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical);
-
-
//setup the heading.
- HbLabel* label = new HbLabel(hbTrId("txt_cp_title_select_theme"), contentWidget);
- label->setFontSpec(HbFontSpec(HbFontSpec::Primary));
+ HbLabel* label = new HbLabel(hbTrId("txt_cp_title_select_theme"), contentWidget);//txt_cp_title_select_theme
layout->addItem(label);
connect(mThemeList, SIGNAL(activated(const QModelIndex&)),
this, SIGNAL(newThemeSelected(const QModelIndex&)));
+ HbListViewItem* listViewItem = mThemeList->listItemPrototype();
+ listViewItem->setGraphicsSize(HbListViewItem::LargeIcon);
+
//add the list to layout.
layout->addItem(mThemeList);
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/src/cpthemepreview.cpp
--- a/controlpanelplugins/themeplugin/src/cpthemepreview.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemepreview.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -18,7 +18,7 @@
#include
#include
#include
-#include
+
#include
#include
#include
@@ -26,6 +26,7 @@
#include
#include
#include
+#include
#include "cpthemepreview.h"
@@ -51,13 +52,9 @@
//setup the heading.
- //TODO: translation of string hbTrId("txt_cp_title_preview_1")
-
- QString themeHeading = tr("Preview: ") + mTheme.name;
+ QString themeHeading = HbParameterLengthLimiter("txt_cp_title_preview_1").arg(mTheme.name);
HbLabel* label = new HbLabel(themeHeading, this);
- label->setFontSpec(HbFontSpec(HbFontSpec::Primary));
- label->setPreferredHeight(5.0);
layout->addItem(label);
layout->setAlignment(layout->itemAt(0), Qt::AlignTop);
@@ -90,8 +87,7 @@
mPreviewIcon = new HbIconItem(mTheme.portraitPreviewIcon, this);
}
layout->addItem(mPreviewIcon);
- layout->setAlignment(layout->itemAt(0), Qt::AlignTop);
-
+
setToolBar(mToolBar);
setLayout(layout);
@@ -101,7 +97,7 @@
QObject::connect(mSoftKeyBackAction, SIGNAL(triggered()),
this, SIGNAL(aboutToClose()) );
- this->setNavigationAction(mSoftKeyBackAction);
+ setNavigationAction(mSoftKeyBackAction);
}
/*!
@@ -152,16 +148,14 @@
QGraphicsLinearLayout* previewLayout = dynamic_cast(layout());
- if(mPreviewIcon == dynamic_cast(previewLayout->itemAt(1)) ) {
+ if(mPreviewIcon && mPreviewIcon == dynamic_cast(previewLayout->itemAt(1)) ) {
previewLayout->removeAt(1);
- delete mPreviewIcon;
- mPreviewIcon = 0;
if(orientation == Qt::Horizontal) {
- mPreviewIcon = new HbIconItem(mTheme.landscapePreviewIcon, this);
+ mPreviewIcon->setIcon(mTheme.landscapePreviewIcon);
}
else {
- mPreviewIcon = new HbIconItem(mTheme.portraitPreviewIcon, this);
+ mPreviewIcon->setIcon(mTheme.portraitPreviewIcon);
}
previewLayout->addItem(mPreviewIcon);
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/themeplugin.pri
--- a/controlpanelplugins/themeplugin/themeplugin.pri Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/themeplugin.pri Thu Jun 10 16:07:41 2010 +0800
@@ -1,52 +1,41 @@
-#
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
# which accompanies this distribution, and is available
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
# Initial Contributors:
# Nokia Corporation - initial contribution.
-#
# Contributors:
-#
# Description: cpthemeplugin source files
-#
-
# Input
-HEADERS += src/cpthemepreview.h \
- src/cpthemecontrol.h \
- src/cpthemeplugin.h \
- src/cpthemelistview.h \
- src/cpthemepluginentryitemdata.h
+HEADERS += src/cpthemeclient_p_p.h \
+ src/cpthemepreview.h \
+ src/cpthemecontrol.h \
+ src/cpthemeplugin.h \
+ src/cpthemelistview.h \
+ src/cpthemelistmodel.h \
+ src/cpthemechanger.h \
+ src/cpthemeclient_p.h \
+ src/cpthemecommon_p.h \
+ src/cpthemechanger_p.h \
+ src/cpthemepluginentryitemdata.h
SOURCES += src/cpthemepreview.cpp \
- src/cpthemecontrol.cpp \
- src/cpthemeplugin.cpp \
- src/cpthemelistview.cpp \
- src/cpthemepluginentryitemdata.cpp
-
-# Remove once this goes into Hb.
-HEADERS += src/cpthemechanger.h \
- src/cpthemeclient_p.h \
- src/cpthemecommon_p.h \
- src/cpthemechanger_p.h
-
-# Remove once this goes into Hb.
-SOURCES += src/cpthemechanger.cpp \
- src/cpthemechanger_p.cpp \
- src/cpthemeclient_p.cpp
-
-# Remove once this goes into Hb.
-win32|mac {
- HEADERS += src/cpthemeclientqt_p.h
+ src/cpthemecontrol.cpp \
+ src/cpthemeplugin.cpp \
+ src/cpthemelistview.cpp \
+ src/cpthemelistmodel.cpp \
+ src/cpthemepluginentryitemdata.cpp \
+ src/cpthemechanger.cpp \
+ src/cpthemechanger_p.cpp \
+ src/cpthemeclient_p.cpp
+
+win32|mac {
SOURCES += src/cpthemeclientqt_p.cpp
}
-# Remove once this goes into Hb.
-symbian {
- HEADERS += src/cpthemeclientsymbian_p.h \
- src/cpthemesymbiancommon_p.h
+symbian {
+ HEADERS += src/cpthemesymbiancommon_p.h
SOURCES += src/cpthemeclientsymbian_p.cpp
}
diff -r 22d3abee08da -r 2883a5458389 controlpanelplugins/themeplugin/themeplugin.qrc
--- a/controlpanelplugins/themeplugin/themeplugin.qrc Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/themeplugin.qrc Thu Jun 10 16:07:41 2010 +0800
@@ -1,7 +1,5 @@
- image/qgn_menu_note.svg
- image/themePreview.png
- image/themePreview.svg
+ image/themePreview.nvg
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/rom/controlpanelui.iby
--- a/controlpanelui/rom/controlpanelui.iby Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/rom/controlpanelui.iby Thu Jun 10 16:07:41 2010 +0800
@@ -26,11 +26,11 @@
file=ABI_DIR\BUILD_DIR\controlpanel.exe SHARED_LIB_DIR\controlpanel.exe
CP_UPGRADABLE_APP_REG_RSC(controlpanel)
+
file=ABI_DIR\BUILD_DIR\cpserviceprovider.exe SHARED_LIB_DIR\cpserviceprovider.exe
CP_UPGRADABLE_APP_REG_RSC(cpserviceprovider)
file=ABI_DIR\BUILD_DIR\cpcategorymodel.dll SHARED_LIB_DIR\cpcategorymodel.dll
-file=ABI_DIR\BUILD_DIR\seccodeui.dll SHARED_LIB_DIR\seccodeui.dll
file=ABI_DIR\BUILD_DIR\cpprofilewrapper.dll SHARED_LIB_DIR\cpprofilewrapper.dll
file=ABI_DIR\BUILD_DIR\cpringtoneview.dll SHARED_LIB_DIR\cpringtoneview.dll
@@ -41,8 +41,6 @@
file=ABI_DIR\BUILD_DIR\cpprivacyplugin.dll SHARED_LIB_DIR\cpprivacyplugin.dll
file=ABI_DIR\BUILD_DIR\cplookfeelplugin.dll SHARED_LIB_DIR\cplookfeelplugin.dll
file=ABI_DIR\BUILD_DIR\cpkeytouchfdbkplugin.dll SHARED_LIB_DIR\cpkeytouchfdbkplugin.dll
-file=ABI_DIR\BUILD_DIR\cppincodeplugin.dll SHARED_LIB_DIR\cppincodeplugin.dll
-file=ABI_DIR\BUILD_DIR\cpdevicelockplugin.dll SHARED_LIB_DIR\cpdevicelockplugin.dll
file=ABI_DIR\BUILD_DIR\cpprofileactivator.dll SHARED_LIB_DIR\cpprofileactivator.dll
file=ABI_DIR\BUILD_DIR\cpvolumeplugin.dll SHARED_LIB_DIR\cpvolumeplugin.dll
file=ABI_DIR\BUILD_DIR\cpringtoneplugin.dll SHARED_LIB_DIR\cpringtoneplugin.dll
@@ -61,8 +59,6 @@
data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpprivacyplugin.qtplugin resource\qt\plugins\controlpanel\cpprivacyplugin.qtplugin
data=\epoc32\data\c\resource\qt\plugins\controlpanel\cplookfeelplugin.qtplugin resource\qt\plugins\controlpanel\cplookfeelplugin.qtplugin
data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpkeytouchfdbkplugin.qtplugin resource\qt\plugins\controlpanel\cpkeytouchfdbkplugin.qtplugin
-data=\epoc32\data\c\resource\qt\plugins\controlpanel\cppincodeplugin.qtplugin resource\qt\plugins\controlpanel\cppincodeplugin.qtplugin
-data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpdevicelockplugin.qtplugin resource\qt\plugins\controlpanel\cpdevicelockplugin.qtplugin
data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpprofileactivator.qtplugin resource\qt\plugins\controlpanel\cpprofileactivator.qtplugin
data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpvolumeplugin.qtplugin resource\qt\plugins\controlpanel\cpvolumeplugin.qtplugin
data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpringtoneplugin.qtplugin resource\qt\plugins\controlpanel\cpringtoneplugin.qtplugin
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/cpapplication/src/cpmainview.cpp
--- a/controlpanelui/src/cpapplication/src/cpmainview.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpapplication/src/cpmainview.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -32,8 +32,6 @@
{
//delay loading
connect(mMainWindow,SIGNAL(viewReady()),this,SLOT(initializeMainModel()));
-
- setTitle( QObject::tr("Control Panel") ); //should use qtTrId("txt_cp_title_control_panel")
}
CpMainView::~CpMainView()
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/cpplugins/communicationplugin/communicationplugin.pro
--- a/controlpanelui/src/cpplugins/communicationplugin/communicationplugin.pro Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/communicationplugin/communicationplugin.pro Thu Jun 10 16:07:41 2010 +0800
@@ -26,6 +26,7 @@
symbian {
TARGET.UID3 = 0x20025FDF
+ LIBS += -lxqsettingsmanager
}
symbian {
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp
--- a/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -16,10 +16,16 @@
*/
#include "cpcommunicationgroupitemdata.h"
#include
+#include
+#include
+#include
+#include
CpCommunicationGroupItemData::CpCommunicationGroupItemData(const QString &configFile,
const HbDataFormModelItem *parent):
-CpCategorySettingFormItemData(configFile,parent)
+ CpCategorySettingFormItemData(configFile,parent),
+ mAirplaneModeItem(0),
+ mSettingManager(new XQSettingsManager())
{
}
@@ -28,24 +34,65 @@
const QString &label,
const QString &configFile,
const HbDataFormModelItem *parent):
-CpCategorySettingFormItemData(type, label, configFile, parent)
+ CpCategorySettingFormItemData(type, label, configFile, parent),
+ mAirplaneModeItem(0),
+ mSettingManager(new XQSettingsManager())
{
}
+
CpCommunicationGroupItemData::~CpCommunicationGroupItemData()
{
+ delete mSettingManager;
+}
+
+void CpCommunicationGroupItemData::beforeLoadingConfigPlugins(CpItemDataHelper &itemDataHelper)
+{
+ mAirplaneModeItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem,
+ hbTrId("txt_cp_setlabel_offline_airplane_mode"));
+ mAirplaneModeItem->setDescription(hbTrId("txt_cp_info_in_offline_mode_all_wireless_communica"));
+
+ itemDataHelper.addConnection(mAirplaneModeItem,
+ SIGNAL(clicked()),
+ this,
+ SLOT(toggleAirplaneMode()));
+
+ XQCentralRepositorySettingsKey key(KCRUidCommunicationSettings.iUid,KSettingsAirplaneMode);
+ QVariant airplaneMode = mSettingManager->readItemValue(key,XQSettingsManager::TypeInt);
+ settingValueChanged(key,airplaneMode);
+
+ mSettingManager->startMonitoring(key,XQSettingsManager::TypeInt);
+ connect(mSettingManager, SIGNAL(valueChanged (XQSettingsKey, QVariant)),
+ this, SLOT(settingValueChanged(XQSettingsKey, QVariant)));
+
+ this->appendChild(mAirplaneModeItem);
}
-void CpCommunicationGroupItemData::beforeLoadingConfigPlugins(CpItemDataHelper &/*itemDataHelper*/)
+
+void CpCommunicationGroupItemData::toggleAirplaneMode()
+{
+ XQCentralRepositorySettingsKey key(KCRUidCommunicationSettings.iUid,KSettingsAirplaneMode);
+ QVariant airplaneMode = mSettingManager->readItemValue(key,XQSettingsManager::TypeInt);
+
+ airplaneMode.setValue( static_cast (!airplaneMode.toBool()) );
+
+ mSettingManager->writeItemValue(key,airplaneMode);
+}
+
+void CpCommunicationGroupItemData::settingValueChanged(const XQSettingsKey &key, const QVariant &value)
{
- HbDataFormModelItem *airPlaneMode = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem,
- tr("Offline mode"));
- QStringList airModeList;
- airModeList << QObject::tr("On") << QObject::tr("Off");
-
- airPlaneMode->setContentWidgetData("text",airModeList.at(1));
- airPlaneMode->setContentWidgetData("additionalText",airModeList.at(0));
+ if (mAirplaneModeItem
+ && key.uid() == KCRUidCommunicationSettings.iUid
+ && key.key() == KSettingsAirplaneMode
+ && value.isValid()) {
+ QString text = hbTrId("txt_cp_setlabel_offline_mode_val_on");
+ QString additionalText = hbTrId("txt_cp_setlabel_offline_mode_val_off");
+ if (!value.toBool()) {
+ ::qSwap (text, additionalText);
+ }
+ mAirplaneModeItem->setContentWidgetData("text",text);
+ mAirplaneModeItem->setContentWidgetData("additionalText",additionalText);
+ }
+}
- this->appendChild(airPlaneMode);
-
-}
+//End of File
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.h
--- a/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.h Thu Jun 10 16:07:41 2010 +0800
@@ -19,8 +19,12 @@
#include
class CpItemDataHelper;
+class XQSettingsManager;
+class XQSettingsKey;
+
class CpCommunicationGroupItemData: public CpCategorySettingFormItemData
{
+ Q_OBJECT
public:
explicit CpCommunicationGroupItemData(const QString &configFile = QString(),
const HbDataFormModelItem *parent = 0);
@@ -31,7 +35,13 @@
const HbDataFormModelItem *parent = 0);
~CpCommunicationGroupItemData();
+private slots:
+ void toggleAirplaneMode();
+ void settingValueChanged(const XQSettingsKey &key, const QVariant &value);
private:
virtual void beforeLoadingConfigPlugins(CpItemDataHelper &itemDataHelper);
+private:
+ HbDataFormModelItem *mAirplaneModeItem;
+ XQSettingsManager *mSettingManager;
};
#endif /* CPCOMMUNICATIONGROUPITEMDATA_H */
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationplugin.cpp
--- a/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationplugin.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationplugin.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -32,7 +32,7 @@
CpCategorySettingFormItemData *itemData =
new CpCommunicationGroupItemData(
HbDataFormModelItem::GroupItem,
- QString("Connectivity"),
+ hbTrId("txt_cp_subhead_connectivity"),
QString("cpcommunicationplugin.cpcfg") );
return QList() << itemData;
}
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/cpplugins/deviceplugin/src/cpdeviceplugin.cpp
--- a/controlpanelui/src/cpplugins/deviceplugin/src/cpdeviceplugin.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/deviceplugin/src/cpdeviceplugin.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -32,7 +32,7 @@
CpCategorySettingFormItemData *itemData =
new CpCategorySettingFormItemData(
HbDataFormModelItem::GroupItem,
- tr("Device"),
+ hbTrId("txt_cp_subhead_device"),
QString("cpdeviceplugin.cpcfg") );
return QList() << itemData;
}
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenconstants.h
--- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenconstants.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenconstants.h Thu Jun 10 16:07:41 2010 +0800
@@ -18,16 +18,6 @@
#ifndef CPKEYSCREENCONSTANTS_H
#define CPKEYSCREENCONSTANTS_H
-enum KeyscreenLockItems{
- EKeyScreenLockItem1,
- EKeyScreenLockItem2,
- EKeyScreenLockItem3,
- EKeyScreenLockItem4,
- EKeyScreenLockItem5
-};
-
-const int KCpKeyscreenTimeCoeff = 15;
-
const int KCpKeyscreenLock15s = 15;
const int KCpKeyscreenLock30s = 30;
const int KCpKeyscreenLock45s = 45;
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenplugin.cpp
--- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenplugin.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenplugin.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -30,7 +30,7 @@
{
CpSettingFormItemData* itemData = new CpSettingFormEntryItemDataImpl(
itemDataHelper,
- hbTrId("Keys & screen"));
+ hbTrId("txt_cp_list_keys_screen"));
return QList() << itemData;
}
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.cpp
--- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -25,18 +25,27 @@
#include
#include
#include
+#include
CpKeyScreenView::CpKeyScreenView(QGraphicsItem *parent) :
CpBaseSettingView(0,parent),
- mScreenRadioButton(0),
+ mScreenComboButton(0),
mRotateCheckbox(0),
mBrightSliderItem(0),
mCallibItem(0),
mModel(0)
-{
+{
HbDataForm *form = qobject_cast ( widget() );
if (form) {
+ // Valid range is:
+ // 15 secs, 30 secs, 45 secs, 1 min, 2 mins
+ mScreenLockValues.insert(KCpKeyscreenLock15s,hbTrId("txt_cp_setlabel_keys_screen_val_15_seconds"));
+ mScreenLockValues.insert(KCpKeyscreenLock30s,hbTrId("txt_cp_setlabel_keys_screen_val_30_seconds"));
+ mScreenLockValues.insert(KCpKeyscreenLock45s,hbTrId("txt_cp_setlabel_keys_screen_val_45_seconds"));
+ mScreenLockValues.insert(KCpKeyscreenLock60s,hbTrId("txt_cp_setlabel_keys_screen_val_1_minute"));
+ mScreenLockValues.insert(KCpKeyscreenLock120s,hbTrId("txt_cp_setlabel_keys_screen_val_2_minutes"));
+
form->setHeading(hbTrId("txt_cp_subhead_keys_screen"));
mModel = new CpKeyScreenModel();
HbDataFormModel *model = new HbDataFormModel;
@@ -61,30 +70,36 @@
void CpKeyScreenView::makeScreenItem(HbDataFormModel& model)
{
- mScreenRadioButton = new CpSettingFormItemData(HbDataFormModelItem::RadioButtonListItem,
- hbTrId("txt_cp_setlabel_keys_screen_locked_after"));
- qobject_cast ( widget() )->addConnection(mScreenRadioButton,SIGNAL(itemSelected(int)),this,SLOT(screenValueChanged(int)));
- model.appendDataFormItem(mScreenRadioButton, model.invisibleRootItem());
+ mScreenComboButton = new CpSettingFormItemData(HbDataFormModelItem::ComboBoxItem,
+ hbTrId("txt_cp_setlabel_keys_screen_locked_after"));
+
+ qobject_cast ( widget() )->addConnection(
+ mScreenComboButton,SIGNAL(currentIndexChanged(QString)),
+ this,SLOT(screenValueChanged(QString)));
+
+ model.appendDataFormItem(mScreenComboButton, model.invisibleRootItem());
- // Valid range is:
- // 15 secs, 30 secs, 45 secs, 1 min, 2 mins
- QStringList sList;
- sList<< hbTrId("txt_cp_setlabel_keys_screen_val_15_seconds")<< hbTrId("txt_cp_setlabel_keys_screen_val_30_seconds")
- << hbTrId("txt_cp_setlabel_keys_screen_val_45_seconds")<< hbTrId("txt_cp_setlabel_keys_screen_val_1_minute")
- << hbTrId("txt_cp_setlabel_keys_screen_val_2_minutes");
int period = mModel->keyguard();
- int selectedIndex = period/KCpKeyscreenTimeCoeff - 1;
- if ( KCpKeyscreenLock120s == period ){ // 2 minutes
- selectedIndex = EKeyScreenLockItem5;
+
+ int selectedIndex(-1);
+
+ QMap::iterator it = mScreenLockValues.find(period);
+ if (it == mScreenLockValues.end()) {
+ mModel->setKeyguard(KCpKeyscreenLockDefault30s); // Set keyguard and backlight period to default
+ selectedIndex = 1;
}
- if ( (KCpKeyscreenLock15s != period) && (KCpKeyscreenLock30s != period) &&
- (KCpKeyscreenLock45s != period) && (KCpKeyscreenLock60s != period) &&
- (KCpKeyscreenLock120s != period) ){
- mModel->setKeyguard(KCpKeyscreenLockDefault30s); // Set keyguard and backlight period to default
- selectedIndex = EKeyScreenLockItem2;
+ else {
+ for (it = mScreenLockValues.begin();it != mScreenLockValues.end();++it) {
+ selectedIndex++;
+ if (it.key() == period) {
+ break;
+ }
+ }
}
- mScreenRadioButton->setContentWidgetData( QString("items"), sList );
- mScreenRadioButton->setContentWidgetData( QString("selected"), selectedIndex);
+
+ QStringList items = mScreenLockValues.values();
+ mScreenComboButton->setContentWidgetData( QString("items"), items );
+ mScreenComboButton->setContentWidgetData( QString("currentIndex"), selectedIndex);
}
void CpKeyScreenView::makeRotateItem(HbDataFormModel& model)
@@ -110,9 +125,17 @@
qobject_cast ( widget() )->addConnection(mBrightSliderItem,SIGNAL(valueChanged(int)),this,SLOT(brightValueChanged(int)));
model.appendDataFormItem(mBrightSliderItem, model.invisibleRootItem());
+ QList sliderElements;
+ sliderElements << QVariant(HbSlider::IncreaseElement) << QVariant(HbSlider::TrackElement)
+ << QVariant(HbSlider::DecreaseElement);
+ mBrightSliderItem->setContentWidgetData("sliderElements",sliderElements);
mBrightSliderItem->setContentWidgetData( QString("value"), mModel->brightness() );
mBrightSliderItem->setContentWidgetData( QString("minimum"), 1 );
mBrightSliderItem->setContentWidgetData( QString("maximum"), 5 );
+ QMap< QString, QVariant > iconElements;
+ iconElements.insert(QString("IncreaseElement") , QVariant(":/icon/hb_vol_slider_increment.svg"));
+ iconElements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg") );
+ mBrightSliderItem->setContentWidgetData( QString( "elementIcons" ), iconElements );
}
void CpKeyScreenView::makeCallibrationItem(HbDataFormModel& model)
@@ -130,13 +153,15 @@
mModel = 0;
}
-void CpKeyScreenView::screenValueChanged(int index)
-{
- int period = (index + 1) * KCpKeyscreenTimeCoeff;
- if (EKeyScreenLockItem5 == index){
- period = KCpKeyscreenLock120s;
+void CpKeyScreenView::screenValueChanged(const QString &value)
+{
+ for (QMap::iterator it = mScreenLockValues.begin();
+ it != mScreenLockValues.end();++it) {
+ if (it.value() == value) {
+ mModel->setKeyguard(it.key());
+ break;
+ }
}
- mModel->setKeyguard(period);
}
void CpKeyScreenView::rotateValueChanged(int value)
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.h
--- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.h Thu Jun 10 16:07:41 2010 +0800
@@ -17,6 +17,7 @@
#ifndef CPKEYSCREENVIEW_H
#define CPKEYSCREENVIEW_H
+#include
#include
#include
@@ -24,6 +25,8 @@
class HbDataFormModel;
class CpSettingFormItemData;
class CpKeyScreenModel;
+class QPersistentModelIndex;
+class QVariant;
class CpKeyScreenView : public CpBaseSettingView
{
@@ -39,17 +42,18 @@
void makeCallibrationItem(HbDataFormModel& model);
private slots:
- //need handling your member's value change
- void screenValueChanged(int index);
+ void screenValueChanged(const QString&);
void rotateValueChanged(int value);
void brightValueChanged(int value);
void launchCallib();
private:
- CpSettingFormItemData *mScreenRadioButton;
+ CpSettingFormItemData *mScreenComboButton;
CpSettingFormItemData *mRotateCheckbox;
CpSettingFormItemData *mBrightSliderItem;
CpSettingFormItemData *mCallibItem;
CpKeyScreenModel* mModel;
+
+ QMap mScreenLockValues;
};
#endif// CPKEYSCREENVIEW_H
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp
--- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -188,9 +188,18 @@
//Touch Screen Vibra item
modelItem = mModel->appendDataFormItem( HbDataFormModelItem::SliderItem, QString( hbTrId( "txt_cp_setlabel_touch_screen_vibra" ) ), parent );
//TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3
+ sliderElements.clear();
+ sliderElements << QVariant(HbSlider::IncreaseElement) << QVariant(HbSlider::TrackElement)
+ << QVariant(HbSlider::DecreaseElement);
+ modelItem->setContentWidgetData("sliderElements",sliderElements);
+
modelItem->setContentWidgetData( QString( "minimum" ), 0 );
modelItem->setContentWidgetData( QString( "maximum" ), 5 );
modelItem->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenVibra );
+ QMap< QString, QVariant > iconElements;
+ iconElements.insert(QString("IncreaseElement") , QVariant(":/icon/hb_vol_slider_increment.svg"));
+ iconElements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg") );
+ modelItem->setContentWidgetData( QString( "elementIcons" ), iconElements );
if (profileId == EProfileWrapperGeneralId) {
addConnection( modelItem, SIGNAL( valueChanged( int )), this, SLOT( on_general_screenVibra_ValueChanged( int )));
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/cpplugins/privacyplugin/src/cpprivacyplugin.cpp
--- a/controlpanelui/src/cpplugins/privacyplugin/src/cpprivacyplugin.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/privacyplugin/src/cpprivacyplugin.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -34,7 +34,7 @@
CpCategorySettingFormItemData *itemData =
new CpCategorySettingFormItemData(
HbDataFormModelItem::GroupItem,
- tr("Security"),
+ hbTrId("txt_cp_subhead_security"),
QString("cpprivacyplugin.cpcfg") );
return QList() << itemData;
}
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/cpplugins/profileactivatorplugin/profileactivatorplugin.pro
--- a/controlpanelui/src/cpplugins/profileactivatorplugin/profileactivatorplugin.pro Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/profileactivatorplugin/profileactivatorplugin.pro Thu Jun 10 16:07:41 2010 +0800
@@ -27,4 +27,5 @@
TARGET.UID3 = 0X20028739
TARGET.CAPABILITY = All -TCB
TARGET.EPOCALLOWDLLDATA = 1
+ LIBS += -lprofileeng
}
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.cpp
--- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -20,7 +20,11 @@
#include
#include
#include
+#include
#include "cpprofileactivatorentryitem.h"
+#include
+#include
+
CpProfileActivatorDialog::CpProfileActivatorDialog(CpSettingFormItemData *profileActivator,
CpProfileModel &profileModel,
QGraphicsItem *parent):HbDialog(parent),
@@ -28,11 +32,19 @@
mProfileList(0),
mProfileActivator(profileActivator)
{
+ mTitleLabel = new HbLabel(this);
+ mTitleLabel->setPlainText(hbTrId("txt_cp_title_profile"));
+ mContentWidget = new QGraphicsWidget(this);
+ setContentWidget(mContentWidget);
+ mLayout = new QGraphicsLinearLayout();
+ mLayout->setOrientation( Qt::Vertical );
mProfileIds << EProfileWrapperGeneralId
<< EProfileWrapperMeetingId;
mProfileList = new HbRadioButtonList();
mProfileList->setItems(profileModel.profileNames());
-
+ mLayout->addItem(mTitleLabel);
+ mLayout->addItem(mProfileList);
+
int currentId = mProfileModel.activeProfileId();
mProfileList->setSelected(mProfileIds.indexOf(static_cast(currentId)));
@@ -46,12 +58,11 @@
this->addAction(mConfirmProfile);
- this->addAction(mCancelProfile);
-
- this->setContentWidget(mProfileList);
+ this->addAction(mCancelProfile);
this->setModal(true);
this->setDismissPolicy(HbPopup::NoDismiss);
this->setTimeout(HbPopup::NoTimeout);
+ mContentWidget->setLayout( mLayout );
}
CpProfileActivatorDialog::~CpProfileActivatorDialog()
@@ -61,6 +72,9 @@
void CpProfileActivatorDialog::confirmProfileSelection()
{
int currentIndex = mProfileList->selected();
+ if (currentIndex == -1) {
+ return;
+ }
// the best choice is no need to convert the index to id
mProfileModel.activateProfile(mProfileIds.at(currentIndex));
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.h
--- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.h Thu Jun 10 16:07:41 2010 +0800
@@ -24,6 +24,9 @@
class HbDataFormModelItem;
class CpProfileActivatorEntryItem;
class CpSettingFormItemData;
+class QGraphicsLinearLayout;
+class QGraphicsWidget;
+class HbLabel;
class CpProfileActivatorDialog: public HbDialog
{
@@ -44,5 +47,8 @@
QPointer mConfirmProfile;
QPointer mCancelProfile;
QList mProfileIds;
+ QGraphicsLinearLayout *mLayout;
+ QGraphicsWidget *mContentWidget;
+ HbLabel *mTitleLabel;
};
#endif
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.cpp
--- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -20,23 +20,31 @@
#include
#include
#include
+#include "cpprofilemonitor.h"
+
CpProfileActivatorEntryItem::CpProfileActivatorEntryItem(CpItemDataHelper &itemDataHelper,
const QString &text,
const QString &description,
const HbIcon &icon,
const HbDataFormModelItem *parent)
:CpSettingFormEntryItemData(itemDataHelper,text,description,
- icon,parent)
+ icon,parent),mProfileModel(0),mProfileMonitor(0)
{
+ mProfileMonitor = new CpProfileMonitor();
mProfileModel = new CpProfileModel();
+
int currentId = mProfileModel->activeProfileId();
QString currentName = mProfileModel->profileName(currentId);
this->setDescription(currentName);
+ connect(mProfileMonitor, SIGNAL(profileActivated(int)), this, SLOT(onProfileChanged(int)));
}
+
CpProfileActivatorEntryItem::~CpProfileActivatorEntryItem()
{
delete mProfileModel;
+ delete mProfileMonitor;
}
+
void CpProfileActivatorEntryItem::onLaunchView()
{
CpProfileActivatorDialog *dialog =
@@ -46,6 +54,12 @@
dialog->show();
}
+
+void CpProfileActivatorEntryItem::onProfileChanged(int activeProfileId)
+{
+ QString profileName = mProfileModel->profileName(activeProfileId);
+ this->setDescription(profileName);
+}
/*void CpPersonalizationEntryItemData::handleOk(const QVariant &result)
{
if (!result.canConvert())
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.h
--- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.h Thu Jun 10 16:07:41 2010 +0800
@@ -20,6 +20,8 @@
#include
class CpProfileModel;
+class CpProfileMonitor;
+
class CpProfileActivatorEntryItem : public CpSettingFormEntryItemData
{
Q_OBJECT
@@ -31,12 +33,14 @@
virtual ~CpProfileActivatorEntryItem();
private slots:
void onLaunchView();
+ void onProfileChanged(int activeProfileId);
//void handleOk(const QVariant &result);
//void handleError(int errorCode, const QString& errorMessage);
private:
virtual CpBaseSettingView *createSettingView() const;
private:
CpProfileModel *mProfileModel;
+ CpProfileMonitor *mProfileMonitor;
};
#endif // CPPROFILEACTIVATORENTRYITEM_H
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofilemonitor.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofilemonitor.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0""
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#include "cpprofilemonitor.h"
+
+#include
+
+CpProfileMonitor::CpProfileMonitor(QObject *parent)
+ :QObject(parent),mProfileNotifier(0)
+{
+ mProfileNotifier = CProfileChangeNotifyHandler::NewL(this);
+}
+
+CpProfileMonitor::~CpProfileMonitor()
+{
+ delete mProfileNotifier;
+}
+
+void CpProfileMonitor::HandleActiveProfileEventL(TProfileEvent aProfileEvent, TInt aProfileId)
+{
+ if (EProfileNewActiveProfile == aProfileEvent) {
+ emit profileActivated(aProfileId);
+ }
+}
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofilemonitor.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofilemonitor.h Thu Jun 10 16:07:41 2010 +0800
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0""
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#ifndef CPPROFILEMONITOR_H_
+#define CPPROFILEMONITOR_H_
+
+#include
+#include
+
+class CProfileChangeNotifyHandler;
+
+class CpProfileMonitor: public QObject,public MProfileChangeObserver
+{
+ Q_OBJECT
+public:
+ explicit CpProfileMonitor(QObject *parent = 0);
+ ~CpProfileMonitor();
+signals:
+ void profileActivated(int activeProfileId);
+private:
+ virtual void HandleActiveProfileEventL(
+ TProfileEvent aProfileEvent, TInt aProfileId );
+
+private:
+ CProfileChangeNotifyHandler* mProfileNotifier;
+};
+
+#endif /* CPPROFILEMONITOR_H_ */
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp
--- a/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -28,7 +28,7 @@
#include
CpVolumeGroupItemData::CpVolumeGroupItemData(CpItemDataHelper &itemDataHelper)
-: CpSettingFormItemData(HbDataFormModelItem::GroupItem,tr("txt_cp_subhead_volume")),//mSilenceIndicator(0),
+: CpSettingFormItemData(HbDataFormModelItem::GroupItem,hbTrId("txt_cp_subhead_volume")),//mSilenceIndicator(0),
//mMasterVolume(0),
//mMasterVibra(0),
mVolumeController(0),
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp
--- a/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -142,9 +142,9 @@
// so hard code here, wait for engine's correcting.
switch (profileId) {
case EProfileWrapperGeneralId:
- return hbTrId("txt_cp_setlabel_active_profile_val_general");
+ return hbTrId("txt_cp_list_general");
case EProfileWrapperMeetingId:
- return hbTrId("txt_cp_setlabel_active_profile_val_meeting");
+ return hbTrId("txt_cp_list_meeting");
default:
return QString("");
}
@@ -153,8 +153,8 @@
{
//hard code, until engine part support qt localized name
QStringList nameList;
- nameList<
#include
#include
+#include
+#include
#include
#include "cpservicemainwindow.h"
#include "cpsplogger.h"
@@ -29,6 +31,12 @@
CPSP_LOGGER_CONFIG_PATH,QSettings::IniFormat);
CPSP_LOG("Entering CpServiceProvider.exe...");
+ QTranslator translator;
+ if (translator.load("control_panel_" + QLocale::system().name(),"Z:/resource/qt/translations"))
+ {
+ qApp->installTranslator(&translator);
+ }
+
HbStyleLoader::registerFilePath(CP_RESOURCE_PATH + QDir::separator() + WIDGETML_SUB_PATH);
CpServiceMainWindow wnd;
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/tonefetcher/src/tonefetchermodel.cpp
--- a/controlpanelui/src/tonefetcher/src/tonefetchermodel.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/src/tonefetchermodel.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -88,6 +88,11 @@
emit layoutChanged();
}
+void ToneFetcherModel::toBeFreshed()
+{
+ emit layoutAboutToBeChanged();
+}
+
void ToneFetcherModel::clearAll()
{
mUserDataLst.clear();
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/tonefetcher/src/tonefetchermodel.h
--- a/controlpanelui/src/tonefetcher/src/tonefetchermodel.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/src/tonefetchermodel.h Thu Jun 10 16:07:41 2010 +0800
@@ -38,6 +38,7 @@
void insertInOrder(QStandardItem *fileName, QStandardItem *filePath, int role = Qt::DisplayRole);
QString path(const QModelIndex &index) const;
void refresh();
+ void toBeFreshed();
void clearAll();
private:
/*
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp
--- a/controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -34,6 +34,7 @@
#include "tonefetcherview.h"
#include "tonefetchermodel.h"
#include
+#include
ToneFetcherWidget::ToneFetcherWidget( ToneFetcherView *serviceView )
: HbWidget(this),
@@ -42,7 +43,8 @@
mLayout(0),
mToneModel(0),
mServiceView(serviceView),
- mServiceEngine(0)
+ mServiceEngine(0),
+ mWaitNote(0)
{
mSelected = false;
@@ -60,11 +62,18 @@
this, SLOT(previewEvent(ToneServiceEngine::TPreviewEvent, int)));
connect( mServiceEngine, SIGNAL(notifyObjectChanged()),
this, SLOT(onObjectChanged()));
+ connect( mServiceEngine, SIGNAL(notifyRefreshStart()),
+ this, SLOT(refreshStart()));
+ connect( mServiceEngine, SIGNAL(notifyRefreshFinish()),
+ this, SLOT(refreshFinish()));
}
ToneFetcherWidget::~ToneFetcherWidget()
{
- delete mToneModel;
+ delete mToneModel;
+ mToneModel = 0;
+ delete mWaitNote;
+ mWaitNote = 0;
}
void ToneFetcherWidget::on_list_activated(const QModelIndex &index)
@@ -73,7 +82,7 @@
//stop previewing when clicking another item.
if (mServiceEngine->IsPlaying()) {
- mServiceEngine->preview(getCurrentItemPath());
+ mServiceEngine->stop();
}
/*
* when one item is selected, reselecting it will deselect it. selecting another
@@ -125,6 +134,12 @@
connect(mListView, SIGNAL(activated(QModelIndex)),
this, SLOT(on_list_activated(QModelIndex )));
+ if( !mWaitNote ){
+ mWaitNote = new HbProgressDialog( HbProgressDialog::WaitDialog );
+ mWaitNote->setText( hbTrId( "Refreshing..." ) );
+ QAction *action = mWaitNote->actions().at(0);//disable Cancel buttion.
+ action->setEnabled(false);
+ }
}
void ToneFetcherWidget::mdeSessionOpened()
@@ -171,7 +186,12 @@
void ToneFetcherWidget::playOrPause()
{
+ if(mServiceEngine->IsPlaying()) {
+ mServiceEngine->stop();
+ } else {
mServiceEngine->preview(getCurrentItemPath());
+ }
+
}
void ToneFetcherWidget::previewEvent(ToneFetcherEngine::TPreviewEvent event, int errorId)
@@ -186,6 +206,11 @@
void ToneFetcherWidget::onObjectChanged()
{
+ if (mServiceEngine->IsPlaying()) {
+ mServiceEngine->stop();
+ }
+ emit triggerToolBar(false);
+ mToneModel->toBeFreshed();
mToneModel->clearAll();
mDigitalSoundList.clear();
mSimpleSoundList.clear();
@@ -217,4 +242,18 @@
mToneModel->insertInOrder(fileName, filePath);
}
}
+
+void ToneFetcherWidget::refreshFinish()
+{
+ if (mWaitNote) {
+ mWaitNote->close();
+ }
+}
+
+void ToneFetcherWidget::refreshStart()
+{
+ if (mWaitNote) {
+ mWaitNote->open();
+ }
+}
//End of File
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/tonefetcher/src/tonefetcherwidget.h
--- a/controlpanelui/src/tonefetcher/src/tonefetcherwidget.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/src/tonefetcherwidget.h Thu Jun 10 16:07:41 2010 +0800
@@ -32,6 +32,7 @@
class ToneFetcherView;
class ToneFetcherModel;
class HbLabel;
+class HbProgressDialog;
class ToneFetcherWidget : public HbWidget
{
@@ -55,6 +56,8 @@
void queryError(int error );
void previewEvent(ToneFetcherEngine::TPreviewEvent event, int errorId);
void onObjectChanged();
+ void refreshFinish();
+ void refreshStart();
private:
void init();
@@ -73,5 +76,6 @@
QFileInfoList mDigitalSoundList;
bool mSelected;
QModelIndex mOldSeletedItem;
+ HbProgressDialog *mWaitNote;
};
#endif /* TONEFETCHERWIDGET_H_ */
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/tonefetcher/tonefetcher.pro
--- a/controlpanelui/src/tonefetcher/tonefetcher.pro Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/tonefetcher.pro Thu Jun 10 16:07:41 2010 +0800
@@ -51,7 +51,7 @@
SERVICE.FILE = service_conf.xml
SERVICE.OPTIONS = embeddable
-#SERVICE.OPTIONS += hidden
+SERVICE.OPTIONS += hidden
libFiles.sources = xqservice.dll
libFiles.path = "!:\sys\bin"
DEPLOYMENT += libFiles
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/tonepreviewprivate.cpp
--- a/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/tonepreviewprivate.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/tonepreviewprivate.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -237,6 +237,8 @@
iAudioPlayerStatus = EPlayerNotCreated;
CMFPreviewHandlerBase::ConstructL();
iTonePlayerStatus = EPlayerNotCreated;
+ CCoeEnv* coeEnv = CCoeEnv::Static();
+ coeEnv->AddForegroundObserverL( *this );
}
TonePreviewPrivate::~TonePreviewPrivate()
@@ -264,12 +266,7 @@
}
void TonePreviewPrivate::Play()
- {
- if( IsPlaying() )
- {
- Stop();
- return;
- }
+ {
//sequence for playing a beep once sound
_LIT8( KFileListBeepSequence, "\x00\x11\x06\x0A\x08\x73\x0A\x40\x28\x0A\xF7\
\x05\xFC\x40\x64\x0A\x08\x40\x32\x0A\xF7\x06\x0B" );
@@ -601,3 +598,15 @@
Cancel();
emit notifyPreviewEvent( ToneFetcherEngine::EAudioPreviewComplete, aError );
}
+
+void TonePreviewPrivate::HandleLosingForeground()
+ {
+ if ( IsPlaying() )
+ {
+ Stop();
+ }
+ }
+void TonePreviewPrivate::HandleGainingForeground()
+ {
+
+ }
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/tonepreviewprivate.h
--- a/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/tonepreviewprivate.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/tonepreviewprivate.h Thu Jun 10 16:07:41 2010 +0800
@@ -27,6 +27,7 @@
#include
#include
#include "tonefetcherengine.h"
+#include
class C3DRingingToneInterface;
class RWindow;
@@ -164,7 +165,8 @@
class TonePreviewPrivate : public CMFPreviewHandlerBase,
public MDrmAudioPlayerCallback,
- public MMdaAudioToneObserver
+ public MMdaAudioToneObserver,
+ public MCoeForegroundObserver
{
Q_OBJECT
@@ -196,6 +198,9 @@
void MdapcInitComplete(TInt aError,
const TTimeIntervalMicroSeconds& aDuration);
void MdapcPlayComplete(TInt aError);
+ // from MCoeForegroundObserver
+ void HandleLosingForeground();
+ void HandleGainingForeground();
private:
// audio player
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/toneselectionengine_p.cpp
--- a/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/toneselectionengine_p.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/toneselectionengine_p.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -23,12 +23,69 @@
#include "tonefetcherengine.h"
#include
#include
+#include
+
+
+CTimeOutTimer* CTimeOutTimer::NewL(ToneSelectionEnginePrivate& aObserver)
+ {
+ CTimeOutTimer* self = CTimeOutTimer::NewLC(aObserver);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+
+
+CTimeOutTimer* CTimeOutTimer::NewLC(ToneSelectionEnginePrivate& aObserver)
+ {
+ CTimeOutTimer* self = new (ELeave) CTimeOutTimer(aObserver);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+
+
+CTimeOutTimer::CTimeOutTimer(ToneSelectionEnginePrivate& aObserver)
+ : CTimer(EPriorityStandard),
+ iObserver( aObserver )
+ {
+
+ }
+
+
+
+CTimeOutTimer::~CTimeOutTimer()
+ {
+ Cancel();
+ }
+
+
+
+void CTimeOutTimer::ConstructL()
+ {
+ CTimer::ConstructL();
+ CActiveScheduler::Add(this);
+ }
+
+
+
+void CTimeOutTimer::RunL()
+ {
+ iObserver.ChangeObject();
+ }
ToneSelectionEnginePrivate::ToneSelectionEnginePrivate( ToneFetcherEngine *engine ) : mServiceEngine( engine )
{
iSession = CMdESession::NewL( *this );
+ iTimer = CTimeOutTimer::NewLC( *this );
+ iContinue = EFalse;
+ iTimerStarted = EFalse;
+ iFreshing = EFalse;
+ CleanupStack::Pop();
+
+
}
ToneSelectionEnginePrivate::~ToneSelectionEnginePrivate()
@@ -78,11 +135,23 @@
void ToneSelectionEnginePrivate::HandleObjectNotification( CMdESession& /*aSession*/,
TObserverNotificationType aType,
- const RArray& /*aObjectIdArray*/ )
+ const RArray& aObjectIdArray )
{
- if ( aType == ENotifyAdd || aType == ENotifyModify || aType == ENotifyRemove )
+ if ( aObjectIdArray.Count() > 0 && ( aType == ENotifyAdd || aType == ENotifyModify || aType == ENotifyRemove ) )
{
- emit notifyObjectChanged();
+ CPFW_LOG("ToneSelectionEnginePrivate::HandleObjectNotification count = " + QVariant(aObjectIdArray.Count()).toString() + " type = " + QVariant(aType).toString());
+ const TInt KOneSecond = 1000*1000;
+ if ( !iFreshing )
+ {
+ emit notifyRefreshStart();
+ iFreshing = ETrue;
+ }
+ if ( !iTimerStarted )
+ {
+ iTimer->After( 5 * KOneSecond );
+ iTimerStarted = ETrue;
+ }
+ iContinue = ETrue;
}
}
@@ -103,7 +172,18 @@
{
if( aObjectIdArray.Count() > 0 )
{
- emit notifyObjectChanged();
+ const TInt KOneSecond = 1000*1000;
+ if ( !iFreshing )
+ {
+ emit notifyRefreshStart();
+ iFreshing = ETrue;
+ }
+ if ( !iTimerStarted )
+ {
+ iTimer->After( 5 * KOneSecond );
+ iTimerStarted = ETrue;
+ }
+ iContinue = ETrue;
}
}
@@ -268,5 +348,29 @@
}
}
}
+
+void ToneSelectionEnginePrivate::ChangeObject()
+ {
+ if ( iTimerStarted )
+ {
+ emit notifyObjectChanged();
+ iTimerStarted = EFalse;
+ }
+
+ if ( iContinue )
+ {
+ iContinue = EFalse;
+ iTimer->After( 5000*1000 );
+ iTimerStarted = ETrue;
+ }
+ else
+ {
+ if ( iFreshing )
+ {
+ emit notifyRefreshFinish();
+ iFreshing = EFalse;
+ }
+ }
+ }
// End of File
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/toneselectionengine_p.h
--- a/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/toneselectionengine_p.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/toneselectionengine_p.h Thu Jun 10 16:07:41 2010 +0800
@@ -32,9 +32,30 @@
#include
// FORWARD DECLARATIONS
class ToneFetcherEngine;
+class ToneSelectionEnginePrivate;
// CONSTANTS
_LIT( KMimeMp3, "mp3" );
+class CTimeOutTimer : public CTimer
+{
+public:
+ static CTimeOutTimer* NewL(ToneSelectionEnginePrivate& aObserver);
+ static CTimeOutTimer* NewLC(ToneSelectionEnginePrivate& aObserver);
+
+ ~CTimeOutTimer();
+
+protected:
+ virtual void RunL();
+
+private:
+ CTimeOutTimer(ToneSelectionEnginePrivate& aObserver);
+ void ConstructL();
+
+private:
+
+ ToneSelectionEnginePrivate& iObserver;
+};
+
// CLASS DECLARATION
/**
* This class is used for quering tones from mde.
@@ -74,14 +95,15 @@
public:
ToneSelectionEnginePrivate( ToneFetcherEngine *engine );
virtual ~ToneSelectionEnginePrivate();
-
+ void ChangeObject();
signals:
void mdeSessionOpened();
void mdeSessionError( int error );
- void queryComplete( QStringList nameList, QStringList uriList );
+ void queryComplete( const QStringList& nameList, const QStringList& uriList );
void queryError( int error );
void notifyObjectChanged();
-
+ void notifyRefreshStart();
+ void notifyRefreshFinish();
public:
static CMdEPropertyDef& PropertyDefL(CMdESession* aSession, TInt aAttr);
@@ -137,6 +159,12 @@
// query error
TInt iQueryError;
+
+ // for refresh
+ CTimeOutTimer *iTimer;
+ TBool iContinue;
+ TBool iTimerStarted;
+ TBool iFreshing;
};
#endif /* TONESELECTIONENGINE_H_ */
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.cpp
--- a/controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -35,6 +35,10 @@
this, SIGNAL(queryError(int)));
connect(d, SIGNAL(notifyObjectChanged()),
this, SIGNAL(notifyObjectChanged()));
+ connect(d, SIGNAL(notifyRefreshStart()),
+ this, SIGNAL(notifyRefreshStart()));
+ connect(d, SIGNAL(notifyRefreshFinish()),
+ this, SIGNAL(notifyRefreshFinish()));
connect(mAudioPlayer, SIGNAL(notifyPreviewEvent(ToneServiceEngine::TPreviewEvent, int)),
this, SIGNAL(notifyPreviewEvent(ToneServiceEngine::TPreviewEvent, int)));
}
@@ -59,4 +63,10 @@
{
mAudioPlayer->IsPlaying();
}
+
+void ToneFetcherEngine::stop()
+{
+ mAudioPlayer->Stop();
+}
+
//End of File
diff -r 22d3abee08da -r 2883a5458389 controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.h
--- a/controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.h Thu Jun 10 16:07:41 2010 +0800
@@ -82,6 +82,11 @@
void preview(const QString &file);
bool IsPlaying();
+
+ /*
+ * stop previewing
+ */
+ void stop();
signals:
void mdeSessionOpened();
void mdeSessionError(int error);
@@ -89,6 +94,8 @@
void queryError(int error);
void notifyPreviewEvent(ToneFetcherEngine::TPreviewEvent event, int errorId);
void notifyObjectChanged();
+ void notifyRefreshStart();
+ void notifyRefreshFinish();
private:
ToneSelectionEnginePrivate *d;
TonePreviewPrivate *mAudioPlayer;