# HG changeset patch # User hgs # Date 1277457140 -28800 # Node ID a5692c68d7722745e91ff44798070a4126f42b72 # Parent 2883a5458389cbccd6c306938b40dd4d49de369e 201025 diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/src/cpthemechanger.cpp --- a/controlpanelplugins/themeplugin/src/cpthemechanger.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemechanger.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -14,19 +14,20 @@ * Description: * */ +#include #include "cpthemechanger.h" -#include "cpthemechanger_p.h" -#include "cpthemelistmodel.h" +#include "cpthemeutil.h" +#include "cpthemeinfo.h" + +#include +#include /*! - @alpha \class CpThemeChanger \brief CpThemeChanger provides an interface for changing the current - theme and enumerating the available themes (e.g., for the UI to provide - a list of themes to show). - + theme. This API is only for use with the control panel and its theme changing plugin. */ @@ -36,75 +37,76 @@ */ CpThemeChanger::CpThemeChanger(QObject* p) : QObject(p), - d_ptr(new CpThemeChangerPrivate(this)) + mCurrentTheme(0) { + connect(hbInstance->theme(),SIGNAL(changeFinished()), this, SLOT(changeFinished())); + + setCurrentTheme(); +} + +/*! + Returns a ThemeInfo object containing the current theme name and + corresponding icons. + + If no repersentative icons exist, the HbIcon returned will be + uninitialized. +*/ +const CpThemeInfo* CpThemeChanger::currentTheme() const +{ + return mCurrentTheme; } /*! - Provides a list of themes as a const QAbstractItemModel*. -*/ -QAbstractItemModel& CpThemeChanger::model() + * Private helper function that gets the current theme from hbinstance and s + * ets class' current theme. + */ +void CpThemeChanger::setCurrentTheme() { - Q_D(CpThemeChanger); - - return d->mModel; + QString themeName = ""; + if (HbInstance::instance()) { + HbTheme *hbTheme = HbInstance::instance()->theme(); + if(hbTheme) { + themeName = hbTheme->name(); + } + + } + + if(mCurrentTheme && mCurrentTheme->name() == themeName) { + return; + } + else { + //buildThemeInfo creates new theme info. + CpThemeInfo* tmpTheme = CpThemeUtil::buildThemeInfo(HbThemeServices::themePath(), themeName); + + //delete old value. set the new value. + if(tmpTheme) { + if(mCurrentTheme){ + delete mCurrentTheme; + } + mCurrentTheme = tmpTheme; + } + } } /*! - Creates a connection to the theme server for the purpose of - changing the theme. - */ -bool CpThemeChanger::connectToServer() -{ - Q_D(CpThemeChanger); - - return d->connectToServer(); -} - -/*! - Indicates if the client is connected to the theme server. -*/ -bool CpThemeChanger::isConnected() const -{ - Q_D(const CpThemeChanger); - - return d->isConnected(); -} - - -/*! - Returns a ThemeInfo struct containing the current theme name and - a repersentative HbIcon. - - If no repersentative icon exists, the HbIcon returned will be - uninitialized. -*/ -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); -} - -/*! Change a theme. Returns true on success, false otherwise. */ -bool CpThemeChanger::changeTheme(const QString& newtheme) +bool CpThemeChanger::changeTheme(const QString& newTheme) { - Q_D(CpThemeChanger); + bool result = false; + // Skip doing this if the request is for the current theme + if (newTheme.isEmpty() || newTheme == mCurrentTheme->name()) { + return result; + } - return d->changeTheme(newtheme); + QString themePath = CpThemeUtil::themePath(newTheme); + + if(!themePath.isEmpty()) { + HbThemeServices::setTheme(themePath); + result = true; + } + return result; } /*! @@ -112,11 +114,21 @@ */ CpThemeChanger::~CpThemeChanger() { - delete d_ptr; - d_ptr = 0; + delete mCurrentTheme; + mCurrentTheme = 0; } -#include "moc_cpthemechanger.cpp" +/*! + * Slot to handle notification from theme server that theme change + * is done. Notify the owner. + */ +void CpThemeChanger::changeFinished() +{ + + setCurrentTheme(); + + emit themeChangeFinished(); +} // End of file diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/src/cpthemechanger.h --- a/controlpanelplugins/themeplugin/src/cpthemechanger.h Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemechanger.h Fri Jun 25 17:12:20 2010 +0800 @@ -24,6 +24,7 @@ #include class CpThemeChangerPrivate; +class CpThemeInfo; QT_BEGIN_NAMESPACE class QAbstractItemModel; @@ -32,43 +33,25 @@ class CpThemeChanger : public QObject { Q_OBJECT - + public: explicit CpThemeChanger(QObject* parent=0); ~CpThemeChanger(); - - enum ThemeListUserRole { - PortraitPreviewRole = Qt::UserRole, - LandscapePreviewRole - }; - - struct ThemeInfo{ - QString name; - HbIcon icon; - HbIcon portraitPreviewIcon; - HbIcon landscapePreviewIcon; - bool operator < (const struct ThemeInfo &other) const { - return name.localeAwareCompare(other.name) < 0; - } - bool operator == (const struct ThemeInfo &other) const { - return name.localeAwareCompare(other.name) == 0; - } - }; + + const CpThemeInfo* currentTheme() const; + bool changeTheme(const QString& newtheme); + +signals: + void themeChangeFinished(); - QAbstractItemModel& model(); - - const ThemeInfo& currentTheme() const; - int indexOf(const ThemeInfo& theme) const; - - bool changeTheme(const QString& newtheme); +public slots: + void changeFinished(); - bool connectToServer(); - bool isConnected() const; - private: - CpThemeChangerPrivate* d_ptr; - Q_DECLARE_PRIVATE(CpThemeChanger) - Q_PRIVATE_SLOT(d_func(), void _q_themeDirectoryChanged(const QString&)) + void setCurrentTheme(); + + CpThemeInfo* mCurrentTheme; }; + #endif /* CPTHEMECHANGER_H */ diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/src/cpthemechanger_p.cpp --- a/controlpanelplugins/themeplugin/src/cpthemechanger_p.cpp Thu Jun 10 16:07:41 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,342 +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: - * - */ - -#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 - - -#if !defined(Q_OS_SYMBIAN) - #include - static const char* KThemePathKey = "HB_THEMES_DIR"; -#endif - 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), - mThemeClient(CpThemeClient::global()), - mFileWatcher(new QFileSystemWatcher(qq)), - mModel(this, qq) - -{ - Q_Q(CpThemeChanger); - - // 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; - _dupenv_s(&_path, &_size, KThemePathKey); - mThemeRootPath = QString(_path); - mThemeRootPathPostfix = QString(); - free(_path); -#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()) { - HbTheme *hbTheme = HbInstance::instance()->theme(); - if (hbTheme) { - mCurrentTheme.name = hbTheme->name(); - } - } - - // Watch for changes to the theme directory in flash. - // This may change once we start offering a model. -#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() -{ - mThemeClient->releaseInstance(); - mThemeClient = 0; -} - -const CpThemeChanger::ThemeInfo& CpThemeChangerPrivate::currentTheme() const -{ - return mCurrentTheme; -} - -const QString& CpThemeChangerPrivate::currentThemeName() const -{ - return mCurrentTheme.name.isEmpty() ? KDefaultTheme : mCurrentTheme.name; -} - -int CpThemeChangerPrivate::indexOf(const CpThemeChanger::ThemeInfo& theme) const -{ - return mThemeList.indexOf(theme); -} - -void CpThemeChangerPrivate::updateThemeList(const QString& newThemeName) -{ - if(!mThemeList.isEmpty()) { - mThemeList.clear(); - } - - mCurrentTheme.name = newThemeName.isEmpty() ? KDefaultTheme : newThemeName; - - 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 )) { - QDir root(themeDir.path()); - 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); - if(iconThemePath.exists("index.theme") && - (iconThemePath.exists("scalable") || iconThemePath.exists("pixmap") )) { - QSettings iniSetting(iconThemePath.path() + "/index.theme", QSettings::IniFormat); - iniSetting.beginGroup("Icon Theme"); - QString hidden = iniSetting.value("Hidden").toString(); - QString name = iniSetting.value("Name").toString(); - QString iconPath = iniSetting.value("PreviewThumbnailPath").toString(); - QString previewPathPrt = iniSetting.value("PreviewIconPath_prt").toString(); - QString previewPathLsc = iniSetting.value("PreviewIconPath_lsc").toString(); - if (name.isEmpty()) { - continue; - } - - 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 + iconPath); - } - - //Portrait preview - - if(previewPathPrt.isEmpty() || !QFileInfo(fullPathToIcon + previewPathPrt).exists()) { - - 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(KDefaultThemeIcon); - } - } - else { - nameIconPair.portraitPreviewIcon = HbIcon(fullPathToIcon + previewPathPrt); - } - - //Landscape preview - - 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(KDefaultThemeIcon); - } - } - else { - nameIconPair.landscapePreviewIcon = HbIcon(fullPathToIcon + previewPathLsc); - } - - nameIconPair.name = name; - - mThemeList.append(nameIconPair); - - if (name == mCurrentTheme.name) { - mCurrentTheme = nameIconPair; - } - - iniSetting.endGroup(); - if((hidden == "true") ||( hidden == "")||(name != themefolder) ) { - iconthemeslist.removeOne(themefolder); - if(!mThemeList.isEmpty()) { - mThemeList.removeLast(); - } - } - } else { - iconthemeslist.removeOne(themefolder); - if(!mThemeList.isEmpty()) { - mThemeList.removeLast(); - } - } - } - } - } - - if (mCurrentTheme.name == KDefaultTheme) - { - // Include default - CpThemeChanger::ThemeInfo def; - def.name = KDefaultTheme; - def.icon = HbIcon(KDefaultThemeIcon); - mThemeList.append(def); - - mCurrentTheme = def; - } - -} - -const QList& CpThemeChangerPrivate::themes() const -{ - return mThemeList; -} - -bool CpThemeChangerPrivate::connectToServer() -{ - return mThemeClient->connectToServer(); -} - -/** - * Indicate if the client is connected to the server - */ -bool CpThemeChangerPrivate::isConnected() const -{ - return mThemeClient->isConnected(); -} - -/** - * Change a theme - */ -bool CpThemeChangerPrivate::changeTheme(const QString& newTheme) -{ - bool result = false; - // Skip doing this if the request is for the current theme - if (newTheme.isEmpty() || newTheme == mCurrentTheme.name) { - return result; - } - - // Make sure it's a valid theme name and set the current theme. - bool exists = false; - QList::const_iterator i; - for (i = mThemeList.constBegin(); i != mThemeList.constEnd(); ++i) { - if ( newTheme == i->name) { - exists = true; - break; - } - } - - if (exists) { - result = mThemeClient->changeTheme(newTheme); - if(result) { - mCurrentTheme = *i; - } - } - return result; -} - -void CpThemeChangerPrivate::_q_themeDirectoryChanged(const QString&) -{ - updateThemeList(); -} - - - -// End of file diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/src/cpthemechanger_p.h --- a/controlpanelplugins/themeplugin/src/cpthemechanger_p.h Thu Jun 10 16:07:41 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +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 HBTHEMECHANGER_P_H -#define HBTHEMECHANGER_P_H - -#include - -#include - -#include "cpthemechanger.h" -#include "cpthemelistmodel.h" - -QT_BEGIN_NAMESPACE -class QString; -class QStringList; -class QFileSystemWatcher; -QT_END_NAMESPACE - -class CpThemeClient; - -class CpThemeChangerPrivate -{ - CpThemeChanger* q_ptr; - Q_DECLARE_PUBLIC(CpThemeChanger) - -public: - CpThemeChangerPrivate(CpThemeChanger* q); - ~CpThemeChangerPrivate(); - - bool connectToServer(); - bool isConnected() const; - - const QList& themes() const; - void updateThemeList(const QString& currentThemeName = QString()); - - const CpThemeChanger::ThemeInfo& currentTheme() const; - int indexOf(const CpThemeChanger::ThemeInfo& theme) const; - - const QString& currentThemeName() const; - bool changeTheme(const QString& newtheme); - - void _q_themeDirectoryChanged(const QString&); - - CpThemeChanger::ThemeInfo mCurrentTheme; - - QString mThemeRootPath; - QString mThemeRootPathPostfix; - QStringList mThemesPathList; - - CpThemeClient* mThemeClient; - QFileSystemWatcher* mFileWatcher; - QList mThemeList; - CpThemeListModel mModel; - friend class CpThemeListModel; -}; - -#endif /* HBTHEMECHANGER_P_H */ diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/src/cpthemeclient_p.cpp --- a/controlpanelplugins/themeplugin/src/cpthemeclient_p.cpp Thu Jun 10 16:07:41 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +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: - * - */ - -#include "cpthemeclient_p.h" -#include "cpthemeclient_p_p.h" - -static CpThemeClient *clientInst=0; - -/** - * Constructor - */ -CpThemeClient::CpThemeClient():d_ptr(new CpThemeClientPrivate) -{ - -} - -/** - * CpThemeClient::connectToServer() - */ -bool CpThemeClient::connectToServer() -{ - Q_D(CpThemeClient); - - return d->connectToServer(); -} - -bool CpThemeClient::isConnected() -{ - Q_D(const CpThemeClient); - - return d->isConnected(); -} - -/** - * Change a theme - */ -bool CpThemeClient::changeTheme(const QString& newtheme) -{ - Q_D(CpThemeClient); - - return d->changeTheme(newtheme); -} - -/** - * CpThemeClient::~CpThemeClient() - */ -CpThemeClient::~CpThemeClient() -{ - Q_D(CpThemeClient); - - delete d; -} - -/** - * CpThemeClient::global() - */ -CpThemeClient *CpThemeClient::global() -{ - if ( !clientInst ) { - clientInst = new CpThemeClient; - } - return clientInst; -} - -/** - * CpThemeClient::releaseInstance() - */ -void CpThemeClient::releaseInstance() -{ - delete clientInst; - clientInst = 0; -} diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/src/cpthemeclient_p.h --- a/controlpanelplugins/themeplugin/src/cpthemeclient_p.h Thu Jun 10 16:07:41 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +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 CPTHEMECLIENT_P_H -#define CPTHEMECLIENT_P_H - -#include - -class CpThemeClientPrivate; - -class CpThemeClient -{ - CpThemeClientPrivate* d_ptr; - Q_DECLARE_PRIVATE_D(d_ptr, CpThemeClient) - -public: - bool connectToServer(); - - bool changeTheme(const QString& newtheme); - - bool isConnected(); - -public: - static CpThemeClient *global(); - static void releaseInstance(); - ~CpThemeClient(); - -private: - CpThemeClient(); -}; - -#endif /* CPTHEMECLIENT_P_H */ diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/src/cpthemeclient_p_p.h --- a/controlpanelplugins/themeplugin/src/cpthemeclient_p_p.h Thu Jun 10 16:07:41 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +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 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 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/src/cpthemeclientqt_p.cpp --- a/controlpanelplugins/themeplugin/src/cpthemeclientqt_p.cpp Thu Jun 10 16:07:41 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,187 +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: - * - */ - -#include "cpthemeclient_p_p.h" -#include -#include -#include -#include -#include -#include - -#include - - -#define WAIT_TIME_TO_CONNECT_TO_SERVER 500 -#define WAIT_TIME_TO_START_SERVER 5000 -/** - * Constructor - */ -CpThemeClientPrivate::CpThemeClientPrivate():clientConnected( false ),localSocket( new QLocalSocket() ) -{ -#ifdef THEME_SERVER_TRACES - qDebug() << Q_FUNC_INFO ; -#endif -} - -/** - * connectToServer - */ -bool CpThemeClientPrivate::connectToServer() -{ - localSocket->connectToServer(THEME_SERVER_NAME); - // This logic needs to be improved - bool success = localSocket->waitForConnected( WAIT_TIME_TO_CONNECT_TO_SERVER ); - -#ifdef THEME_SERVER_TRACES - qDebug() << Q_FUNC_INFO << "Socket Connect status: " << success; -#endif - -// Stub shouldn't try starting the theme server yet again. -#if 0 - if(!success) { - QProcess *newProcess = new QProcess(); - newProcess->start(SERVERFILEPATH); - success = newProcess->waitForStarted( WAIT_TIME_TO_START_SERVER ); -#ifdef THEME_SERVER_TRACES - qDebug() << Q_FUNC_INFO << "Server Start Status: " << success << "Error = " << newProcess->error (); -#endif - - // If server started - if (success) { - // ToDo: This is to wait for server to start running. Logic needs to be improved. - newProcess->waitForFinished(3000); -#ifdef THEME_SERVER_TRACES - qDebug() <connectToServer(THEME_SERVER_NAME); - success = localSocket->waitForConnected(); -#ifdef THEME_SERVER_TRACES - qDebug() <disconnectFromServer(); - delete localSocket; -} - -/** - * CpThemeClientPrivate::themeChanged() - */ -void CpThemeClientPrivate::themeChanged() -{ -#ifdef THEME_SERVER_TRACES - qDebug() << Q_FUNC_INFO; -#endif - - QByteArray inputByteArray = localSocket->readAll(); - QDataStream inputDataStream(inputByteArray); - int request; - inputDataStream >> request; - -#ifdef THEME_SERVER_TRACES - qDebug() << Q_FUNC_INFO << "recognizer: "<theme()->d_ptr->clearCache(); - } -#endif -} - -/** - * CpThemeClientPrivate::handleThemeChangeRequest() - */ -void CpThemeClientPrivate::handleThemeChangeRequest(QDataStream &dataStream) -{ - QString themeName; - dataStream >> themeName; -#ifdef THEME_SERVER_TRACES - qDebug() << Q_FUNC_INFO <<"themeName is : " <theme()->name() == themeName)) { -#ifdef THEME_SERVER_TRACES - qDebug() << Q_FUNC_INFO <<"themeChanged(): called"; -#endif -#if 0 - // TODO determine if we need this for the control panel app - hbInstance->theme()->d_ptr->handleThemeChange(); -#endif - } -} - -/** - * changeTheme - */ -bool CpThemeClientPrivate::changeTheme(const QString &newTheme) -{ -#ifdef THEME_CHANGER_TRACES - qDebug() <<"ThemeClientQt::changeTheme("<write(outputByteArray); -#ifdef THEME_CHANGER_TRACES - qDebug()<<"ThemeClientQt::ThemeName written to server"; -#endif - localSocket->flush(); - return count == expected; -} - - - - - - diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.cpp --- a/controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.cpp Thu Jun 10 16:07:41 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +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: - * - */ - -#include "cpthemeclient_p_p.h" -#include "cpthemesymbiancommon_p.h" -#include - - -/** -* constructor -*/ -CpThemeClientPrivate::CpThemeClientPrivate() -{ -} - -/** -* CpThemeClientPrivate::connectToServer() -* -* Connects to the server -*/ -bool CpThemeClientPrivate::connectToServer() -{ - return true; -} - -/** -Indicates a connection to the server -*/ -bool CpThemeClientPrivate::isConnected() const -{ - return true; -} - -/** - * Destructor - */ -CpThemeClientPrivate::~CpThemeClientPrivate() -{ -} - -/** - * changeTheme - */ -bool CpThemeClientPrivate::changeTheme(const QString& aString ) -{ - TInt err = KErrGeneral; - RProperty themeRequestProp; - - User::LeaveIfError( themeRequestProp.Attach( KServerUid3, KNewThemeForThemeChanger ) ); - - TBuf<256> newThemenameChangeRequest; - _LIT(KThemeRequestFormatter, "%d:%S"); - TBuf<256> newThemename(aString.utf16()); - newThemenameChangeRequest.Format( KThemeRequestFormatter, EThemeSelection, &newThemename); - err = themeRequestProp.Set(newThemenameChangeRequest); - themeRequestProp.Close(); - return (err == KErrNone); -} diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/src/cpthemecommon_p.h --- a/controlpanelplugins/themeplugin/src/cpthemecommon_p.h Thu Jun 10 16:07:41 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,196 +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 HBTHEMECOMMON_P_H -#define HBTHEMECOMMON_P_H - -#include -#include -#include -#include - -#define THEME_SERVER_NAME "hbthemeserver" -#define HB_THEME_SHARED_PIXMAP_CHUNK "themeserver_chunk" -#define ORGANIZATION "Nokia" -#define THEME_COMPONENT "ThemeFramework" - -// To enable/disable debug messages for theme server functionality -#undef THEME_SERVER_TRACES - -// To enable fute testing for cache -//#define HB_ICON_CACHE_DEBUG -struct MultiPartSizeData -{ - // Indexing order is: - - // 'NinePieces' -> tl, t, tr, l, c, r, bl, b, br - // 'ThreePiecesHorizontal' -> l, c, r - // 'ThreePiecesVertical' -> t, c, b - QString multiPartIconId; - QRect sources[9]; // rects used from the rasterized frame part pixmaps - QRect targets[9]; // frame part target rects inside the bounding rectangle of the frame - QSize pixmapSizes[9]; // frame part pixmaps are rasterized to these sizes -}; - - -struct HbMultiIconParams -{ - QString multiPartIconId; - QStringList multiPartIconList; - MultiPartSizeData multiPartIconData; - QSizeF size; - int aspectRatioMode; - int mode; - int options; - bool mirrored; - QColor color; - int rgba; - bool colorflag; -}; - - -enum IconFormatType { - INVALID_FORMAT = -1, - NVG, - PIC, - SVG, - BLOB, - OTHER_SUPPORTED_FORMATS -}; - -struct HbSharedPixmapInfo -{ - int offset; - int width; - int height; - int defaultWidth; - int defaultHeight; - QImage::Format format; -}; - -struct HbSharedNVGInfo -{ - int offset; - int dataSize; - int width; - int height; - int defaultWidth; - int defaultHeight; - -}; - -struct HbSharedPICInfo -{ - int offset; - int dataSize; - int width; - int height; - int defaultWidth; - int defaultHeight; -}; - -struct HbSharedBLOBInfo -{ - int offset; - int dataSize; -}; - -struct HbSharedIconInfo -{ - IconFormatType type; - - union - { - HbSharedPixmapInfo pixmapData; - HbSharedNVGInfo nvgData; - HbSharedPICInfo picData; - HbSharedBLOBInfo blobData; - }; - -}; - -struct HbSharedStyleSheetInfo -{ - int offset; - int refCount; - HbSharedStyleSheetInfo(): - offset(-1), - refCount(0) - {} -}; - -struct HbSharedEffectInfo -{ - int offset; - HbSharedEffectInfo(): offset(-1){} -}; - -struct HbSharedWMLInfo -{ - int offset; - HbSharedWMLInfo() : offset(-1) {} -}; - -struct HbDeviceProfileInfo -{ - int offset; - HbDeviceProfileInfo() : offset(-1) {} -}; - -// Function codes (opcodes) used in message passing between client and server -enum ThemeServerRequest - { - EIconLookup = 1, - EIconDefaultSize, - EStyleSheetLookup, - EThemeSelection, - EMultiPieceIcon, - EWidgetMLLookup, - EDeviceProfileOffset, - #ifdef HB_ICON_CACHE_DEBUG - EIconCleanUp, - ECacheIconCount, - ERasterMemLimit, - EVectorMemLimit, - EFreeRasterMem, - EFreeVectorMem, - ELastAddedItemMem, - ELastAddedItemRefCount, - ELastRemovedItemMem, - ELastRemovedItemRefCount, - EEnableCache, - ECacheHit, - ECacheMiss, - ECleanRasterLRUList, - ECleanVectorLRUList, - EServerHeap, - EGpuLruCount, - ECpuLruCount, - EServerStat, - EServerHeapMarkStart, - EServerHeapMarkEnd, - EServerAllocFail, - EServerAllocReset, - #endif - EThemeContentUpdate, - EEffectLookupFilePath, - EEffectAdd, - EUnloadIcon, - EThemeServerStop - }; - -#endif /* HBTHEMECOMMON_P_H */ diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/src/cpthemecontrol.cpp --- a/controlpanelplugins/themeplugin/src/cpthemecontrol.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -34,6 +34,8 @@ #include #include #include +#include +#include #include #include @@ -42,6 +44,8 @@ #include "cpthemecontrol.h" #include "cpthemelistview.h" #include "cpthemepreview.h" +#include "cpthemeinfo.h" +#include "cpthemelistmodel.h" #include #include @@ -67,7 +71,6 @@ mThemePreview(0), mThemeChanger(0), mListModel(0), - mSortModel(0), mThemeChangeFinished(false), mWaitDialog(0) { @@ -79,7 +82,7 @@ translator->load("control_panel_" + lang, path); qApp->installTranslator(translator); - connect(hbInstance->theme(),SIGNAL(changeFinished()), this, SLOT(themeChangeFinished())); + connect(mThemeChanger,SIGNAL(themeChangeFinished()), this, SLOT(themeChangeFinished())); } @@ -111,16 +114,12 @@ mThemeListView = new CpThemeListView(); - mListModel = &mThemeChanger->model(); + if(!mListModel) { + mListModel = new CpThemeListModel(this); + } - mSortModel = new QSortFilterProxyModel(this); - mSortModel->setDynamicSortFilter(true); - mSortModel->setSortCaseSensitivity(Qt::CaseInsensitive); - mSortModel->sort(0); - mSortModel->setSourceModel(mListModel); - // Set the model for theme list. - mThemeListView->setModel(mSortModel); + mThemeListView->setModel(mListModel); mThemeListView->themeList()->setSelectionMode(HbAbstractItemView::SingleSelection); setActiveThemeIndex(); @@ -154,7 +153,11 @@ */ QString CpThemeControl::currentThemeName() const { - return mThemeChanger->currentTheme().name; + QString name = ""; + if(mThemeChanger->currentTheme()) { + name = mThemeChanger->currentTheme()->name(); + } + return name; } /*! @@ -162,7 +165,11 @@ */ HbIcon CpThemeControl::currentThemeIcon() const { - return mThemeChanger->currentTheme().icon; + HbIcon icon; + if(mThemeChanger->currentTheme()) { + icon = mThemeChanger->currentTheme()->icon(); + } + return icon; } /*! @@ -173,38 +180,66 @@ if(!index.isValid()) { return; } - - CpThemeChanger::ThemeInfo themeInfo; + CpThemeInfo themeInfo; QVariant data; //reset the current index to active theme, so that the selection remains on current //theme even though another list item is selected. setActiveThemeIndex(); + // Figure out whether this is a URI and appropriately delegate + data = index.data(CpThemeListModel::ItemTypeRole); + if(data.isValid() && data.canConvert()) { + + CpThemeInfo::ThemeListItemType type = data.value(); + + switch (type) { + case CpThemeInfo::ThemeListItemType_URL: + //get the URL + data = index.data(CpThemeListModel::ItemDataRole); + if(data.isValid()) { + QString url = data.toString(); + // Launch the URL in the browser and + // continue to Preview if not successful + if (QDesktopServices::openUrl(QUrl(url, QUrl::TolerantMode))) { + return; + } + } + break; + + case CpThemeInfo::ThemeListItemType_APP: + break; + + default: + // do nothing + qt_noop(); + } + } + //get the theme name. data = index.data(Qt::DisplayRole); if(data.isValid()) { - themeInfo.name = data.toString(); + themeInfo.setName(data.toString()); } + //get theme icon. data = index.data(Qt::DecorationRole); if(data.isValid()) { - themeInfo.icon = data.value(); - } - - data = index.data(CpThemeChanger::PortraitPreviewRole); - if(data.isValid()) { - themeInfo.portraitPreviewIcon = data.value(); + themeInfo.setIcon(data.value()); } - data = index.data(CpThemeChanger::LandscapePreviewRole); + data = index.data(CpThemeListModel::PortraitPreviewRole); if(data.isValid()) { - themeInfo.landscapePreviewIcon = data.value(); + themeInfo.setPortraitPreviewIcon(data.value()); } - - - //Set up the theme preview and set it to + + data = index.data(CpThemeListModel::LandscapePreviewRole); + if(data.isValid()) { + themeInfo.setLandscapePreviewIcon(data.value()); + } + + //Set up the theme preview and set it to //the current view of main window. HbMainWindow* mWindow = ::mainWindow(); @@ -221,9 +256,9 @@ mThemePreview->setThemeInfo(themeInfo); } mThemePreview->setTitle(hbTrId("txt_cp_title_control_panel")); - + mWindow->setCurrentView(mThemePreview); - + } /*! @@ -231,22 +266,21 @@ */ void CpThemeControl::themeApplied(const QString& theme) { - bool success = false; - - success = mThemeChanger->connectToServer(); + QThread::currentThread()->setPriority(QThread::HighPriority); + + if(mThemeChanger->changeTheme(theme)) { - if (success) { - QThread::currentThread()->setPriority(QThread::HighPriority); - 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; + } else { + //theme change failed, go back to control panel. + previewClosed(); + triggerThemeListClose(); } - - //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; } @@ -314,8 +348,9 @@ { if(!mWaitDialog) { mWaitDialog = new HbDialog(); + mWaitDialog->setDismissPolicy(HbPopup::NoDismiss); mWaitDialog->setModal(false); - mWaitDialog->setDismissPolicy(HbPopup::NoDismiss); + mWaitDialog->setTimeout(HbPopup::NoTimeout); //TODO: need localized text for Hb Dialog // Create and set HbLabel as content widget. HbLabel *label = new HbLabel("Processing ..."); @@ -334,6 +369,10 @@ QTimer::singleShot(0, this, SLOT(themeChangeTimeout())); mThemeChangeFinished = true; + if(mThemeChanger->currentTheme()) { + emit themeUpdated(mThemeChanger->currentTheme()->name(), mThemeChanger->currentTheme()->icon()); + } + } /*! @@ -343,11 +382,13 @@ void CpThemeControl::setActiveThemeIndex() { //Get the index of current theme. - QModelIndex sourceIndex = mListModel->index(mThemeChanger->indexOf(mThemeChanger->currentTheme()),0); - //Map it to the sort model index. - QModelIndex sortedIndex = mSortModel->mapFromSource(sourceIndex); - //set current index. - mThemeListView->themeList()->setCurrentIndex(sortedIndex, QItemSelectionModel::SelectCurrent); + CpThemeListModel* themeListModel = dynamic_cast(mListModel); + const CpThemeInfo* currentTheme = mThemeChanger->currentTheme(); + if(themeListModel && currentTheme) { + QModelIndex sourceIndex = mListModel->index(themeListModel->indexOf(*currentTheme),0); + //set current index. + mThemeListView->themeList()->setCurrentIndex(sourceIndex, QItemSelectionModel::SelectCurrent); + } } diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/src/cpthemecontrol.h --- a/controlpanelplugins/themeplugin/src/cpthemecontrol.h Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.h Fri Jun 25 17:12:20 2010 +0800 @@ -34,7 +34,7 @@ class CpThemeListView; class CpThemePreview; class CpBaseSettingView; - +class CpThemeListModel; class CpThemeControl : public QObject @@ -70,7 +70,6 @@ CpThemePreview* mThemePreview; CpThemeChanger* mThemeChanger; QAbstractItemModel* mListModel; - QSortFilterProxyModel* mSortModel; bool mThemeChangeFinished; HbDialog* mWaitDialog; }; diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/src/cpthemeinfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemeinfo.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,102 @@ +/* + * 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: + * + */ + +/*! + * A simple class to represent theme information. This information includes: + * 1. Theme Name + * 2. Theme Preview Thumbnail + * 3. Theme Preview landscape and portrait icon + * 4. Theme list type: either an item representing a theme, or a link (e.g OviStore). + * 5. Item type data. Represents additional information (e.g for link type, the URL). + */ +#include + +#include "cpthemeinfo.h" + + CpThemeInfo::CpThemeInfo() +{ +} + + + CpThemeInfo::~CpThemeInfo() +{ +} + +QString CpThemeInfo::name() const +{ + return mName; +} + +void CpThemeInfo::setName(const QString& newName) +{ + mName = newName; +} + +CpThemeInfo::ThemeListItemType CpThemeInfo::itemType() const +{ + return mItemType; +} + +void CpThemeInfo::setItemType(CpThemeInfo::ThemeListItemType type) +{ + mItemType = type; +} + + +QString CpThemeInfo::itemData() const +{ + return mItemData; +} + +void CpThemeInfo::setItemData(const QString& data) +{ + mItemData = data; +} + + +HbIcon CpThemeInfo::icon() const +{ + return mIcon; +} + +void CpThemeInfo::setIcon(const HbIcon& newIcon) +{ + mIcon = newIcon; +} + + +HbIcon CpThemeInfo::portraitPreviewIcon() const +{ + return mPortraitPreviewIcon; +} + +void CpThemeInfo::setPortraitPreviewIcon(const HbIcon& newIcon) +{ + mPortraitPreviewIcon = newIcon; +} + + +HbIcon CpThemeInfo::landscapePreviewIcon() const +{ + return mLandscapePreviewIcon; +} + +void CpThemeInfo::setLandscapePreviewIcon(const HbIcon& newIcon) +{ + mLandscapePreviewIcon = newIcon; +} + diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/src/cpthemeinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemeinfo.h Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,77 @@ +/* + * 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 CPTHEMEINFO_H_ +#define CPTHEMEINFO_H_ + + +#include + +#include + +class CpThemeInfo { + +public: + + Q_ENUMS(ThemeListItemType) + + enum ThemeListItemType { + ThemeListItemType_default = 0, + ThemeListItemType_URL, + ThemeListItemType_APP + }; + + CpThemeInfo(); + ~CpThemeInfo(); + + QString name() const; + void setName(const QString& newName); + + ThemeListItemType itemType() const; + void setItemType(ThemeListItemType type); + + QString itemData() const; + void setItemData(const QString& data); + + HbIcon icon() const; + void setIcon(const HbIcon& newIcon); + + HbIcon portraitPreviewIcon() const; + void setPortraitPreviewIcon(const HbIcon& newIcon); + + HbIcon landscapePreviewIcon() const; + void setLandscapePreviewIcon(const HbIcon& newIcon); + + bool operator < (const CpThemeInfo &other) const { + return mName.toCaseFolded().localeAwareCompare(other.mName.toCaseFolded()) < 0; + } + bool operator == (const CpThemeInfo &other) const { + return mName.localeAwareCompare(other.mName) == 0; + } + +private: + CpThemeInfo::ThemeListItemType mItemType; + QString mItemData; + QString mName; + HbIcon mIcon; + HbIcon mPortraitPreviewIcon; + HbIcon mLandscapePreviewIcon; + +}; +Q_DECLARE_METATYPE(CpThemeInfo::ThemeListItemType) + + +#endif /* CPTHEMEINFO_H_ */ diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp --- a/controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -1,39 +1,69 @@ /* - * ============================================================================ - * 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) 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". * - * 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. - * ============================================================================ + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * */ +#include +#include +#include + +#include + #include "cpthemelistmodel.h" -#include "cpthemechanger_p.h" -#include +#include "cpthemeinfo.h" +#include "cpthemeutil.h" /* CpThemeChangerModel provides an interface to the data contained in the - CpThemeChanger using QAbstractListModel. + theme list using QAbstractListModel. */ /* Constructor */ -CpThemeListModel::CpThemeListModel(CpThemeChangerPrivate *dd, QObject* parent) +CpThemeListModel::CpThemeListModel(QObject* parent) : QAbstractListModel(parent) - , mThemeChangerPrivate(dd) + , mTopThemeList() + , mThemeList() + , mBottomThemeList() + , mFileWatcher(new QFileSystemWatcher(this)) { - connect(dd->mFileWatcher, SIGNAL(directoryChanged(const QString&)), - this, SLOT(themeListChanged())); + //Build theme list + mThemeList = CpThemeUtil::buildThemeList(); + + //Look into theme paths and add a file watcher for it + //to get notified when themes are added. + QStringList themesPathList = CpThemeUtil::themePathList(); + foreach (const QString &path, themesPathList) { + 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/"); + } + } + connect(mFileWatcher, SIGNAL(directoryChanged(const QString&)), + this, SLOT(themeListChanged())); + + // data for the list which appears after the themes: + CpThemeInfo fetchFromStore; + fetchFromStore.setName(hbTrId("txt_cp_list_get_more_tones")); + fetchFromStore.setItemType(CpThemeInfo::ThemeListItemType_URL); + fetchFromStore.setItemData(QString("http://lr.ovi.mobi/store/themes")); + fetchFromStore.setIcon(HbIcon("qtg_large_ovistore")); + mBottomThemeList.append(fetchFromStore); } /* @@ -41,6 +71,8 @@ */ CpThemeListModel::~CpThemeListModel() { + delete mFileWatcher; + mFileWatcher = 0; } @@ -49,42 +81,70 @@ */ int CpThemeListModel::rowCount(const QModelIndex&) const { - return mThemeChangerPrivate->mThemeList.size(); + return mTopThemeList.size() + + mThemeList.size() + + mBottomThemeList.size(); } /* - Reimplemented from QAbstractListModel. Provides the data for Qt::DisplayRole and - Qt::DecorationRole. + Reimplemented from QAbstractListModel. */ 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; + // figure out which list we're in and do the appropriate mapping + int row = index.row(); + const QList *list = 0; + if (row < mTopThemeList.size()) { + list = &mTopThemeList; + } else { + row -= mTopThemeList.size(); + if ( row < mThemeList.size() ) { + list = &mThemeList; + } else { + row -= mThemeList.size(); + if ( row < mBottomThemeList.size() ) { + list = &mBottomThemeList; + } + } + } - case Qt::DecorationRole: - retVal = mThemeChangerPrivate->mThemeList.at(index.row()).icon; - break; + if (list) { + switch (role) { + case Qt::DisplayRole: + retVal = list->at(row).name(); + 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; + case Qt::DecorationRole: + retVal = list->at(row).icon(); + break; - default: - // do nothing - qt_noop(); + case Qt::SizeHintRole: + retVal = list->at(row).icon().size(); + break; + + case PortraitPreviewRole: + retVal = list->at(row).portraitPreviewIcon(); + break; + + case LandscapePreviewRole: + retVal = list->at(row).landscapePreviewIcon(); + break; + + case ItemDataRole: + retVal = list->at(row).itemData(); + break; + + case ItemTypeRole: + retVal = QVariant::fromValue(list->at(row).itemType()); + break; + + default: + // do nothing + qt_noop(); + } } } @@ -101,8 +161,17 @@ void CpThemeListModel::themeListChanged() { beginResetModel(); - - mThemeChangerPrivate->themes(); - + if(!mThemeList.empty()) { + mThemeList.clear(); + } + mThemeList = CpThemeUtil::buildThemeList(); + endResetModel(); } +/*! + * Returns index of theme infor within the theme list. + */ +int CpThemeListModel::indexOf(const CpThemeInfo& theme) const +{ + return mThemeList.indexOf(theme); +} diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/src/cpthemelistmodel.h --- a/controlpanelplugins/themeplugin/src/cpthemelistmodel.h Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemelistmodel.h Fri Jun 25 17:12:20 2010 +0800 @@ -1,20 +1,19 @@ /* -* ============================================================================ -* 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. -* ============================================================================ -*/ + * 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 CP_THEME_LIST_MODEL_P_H #define CP_THEME_LIST_MODEL_P_H @@ -22,25 +21,38 @@ #include #include #include +#include "cpthemeutil.h" -class CpThemeChangerPrivate; +class QFileSystemWatcher; class CpThemeListModel : public QAbstractListModel { Q_OBJECT public: - CpThemeListModel(CpThemeChangerPrivate* dd, QObject *parent = 0); + + enum ThemeListUserRole { + PortraitPreviewRole = Qt::UserRole, + LandscapePreviewRole, + ItemTypeRole, + ItemDataRole + }; + + explicit CpThemeListModel(QObject *parent = 0); virtual ~CpThemeListModel(); virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; - + int indexOf(const CpThemeInfo& theme) const; + public slots: void themeListChanged(); private: - CpThemeChangerPrivate *mThemeChangerPrivate; + QList mTopThemeList; + QList mThemeList; + QList mBottomThemeList; + QFileSystemWatcher *mFileWatcher; }; #endif //CP_THEME_LIST_MODEL_P_H diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/src/cpthemepreview.cpp --- a/controlpanelplugins/themeplugin/src/cpthemepreview.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemepreview.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -29,6 +29,7 @@ #include #include "cpthemepreview.h" +#include "cpthemeinfo.h" /*! \class CpThemePreview @@ -40,7 +41,7 @@ /*! constructor. */ -CpThemePreview::CpThemePreview(const CpThemeChanger::ThemeInfo& theme, QGraphicsItem *parent) : +CpThemePreview::CpThemePreview(const CpThemeInfo& theme, QGraphicsItem *parent) : HbView(parent), mTheme(theme), mSoftKeyBackAction(0), @@ -52,22 +53,23 @@ //setup the heading. - QString themeHeading = HbParameterLengthLimiter("txt_cp_title_preview_1").arg(mTheme.name); + QString themeHeading = HbParameterLengthLimiter("txt_cp_title_preview_1").arg(mTheme.name()); HbLabel* label = new HbLabel(themeHeading, this); layout->addItem(label); layout->setAlignment(layout->itemAt(0), Qt::AlignTop); + layout->itemAt(0)->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed,QSizePolicy::DefaultType); //Create the toolbar and "Select" and "Cancel" actions. HbToolBar* mToolBar = new HbToolBar(this); - HbAction* selectAction = new HbAction(tr("Select")); + HbAction* selectAction = new HbAction(hbTrId("txt_common_button_select")); //Add Action to the toolbar and show toolbar mToolBar->addAction( selectAction ); - HbAction* cancelAction = new HbAction(tr("Cancel")); + HbAction* cancelAction = new HbAction(hbTrId("txt_common_button_cancel")); mToolBar->addAction( cancelAction ); QObject::connect( selectAction, SIGNAL(triggered()), @@ -81,12 +83,14 @@ if(mainWindow()->orientation() == Qt::Horizontal) { - mPreviewIcon = new HbIconItem(mTheme.landscapePreviewIcon, this); + mPreviewIcon = new HbIconItem(mTheme.landscapePreviewIcon(), this); } else { - mPreviewIcon = new HbIconItem(mTheme.portraitPreviewIcon, this); + mPreviewIcon = new HbIconItem(mTheme.portraitPreviewIcon(), this); } layout->addItem(mPreviewIcon); + layout->itemAt(1)->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred,QSizePolicy::DefaultType); + setToolBar(mToolBar); setLayout(layout); @@ -110,7 +114,7 @@ /*! sets the theme to \a theme. */ -void CpThemePreview::setThemeInfo(const CpThemeChanger::ThemeInfo& theme) +void CpThemePreview::setThemeInfo(const CpThemeInfo& theme) { mTheme = theme; } @@ -120,7 +124,7 @@ */ const QString& CpThemePreview::themeName() const { - return mTheme.name; + return mTheme.name(); } /*! @@ -128,7 +132,7 @@ */ const HbIcon& CpThemePreview::themeIcon() const { - return mTheme.icon; + return mTheme.icon(); } /*! @@ -136,7 +140,7 @@ */ void CpThemePreview::themeSelected() { - emit applyTheme(mTheme.name); + emit applyTheme(mTheme.name()); } /*! @@ -152,10 +156,10 @@ previewLayout->removeAt(1); if(orientation == Qt::Horizontal) { - mPreviewIcon->setIcon(mTheme.landscapePreviewIcon); + mPreviewIcon->setIcon(mTheme.landscapePreviewIcon()); } else { - mPreviewIcon->setIcon(mTheme.portraitPreviewIcon); + mPreviewIcon->setIcon(mTheme.portraitPreviewIcon()); } previewLayout->addItem(mPreviewIcon); diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/src/cpthemepreview.h --- a/controlpanelplugins/themeplugin/src/cpthemepreview.h Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemepreview.h Fri Jun 25 17:12:20 2010 +0800 @@ -21,7 +21,9 @@ #include #include #include -#include +#include "cpthemechanger.h" +#include "cpthemeinfo.h" + QT_BEGIN_NAMESPACE class QString; @@ -36,9 +38,9 @@ Q_OBJECT public: - explicit CpThemePreview(const CpThemeChanger::ThemeInfo &theme, QGraphicsItem *parent = 0); + explicit CpThemePreview(const CpThemeInfo &theme, QGraphicsItem *parent = 0); ~CpThemePreview(); - void setThemeInfo(const CpThemeChanger::ThemeInfo& theme); + void setThemeInfo(const CpThemeInfo& theme); const QString& themeName() const; const HbIcon& themeIcon() const; @@ -51,7 +53,7 @@ void previewOrientationChanged(Qt::Orientation orientation); private: - CpThemeChanger::ThemeInfo mTheme; + CpThemeInfo mTheme; HbAction* mSoftKeyBackAction; HbIconItem* mPreviewIcon; diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/src/cpthemesymbiancommon_p.h --- a/controlpanelplugins/themeplugin/src/cpthemesymbiancommon_p.h Thu Jun 10 16:07:41 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +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 HBTHEMESYMBIANCOMMON_P_H -#define HBTHEMESYMBIANCOMMON_P_H - -#include -#include "cpthemecommon_p.h" -struct TIconParams -{ - TBuf<256> fileName; - TReal width; - TReal height; - TUint8 aspectRatioMode; - TUint8 mode; - TUint8 options; - TBool mirrored; - TUint32 rgba; - TBool colorflag; - }; - -struct TMultiIconSymbParams -{ - TBuf<256> multiPartIconId; - TBuf<256> multiPartIconList[9]; - TRect sources[9]; - TRect targets[9]; - TSize pixmapSizes[9]; - QSizeF size; - TInt aspectRatioMode; - TInt mode; - TInt options; - TBool mirrored; - TInt rgba; - TBool colorflag; - }; - -// server name -_LIT(KThemeServerName,"hbthemeserver"); -const TUid KServerUid3={0x20022E82}; -// Common unique ID for Pub/Sub -const TInt KNewThemeForThemeChanger = 9; - -// A version must be specifyed when creating a session with the server - - -const TUint KThemeServerMajorVersionNumber=0; -const TUint KThemeServerMinorVersionNumber=1; -const TUint KThemeServerBuildVersionNumber=1; - -enum TThemeServerLeave -{ - ENonNumericString = 99 -}; - -#endif // HBTHEMESYMBIANCOMMON_P_H - diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/src/cpthemeutil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemeutil.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,311 @@ +/* + * 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 "cpthemeinfo.h" +#include "cpthemeutil.h" + +#include +#include +#include +#include +#include + +#include +#include + +/*! + * This class provides utility function to get Theme information. + */ + +#if defined(Q_OS_SYMBIAN) +#include +#include + static const TUid KServerUid3={0x20022E82}; + static const TUint32 KDefaultThemeNameKey = 0x2; + static const TUint32 KDefaultThemeRootPathKey = 0x3; + +#endif + +#if !defined(Q_OS_SYMBIAN) + #include + static const char* KThemePathKey = "HB_THEMES_DIR"; //used for getting default theme. +#endif + + +#ifdef Q_OS_WIN + static char* _path = NULL; + static size_t _size = 0; + _dupenv_s(&_path, &_size, KThemePathKey); + static QString themeRootPath = QString(_path); + static QString themeRootPathPostfix = QString(); + free(_path); +#elif defined(Q_OS_SYMBIAN) + static QString themeRootPath = "c:\\resource\\hb"; + static QString themeRootPathPostfix = "resource\\hb"; +#elif defined(Q_OS_MACX) + static QString themeRootPath = QDir::homePath() + '/' + "Library" + QString("hb"); + static QString themeRootPathPostfix = QString(); +#elif defined(Q_OS_UNIX) + static QString themeRootPath = QString(getenv(KThemePathKey)); + static QString themeRootPathPostfix = QString(); +#else + static QString themeRootPath = "c:\\resource\\hb"; + static QString themeRootPathPostfix = QString(); +#endif + + //Location of theme preview and background icons. + 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"; + +/*! + * Returns a list of paths where themes folder reside. + */ +QStringList CpThemeUtil::themePathList() +{ + static QStringList themesPathList; + + if(themesPathList.isEmpty()) { + +#if defined(Q_OS_SYMBIAN) + QFileInfoList driveInfoList = QDir::drives(); + foreach (const QFileInfo &driveInfo, driveInfoList) { + const QString themePath = driveInfo.absolutePath() + themeRootPathPostfix; + if(QDir(themePath).exists()) + themesPathList << themePath; + } +#else + themesPathList << themeRootPath; +#endif + } + return themesPathList; +} + +/*! + * Given the theme name, it returns the absolute path of the theme. + */ +QString CpThemeUtil::themePath(const QString& themeName) +{ + QString themePath = ""; + QStringList themesPathList = themePathList(); + foreach (const QString &path, themesPathList) { + QString tmpPath = path + "/themes/icons/" + themeName; + if(QDir(tmpPath).exists()) { + themePath = tmpPath; + break; + } + } + return themePath; +} + +/* + * Builds a CpThemeInfo object given theme path and theme name. It creates the name and + * preview icons for the object. Creates a new CpThemeInfo objects. Caller takes ownership. + * Returns NULL if can't build the object. + */ +CpThemeInfo* CpThemeUtil::buildThemeInfo(const QString& themePath, const QString& themeName) +{ + CpThemeInfo *themeInfo = new CpThemeInfo(); + QString iconPath; + + QString previewPathPrt; + QString previewPathLsc; + QString name = themeName; + QString hidden = ""; + + //first look into the index.theme file to get theme information. + + if(QFileInfo(themePath + "/index.theme").exists()) { + QSettings iniSetting(themePath + "/index.theme", QSettings::IniFormat); + iniSetting.beginGroup("Icon Theme"); + name = iniSetting.value("Name").toString(); + hidden = iniSetting.value("Hidden").toString(); + iconPath = iniSetting.value("PreviewThumbnailPath").toString(); + previewPathPrt = iniSetting.value("PreviewIconPath_prt").toString(); + previewPathLsc = iniSetting.value("PreviewIconPath_lsc").toString(); + iniSetting.endGroup(); + + } + + if(name.isEmpty() || (hidden == "true") ||( hidden == "")) { + return NULL; + } + + themeInfo->setName(name); + themeInfo->setItemType(CpThemeInfo::ThemeListItemType_default); + + //Get the icons. Logic is as follow: + /* 1. If the icon path is in index.theme and the icon exist, use it. + * 2. Otherwise look for the icon in the theme folder. + * 2. If preview icon doesn't exist, use background icon. + * 3. If no icon exist (background or preview),use default theme icon. + */ + if(iconPath.isEmpty() || !QFileInfo(themePath + iconPath).exists()){ + //Set thumbnail + if(QFileInfo(themePath + KPreviewThumbnailNVG).exists()){ + themeInfo->setIcon(HbIcon(themePath + KPreviewThumbnailNVG)); + }else if(QFileInfo(themePath + KPreviewThumbnailSVG).exists()){ + themeInfo->setIcon(HbIcon(themePath + KPreviewThumbnailSVG)); + }else if(QFileInfo(themePath + KBackgroundPrtNVG).exists()){ + themeInfo->setIcon(HbIcon(themePath + KBackgroundPrtNVG)); + } else if(QFileInfo(themePath + KBackgroundPrtSVG).exists()){ + themeInfo->setIcon(HbIcon(themePath + KBackgroundPrtSVG)); + } else if(QFileInfo(themePath + KBackgroundPrtPNG).exists()){ + themeInfo->setIcon(HbIcon(themePath + KBackgroundPrtPNG)); + }else{ + themeInfo->setIcon(HbIcon(defaultTheme()->icon())); + } + + } else { + themeInfo->setIcon(HbIcon(themePath + iconPath)); + } + + //Portrait preview + + if(previewPathPrt.isEmpty() || !QFileInfo(themePath + previewPathPrt).exists()) { + + if(QFileInfo(themePath + KPreviewPrtNVG).exists()){ + themeInfo->setPortraitPreviewIcon(HbIcon(themePath + KPreviewPrtNVG)); + }else if(QFileInfo(themePath + KPreviewPrtSVG).exists()){ + themeInfo->setPortraitPreviewIcon(HbIcon(themePath + KPreviewPrtSVG)); + }else if(QFileInfo(themePath + KBackgroundPrtNVG).exists()){ + themeInfo->setPortraitPreviewIcon(HbIcon(themePath + KBackgroundPrtNVG)); + } else if(QFileInfo(themePath + KBackgroundPrtSVG).exists()){ + themeInfo->setPortraitPreviewIcon(HbIcon(themePath + KBackgroundPrtSVG)); + } else if(QFileInfo(themePath + KBackgroundPrtPNG).exists()){ + themeInfo->setPortraitPreviewIcon(HbIcon(themePath + KBackgroundPrtPNG)); + } else{ + themeInfo->setPortraitPreviewIcon(HbIcon(defaultTheme()->icon())); + } + } + else { + themeInfo->setPortraitPreviewIcon(HbIcon(themePath + previewPathPrt)); + } + + //Landscape preview + + if(previewPathLsc.isEmpty() || !QFileInfo(themePath + previewPathLsc).exists()) { + if(QFileInfo(themePath + KPreviewLscNVG).exists()){ + themeInfo->setLandscapePreviewIcon(HbIcon(themePath + KPreviewLscNVG)); + }else if(QFileInfo(themePath + KPreviewLscSVG).exists()){ + themeInfo->setLandscapePreviewIcon(HbIcon(themePath + KPreviewLscSVG)); + }else if(QFileInfo(themePath + KBackgroundLscNVG).exists()){ + themeInfo->setLandscapePreviewIcon(HbIcon(themePath + KBackgroundLscNVG)); + } else if(QFileInfo(themePath + KBackgroundLscSVG).exists()){ + themeInfo->setLandscapePreviewIcon(HbIcon(themePath + KBackgroundLscSVG)); + } else if(QFileInfo(themePath + KBackgroundLscPNG).exists()){ + themeInfo->setLandscapePreviewIcon(HbIcon(themePath + KBackgroundLscPNG)); + } else{ + themeInfo->setLandscapePreviewIcon(HbIcon(defaultTheme()->icon())); + } + } + else { + themeInfo->setLandscapePreviewIcon(HbIcon(themePath + previewPathLsc)); + } + return themeInfo; + +} + +/*! Creates a list of CpThemeInfo objects representing theme information. + * Caller should take ownership of the list. + */ +QList CpThemeUtil::buildThemeList() +{ + QList themeList; + + QStringList mThemesPathList = themePathList(); + + foreach (const QString &path, mThemesPathList) { + QDir themeDir; + themeDir.setPath( path ) ; + QStringList iconthemeslist; + QStringList list = themeDir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name); + CpThemeInfo* themeInfo; + + 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); + foreach(QString themefolder, iconthemeslist) { + QDir iconThemePath(root.path() + "/themes/icons/" + themefolder); + if(iconThemePath.exists("index.theme") && + (iconThemePath.exists("scalable") || iconThemePath.exists("pixmap") )) { + + themeInfo = buildThemeInfo(iconThemePath.path(), themefolder); + if(themeInfo && !themeInfo->name().isEmpty()) { + themeList.append(*themeInfo); + } + } + } + } + } + qSort( themeList ); + return themeList; +} + +/*! + * Returns the default theme information. + */ +CpThemeInfo* CpThemeUtil::defaultTheme() +{ + //static because default theme doesn't change. + static CpThemeInfo *defaultTheme = new CpThemeInfo(); + QString defaultThemeName; + QString defaultThemeRootDir; + if(defaultTheme->name().isEmpty()) { + + +#ifdef Q_OS_SYMBIAN + CRepository *repository = 0; + TRAP_IGNORE(repository = CRepository::NewL(KServerUid3)); + if (repository) { + TBuf<256> value; + if (KErrNone == repository->Get((TUint32)KDefaultThemeNameKey, value)) { + QString qvalue((QChar*)value.Ptr(), value.Length()); + defaultThemeName = qvalue.trimmed(); + } + value.Zero(); + if (KErrNone == repository->Get((TUint32)KDefaultThemeRootPathKey, value)) { + QString qvalue((QChar*)value.Ptr(), value.Length()); + defaultThemeRootDir = qvalue.trimmed(); + } + else { + defaultThemeRootDir = themePath(defaultThemeName); + } + value.Zero(); + delete repository; + } + +#endif + defaultTheme = buildThemeInfo(defaultThemeRootDir, defaultThemeName); + + } + return defaultTheme; +} + diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/src/cpthemeutil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemeutil.h Fri Jun 25 17:12:20 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: + * + */ + +#ifndef CPTHEMEUTIL_H_ +#define CPTHEMEUTIL_H_ + +#include + +class QStringList; +class CpThemeInfo; + +class CpThemeUtil { + +public: + static QStringList themePathList(); + static QList buildThemeList(); + static CpThemeInfo* buildThemeInfo(const QString& themePath, const QString& themeName); + static QString themePath(const QString& themeName); + static CpThemeInfo* defaultTheme(); +}; + +#endif /* CPTHEMEUTIL_H_ */ + + diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/themeplugin.pri --- a/controlpanelplugins/themeplugin/themeplugin.pri Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelplugins/themeplugin/themeplugin.pri Fri Jun 25 17:12:20 2010 +0800 @@ -9,18 +9,15 @@ # Contributors: # Description: cpthemeplugin source files # Input -HEADERS += src/cpthemeclient_p_p.h \ - src/cpthemepreview.h \ +HEADERS += 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 - + src/cpthemepluginentryitemdata.h \ + src/cpthemeutil.h \ + src/cpthemeinfo.h SOURCES += src/cpthemepreview.cpp \ src/cpthemecontrol.cpp \ src/cpthemeplugin.cpp \ @@ -28,14 +25,5 @@ src/cpthemelistmodel.cpp \ src/cpthemepluginentryitemdata.cpp \ src/cpthemechanger.cpp \ - src/cpthemechanger_p.cpp \ - src/cpthemeclient_p.cpp - -win32|mac { - SOURCES += src/cpthemeclientqt_p.cpp -} - -symbian { - HEADERS += src/cpthemesymbiancommon_p.h - SOURCES += src/cpthemeclientsymbian_p.cpp -} + src/cpthemeutil.cpp \ + src/cpthemeinfo.cpp diff -r 2883a5458389 -r a5692c68d772 controlpanelplugins/themeplugin/themeplugin.pro --- a/controlpanelplugins/themeplugin/themeplugin.pro Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelplugins/themeplugin/themeplugin.pro Fri Jun 25 17:12:20 2010 +0800 @@ -65,6 +65,7 @@ symbian { INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE INCLUDEPATH += $$MOC_DIR + LIBS += -lcentralrepository TARGET.CAPABILITY = ALL -TCB TARGET.EPOCALLOWDLLDATA = 1 TARGET.UID3 = 0X2002C2F3 diff -r 2883a5458389 -r a5692c68d772 controlpanelui/examples/groupplugin/src/cpsamplegroup.cpp --- a/controlpanelui/examples/groupplugin/src/cpsamplegroup.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/examples/groupplugin/src/cpsamplegroup.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -42,11 +42,11 @@ void CpSampleGroup::sliderValueChanged(int value) { //TODO: store your changes - HbMessageBox::launchInformationMessageBox(QString("slider value changed to:%1").arg(value)); + // HbMessageBox::message(QString("slider value changed to:%1").arg(value)); } void CpSampleGroup::checkBoxStateChanged(int state) { //TODO: store your changes QString str = (state ? "checked" : "un-checked"); - HbMessageBox::launchInformationMessageBox(str); + // HbMessageBox::message(str); } diff -r 2883a5458389 -r a5692c68d772 controlpanelui/examples/pluginlauncherclient/src/main.cpp --- a/controlpanelui/examples/pluginlauncherclient/src/main.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/examples/pluginlauncherclient/src/main.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -19,14 +19,15 @@ #include #include #include -#include #include "mainview.h" int main(int argc, char **argv) { HbApplication app(argc, argv); - HbStyleLoader::registerFilePath(CP_RESOURCE_PATH + QDir::separator() + WIDGETML_SUB_PATH); + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.css"); + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem_color.css"); + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.widgetml"); HbMainWindow mainWindow; MainView *mainView = new MainView(); diff -r 2883a5458389 -r a5692c68d772 controlpanelui/examples/pluginlauncherclient/src/mainview.cpp --- a/controlpanelui/examples/pluginlauncherclient/src/mainview.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/examples/pluginlauncherclient/src/mainview.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -24,16 +24,17 @@ #include #include #include +#include MainView::MainView(QGraphicsItem *parent/* = 0*/) -: HbView(parent) +: HbView(parent),mRequest(0) { init(); } MainView::~MainView() { - + delete mRequest; } void MainView::init() @@ -60,16 +61,21 @@ void MainView::launchQtHighwayProfileView() { - XQAiwRequest *request = mAppMgr.create("com.nokia.symbian.ICpPluginLauncher", "launchSettingView(QString,QVariant)", true); + if (mRequest) { + delete mRequest; + mRequest = 0; + } + + mRequest = mAppMgr.create("com.nokia.symbian.ICpPluginLauncher", "launchSettingView(QString,QVariant)", true); - if (!request) + if (!mRequest) { return; } else { - connect(request, SIGNAL(requestOk(QVariant)), SLOT(handleReturnValue(QVariant))); - connect(request, SIGNAL(requestError(int,QString)), SLOT(handleError(int,QString))); + connect(mRequest, SIGNAL(requestOk(QVariant)), SLOT(handleReturnValue(QVariant))); + connect(mRequest, SIGNAL(requestError(int,QString)), SLOT(handleError(int,QString))); } @@ -77,15 +83,18 @@ QList args; args << QVariant( "cppersonalizationplugin.dll" ); args << QVariant ( "profile_view" ); - request->setArguments(args); + mRequest->setArguments(args); + mRequest->setSynchronous(false); + + QTimer::singleShot(20* 1000, this, SLOT(closeSettingView())); + // Make the request - if (!request->send()) + if (!mRequest->send()) { //report error } - delete request; } void MainView::handleReturnValue(const QVariant &returnValue) @@ -98,4 +107,12 @@ HbMessageBox::information( QString("handle error:") + errorMessage); } +void MainView::closeSettingView() +{ + if (mRequest) { + delete mRequest; + mRequest = 0; + } +} + //End of File diff -r 2883a5458389 -r a5692c68d772 controlpanelui/examples/pluginlauncherclient/src/mainview.h --- a/controlpanelui/examples/pluginlauncherclient/src/mainview.h Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/examples/pluginlauncherclient/src/mainview.h Fri Jun 25 17:12:20 2010 +0800 @@ -30,13 +30,19 @@ void init(); private slots: void launchInProcessProfileView(); + void launchQtHighwayProfileView(); + void handleReturnValue(const QVariant &returnValue); void handleError(int errorCode,const QString &errorMessage); + + void closeSettingView(); + private: Q_DISABLE_COPY(MainView) private: XQApplicationManager mAppMgr; + XQAiwRequest *mRequest; }; #endif diff -r 2883a5458389 -r a5692c68d772 controlpanelui/examples/viewplugin/src/cpsampleview.cpp --- a/controlpanelui/examples/viewplugin/src/cpsampleview.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/examples/viewplugin/src/cpsampleview.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -60,12 +60,12 @@ void CpSampleView::sliderValueChanged(int value) { //TODO: store your changes - HbMessageBox::launchInformationMessageBox(QString("slider value changed to:%1").arg(value)); + // HbMessageBox::message(QString("slider value changed to:%1").arg(value)); } void CpSampleView::checkBoxStateChanged(int state) { //TODO: store your changes QString str = (state ? "checked" : "un-checked"); - HbMessageBox::launchInformationMessageBox(str); + // HbMessageBox::message(str); } diff -r 2883a5458389 -r a5692c68d772 controlpanelui/rom/controlpanelui.iby --- a/controlpanelui/rom/controlpanelui.iby Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/rom/controlpanelui.iby Fri Jun 25 17:12:20 2010 +0800 @@ -24,6 +24,7 @@ #define CP_UPGRADABLE_APP_REG_RSC(NAME) data=DATAZ_\PRIVATE\10003A3F\IMPORT\APPS\ ## NAME ## _reg.rsc Private\10003a3f\import\apps\ ## NAME ## _reg.rsc file=ABI_DIR\BUILD_DIR\controlpanel.exe SHARED_LIB_DIR\controlpanel.exe +data = ZRESOURCE\apps\controlpanel.mif APP_RESOURCE_DIR\controlpanel.mif CP_UPGRADABLE_APP_REG_RSC(controlpanel) diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/bwins/cpcategorymodelu.def --- a/controlpanelui/src/bwins/cpcategorymodelu.def Thu Jun 10 16:07:41 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -EXPORTS - ?stop@CpTaskExecutor@@QAEXXZ @ 1 NONAME ; void CpTaskExecutor::stop(void) - ?tr@CpTaskExecutor@@SA?AVQString@@PBD0@Z @ 2 NONAME ; class QString CpTaskExecutor::tr(char const *, char const *) - ?getStaticMetaObject@CpTaskExecutor@@SAABUQMetaObject@@XZ @ 3 NONAME ; struct QMetaObject const & CpTaskExecutor::getStaticMetaObject(void) - ??1CpCategorySettingFormModel@@UAE@XZ @ 4 NONAME ; CpCategorySettingFormModel::~CpCategorySettingFormModel(void) - ?beforeLoadingConfigPlugins@CpCategorySettingFormItemData@@EAEXAAVCpItemDataHelper@@@Z @ 5 NONAME ; void CpCategorySettingFormItemData::beforeLoadingConfigPlugins(class CpItemDataHelper &) - ?trUtf8@CpCategorySettingFormModel@@SA?AVQString@@PBD0H@Z @ 6 NONAME ; class QString CpCategorySettingFormModel::trUtf8(char const *, char const *, int) - ??0CpCategorySettingFormModel@@QAE@ABVQString@@@Z @ 7 NONAME ; CpCategorySettingFormModel::CpCategorySettingFormModel(class QString const &) - ?staticMetaObject@CpTaskExecutor@@2UQMetaObject@@B @ 8 NONAME ; struct QMetaObject const CpTaskExecutor::staticMetaObject - ??_ECpTaskExecutor@@UAE@I@Z @ 9 NONAME ; CpTaskExecutor::~CpTaskExecutor(unsigned int) - ?trUtf8@CpTaskExecutor@@SA?AVQString@@PBD0H@Z @ 10 NONAME ; class QString CpTaskExecutor::trUtf8(char const *, char const *, int) - ?trUtf8@CpCategorySettingFormItemData@@SA?AVQString@@PBD0@Z @ 11 NONAME ; class QString CpCategorySettingFormItemData::trUtf8(char const *, char const *) - ?tr@CpCategorySettingFormModel@@SA?AVQString@@PBD0@Z @ 12 NONAME ; class QString CpCategorySettingFormModel::tr(char const *, char const *) - ?tr@CpCategorySettingFormItemData@@SA?AVQString@@PBD0@Z @ 13 NONAME ; class QString CpCategorySettingFormItemData::tr(char const *, char const *) - ?getStaticMetaObject@CpCategorySettingFormModel@@SAABUQMetaObject@@XZ @ 14 NONAME ; struct QMetaObject const & CpCategorySettingFormModel::getStaticMetaObject(void) - ?destroyGlobalInstance@CpTaskExecutor@@SAXXZ @ 15 NONAME ; void CpTaskExecutor::destroyGlobalInstance(void) - ?initialize@CpCategorySettingFormModel@@UAEXAAVCpItemDataHelper@@@Z @ 16 NONAME ; void CpCategorySettingFormModel::initialize(class CpItemDataHelper &) - ?initialize@CpCategorySettingFormItemData@@QAEXAAVCpItemDataHelper@@@Z @ 17 NONAME ; void CpCategorySettingFormItemData::initialize(class CpItemDataHelper &) - ?tr@CpTaskExecutor@@SA?AVQString@@PBD0H@Z @ 18 NONAME ; class QString CpTaskExecutor::tr(char const *, char const *, int) - ??0CpTaskExecutor@@QAE@PAVQObject@@@Z @ 19 NONAME ; CpTaskExecutor::CpTaskExecutor(class QObject *) - ?tr@CpCategorySettingFormItemData@@SA?AVQString@@PBD0H@Z @ 20 NONAME ; class QString CpCategorySettingFormItemData::tr(char const *, char const *, int) - ?qt_metacast@CpTaskExecutor@@UAEPAXPBD@Z @ 21 NONAME ; void * CpTaskExecutor::qt_metacast(char const *) - ??1CpCategorySettingFormItemData@@UAE@XZ @ 22 NONAME ; CpCategorySettingFormItemData::~CpCategorySettingFormItemData(void) - ?beforeLoadingConfigPlugins@CpCategorySettingFormModel@@EAEXAAVCpItemDataHelper@@@Z @ 23 NONAME ; void CpCategorySettingFormModel::beforeLoadingConfigPlugins(class CpItemDataHelper &) - ??1CpTaskExecutor@@UAE@XZ @ 24 NONAME ; CpTaskExecutor::~CpTaskExecutor(void) - ?createCpPluginItemData@@YAHPAVCpCreatePluginItemDataEvent@@@Z @ 25 NONAME ; int createCpPluginItemData(class CpCreatePluginItemDataEvent *) - ?trUtf8@CpCategorySettingFormModel@@SA?AVQString@@PBD0@Z @ 26 NONAME ; class QString CpCategorySettingFormModel::trUtf8(char const *, char const *) - ?staticMetaObject@CpCategorySettingFormModel@@2UQMetaObject@@B @ 27 NONAME ; struct QMetaObject const CpCategorySettingFormModel::staticMetaObject - ?qt_metacall@CpTaskExecutor@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 28 NONAME ; int CpTaskExecutor::qt_metacall(enum QMetaObject::Call, int, void * *) - ??0CpCategorySettingFormItemData@@QAE@ABVQString@@PBVHbDataFormModelItem@@@Z @ 29 NONAME ; CpCategorySettingFormItemData::CpCategorySettingFormItemData(class QString const &, class HbDataFormModelItem const *) - ?qt_metacast@CpCategorySettingFormItemData@@UAEPAXPBD@Z @ 30 NONAME ; void * CpCategorySettingFormItemData::qt_metacast(char const *) - ?toFront@CpTaskExecutor@@QAE_NPAVCpTask@@@Z @ 31 NONAME ; bool CpTaskExecutor::toFront(class CpTask *) - ?qt_metacall@CpCategorySettingFormModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 32 NONAME ; int CpCategorySettingFormModel::qt_metacall(enum QMetaObject::Call, int, void * *) - ?removeTasks@CpTaskExecutor@@AAEXXZ @ 33 NONAME ; void CpTaskExecutor::removeTasks(void) - ?qt_metacall@CpCategorySettingFormItemData@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 34 NONAME ; int CpCategorySettingFormItemData::qt_metacall(enum QMetaObject::Call, int, void * *) - ?qt_metacast@CpCategorySettingFormModel@@UAEPAXPBD@Z @ 35 NONAME ; void * CpCategorySettingFormModel::qt_metacast(char const *) - ?afterLoadingConfigPlugins@CpCategorySettingFormModel@@EAEXAAVCpItemDataHelper@@@Z @ 36 NONAME ; void CpCategorySettingFormModel::afterLoadingConfigPlugins(class CpItemDataHelper &) - ?getStaticMetaObject@CpCategorySettingFormItemData@@SAABUQMetaObject@@XZ @ 37 NONAME ; struct QMetaObject const & CpCategorySettingFormItemData::getStaticMetaObject(void) - ?metaObject@CpTaskExecutor@@UBEPBUQMetaObject@@XZ @ 38 NONAME ; struct QMetaObject const * CpTaskExecutor::metaObject(void) const - ??0CpCategorySettingFormItemData@@QAE@W4DataItemType@HbDataFormModelItem@@ABVQString@@1PBV2@@Z @ 39 NONAME ; CpCategorySettingFormItemData::CpCategorySettingFormItemData(enum HbDataFormModelItem::DataItemType, class QString const &, class QString const &, class HbDataFormModelItem const *) - ?trUtf8@CpCategorySettingFormItemData@@SA?AVQString@@PBD0H@Z @ 40 NONAME ; class QString CpCategorySettingFormItemData::trUtf8(char const *, char const *, int) - ?runTask@CpTaskExecutor@@QAE_NPAVCpTask@@_N@Z @ 41 NONAME ; bool CpTaskExecutor::runTask(class CpTask *, bool) - ?afterLoadingConfigPlugins@CpCategorySettingFormItemData@@EAEXAAVCpItemDataHelper@@@Z @ 42 NONAME ; void CpCategorySettingFormItemData::afterLoadingConfigPlugins(class CpItemDataHelper &) - ?metaObject@CpCategorySettingFormModel@@UBEPBUQMetaObject@@XZ @ 43 NONAME ; struct QMetaObject const * CpCategorySettingFormModel::metaObject(void) const - ?tr@CpCategorySettingFormModel@@SA?AVQString@@PBD0H@Z @ 44 NONAME ; class QString CpCategorySettingFormModel::tr(char const *, char const *, int) - ?staticMetaObject@CpCategorySettingFormItemData@@2UQMetaObject@@B @ 45 NONAME ; struct QMetaObject const CpCategorySettingFormItemData::staticMetaObject - ?run@CpTaskExecutor@@MAEXXZ @ 46 NONAME ; void CpTaskExecutor::run(void) - ?metaObject@CpCategorySettingFormItemData@@UBEPBUQMetaObject@@XZ @ 47 NONAME ; struct QMetaObject const * CpCategorySettingFormItemData::metaObject(void) const - ?trUtf8@CpTaskExecutor@@SA?AVQString@@PBD0@Z @ 48 NONAME ; class QString CpTaskExecutor::trUtf8(char const *, char const *) - ??_ECpCategorySettingFormItemData@@UAE@I@Z @ 49 NONAME ; CpCategorySettingFormItemData::~CpCategorySettingFormItemData(unsigned int) - ??_ECpCategorySettingFormModel@@UAE@I@Z @ 50 NONAME ; CpCategorySettingFormModel::~CpCategorySettingFormModel(unsigned int) - ?globalInstance@CpTaskExecutor@@SAPAV1@XZ @ 51 NONAME ; class CpTaskExecutor * CpTaskExecutor::globalInstance(void) - diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/bwins/cpprofilewrapperu.def --- a/controlpanelui/src/bwins/cpprofilewrapperu.def Thu Jun 10 16:07:41 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -EXPORTS - ?setKeyTouchScreenVibra@CpProfileModel@@QAEXHH@Z @ 1 NONAME ; void CpProfileModel::setKeyTouchScreenVibra(int, int) - ?tr@CpProfileModel@@SA?AVQString@@PBD0H@Z @ 2 NONAME ; class QString CpProfileModel::tr(char const *, char const *, int) - ?setReminderVibra@CpProfileModel@@QAEXH_N@Z @ 3 NONAME ; void CpProfileModel::setReminderVibra(int, bool) - ?offLineMode@CpProfileModel@@QBE_NXZ @ 4 NONAME ; bool CpProfileModel::offLineMode(void) const - ?masterVibra@CpProfileModel@@QBE_NXZ @ 5 NONAME ; bool CpProfileModel::masterVibra(void) const - ?ringTone@CpProfileModel@@QBE?AVQString@@XZ @ 6 NONAME ; class QString CpProfileModel::ringTone(void) const - ?qt_metacast@CpProfileModel@@UAEPAXPBD@Z @ 7 NONAME ; void * CpProfileModel::qt_metacast(char const *) - ?setRingTone@CpProfileModel@@QAEXABVQString@@@Z @ 8 NONAME ; void CpProfileModel::setRingTone(class QString const &) - ?setReminderTone@CpProfileModel@@QAEXHABVQString@@@Z @ 9 NONAME ; void CpProfileModel::setReminderTone(int, class QString const &) - ?trUtf8@CpProfileModel@@SA?AVQString@@PBD0@Z @ 10 NONAME ; class QString CpProfileModel::trUtf8(char const *, char const *) - ?silenceMode@CpProfileModel@@QBE_NXZ @ 11 NONAME ; bool CpProfileModel::silenceMode(void) const - ?reminderVibra@CpProfileModel@@QBE_NH@Z @ 12 NONAME ; bool CpProfileModel::reminderVibra(int) const - ?setEmailTone@CpProfileModel@@QAEXHABVQString@@@Z @ 13 NONAME ; void CpProfileModel::setEmailTone(int, class QString const &) - ?ringAlertVibra@CpProfileModel@@QBE_NH@Z @ 14 NONAME ; bool CpProfileModel::ringAlertVibra(int) const - ?emailTone@CpProfileModel@@QBE?AVQString@@H@Z @ 15 NONAME ; class QString CpProfileModel::emailTone(int) const - ?activeProfileId@CpProfileModel@@QBEHXZ @ 16 NONAME ; int CpProfileModel::activeProfileId(void) const - ?masterVolume@CpProfileModel@@QBEHXZ @ 17 NONAME ; int CpProfileModel::masterVolume(void) const - ?notificationTone@CpProfileModel@@QBE_NH@Z @ 18 NONAME ; bool CpProfileModel::notificationTone(int) const - ?tr@CpProfileModel@@SA?AVQString@@PBD0@Z @ 19 NONAME ; class QString CpProfileModel::tr(char const *, char const *) - ?getStaticMetaObject@CpProfileModel@@SAABUQMetaObject@@XZ @ 20 NONAME ; struct QMetaObject const & CpProfileModel::getStaticMetaObject(void) - ?keyTouchScreenTone@CpProfileModel@@QBEHH@Z @ 21 NONAME ; int CpProfileModel::keyTouchScreenTone(int) const - ?setRingTone@CpProfileModel@@QAEXHABVQString@@@Z @ 22 NONAME ; void CpProfileModel::setRingTone(int, class QString const &) - ?reminderTone@CpProfileModel@@QBE?AVQString@@H@Z @ 23 NONAME ; class QString CpProfileModel::reminderTone(int) const - ?profileName@CpProfileModel@@QBE?AVQString@@H@Z @ 24 NONAME ; class QString CpProfileModel::profileName(int) const - ?setKeyTouchScreenTone@CpProfileModel@@QAEXHH@Z @ 25 NONAME ; void CpProfileModel::setKeyTouchScreenTone(int, int) - ?setMasterVolume@CpProfileModel@@QAEXH@Z @ 26 NONAME ; void CpProfileModel::setMasterVolume(int) - ?staticMetaObject@CpProfileModel@@2UQMetaObject@@B @ 27 NONAME ; struct QMetaObject const CpProfileModel::staticMetaObject - ?activateProfile@CpProfileModel@@QAEHH@Z @ 28 NONAME ; int CpProfileModel::activateProfile(int) - ?profileNames@CpProfileModel@@QBE?AVQStringList@@XZ @ 29 NONAME ; class QStringList CpProfileModel::profileNames(void) const - ?setNotificationVibra@CpProfileModel@@QAEXH_N@Z @ 30 NONAME ; void CpProfileModel::setNotificationVibra(int, bool) - ?setNotificationTone@CpProfileModel@@QAEXH_N@Z @ 31 NONAME ; void CpProfileModel::setNotificationTone(int, bool) - ?metaObject@CpProfileModel@@UBEPBUQMetaObject@@XZ @ 32 NONAME ; struct QMetaObject const * CpProfileModel::metaObject(void) const - ?setRingAlertVibra@CpProfileModel@@QAEXH_N@Z @ 33 NONAME ; void CpProfileModel::setRingAlertVibra(int, bool) - ??0CpProfileModel@@QAE@PAVQObject@@@Z @ 34 NONAME ; CpProfileModel::CpProfileModel(class QObject *) - ?emailVibra@CpProfileModel@@QBE_NH@Z @ 35 NONAME ; bool CpProfileModel::emailVibra(int) const - ?setProfileSettings@CpProfileModel@@QAEHHAAVCpProfileSettings@@@Z @ 36 NONAME ; int CpProfileModel::setProfileSettings(int, class CpProfileSettings &) - ?setEmailVibra@CpProfileModel@@QAEXH_N@Z @ 37 NONAME ; void CpProfileModel::setEmailVibra(int, bool) - ?setOffLineMode@CpProfileModel@@QAEX_N@Z @ 38 NONAME ; void CpProfileModel::setOffLineMode(bool) - ??1CpProfileModel@@UAE@XZ @ 39 NONAME ; CpProfileModel::~CpProfileModel(void) - ?notificationVibra@CpProfileModel@@QBE_NH@Z @ 40 NONAME ; bool CpProfileModel::notificationVibra(int) const - ?qt_metacall@CpProfileModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 41 NONAME ; int CpProfileModel::qt_metacall(enum QMetaObject::Call, int, void * *) - ?messageTone@CpProfileModel@@QBE?AVQString@@H@Z @ 42 NONAME ; class QString CpProfileModel::messageTone(int) const - ?profileSettings@CpProfileModel@@QAEXHAAVCpProfileSettings@@@Z @ 43 NONAME ; void CpProfileModel::profileSettings(int, class CpProfileSettings &) - ?d_func@CpProfileModel@@ABEPBVCpProfileModelPrivate@@XZ @ 44 NONAME ; class CpProfileModelPrivate const * CpProfileModel::d_func(void) const - ?setSilenceMode@CpProfileModel@@QAEX_N@Z @ 45 NONAME ; void CpProfileModel::setSilenceMode(bool) - ?setMessageVibra@CpProfileModel@@QAEXH_N@Z @ 46 NONAME ; void CpProfileModel::setMessageVibra(int, bool) - ?keyTouchScreenVibra@CpProfileModel@@QBEHH@Z @ 47 NONAME ; int CpProfileModel::keyTouchScreenVibra(int) const - ?d_func@CpProfileModel@@AAEPAVCpProfileModelPrivate@@XZ @ 48 NONAME ; class CpProfileModelPrivate * CpProfileModel::d_func(void) - ?initiationFlag@CpProfileModel@@QAEHXZ @ 49 NONAME ; int CpProfileModel::initiationFlag(void) - ?messageVibra@CpProfileModel@@QBE_NH@Z @ 50 NONAME ; bool CpProfileModel::messageVibra(int) const - ??_ECpProfileModel@@UAE@I@Z @ 51 NONAME ; CpProfileModel::~CpProfileModel(unsigned int) - ?ringTone@CpProfileModel@@QBE?AVQString@@H@Z @ 52 NONAME ; class QString CpProfileModel::ringTone(int) const - ?trUtf8@CpProfileModel@@SA?AVQString@@PBD0H@Z @ 53 NONAME ; class QString CpProfileModel::trUtf8(char const *, char const *, int) - ?setMessageTone@CpProfileModel@@QAEXHABVQString@@@Z @ 54 NONAME ; void CpProfileModel::setMessageTone(int, class QString const &) - ?setMasterVibra@CpProfileModel@@QAEX_N@Z @ 55 NONAME ; void CpProfileModel::setMasterVibra(bool) - diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/bwins/cpringtoneviewu.def --- a/controlpanelui/src/bwins/cpringtoneviewu.def Thu Jun 10 16:07:41 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -EXPORTS - ?tr@CpRingToneView@@SA?AVQString@@PBD0@Z @ 1 NONAME ; class QString CpRingToneView::tr(char const *, char const *) - ?selOK@CpRingToneView@@IAEXABVQString@@@Z @ 2 NONAME ; void CpRingToneView::selOK(class QString const &) - ??1CpRingToneView@@UAE@XZ @ 3 NONAME ; CpRingToneView::~CpRingToneView(void) - ?getStaticMetaObject@CpRingToneView@@SAABUQMetaObject@@XZ @ 4 NONAME ; struct QMetaObject const & CpRingToneView::getStaticMetaObject(void) - ?handleError@CpRingToneView@@AAEXHABVQString@@@Z @ 5 NONAME ; void CpRingToneView::handleError(int, class QString const &) - ?launchMediaFetcher@CpRingToneView@@AAEXABVQString@@0@Z @ 6 NONAME ; void CpRingToneView::launchMediaFetcher(class QString const &, class QString const &) - ?onTypeSelected@CpRingToneView@@AAEXPAVHbListWidgetItem@@@Z @ 7 NONAME ; void CpRingToneView::onTypeSelected(class HbListWidgetItem *) - ?selError@CpRingToneView@@IAEXHABVQString@@@Z @ 8 NONAME ; void CpRingToneView::selError(int, class QString const &) - ?trUtf8@CpRingToneView@@SA?AVQString@@PBD0H@Z @ 9 NONAME ; class QString CpRingToneView::trUtf8(char const *, char const *, int) - ?qt_metacall@CpRingToneView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 10 NONAME ; int CpRingToneView::qt_metacall(enum QMetaObject::Call, int, void * *) - ?staticMetaObject@CpRingToneView@@2UQMetaObject@@B @ 11 NONAME ; struct QMetaObject const CpRingToneView::staticMetaObject - ?metaObject@CpRingToneView@@UBEPBUQMetaObject@@XZ @ 12 NONAME ; struct QMetaObject const * CpRingToneView::metaObject(void) const - ?tr@CpRingToneView@@SA?AVQString@@PBD0H@Z @ 13 NONAME ; class QString CpRingToneView::tr(char const *, char const *, int) - ??0CpRingToneView@@QAE@PAVQGraphicsItem@@@Z @ 14 NONAME ; CpRingToneView::CpRingToneView(class QGraphicsItem *) - ??_ECpRingToneView@@UAE@I@Z @ 15 NONAME ; CpRingToneView::~CpRingToneView(unsigned int) - ?trUtf8@CpRingToneView@@SA?AVQString@@PBD0@Z @ 16 NONAME ; class QString CpRingToneView::trUtf8(char const *, char const *) - ?handleOk@CpRingToneView@@AAEXABVQVariant@@@Z @ 17 NONAME ; void CpRingToneView::handleOk(class QVariant const &) - ?qt_metacast@CpRingToneView@@UAEPAXPBD@Z @ 18 NONAME ; void * CpRingToneView::qt_metacast(char const *) - diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/bwins/seccodeuiu.def --- a/controlpanelui/src/bwins/seccodeuiu.def Thu Jun 10 16:07:41 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -EXPORTS - ?qt_metacall@SecCodeSettings@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1 NONAME ; int SecCodeSettings::qt_metacall(enum QMetaObject::Call, int, void * *) - ?canSetModelIndex@SecCodeEditDataFormViewItem@@UBE_NABVQModelIndex@@@Z @ 2 NONAME ; bool SecCodeEditDataFormViewItem::canSetModelIndex(class QModelIndex const &) const - ?qt_metacast@SecCodeEditDataFormViewItem@@UAEPAXPBD@Z @ 3 NONAME ; void * SecCodeEditDataFormViewItem::qt_metacast(char const *) - ?staticMetaObject@SecCodeEditDataFormViewItem@@2UQMetaObject@@B @ 4 NONAME ; struct QMetaObject const SecCodeEditDataFormViewItem::staticMetaObject - ??0SecCodeSettings@@QAE@PAVQObject@@@Z @ 5 NONAME ; SecCodeSettings::SecCodeSettings(class QObject *) - ?tr@SecCodeEditDataFormViewItem@@SA?AVQString@@PBD0H@Z @ 6 NONAME ; class QString SecCodeEditDataFormViewItem::tr(char const *, char const *, int) - ??_ESecCodeEditDataFormViewItem@@UAE@I@Z @ 7 NONAME ; SecCodeEditDataFormViewItem::~SecCodeEditDataFormViewItem(unsigned int) - ?pinCodeRequest@SecCodeSettings@@QBE_NXZ @ 8 NONAME ; bool SecCodeSettings::pinCodeRequest(void) const - ?metaObject@SecCodeSettings@@UBEPBUQMetaObject@@XZ @ 9 NONAME ; struct QMetaObject const * SecCodeSettings::metaObject(void) const - ?createItem@SecCodeEditDataFormViewItem@@UAEPAVHbAbstractViewItem@@XZ @ 10 NONAME ; class HbAbstractViewItem * SecCodeEditDataFormViewItem::createItem(void) - ?trUtf8@SecCodeEditDataFormViewItem@@SA?AVQString@@PBD0@Z @ 11 NONAME ; class QString SecCodeEditDataFormViewItem::trUtf8(char const *, char const *) - ??_ESecCodeSettings@@UAE@I@Z @ 12 NONAME ; SecCodeSettings::~SecCodeSettings(unsigned int) - ?qt_metacall@SecCodeEditDataFormViewItem@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 13 NONAME ; int SecCodeEditDataFormViewItem::qt_metacall(enum QMetaObject::Call, int, void * *) - ?changePin2Code@SecCodeSettings@@QAEXXZ @ 14 NONAME ; void SecCodeSettings::changePin2Code(void) - ?trUtf8@SecCodeSettings@@SA?AVQString@@PBD0@Z @ 15 NONAME ; class QString SecCodeSettings::trUtf8(char const *, char const *) - ?tr@SecCodeSettings@@SA?AVQString@@PBD0H@Z @ 16 NONAME ; class QString SecCodeSettings::tr(char const *, char const *, int) - ?staticMetaObject@SecCodeSettings@@2UQMetaObject@@B @ 17 NONAME ; struct QMetaObject const SecCodeSettings::staticMetaObject - ?setPinCodeRequest@SecCodeSettings@@QAEX_N@Z @ 18 NONAME ; void SecCodeSettings::setPinCodeRequest(bool) - ?qt_metacast@SecCodeSettings@@UAEPAXPBD@Z @ 19 NONAME ; void * SecCodeSettings::qt_metacast(char const *) - ?tr@SecCodeSettings@@SA?AVQString@@PBD0@Z @ 20 NONAME ; class QString SecCodeSettings::tr(char const *, char const *) - ??1SecCodeSettings@@UAE@XZ @ 21 NONAME ; SecCodeSettings::~SecCodeSettings(void) - ?getStaticMetaObject@SecCodeSettings@@SAABUQMetaObject@@XZ @ 22 NONAME ; struct QMetaObject const & SecCodeSettings::getStaticMetaObject(void) - ?createCustomWidget@SecCodeEditDataFormViewItem@@MAEPAVHbWidget@@XZ @ 23 NONAME ; class HbWidget * SecCodeEditDataFormViewItem::createCustomWidget(void) - ?trUtf8@SecCodeSettings@@SA?AVQString@@PBD0H@Z @ 24 NONAME ; class QString SecCodeSettings::trUtf8(char const *, char const *, int) - ?changePinCode@SecCodeSettings@@QAEXXZ @ 25 NONAME ; void SecCodeSettings::changePinCode(void) - ?tr@SecCodeEditDataFormViewItem@@SA?AVQString@@PBD0@Z @ 26 NONAME ; class QString SecCodeEditDataFormViewItem::tr(char const *, char const *) - ?getStaticMetaObject@SecCodeEditDataFormViewItem@@SAABUQMetaObject@@XZ @ 27 NONAME ; struct QMetaObject const & SecCodeEditDataFormViewItem::getStaticMetaObject(void) - ??1SecCodeEditDataFormViewItem@@UAE@XZ @ 28 NONAME ; SecCodeEditDataFormViewItem::~SecCodeEditDataFormViewItem(void) - ?metaObject@SecCodeEditDataFormViewItem@@UBEPBUQMetaObject@@XZ @ 29 NONAME ; struct QMetaObject const * SecCodeEditDataFormViewItem::metaObject(void) const - ?trUtf8@SecCodeEditDataFormViewItem@@SA?AVQString@@PBD0H@Z @ 30 NONAME ; class QString SecCodeEditDataFormViewItem::trUtf8(char const *, char const *, int) - ??0SecCodeEditDataFormViewItem@@QAE@PAVQGraphicsItem@@@Z @ 31 NONAME ; SecCodeEditDataFormViewItem::SecCodeEditDataFormViewItem(class QGraphicsItem *) - diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpapplication/cpapplication.pro --- a/controlpanelui/src/cpapplication/cpapplication.pro Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpapplication/cpapplication.pro Fri Jun 25 17:12:20 2010 +0800 @@ -17,17 +17,21 @@ TEMPLATE = app TARGET = ControlPanel +ICON = resources/qtg_large_settings.svg + include ( ../common.pri ) include ( cpapplication.pri ) +CONFIG += hb -CONFIG += hb +RESOURCES += cpapplication.qrc LIBS += -lcpframework -lcpcategorymodel TRANSLATIONS = control_panel.ts symbian: { + SKINICON = qtg_large_settings TARGET.UID3 = 0x20025FD9 TARGET.EPOCHEAPSIZE = 0x020000 0x1000000 diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpapplication/cpapplication.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpapplication/cpapplication.qrc Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,5 @@ + + + data/controlpanellog.conf + + \ No newline at end of file diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpapplication/data/controlpanellog.conf --- a/controlpanelui/src/cpapplication/data/controlpanellog.conf Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpapplication/data/controlpanellog.conf Fri Jun 25 17:12:20 2010 +0800 @@ -1,6 +1,3 @@ - -# copy the file(controlpanellog.conf) to C:/data/.config to enable logging - [CpFramework] logdatetime = 1 logloggername = 1 @@ -9,7 +6,7 @@ fileoutput/logfile = C:/data/logs/cpframework.log fileoutput/truncate = 1 -#[CpPerformance] +[CpPerformance] logdatetime = 1 datetimeformat = hh:mm:ss:zzz output = fileoutput diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpapplication/resources/qtg_large_settings.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpapplication/resources/qtg_large_settings.svg Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpapplication/src/cpmainwindow.cpp --- a/controlpanelui/src/cpapplication/src/cpmainwindow.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpapplication/src/cpmainwindow.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -19,7 +19,6 @@ #include "cpmainview.h" #include #include -#include #include #include diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpapplication/src/main.cpp --- a/controlpanelui/src/cpapplication/src/main.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpapplication/src/main.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -24,7 +24,6 @@ #include #include #include -#include int main(int argc, char **argv) { @@ -35,10 +34,15 @@ QCoreApplication::setOrganizationDomain("Orbit"); QCoreApplication::setApplicationName("ControlPanel"); +#ifdef ENABLE_CPFW_LOG Logger::instance(CPFW_LOGGER_NAME)->configure( CP_LOGGER_CONFIG_PATH,QSettings::IniFormat); +#endif + +#ifdef ENABLE_CPPERF_LOG Logger::instance(CPPERF_LOGGER_NAME)->configure( CP_LOGGER_CONFIG_PATH,QSettings::IniFormat); +#endif CPFW_LOG("Entering ControlPanel.exe..."); CPPERF_LOG("Entering ControlPanel.exe..."); @@ -48,8 +52,10 @@ { qApp->installTranslator(&translator); } - - HbStyleLoader::registerFilePath(CP_RESOURCE_PATH + QDir::separator() + WIDGETML_SUB_PATH); + + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.css"); + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem_color.css"); + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.widgetml"); CpMainWindow mainWindow; diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpcategorymodel/bwins/cpcategorymodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/bwins/cpcategorymodelu.def Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,53 @@ +EXPORTS + ?stop@CpTaskExecutor@@QAEXXZ @ 1 NONAME ; void CpTaskExecutor::stop(void) + ?tr@CpTaskExecutor@@SA?AVQString@@PBD0@Z @ 2 NONAME ; class QString CpTaskExecutor::tr(char const *, char const *) + ?getStaticMetaObject@CpTaskExecutor@@SAABUQMetaObject@@XZ @ 3 NONAME ; struct QMetaObject const & CpTaskExecutor::getStaticMetaObject(void) + ??1CpCategorySettingFormModel@@UAE@XZ @ 4 NONAME ; CpCategorySettingFormModel::~CpCategorySettingFormModel(void) + ?beforeLoadingConfigPlugins@CpCategorySettingFormItemData@@EAEXAAVCpItemDataHelper@@@Z @ 5 NONAME ; void CpCategorySettingFormItemData::beforeLoadingConfigPlugins(class CpItemDataHelper &) + ?trUtf8@CpCategorySettingFormModel@@SA?AVQString@@PBD0H@Z @ 6 NONAME ; class QString CpCategorySettingFormModel::trUtf8(char const *, char const *, int) + ??0CpCategorySettingFormModel@@QAE@ABVQString@@@Z @ 7 NONAME ; CpCategorySettingFormModel::CpCategorySettingFormModel(class QString const &) + ?staticMetaObject@CpTaskExecutor@@2UQMetaObject@@B @ 8 NONAME ; struct QMetaObject const CpTaskExecutor::staticMetaObject + ??_ECpTaskExecutor@@UAE@I@Z @ 9 NONAME ; CpTaskExecutor::~CpTaskExecutor(unsigned int) + ?trUtf8@CpTaskExecutor@@SA?AVQString@@PBD0H@Z @ 10 NONAME ; class QString CpTaskExecutor::trUtf8(char const *, char const *, int) + ?trUtf8@CpCategorySettingFormItemData@@SA?AVQString@@PBD0@Z @ 11 NONAME ; class QString CpCategorySettingFormItemData::trUtf8(char const *, char const *) + ?tr@CpCategorySettingFormModel@@SA?AVQString@@PBD0@Z @ 12 NONAME ; class QString CpCategorySettingFormModel::tr(char const *, char const *) + ?tr@CpCategorySettingFormItemData@@SA?AVQString@@PBD0@Z @ 13 NONAME ; class QString CpCategorySettingFormItemData::tr(char const *, char const *) + ?getStaticMetaObject@CpCategorySettingFormModel@@SAABUQMetaObject@@XZ @ 14 NONAME ; struct QMetaObject const & CpCategorySettingFormModel::getStaticMetaObject(void) + ?destroyGlobalInstance@CpTaskExecutor@@SAXXZ @ 15 NONAME ; void CpTaskExecutor::destroyGlobalInstance(void) + ?initialize@CpCategorySettingFormModel@@UAEXAAVCpItemDataHelper@@@Z @ 16 NONAME ; void CpCategorySettingFormModel::initialize(class CpItemDataHelper &) + ?initialize@CpCategorySettingFormItemData@@QAEXAAVCpItemDataHelper@@@Z @ 17 NONAME ; void CpCategorySettingFormItemData::initialize(class CpItemDataHelper &) + ?tr@CpTaskExecutor@@SA?AVQString@@PBD0H@Z @ 18 NONAME ; class QString CpTaskExecutor::tr(char const *, char const *, int) + ??0CpTaskExecutor@@QAE@PAVQObject@@@Z @ 19 NONAME ; CpTaskExecutor::CpTaskExecutor(class QObject *) + ?tr@CpCategorySettingFormItemData@@SA?AVQString@@PBD0H@Z @ 20 NONAME ; class QString CpCategorySettingFormItemData::tr(char const *, char const *, int) + ?qt_metacast@CpTaskExecutor@@UAEPAXPBD@Z @ 21 NONAME ; void * CpTaskExecutor::qt_metacast(char const *) + ??1CpCategorySettingFormItemData@@UAE@XZ @ 22 NONAME ; CpCategorySettingFormItemData::~CpCategorySettingFormItemData(void) + ?beforeLoadingConfigPlugins@CpCategorySettingFormModel@@EAEXAAVCpItemDataHelper@@@Z @ 23 NONAME ; void CpCategorySettingFormModel::beforeLoadingConfigPlugins(class CpItemDataHelper &) + ??1CpTaskExecutor@@UAE@XZ @ 24 NONAME ; CpTaskExecutor::~CpTaskExecutor(void) + ?createCpPluginItemData@@YAHPAVCpCreatePluginItemDataEvent@@@Z @ 25 NONAME ; int createCpPluginItemData(class CpCreatePluginItemDataEvent *) + ?trUtf8@CpCategorySettingFormModel@@SA?AVQString@@PBD0@Z @ 26 NONAME ; class QString CpCategorySettingFormModel::trUtf8(char const *, char const *) + ?staticMetaObject@CpCategorySettingFormModel@@2UQMetaObject@@B @ 27 NONAME ; struct QMetaObject const CpCategorySettingFormModel::staticMetaObject + ?qt_metacall@CpTaskExecutor@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 28 NONAME ; int CpTaskExecutor::qt_metacall(enum QMetaObject::Call, int, void * *) + ??0CpCategorySettingFormItemData@@QAE@ABVQString@@PBVHbDataFormModelItem@@@Z @ 29 NONAME ; CpCategorySettingFormItemData::CpCategorySettingFormItemData(class QString const &, class HbDataFormModelItem const *) + ?qt_metacast@CpCategorySettingFormItemData@@UAEPAXPBD@Z @ 30 NONAME ; void * CpCategorySettingFormItemData::qt_metacast(char const *) + ?toFront@CpTaskExecutor@@QAE_NPAVCpTask@@@Z @ 31 NONAME ; bool CpTaskExecutor::toFront(class CpTask *) + ?qt_metacall@CpCategorySettingFormModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 32 NONAME ; int CpCategorySettingFormModel::qt_metacall(enum QMetaObject::Call, int, void * *) + ?removeTasks@CpTaskExecutor@@AAEXXZ @ 33 NONAME ; void CpTaskExecutor::removeTasks(void) + ?qt_metacall@CpCategorySettingFormItemData@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 34 NONAME ; int CpCategorySettingFormItemData::qt_metacall(enum QMetaObject::Call, int, void * *) + ?qt_metacast@CpCategorySettingFormModel@@UAEPAXPBD@Z @ 35 NONAME ; void * CpCategorySettingFormModel::qt_metacast(char const *) + ?afterLoadingConfigPlugins@CpCategorySettingFormModel@@EAEXAAVCpItemDataHelper@@@Z @ 36 NONAME ; void CpCategorySettingFormModel::afterLoadingConfigPlugins(class CpItemDataHelper &) + ?getStaticMetaObject@CpCategorySettingFormItemData@@SAABUQMetaObject@@XZ @ 37 NONAME ; struct QMetaObject const & CpCategorySettingFormItemData::getStaticMetaObject(void) + ?metaObject@CpTaskExecutor@@UBEPBUQMetaObject@@XZ @ 38 NONAME ; struct QMetaObject const * CpTaskExecutor::metaObject(void) const + ??0CpCategorySettingFormItemData@@QAE@W4DataItemType@HbDataFormModelItem@@ABVQString@@1PBV2@@Z @ 39 NONAME ; CpCategorySettingFormItemData::CpCategorySettingFormItemData(enum HbDataFormModelItem::DataItemType, class QString const &, class QString const &, class HbDataFormModelItem const *) + ?trUtf8@CpCategorySettingFormItemData@@SA?AVQString@@PBD0H@Z @ 40 NONAME ; class QString CpCategorySettingFormItemData::trUtf8(char const *, char const *, int) + ?runTask@CpTaskExecutor@@QAE_NPAVCpTask@@_N@Z @ 41 NONAME ; bool CpTaskExecutor::runTask(class CpTask *, bool) + ?afterLoadingConfigPlugins@CpCategorySettingFormItemData@@EAEXAAVCpItemDataHelper@@@Z @ 42 NONAME ; void CpCategorySettingFormItemData::afterLoadingConfigPlugins(class CpItemDataHelper &) + ?metaObject@CpCategorySettingFormModel@@UBEPBUQMetaObject@@XZ @ 43 NONAME ; struct QMetaObject const * CpCategorySettingFormModel::metaObject(void) const + ?tr@CpCategorySettingFormModel@@SA?AVQString@@PBD0H@Z @ 44 NONAME ; class QString CpCategorySettingFormModel::tr(char const *, char const *, int) + ?staticMetaObject@CpCategorySettingFormItemData@@2UQMetaObject@@B @ 45 NONAME ; struct QMetaObject const CpCategorySettingFormItemData::staticMetaObject + ?run@CpTaskExecutor@@MAEXXZ @ 46 NONAME ; void CpTaskExecutor::run(void) + ?metaObject@CpCategorySettingFormItemData@@UBEPBUQMetaObject@@XZ @ 47 NONAME ; struct QMetaObject const * CpCategorySettingFormItemData::metaObject(void) const + ?trUtf8@CpTaskExecutor@@SA?AVQString@@PBD0@Z @ 48 NONAME ; class QString CpTaskExecutor::trUtf8(char const *, char const *) + ??_ECpCategorySettingFormItemData@@UAE@I@Z @ 49 NONAME ; CpCategorySettingFormItemData::~CpCategorySettingFormItemData(unsigned int) + ??_ECpCategorySettingFormModel@@UAE@I@Z @ 50 NONAME ; CpCategorySettingFormModel::~CpCategorySettingFormModel(unsigned int) + ?globalInstance@CpTaskExecutor@@SAPAV1@XZ @ 51 NONAME ; class CpTaskExecutor * CpTaskExecutor::globalInstance(void) + diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpcategorymodel/eabi/cpcategorymodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/eabi/cpcategorymodelu.def Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,56 @@ +EXPORTS + _Z22createCpPluginItemDataP27CpCreatePluginItemDataEvent @ 1 NONAME + _ZN14CpTaskExecutor11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME + _ZN14CpTaskExecutor11qt_metacastEPKc @ 3 NONAME + _ZN14CpTaskExecutor11removeTasksEv @ 4 NONAME + _ZN14CpTaskExecutor14globalInstanceEv @ 5 NONAME + _ZN14CpTaskExecutor16staticMetaObjectE @ 6 NONAME DATA 16 + _ZN14CpTaskExecutor19getStaticMetaObjectEv @ 7 NONAME + _ZN14CpTaskExecutor21destroyGlobalInstanceEv @ 8 NONAME + _ZN14CpTaskExecutor3runEv @ 9 NONAME + _ZN14CpTaskExecutor4stopEv @ 10 NONAME + _ZN14CpTaskExecutor7runTaskEP6CpTaskb @ 11 NONAME + _ZN14CpTaskExecutor7toFrontEP6CpTask @ 12 NONAME + _ZN14CpTaskExecutorC1EP7QObject @ 13 NONAME + _ZN14CpTaskExecutorC2EP7QObject @ 14 NONAME + _ZN14CpTaskExecutorD0Ev @ 15 NONAME + _ZN14CpTaskExecutorD1Ev @ 16 NONAME + _ZN14CpTaskExecutorD2Ev @ 17 NONAME + _ZN26CpCategorySettingFormModel10initializeER16CpItemDataHelper @ 18 NONAME + _ZN26CpCategorySettingFormModel11qt_metacallEN11QMetaObject4CallEiPPv @ 19 NONAME + _ZN26CpCategorySettingFormModel11qt_metacastEPKc @ 20 NONAME + _ZN26CpCategorySettingFormModel16staticMetaObjectE @ 21 NONAME DATA 16 + _ZN26CpCategorySettingFormModel19getStaticMetaObjectEv @ 22 NONAME + _ZN26CpCategorySettingFormModel25afterLoadingConfigPluginsER16CpItemDataHelper @ 23 NONAME + _ZN26CpCategorySettingFormModel26beforeLoadingConfigPluginsER16CpItemDataHelper @ 24 NONAME + _ZN26CpCategorySettingFormModelC1ERK7QString @ 25 NONAME + _ZN26CpCategorySettingFormModelC2ERK7QString @ 26 NONAME + _ZN26CpCategorySettingFormModelD0Ev @ 27 NONAME + _ZN26CpCategorySettingFormModelD1Ev @ 28 NONAME + _ZN26CpCategorySettingFormModelD2Ev @ 29 NONAME + _ZN29CpCategorySettingFormItemData10initializeER16CpItemDataHelper @ 30 NONAME + _ZN29CpCategorySettingFormItemData11qt_metacallEN11QMetaObject4CallEiPPv @ 31 NONAME + _ZN29CpCategorySettingFormItemData11qt_metacastEPKc @ 32 NONAME + _ZN29CpCategorySettingFormItemData16staticMetaObjectE @ 33 NONAME DATA 16 + _ZN29CpCategorySettingFormItemData19getStaticMetaObjectEv @ 34 NONAME + _ZN29CpCategorySettingFormItemData25afterLoadingConfigPluginsER16CpItemDataHelper @ 35 NONAME + _ZN29CpCategorySettingFormItemData26beforeLoadingConfigPluginsER16CpItemDataHelper @ 36 NONAME + _ZN29CpCategorySettingFormItemDataC1EN19HbDataFormModelItem12DataItemTypeERK7QStringS4_PKS0_ @ 37 NONAME + _ZN29CpCategorySettingFormItemDataC1ERK7QStringPK19HbDataFormModelItem @ 38 NONAME + _ZN29CpCategorySettingFormItemDataC2EN19HbDataFormModelItem12DataItemTypeERK7QStringS4_PKS0_ @ 39 NONAME + _ZN29CpCategorySettingFormItemDataC2ERK7QStringPK19HbDataFormModelItem @ 40 NONAME + _ZN29CpCategorySettingFormItemDataD0Ev @ 41 NONAME + _ZN29CpCategorySettingFormItemDataD1Ev @ 42 NONAME + _ZN29CpCategorySettingFormItemDataD2Ev @ 43 NONAME + _ZNK14CpTaskExecutor10metaObjectEv @ 44 NONAME + _ZNK26CpCategorySettingFormModel10metaObjectEv @ 45 NONAME + _ZNK29CpCategorySettingFormItemData10metaObjectEv @ 46 NONAME + _ZTI14CpTaskExecutor @ 47 NONAME + _ZTI26CpCategorySettingFormModel @ 48 NONAME + _ZTI29CpCategorySettingFormItemData @ 49 NONAME + _ZTV14CpTaskExecutor @ 50 NONAME + _ZTV26CpCategorySettingFormModel @ 51 NONAME + _ZTV29CpCategorySettingFormItemData @ 52 NONAME + _ZThn8_N29CpCategorySettingFormItemDataD0Ev @ 53 NONAME + _ZThn8_N29CpCategorySettingFormItemDataD1Ev @ 54 NONAME + diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.cpp --- a/controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -19,9 +19,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -214,11 +214,7 @@ } if (entryItemData->iconName().isEmpty()) { entryItemData->setIconName( - CP_RESOURCE_PATH - + QDir::separator() - + ICON_SUB_PATH - + QDir::separator() - + QLatin1String("qgn_prop_set_default_sub.svg") ); + QLatin1String(":/icon/qgn_prop_set_default_sub.svg") ); } return true; diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpplugins/communicationplugin/data/cpcommunicationplugin.cpcfg --- a/controlpanelui/src/cpplugins/communicationplugin/data/cpcommunicationplugin.cpcfg Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpplugins/communicationplugin/data/cpcommunicationplugin.cpcfg Fri Jun 25 17:12:20 2010 +0800 @@ -13,7 +13,10 @@ - + + + + \ No newline at end of file diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp --- a/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -17,7 +17,7 @@ #include "cpcommunicationgroupitemdata.h" #include #include -#include +#include #include #include @@ -48,8 +48,7 @@ void CpCommunicationGroupItemData::beforeLoadingConfigPlugins(CpItemDataHelper &itemDataHelper) { - mAirplaneModeItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem, - hbTrId("txt_cp_setlabel_offline_airplane_mode")); + mAirplaneModeItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); mAirplaneModeItem->setDescription(hbTrId("txt_cp_info_in_offline_mode_all_wireless_communica")); itemDataHelper.addConnection(mAirplaneModeItem, @@ -57,7 +56,7 @@ this, SLOT(toggleAirplaneMode())); - XQCentralRepositorySettingsKey key(KCRUidCommunicationSettings.iUid,KSettingsAirplaneMode); + XQCentralRepositorySettingsKey key(KCRUidCoreApplicationUIs.iUid,KCoreAppUIsNetworkConnectionAllowed); QVariant airplaneMode = mSettingManager->readItemValue(key,XQSettingsManager::TypeInt); settingValueChanged(key,airplaneMode); @@ -71,7 +70,7 @@ void CpCommunicationGroupItemData::toggleAirplaneMode() { - XQCentralRepositorySettingsKey key(KCRUidCommunicationSettings.iUid,KSettingsAirplaneMode); + XQCentralRepositorySettingsKey key(KCRUidCoreApplicationUIs.iUid,KCoreAppUIsNetworkConnectionAllowed); QVariant airplaneMode = mSettingManager->readItemValue(key,XQSettingsManager::TypeInt); airplaneMode.setValue( static_cast (!airplaneMode.toBool()) ); @@ -82,12 +81,12 @@ void CpCommunicationGroupItemData::settingValueChanged(const XQSettingsKey &key, const QVariant &value) { if (mAirplaneModeItem - && key.uid() == KCRUidCommunicationSettings.iUid - && key.key() == KSettingsAirplaneMode + && key.uid() == KCRUidCoreApplicationUIs.iUid + && key.key() == KCoreAppUIsNetworkConnectionAllowed && 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()) { + if (ECoreAppUIsNetworkConnectionAllowed == value.toInt()) { ::qSwap (text, additionalText); } mAirplaneModeItem->setContentWidgetData("text",text); diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpplugins/deviceplugin/data/cpdeviceplugin.cpcfg --- a/controlpanelui/src/cpplugins/deviceplugin/data/cpdeviceplugin.cpcfg Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpplugins/deviceplugin/data/cpdeviceplugin.cpcfg Fri Jun 25 17:12:20 2010 +0800 @@ -3,17 +3,17 @@ - + - + - - + + power save mode @@ -21,7 +21,7 @@ - + \ No newline at end of file diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenplugin.cpp --- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenplugin.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenplugin.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -29,8 +29,11 @@ QList CpKeyScreenPlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const { CpSettingFormItemData* itemData = new CpSettingFormEntryItemDataImpl( + CpSettingFormEntryItemData::ListEntryItem, // item type itemDataHelper, - hbTrId("txt_cp_list_keys_screen")); + hbTrId("txt_cp_list_keys_screen"), // text + QString(" "), // description + "qtg_large_key_screen"); // icon name return QList() << itemData; } diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.cpp --- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -60,9 +60,9 @@ makeBrightnessItem(*model); - if ( mModel->isCallibrationSupported() ) { + /* if ( mModel->isCallibrationSupported() ) { makeCallibrationItem(*model); - } + }*/ form->setModel(model); } diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -56,6 +56,9 @@ CpSettingFormEntryItemData *advanceSettingItem = new CpSettingFormEntryItemDataImpl(CpSettingFormEntryItemData::ButtonEntryItem, itemDataHelper, hbTrId("txt_cp_button_advanced_settings")); + + advanceSettingItem->setContentWidgetData("textAlignment", QVariant( Qt::AlignHCenter | Qt::AlignVCenter) ); + appendChild(advanceSettingItem); CPFW_LOG("CpPersonalizationGroupItemData::afterLoadingConfigPlugins(), END"); } diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationplugin.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationplugin.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationplugin.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -35,7 +35,7 @@ CpPersonalizationGroupItemData *personalItemData = new CpPersonalizationGroupItemData( HbDataFormModelItem::GroupItem, - tr("Personalization"), + hbTrId("txt_cp_subhead_personalization"), QString("cppersonalizationplugin.cpcfg") ); return QList() << personalItemData; diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -102,7 +102,7 @@ //ring tone item QFileInfo ringToneFileInfo( profileSettings.mRingTone ); HbDataFormModelItem *modelItem = new CpPersonalizationEntryItemData( *mItemDataHelper, - hbTrId("txt_cp_dblist_ringtone"), ringToneFileInfo.fileName(), mFileIconProvider->icon( ringToneFileInfo ), + hbTrId("txt_cp_dblist_ringtone"), ringToneFileInfo.fileName(), "qtg_large_ring_tone", CpPersonalizationEntryItemData::TONE_Ring, profileId ); mModel->appendDataFormItem(modelItem, parent); modelItems.insert(ProfileItemRingTone,modelItem); @@ -110,7 +110,7 @@ //message tone item QFileInfo messageToneFileInfo( profileSettings.mMessageTone ); modelItem = new CpPersonalizationEntryItemData( *mItemDataHelper, - hbTrId("txt_cp_dblist_message_tone"), messageToneFileInfo.fileName(), mFileIconProvider->icon( messageToneFileInfo ), + hbTrId("txt_cp_dblist_message_tone"), messageToneFileInfo.fileName(), "qtg_large_message", CpPersonalizationEntryItemData::TONE_Message, profileId ); mModel->appendDataFormItem(modelItem , parent); @@ -119,7 +119,7 @@ //email tone item QFileInfo emailToneFileInfo( profileSettings.mEmailTone ); modelItem = new CpPersonalizationEntryItemData( *mItemDataHelper, - hbTrId("txt_cp_dblist_email_tone"), emailToneFileInfo.fileName(), mFileIconProvider->icon( emailToneFileInfo ), + hbTrId("txt_cp_dblist_email_tone"), emailToneFileInfo.fileName(), "qtg_large_email", CpPersonalizationEntryItemData::TONE_Email, profileId ); mModel->appendDataFormItem(modelItem , parent); @@ -128,7 +128,7 @@ //reminder tone item QFileInfo reminderToneFileInfo( profileSettings.mReminderTone ); modelItem = new CpPersonalizationEntryItemData( *mItemDataHelper, - hbTrId("txt_cp_dblist_reminder_tone"), reminderToneFileInfo.fileName(), mFileIconProvider->icon( reminderToneFileInfo ), + hbTrId("txt_cp_dblist_reminder_tone"), reminderToneFileInfo.fileName(), "qtg_large_calendar", CpPersonalizationEntryItemData::TONE_Reminder, profileId ); mModel->appendDataFormItem(modelItem , parent); @@ -419,18 +419,7 @@ HbDataFormModelItem *modelItem = profileItem(EProfileWrapperGeneralId,ProfileItemKeyandTouchScreenTones); if (modelItem) { modelItem->setContentWidgetData( QString("value"), value ); - QMap< QString, QVariant > elements; - if (value != 0) { - elements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); - elements.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); - elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_unmuted.svg") ); - } - else { - elements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); - elements.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); - elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg") ); - } - modelItem->setContentWidgetData( QString( "elementIcons" ), elements ); + setMuteIcon(modelItem, (value == 0) ); } } @@ -481,18 +470,7 @@ HbDataFormModelItem *modelItem = profileItem(EProfileWrapperMeetingId,ProfileItemKeyandTouchScreenTones); if (modelItem) { modelItem->setContentWidgetData( QString("value"), value ); - QMap< QString, QVariant > elements; - if (value != 0) { - elements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); - elements.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); - elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_unmuted.svg") ); - } - else { - elements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); - elements.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); - elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg") ); - } - modelItem->setContentWidgetData( QString( "elementIcons" ), elements ); + setMuteIcon(modelItem, (value == 0) ); } } @@ -557,7 +535,13 @@ for (int i = 0; i < sizeof(silenceSensitiveModelItemIds)/sizeof(silenceSensitiveModelItemIds[0]);++i) { QHash::const_iterator found = it.value().find(silenceSensitiveModelItemIds[i]); if (found != it.value().end()) { - found.value()->setEnabled(!value.toBool()); + if (found.key() == CpProfileSettingForm::ProfileItemKeyandTouchScreenTones) { + int currentValue = found.value()->contentWidgetData("value").toInt(); + // change the mute icon when the silence mode is changed + bool isMute = value.toBool() || (currentValue == 0); + setMuteIcon(found.value(), isMute); + } + found.value()->setEnabled(!value.toBool()); } } } @@ -569,4 +553,30 @@ return mProfileModelItems.value(profileId).value(profileItemId); } +/*! + * Set the slider icon to mute or unmute + * @param isMute: identified the icon of slider, mute or unmute + * @param profileId: identified which slider should be changed + */ + +void CpProfileSettingForm::setMuteIcon(HbDataFormModelItem *sliderItem, bool isMute) +{ + if (sliderItem == 0) { + return; + } + //VolumeSliderItem will be depreacted, so ignore the assert about it + if (sliderItem->type() != HbDataFormModelItem::SliderItem) { + return; + } + + QMap elements = sliderItem->contentWidgetData("elementIcons").toMap(); + + if (isMute) { + elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg")); + } + else { + elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_unmuted.svg")); + } + sliderItem->setContentWidgetData( QString( "elementIcons" ), elements ); +} //End of File diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.h --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.h Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.h Fri Jun 25 17:12:20 2010 +0800 @@ -89,6 +89,7 @@ void initProfileItems(int profileId,HbDataFormModelItem *parent); HbDataFormModelItem *profileItem(int profileId,int profileItemId); + void setMuteIcon(HbDataFormModelItem *silderItem, bool isMute); private: HbDataFormModel *mModel; CpItemDataHelper *mItemDataHelper; diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.cpp --- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -25,9 +25,9 @@ CpProfileActivatorEntryItem::CpProfileActivatorEntryItem(CpItemDataHelper &itemDataHelper, const QString &text, const QString &description, - const HbIcon &icon, + const QString &icon, const HbDataFormModelItem *parent) - :CpSettingFormEntryItemData(itemDataHelper,text,description, + :CpSettingFormEntryItemData(CpSettingFormEntryItemData::ListEntryItem, itemDataHelper,text,description, icon,parent),mProfileModel(0),mProfileMonitor(0) { mProfileMonitor = new CpProfileMonitor(); diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.h --- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.h Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.h Fri Jun 25 17:12:20 2010 +0800 @@ -28,7 +28,7 @@ public: explicit CpProfileActivatorEntryItem(CpItemDataHelper &itemDataHelper, const QString &text = QString(), const QString &description = - QString(), const HbIcon &icon = HbIcon(), + QString(), const QString &icon = QString(), const HbDataFormModelItem *parent = 0); virtual ~CpProfileActivatorEntryItem(); private slots: diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorplugin.cpp --- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorplugin.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorplugin.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -30,7 +30,9 @@ { CpSettingFormItemData* itemData = new CpProfileActivatorEntryItem( itemDataHelper, - hbTrId("txt_cp_dblist_profile")); + hbTrId("txt_cp_dblist_profile"), + " ", + "qtg_large_profiles"); return QList() << itemData; } diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.cpp --- a/controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -31,11 +31,11 @@ CpPersonalizationEntryItemData::CpPersonalizationEntryItemData(CpItemDataHelper &itemDataHelper, const QString &text, const QString &description, - const HbIcon &icon, + const QString &icon, Profile_Tone_Types toneType, int profileId, const HbDataFormModelItem *parent) - :CpSettingFormEntryItemData( itemDataHelper,text,description,icon,parent), + :CpSettingFormEntryItemData(CpSettingFormEntryItemData::ListEntryItem, itemDataHelper,text,description,icon,parent), mProfileModel(0), m_profileID(profileId), mToneType(toneType), diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.h --- a/controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.h Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.h Fri Jun 25 17:12:20 2010 +0800 @@ -38,7 +38,7 @@ explicit CpPersonalizationEntryItemData(CpItemDataHelper &itemDataHelper, const QString &text = QString(), const QString &description = QString(), - const HbIcon &icon = HbIcon(), + const QString &icon = QString(), Profile_Tone_Types toneType = TONE_Ring, int profileId = -1, const HbDataFormModelItem *parent = 0); diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpplugins/ringtoneplugin/src/cpringtoneplugin.cpp --- a/controlpanelui/src/cpplugins/ringtoneplugin/src/cpringtoneplugin.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpplugins/ringtoneplugin/src/cpringtoneplugin.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -27,9 +27,12 @@ QList CpRingTonePlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const { - CpPersonalizationEntryItemData *itemData = new CpPersonalizationEntryItemData(itemDataHelper, - tr("Ring tone"), - tr("Default ring tone")); + CpPersonalizationEntryItemData *itemData + = new CpPersonalizationEntryItemData( + itemDataHelper, + hbTrId("txt_cp_dblist_ringtone"), + QString(""), + "qtg_large_ring_tone"); return QList() << itemData; } diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp --- a/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -57,7 +57,7 @@ this->appendChild(silenceIndicator); HbDataFormModelItem *masterVolume = new HbDataFormModelItem(HbDataFormModelItem::SliderItem, - hbTrId("txt_cp_setlabel_volume")); + hbTrId("txt_cp_setlabel_ringing_volume")); mItemList.insert(CpVolumeGroupItemData::EVolumeMasterVolumeItem, masterVolume); QList elements; elements << QVariant(HbSlider::IncreaseElement) << QVariant(HbSlider::TrackElement) @@ -76,11 +76,11 @@ masterVolume->setContentWidgetData("majorTickInterval",1); masterVolume->setContentWidgetData("tickPosition",Hb::SliderTicksBelow); - QStringList tickLabels; + /*QStringList tickLabels; tickLabels<setContentWidgetData("majorTickLabels",tickLabels); + masterVolume->setContentWidgetData("majorTickLabels",tickLabels);*/ masterVolume->setContentWidgetData("iconCheckable",false); this->appendChild(masterVolume); diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpprofilewrapper/bwins/cpprofilewrapperu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpprofilewrapper/bwins/cpprofilewrapperu.def Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,57 @@ +EXPORTS + ?setKeyTouchScreenVibra@CpProfileModel@@QAEXHH@Z @ 1 NONAME ; void CpProfileModel::setKeyTouchScreenVibra(int, int) + ?tr@CpProfileModel@@SA?AVQString@@PBD0H@Z @ 2 NONAME ; class QString CpProfileModel::tr(char const *, char const *, int) + ?setReminderVibra@CpProfileModel@@QAEXH_N@Z @ 3 NONAME ; void CpProfileModel::setReminderVibra(int, bool) + ?offLineMode@CpProfileModel@@QBE_NXZ @ 4 NONAME ; bool CpProfileModel::offLineMode(void) const + ?masterVibra@CpProfileModel@@QBE_NXZ @ 5 NONAME ; bool CpProfileModel::masterVibra(void) const + ?ringTone@CpProfileModel@@QBE?AVQString@@XZ @ 6 NONAME ; class QString CpProfileModel::ringTone(void) const + ?qt_metacast@CpProfileModel@@UAEPAXPBD@Z @ 7 NONAME ; void * CpProfileModel::qt_metacast(char const *) + ?setRingTone@CpProfileModel@@QAEXABVQString@@@Z @ 8 NONAME ; void CpProfileModel::setRingTone(class QString const &) + ?setReminderTone@CpProfileModel@@QAEXHABVQString@@@Z @ 9 NONAME ; void CpProfileModel::setReminderTone(int, class QString const &) + ?trUtf8@CpProfileModel@@SA?AVQString@@PBD0@Z @ 10 NONAME ; class QString CpProfileModel::trUtf8(char const *, char const *) + ?silenceMode@CpProfileModel@@QBE_NXZ @ 11 NONAME ; bool CpProfileModel::silenceMode(void) const + ?reminderVibra@CpProfileModel@@QBE_NH@Z @ 12 NONAME ; bool CpProfileModel::reminderVibra(int) const + ?setEmailTone@CpProfileModel@@QAEXHABVQString@@@Z @ 13 NONAME ; void CpProfileModel::setEmailTone(int, class QString const &) + ?ringAlertVibra@CpProfileModel@@QBE_NH@Z @ 14 NONAME ; bool CpProfileModel::ringAlertVibra(int) const + ?emailTone@CpProfileModel@@QBE?AVQString@@H@Z @ 15 NONAME ; class QString CpProfileModel::emailTone(int) const + ?activeProfileId@CpProfileModel@@QBEHXZ @ 16 NONAME ; int CpProfileModel::activeProfileId(void) const + ?masterVolume@CpProfileModel@@QBEHXZ @ 17 NONAME ; int CpProfileModel::masterVolume(void) const + ?notificationTone@CpProfileModel@@QBE_NH@Z @ 18 NONAME ; bool CpProfileModel::notificationTone(int) const + ?tr@CpProfileModel@@SA?AVQString@@PBD0@Z @ 19 NONAME ; class QString CpProfileModel::tr(char const *, char const *) + ?getStaticMetaObject@CpProfileModel@@SAABUQMetaObject@@XZ @ 20 NONAME ; struct QMetaObject const & CpProfileModel::getStaticMetaObject(void) + ?keyTouchScreenTone@CpProfileModel@@QBEHH@Z @ 21 NONAME ; int CpProfileModel::keyTouchScreenTone(int) const + ?setRingTone@CpProfileModel@@QAEXHABVQString@@@Z @ 22 NONAME ; void CpProfileModel::setRingTone(int, class QString const &) + ?reminderTone@CpProfileModel@@QBE?AVQString@@H@Z @ 23 NONAME ; class QString CpProfileModel::reminderTone(int) const + ?profileName@CpProfileModel@@QBE?AVQString@@H@Z @ 24 NONAME ; class QString CpProfileModel::profileName(int) const + ?setKeyTouchScreenTone@CpProfileModel@@QAEXHH@Z @ 25 NONAME ; void CpProfileModel::setKeyTouchScreenTone(int, int) + ?setMasterVolume@CpProfileModel@@QAEXH@Z @ 26 NONAME ; void CpProfileModel::setMasterVolume(int) + ?staticMetaObject@CpProfileModel@@2UQMetaObject@@B @ 27 NONAME ; struct QMetaObject const CpProfileModel::staticMetaObject + ?activateProfile@CpProfileModel@@QAEHH@Z @ 28 NONAME ; int CpProfileModel::activateProfile(int) + ?profileNames@CpProfileModel@@QBE?AVQStringList@@XZ @ 29 NONAME ; class QStringList CpProfileModel::profileNames(void) const + ?setNotificationVibra@CpProfileModel@@QAEXH_N@Z @ 30 NONAME ; void CpProfileModel::setNotificationVibra(int, bool) + ?setNotificationTone@CpProfileModel@@QAEXH_N@Z @ 31 NONAME ; void CpProfileModel::setNotificationTone(int, bool) + ?metaObject@CpProfileModel@@UBEPBUQMetaObject@@XZ @ 32 NONAME ; struct QMetaObject const * CpProfileModel::metaObject(void) const + ?setRingAlertVibra@CpProfileModel@@QAEXH_N@Z @ 33 NONAME ; void CpProfileModel::setRingAlertVibra(int, bool) + ??0CpProfileModel@@QAE@PAVQObject@@@Z @ 34 NONAME ; CpProfileModel::CpProfileModel(class QObject *) + ?emailVibra@CpProfileModel@@QBE_NH@Z @ 35 NONAME ; bool CpProfileModel::emailVibra(int) const + ?setProfileSettings@CpProfileModel@@QAEHHAAVCpProfileSettings@@@Z @ 36 NONAME ; int CpProfileModel::setProfileSettings(int, class CpProfileSettings &) + ?setEmailVibra@CpProfileModel@@QAEXH_N@Z @ 37 NONAME ; void CpProfileModel::setEmailVibra(int, bool) + ?setOffLineMode@CpProfileModel@@QAEX_N@Z @ 38 NONAME ; void CpProfileModel::setOffLineMode(bool) + ??1CpProfileModel@@UAE@XZ @ 39 NONAME ; CpProfileModel::~CpProfileModel(void) + ?notificationVibra@CpProfileModel@@QBE_NH@Z @ 40 NONAME ; bool CpProfileModel::notificationVibra(int) const + ?qt_metacall@CpProfileModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 41 NONAME ; int CpProfileModel::qt_metacall(enum QMetaObject::Call, int, void * *) + ?messageTone@CpProfileModel@@QBE?AVQString@@H@Z @ 42 NONAME ; class QString CpProfileModel::messageTone(int) const + ?profileSettings@CpProfileModel@@QAEXHAAVCpProfileSettings@@@Z @ 43 NONAME ; void CpProfileModel::profileSettings(int, class CpProfileSettings &) + ?d_func@CpProfileModel@@ABEPBVCpProfileModelPrivate@@XZ @ 44 NONAME ; class CpProfileModelPrivate const * CpProfileModel::d_func(void) const + ?setSilenceMode@CpProfileModel@@QAEX_N@Z @ 45 NONAME ; void CpProfileModel::setSilenceMode(bool) + ?setMessageVibra@CpProfileModel@@QAEXH_N@Z @ 46 NONAME ; void CpProfileModel::setMessageVibra(int, bool) + ?keyTouchScreenVibra@CpProfileModel@@QBEHH@Z @ 47 NONAME ; int CpProfileModel::keyTouchScreenVibra(int) const + ?d_func@CpProfileModel@@AAEPAVCpProfileModelPrivate@@XZ @ 48 NONAME ; class CpProfileModelPrivate * CpProfileModel::d_func(void) + ?initiationFlag@CpProfileModel@@QAEHXZ @ 49 NONAME ; int CpProfileModel::initiationFlag(void) + ?messageVibra@CpProfileModel@@QBE_NH@Z @ 50 NONAME ; bool CpProfileModel::messageVibra(int) const + ??_ECpProfileModel@@UAE@I@Z @ 51 NONAME ; CpProfileModel::~CpProfileModel(unsigned int) + ?ringTone@CpProfileModel@@QBE?AVQString@@H@Z @ 52 NONAME ; class QString CpProfileModel::ringTone(int) const + ?trUtf8@CpProfileModel@@SA?AVQString@@PBD0H@Z @ 53 NONAME ; class QString CpProfileModel::trUtf8(char const *, char const *, int) + ?setMessageTone@CpProfileModel@@QAEXHABVQString@@@Z @ 54 NONAME ; void CpProfileModel::setMessageTone(int, class QString const &) + ?setMasterVibra@CpProfileModel@@QAEX_N@Z @ 55 NONAME ; void CpProfileModel::setMasterVibra(bool) + diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpprofilewrapper/eabi/cpprofilewrapperu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpprofilewrapper/eabi/cpprofilewrapperu.def Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,55 @@ +EXPORTS + _ZN14CpProfileModel11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME + _ZN14CpProfileModel11qt_metacastEPKc @ 2 NONAME + _ZN14CpProfileModel11setRingToneERK7QString @ 3 NONAME + _ZN14CpProfileModel11setRingToneEiRK7QString @ 4 NONAME + _ZN14CpProfileModel12setEmailToneEiRK7QString @ 5 NONAME + _ZN14CpProfileModel13setEmailVibraEib @ 6 NONAME + _ZN14CpProfileModel14initiationFlagEv @ 7 NONAME + _ZN14CpProfileModel14setMasterVibraEb @ 8 NONAME + _ZN14CpProfileModel14setMessageToneEiRK7QString @ 9 NONAME + _ZN14CpProfileModel14setOffLineModeEb @ 10 NONAME + _ZN14CpProfileModel14setSilenceModeEb @ 11 NONAME + _ZN14CpProfileModel15activateProfileEi @ 12 NONAME + _ZN14CpProfileModel15profileSettingsEiR17CpProfileSettings @ 13 NONAME + _ZN14CpProfileModel15setMasterVolumeEi @ 14 NONAME + _ZN14CpProfileModel15setMessageVibraEib @ 15 NONAME + _ZN14CpProfileModel15setReminderToneEiRK7QString @ 16 NONAME + _ZN14CpProfileModel16setReminderVibraEib @ 17 NONAME + _ZN14CpProfileModel16staticMetaObjectE @ 18 NONAME DATA 16 + _ZN14CpProfileModel17setRingAlertVibraEib @ 19 NONAME + _ZN14CpProfileModel18setProfileSettingsEiR17CpProfileSettings @ 20 NONAME + _ZN14CpProfileModel19getStaticMetaObjectEv @ 21 NONAME + _ZN14CpProfileModel19setNotificationToneEib @ 22 NONAME + _ZN14CpProfileModel20setNotificationVibraEib @ 23 NONAME + _ZN14CpProfileModel21setKeyTouchScreenToneEii @ 24 NONAME + _ZN14CpProfileModel22setKeyTouchScreenVibraEii @ 25 NONAME + _ZN14CpProfileModelC1EP7QObject @ 26 NONAME + _ZN14CpProfileModelC2EP7QObject @ 27 NONAME + _ZN14CpProfileModelD0Ev @ 28 NONAME + _ZN14CpProfileModelD1Ev @ 29 NONAME + _ZN14CpProfileModelD2Ev @ 30 NONAME + _ZNK14CpProfileModel10emailVibraEi @ 31 NONAME + _ZNK14CpProfileModel10metaObjectEv @ 32 NONAME + _ZNK14CpProfileModel11masterVibraEv @ 33 NONAME + _ZNK14CpProfileModel11messageToneEi @ 34 NONAME + _ZNK14CpProfileModel11offLineModeEv @ 35 NONAME + _ZNK14CpProfileModel11profileNameEi @ 36 NONAME + _ZNK14CpProfileModel11silenceModeEv @ 37 NONAME + _ZNK14CpProfileModel12masterVolumeEv @ 38 NONAME + _ZNK14CpProfileModel12messageVibraEi @ 39 NONAME + _ZNK14CpProfileModel12profileNamesEv @ 40 NONAME + _ZNK14CpProfileModel12reminderToneEi @ 41 NONAME + _ZNK14CpProfileModel13reminderVibraEi @ 42 NONAME + _ZNK14CpProfileModel14ringAlertVibraEi @ 43 NONAME + _ZNK14CpProfileModel15activeProfileIdEv @ 44 NONAME + _ZNK14CpProfileModel16notificationToneEi @ 45 NONAME + _ZNK14CpProfileModel17notificationVibraEi @ 46 NONAME + _ZNK14CpProfileModel18keyTouchScreenToneEi @ 47 NONAME + _ZNK14CpProfileModel19keyTouchScreenVibraEi @ 48 NONAME + _ZNK14CpProfileModel8ringToneEi @ 49 NONAME + _ZNK14CpProfileModel8ringToneEv @ 50 NONAME + _ZNK14CpProfileModel9emailToneEi @ 51 NONAME + _ZTI14CpProfileModel @ 52 NONAME + _ZTV14CpProfileModel @ 53 NONAME + diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp --- a/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -201,6 +201,7 @@ profileSettings.mEmailTone = stringFromDescriptor(extTones.EmailAlertTone()); profileSettings.mReminderTone = stringFromDescriptor(extTones.ReminderTone()); profileSettings.mNotificationTone = toneSettings.iWarningAndGameTones; + // only use Keypad Volume as a base value for display in key & touch screen setting option profileSettings.mKeyTouchScreenTone = toneSettings.iKeypadVolume; profileSettings.mRingAlertVibra = vibraSettings.RingAlertVibra(); @@ -211,6 +212,11 @@ profileSettings.mKeyTouchScreenVibra = feedbackSettings.TactileFeedback(); } +/*! + set profile settings + \param profileId identify the profile + \param profileSettings value of profile options + */ int CpProfileModelPrivate::setProfileSettings(int profileId, CpProfileSettings& profileSettings) { MProfileExtended2 *profileExtend = mProfileList.value(profileId); @@ -224,7 +230,7 @@ profileExtend->ProfileSetExtraSettings(); MProfileSetFeedbackSettings &setFeedbackSettings = extraSettings.ProfileSetFeedbackSettings(); - // ignore here, wait for the exception deal framework of qt-symbian + TRAP_IGNORE( setTones.SetRingingTone1L(*descriptorFromString( profileSettings.mRingTone)); @@ -237,8 +243,12 @@ ) toneSettings.iWarningAndGameTones = profileSettings.mNotificationTone; + // Change the keypad volume and touch screen tone together toneSettings.iKeypadVolume - = static_cast (profileSettings.mKeyTouchScreenTone); + = static_cast (profileSettings.mKeyTouchScreenTone); + setFeedbackSettings.SetAudioFeedback( + static_cast (profileSettings.mKeyTouchScreenTone)); + setVibraSettings.SetRingAlertVibra(profileSettings.mRingAlertVibra); setVibraSettings.SetMessageAlertVibra(profileSettings.mMessageVibra); setVibraSettings.SetEmailAlertVibra(profileSettings.mEmailVibra); @@ -429,7 +439,10 @@ mEngine->CommitChangeL(*profileExtend); ) } - +/*! + return key & touch screen tone's value + \sa setKeyTouchScreenTone + */ int CpProfileModelPrivate::keyTouchScreenTone(int profileId) const { MProfileExtended2 *profileExtend = mProfileList.value(profileId); @@ -440,7 +453,12 @@ int keyTouchScreenTone = toneSettings.iKeypadVolume; return keyTouchScreenTone; } - +/*! + set key & touch screen tone + \param profileId identify the profile + \param level 0-5 + \sa keyTouchScreenTone + */ void CpProfileModelPrivate::setKeyTouchScreenTone(int profileId, int level) { MProfileExtended2 *profileExtend = mProfileList.value(profileId); @@ -449,8 +467,16 @@ TProfileToneSettings &toneSettings = setTones.SetToneSettings(); + MProfileSetExtraSettings &extraSettings = + profileExtend->ProfileSetExtraSettings(); + MProfileSetFeedbackSettings &setFeedbackSettings = + extraSettings.ProfileSetFeedbackSettings(); + toneSettings.iKeypadVolume = static_cast (level); + + setFeedbackSettings.SetAudioFeedback( + static_cast (level)); TRAP_IGNORE ( mEngine->CommitChangeL(*profileExtend); ) diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpringtoneview/bwins/cpringtoneviewu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpringtoneview/bwins/cpringtoneviewu.def Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,20 @@ +EXPORTS + ?tr@CpRingToneView@@SA?AVQString@@PBD0@Z @ 1 NONAME ; class QString CpRingToneView::tr(char const *, char const *) + ?selOK@CpRingToneView@@IAEXABVQString@@@Z @ 2 NONAME ; void CpRingToneView::selOK(class QString const &) + ??1CpRingToneView@@UAE@XZ @ 3 NONAME ; CpRingToneView::~CpRingToneView(void) + ?getStaticMetaObject@CpRingToneView@@SAABUQMetaObject@@XZ @ 4 NONAME ; struct QMetaObject const & CpRingToneView::getStaticMetaObject(void) + ?handleError@CpRingToneView@@AAEXHABVQString@@@Z @ 5 NONAME ; void CpRingToneView::handleError(int, class QString const &) + ?launchMediaFetcher@CpRingToneView@@AAEXABVQString@@0@Z @ 6 NONAME ; void CpRingToneView::launchMediaFetcher(class QString const &, class QString const &) + ?selError@CpRingToneView@@IAEXHABVQString@@@Z @ 7 NONAME ; void CpRingToneView::selError(int, class QString const &) + ?trUtf8@CpRingToneView@@SA?AVQString@@PBD0H@Z @ 8 NONAME ; class QString CpRingToneView::trUtf8(char const *, char const *, int) + ?qt_metacall@CpRingToneView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 9 NONAME ; int CpRingToneView::qt_metacall(enum QMetaObject::Call, int, void * *) + ?staticMetaObject@CpRingToneView@@2UQMetaObject@@B @ 10 NONAME ; struct QMetaObject const CpRingToneView::staticMetaObject + ?metaObject@CpRingToneView@@UBEPBUQMetaObject@@XZ @ 11 NONAME ; struct QMetaObject const * CpRingToneView::metaObject(void) const + ?tr@CpRingToneView@@SA?AVQString@@PBD0H@Z @ 12 NONAME ; class QString CpRingToneView::tr(char const *, char const *, int) + ??0CpRingToneView@@QAE@PAVQGraphicsItem@@@Z @ 13 NONAME ; CpRingToneView::CpRingToneView(class QGraphicsItem *) + ?itemActivated@CpRingToneView@@AAEXABVQModelIndex@@@Z @ 14 NONAME ; void CpRingToneView::itemActivated(class QModelIndex const &) + ??_ECpRingToneView@@UAE@I@Z @ 15 NONAME ; CpRingToneView::~CpRingToneView(unsigned int) + ?trUtf8@CpRingToneView@@SA?AVQString@@PBD0@Z @ 16 NONAME ; class QString CpRingToneView::trUtf8(char const *, char const *) + ?handleOk@CpRingToneView@@AAEXABVQVariant@@@Z @ 17 NONAME ; void CpRingToneView::handleOk(class QVariant const &) + ?qt_metacast@CpRingToneView@@UAEPAXPBD@Z @ 18 NONAME ; void * CpRingToneView::qt_metacast(char const *) + diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpringtoneview/eabi/cpringtoneviewu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpringtoneview/eabi/cpringtoneviewu.def Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,24 @@ +EXPORTS + _ZN14CpRingToneView11handleErrorEiRK7QString @ 1 NONAME + _ZN14CpRingToneView11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME + _ZN14CpRingToneView11qt_metacastEPKc @ 3 NONAME + _ZN14CpRingToneView13itemActivatedERK11QModelIndex @ 4 NONAME + _ZN14CpRingToneView16staticMetaObjectE @ 5 NONAME DATA 16 + _ZN14CpRingToneView18launchMediaFetcherERK7QStringS2_ @ 6 NONAME + _ZN14CpRingToneView19getStaticMetaObjectEv @ 7 NONAME + _ZN14CpRingToneView5selOKERK7QString @ 8 NONAME + _ZN14CpRingToneView8handleOkERK8QVariant @ 9 NONAME + _ZN14CpRingToneView8selErrorEiRK7QString @ 10 NONAME + _ZN14CpRingToneViewC1EP13QGraphicsItem @ 11 NONAME + _ZN14CpRingToneViewC2EP13QGraphicsItem @ 12 NONAME + _ZN14CpRingToneViewD0Ev @ 13 NONAME + _ZN14CpRingToneViewD1Ev @ 14 NONAME + _ZN14CpRingToneViewD2Ev @ 15 NONAME + _ZNK14CpRingToneView10metaObjectEv @ 16 NONAME + _ZTI14CpRingToneView @ 17 NONAME + _ZTV14CpRingToneView @ 18 NONAME + _ZThn16_N14CpRingToneViewD0Ev @ 19 NONAME + _ZThn16_N14CpRingToneViewD1Ev @ 20 NONAME + _ZThn8_N14CpRingToneViewD0Ev @ 21 NONAME + _ZThn8_N14CpRingToneViewD1Ev @ 22 NONAME + diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpringtoneview/src/cpringtoneview.cpp --- a/controlpanelui/src/cpringtoneview/src/cpringtoneview.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpringtoneview/src/cpringtoneview.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -19,54 +19,56 @@ #include #include #include +#include #include #include #include #include #include +#include +#include +#include +#include +#include CpRingToneView::CpRingToneView( QGraphicsItem *parent ): CpBaseSettingView(0, parent), mToneTypeList( new HbListWidget(this) ), mReq(0) { - HbWidget* contentWidget = new HbWidget(this); - QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical); - - //setup the heading. - HbLabel* label = new HbLabel( hbTrId("txt_cp_subhead_select_tone_type"), contentWidget ); - layout->addItem(label); - //handling user click - bool bret = connect(mToneTypeList, SIGNAL( activated(HbListWidgetItem *) ), - this, SLOT(onTypeSelected(HbListWidgetItem *))); - //initialize the list contents - QList tonesTypeList; - tonesTypeList << - hbTrId("txt_cp_list_no_tone")<< - hbTrId("txt_cp_list_tone")<< - hbTrId("txt_cp_list_music")<< - hbTrId("txt_cp_list_recording")<< - hbTrId("txt_cp_list_get_more_tones"); - for ( int i = 0; i < tonesTypeList.count(); i++ ) - { - mToneTypeList->addItem(tonesTypeList.at(i)); + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.css"); + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem_color.css"); + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.widgetml"); + + HbDataForm *form = qobject_cast ( widget() ); + form->setHeading("txt_cp_subhead_select_tone_type"); + + HbDataFormModel *model = new HbDataFormModel(); + QList< QPair > tonesTypeList; + tonesTypeList << qMakePair( QString("qtg_large_tone_off"), hbTrId("txt_cp_list_no_tone") ) + << qMakePair( QString("qtg_large_tone"), hbTrId("txt_cp_list_tone") ) + << qMakePair( QString("qtg_large_music"), hbTrId("txt_cp_list_music") ) + << qMakePair( QString("qtg_large_ovistore"), hbTrId("txt_cp_list_get_more_tones") ); + + for (int i = 0; i < tonesTypeList.count(); ++i) { + HbDataFormModelItem *itemData = new HbDataFormModelItem(); + itemData->setType ( static_cast (CpSettingFormEntryItemData::ListEntryItem) ); + itemData->setLabel(tonesTypeList.at(i).second); + itemData->setIcon(tonesTypeList.at(i).first); + model->appendDataFormItem(itemData, model->invisibleRootItem()); } - //add the list to layout. - layout->addItem(mToneTypeList); - - contentWidget->setLayout(layout); - - setWidget(contentWidget); + connect(form, SIGNAL(activated(QModelIndex)), this, SLOT(itemActivated(QModelIndex))); + form->setModel(model); } CpRingToneView::~CpRingToneView() { if(mReq) delete mReq; } -void CpRingToneView::onTypeSelected(HbListWidgetItem *item) +void CpRingToneView::itemActivated( const QModelIndex &index ) { - int nRow = mToneTypeList->row( item ); - switch(nRow) - { + int nRow = index.row(); + + switch(nRow) { case 0: //no tone, set default no sound emit selOK(QString("")); emit aboutToClose(); @@ -77,11 +79,10 @@ case 2: //music launchMediaFetcher("com.nokia.symbian.IMusicFetch", "fetch()" ); break; - case 3: //recording - case 4: //get more tones - default: - break; - } + case 3: //get more tones + default: + break; + } } void CpRingToneView::handleOk(const QVariant &result) { diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpserviceprovider/src/cplauncherservice.cpp --- a/controlpanelui/src/cpserviceprovider/src/cplauncherservice.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpserviceprovider/src/cplauncherservice.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -31,6 +31,7 @@ { CPSP_LOG("CpLauncherService Constructing..."); publishAll(); + connect(this,SIGNAL(clientDisconnected()),this,SLOT(handleClientDisconnected())); } CpLauncherService::~CpLauncherService() @@ -38,11 +39,13 @@ CPSP_LOG("CpLauncherService Destructing..."); } -void CpLauncherService::complete() +bool CpLauncherService::complete() { CPSP_LOG( QString("CpLauncherService::complete() mAsyncRequestIndex = %1, mReturnValue = %2").arg( mAsyncRequestIndex).arg(mReturnValue.toBool()) ); - completeRequest(mAsyncRequestIndex, mReturnValue); + bool ret = completeRequest(mAsyncRequestIndex, mReturnValue); + mAsyncRequestIndex = -1; + return ret; } void CpLauncherService::setReturnValue(const QVariant &returnValue) @@ -86,4 +89,9 @@ return succeed; } +void CpLauncherService::handleClientDisconnected() +{ + qApp->quit(); +} + //End of File diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpserviceprovider/src/cplauncherservice.h --- a/controlpanelui/src/cpserviceprovider/src/cplauncherservice.h Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpserviceprovider/src/cplauncherservice.h Fri Jun 25 17:12:20 2010 +0800 @@ -28,11 +28,12 @@ public: explicit CpLauncherService(HbMainWindow *mainWindow = 0); virtual ~CpLauncherService(); - void complete(); + bool complete(); public slots: bool launchSettingView(const QString &pluginFile,const QVariant &hint); private slots: void setReturnValue(const QVariant &returnValue); + void handleClientDisconnected(); private: HbMainWindow *mMainWindow; int mAsyncRequestIndex; diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.cpp --- a/controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -22,7 +22,7 @@ #include "cpsplogger.h" CpServiceMainWindow::CpServiceMainWindow(QWidget *parent /* = 0*/) -: HbMainWindow(parent), mLauncherService(0) +: HbMainWindow(parent), mLauncherService(0), mPreviousView(0) { CPSP_LOG("CpServiceMainWindow Constructing..."); mLauncherService = new CpLauncherService(this); @@ -37,6 +37,8 @@ { mSettingViewPointer = settingView; + mPreviousView = currentView(); + connect(settingView, SIGNAL(aboutToClose()), this, SLOT(quit())); addView(settingView); setCurrentView(settingView); @@ -46,6 +48,8 @@ { CPSP_LOG("CpServiceMainWindow::quit()"); + closeSettingView(); + connect(mLauncherService, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); mLauncherService->complete(); @@ -59,4 +63,14 @@ */ } +void CpServiceMainWindow::closeSettingView() +{ + if (mSettingViewPointer) { + removeView(mSettingViewPointer); + mSettingViewPointer->deleteLater(); + } + + setCurrentView(mPreviousView); +} + //End of File diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.h --- a/controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.h Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.h Fri Jun 25 17:12:20 2010 +0800 @@ -31,12 +31,21 @@ explicit CpServiceMainWindow(QWidget *parent = 0); virtual ~CpServiceMainWindow(); + /* + * set the setting view as current view + */ void setSettingView(CpBaseSettingView *settingView); + /* + * close current setting view + */ + void closeSettingView(); + public slots: void quit(); private: CpLauncherService *mLauncherService; + HbView *mPreviousView; QPointer mSettingViewPointer; }; diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/cpserviceprovider/src/main.cpp --- a/controlpanelui/src/cpserviceprovider/src/main.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/cpserviceprovider/src/main.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -19,7 +19,6 @@ #include #include #include -#include #include "cpservicemainwindow.h" #include "cpsplogger.h" @@ -37,7 +36,9 @@ qApp->installTranslator(&translator); } - HbStyleLoader::registerFilePath(CP_RESOURCE_PATH + QDir::separator() + WIDGETML_SUB_PATH); + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.css"); + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem_color.css"); + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.widgetml"); CpServiceMainWindow wnd; wnd.show(); diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/eabi/cpcategorymodelu.def --- a/controlpanelui/src/eabi/cpcategorymodelu.def Thu Jun 10 16:07:41 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -EXPORTS - _Z22createCpPluginItemDataP27CpCreatePluginItemDataEvent @ 1 NONAME - _ZN14CpTaskExecutor11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME - _ZN14CpTaskExecutor11qt_metacastEPKc @ 3 NONAME - _ZN14CpTaskExecutor11removeTasksEv @ 4 NONAME - _ZN14CpTaskExecutor14globalInstanceEv @ 5 NONAME - _ZN14CpTaskExecutor16staticMetaObjectE @ 6 NONAME DATA 16 - _ZN14CpTaskExecutor19getStaticMetaObjectEv @ 7 NONAME - _ZN14CpTaskExecutor21destroyGlobalInstanceEv @ 8 NONAME - _ZN14CpTaskExecutor3runEv @ 9 NONAME - _ZN14CpTaskExecutor4stopEv @ 10 NONAME - _ZN14CpTaskExecutor7runTaskEP6CpTaskb @ 11 NONAME - _ZN14CpTaskExecutor7toFrontEP6CpTask @ 12 NONAME - _ZN14CpTaskExecutorC1EP7QObject @ 13 NONAME - _ZN14CpTaskExecutorC2EP7QObject @ 14 NONAME - _ZN14CpTaskExecutorD0Ev @ 15 NONAME - _ZN14CpTaskExecutorD1Ev @ 16 NONAME - _ZN14CpTaskExecutorD2Ev @ 17 NONAME - _ZN26CpCategorySettingFormModel10initializeER16CpItemDataHelper @ 18 NONAME - _ZN26CpCategorySettingFormModel11qt_metacallEN11QMetaObject4CallEiPPv @ 19 NONAME - _ZN26CpCategorySettingFormModel11qt_metacastEPKc @ 20 NONAME - _ZN26CpCategorySettingFormModel16staticMetaObjectE @ 21 NONAME DATA 16 - _ZN26CpCategorySettingFormModel19getStaticMetaObjectEv @ 22 NONAME - _ZN26CpCategorySettingFormModel25afterLoadingConfigPluginsER16CpItemDataHelper @ 23 NONAME - _ZN26CpCategorySettingFormModel26beforeLoadingConfigPluginsER16CpItemDataHelper @ 24 NONAME - _ZN26CpCategorySettingFormModelC1ERK7QString @ 25 NONAME - _ZN26CpCategorySettingFormModelC2ERK7QString @ 26 NONAME - _ZN26CpCategorySettingFormModelD0Ev @ 27 NONAME - _ZN26CpCategorySettingFormModelD1Ev @ 28 NONAME - _ZN26CpCategorySettingFormModelD2Ev @ 29 NONAME - _ZN29CpCategorySettingFormItemData10initializeER16CpItemDataHelper @ 30 NONAME - _ZN29CpCategorySettingFormItemData11qt_metacallEN11QMetaObject4CallEiPPv @ 31 NONAME - _ZN29CpCategorySettingFormItemData11qt_metacastEPKc @ 32 NONAME - _ZN29CpCategorySettingFormItemData16staticMetaObjectE @ 33 NONAME DATA 16 - _ZN29CpCategorySettingFormItemData19getStaticMetaObjectEv @ 34 NONAME - _ZN29CpCategorySettingFormItemData25afterLoadingConfigPluginsER16CpItemDataHelper @ 35 NONAME - _ZN29CpCategorySettingFormItemData26beforeLoadingConfigPluginsER16CpItemDataHelper @ 36 NONAME - _ZN29CpCategorySettingFormItemDataC1EN19HbDataFormModelItem12DataItemTypeERK7QStringS4_PKS0_ @ 37 NONAME - _ZN29CpCategorySettingFormItemDataC1ERK7QStringPK19HbDataFormModelItem @ 38 NONAME - _ZN29CpCategorySettingFormItemDataC2EN19HbDataFormModelItem12DataItemTypeERK7QStringS4_PKS0_ @ 39 NONAME - _ZN29CpCategorySettingFormItemDataC2ERK7QStringPK19HbDataFormModelItem @ 40 NONAME - _ZN29CpCategorySettingFormItemDataD0Ev @ 41 NONAME - _ZN29CpCategorySettingFormItemDataD1Ev @ 42 NONAME - _ZN29CpCategorySettingFormItemDataD2Ev @ 43 NONAME - _ZNK14CpTaskExecutor10metaObjectEv @ 44 NONAME - _ZNK26CpCategorySettingFormModel10metaObjectEv @ 45 NONAME - _ZNK29CpCategorySettingFormItemData10metaObjectEv @ 46 NONAME - _ZTI14CpTaskExecutor @ 47 NONAME - _ZTI26CpCategorySettingFormModel @ 48 NONAME - _ZTI29CpCategorySettingFormItemData @ 49 NONAME - _ZTV14CpTaskExecutor @ 50 NONAME - _ZTV26CpCategorySettingFormModel @ 51 NONAME - _ZTV29CpCategorySettingFormItemData @ 52 NONAME - _ZThn8_N29CpCategorySettingFormItemDataD0Ev @ 53 NONAME - _ZThn8_N29CpCategorySettingFormItemDataD1Ev @ 54 NONAME - diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/eabi/cpprofilewrapperu.def --- a/controlpanelui/src/eabi/cpprofilewrapperu.def Thu Jun 10 16:07:41 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -EXPORTS - _ZN14CpProfileModel11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME - _ZN14CpProfileModel11qt_metacastEPKc @ 2 NONAME - _ZN14CpProfileModel11setRingToneERK7QString @ 3 NONAME - _ZN14CpProfileModel11setRingToneEiRK7QString @ 4 NONAME - _ZN14CpProfileModel12setEmailToneEiRK7QString @ 5 NONAME - _ZN14CpProfileModel13setEmailVibraEib @ 6 NONAME - _ZN14CpProfileModel14initiationFlagEv @ 7 NONAME - _ZN14CpProfileModel14setMasterVibraEb @ 8 NONAME - _ZN14CpProfileModel14setMessageToneEiRK7QString @ 9 NONAME - _ZN14CpProfileModel14setOffLineModeEb @ 10 NONAME - _ZN14CpProfileModel14setSilenceModeEb @ 11 NONAME - _ZN14CpProfileModel15activateProfileEi @ 12 NONAME - _ZN14CpProfileModel15profileSettingsEiR17CpProfileSettings @ 13 NONAME - _ZN14CpProfileModel15setMasterVolumeEi @ 14 NONAME - _ZN14CpProfileModel15setMessageVibraEib @ 15 NONAME - _ZN14CpProfileModel15setReminderToneEiRK7QString @ 16 NONAME - _ZN14CpProfileModel16setReminderVibraEib @ 17 NONAME - _ZN14CpProfileModel16staticMetaObjectE @ 18 NONAME DATA 16 - _ZN14CpProfileModel17setRingAlertVibraEib @ 19 NONAME - _ZN14CpProfileModel18setProfileSettingsEiR17CpProfileSettings @ 20 NONAME - _ZN14CpProfileModel19getStaticMetaObjectEv @ 21 NONAME - _ZN14CpProfileModel19setNotificationToneEib @ 22 NONAME - _ZN14CpProfileModel20setNotificationVibraEib @ 23 NONAME - _ZN14CpProfileModel21setKeyTouchScreenToneEii @ 24 NONAME - _ZN14CpProfileModel22setKeyTouchScreenVibraEii @ 25 NONAME - _ZN14CpProfileModelC1EP7QObject @ 26 NONAME - _ZN14CpProfileModelC2EP7QObject @ 27 NONAME - _ZN14CpProfileModelD0Ev @ 28 NONAME - _ZN14CpProfileModelD1Ev @ 29 NONAME - _ZN14CpProfileModelD2Ev @ 30 NONAME - _ZNK14CpProfileModel10emailVibraEi @ 31 NONAME - _ZNK14CpProfileModel10metaObjectEv @ 32 NONAME - _ZNK14CpProfileModel11masterVibraEv @ 33 NONAME - _ZNK14CpProfileModel11messageToneEi @ 34 NONAME - _ZNK14CpProfileModel11offLineModeEv @ 35 NONAME - _ZNK14CpProfileModel11profileNameEi @ 36 NONAME - _ZNK14CpProfileModel11silenceModeEv @ 37 NONAME - _ZNK14CpProfileModel12masterVolumeEv @ 38 NONAME - _ZNK14CpProfileModel12messageVibraEi @ 39 NONAME - _ZNK14CpProfileModel12profileNamesEv @ 40 NONAME - _ZNK14CpProfileModel12reminderToneEi @ 41 NONAME - _ZNK14CpProfileModel13reminderVibraEi @ 42 NONAME - _ZNK14CpProfileModel14ringAlertVibraEi @ 43 NONAME - _ZNK14CpProfileModel15activeProfileIdEv @ 44 NONAME - _ZNK14CpProfileModel16notificationToneEi @ 45 NONAME - _ZNK14CpProfileModel17notificationVibraEi @ 46 NONAME - _ZNK14CpProfileModel18keyTouchScreenToneEi @ 47 NONAME - _ZNK14CpProfileModel19keyTouchScreenVibraEi @ 48 NONAME - _ZNK14CpProfileModel8ringToneEi @ 49 NONAME - _ZNK14CpProfileModel8ringToneEv @ 50 NONAME - _ZNK14CpProfileModel9emailToneEi @ 51 NONAME - _ZTI14CpProfileModel @ 52 NONAME - _ZTV14CpProfileModel @ 53 NONAME - diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/eabi/cpringtoneviewu.def --- a/controlpanelui/src/eabi/cpringtoneviewu.def Thu Jun 10 16:07:41 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -EXPORTS - _ZN14CpRingToneView11handleErrorEiRK7QString @ 1 NONAME - _ZN14CpRingToneView11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME - _ZN14CpRingToneView11qt_metacastEPKc @ 3 NONAME - _ZN14CpRingToneView14onTypeSelectedEP16HbListWidgetItem @ 4 NONAME - _ZN14CpRingToneView16staticMetaObjectE @ 5 NONAME DATA 16 - _ZN14CpRingToneView18launchMediaFetcherERK7QStringS2_ @ 6 NONAME - _ZN14CpRingToneView19getStaticMetaObjectEv @ 7 NONAME - _ZN14CpRingToneView5selOKERK7QString @ 8 NONAME - _ZN14CpRingToneView8handleOkERK8QVariant @ 9 NONAME - _ZN14CpRingToneView8selErrorEiRK7QString @ 10 NONAME - _ZN14CpRingToneViewC1EP13QGraphicsItem @ 11 NONAME - _ZN14CpRingToneViewC2EP13QGraphicsItem @ 12 NONAME - _ZN14CpRingToneViewD0Ev @ 13 NONAME - _ZN14CpRingToneViewD1Ev @ 14 NONAME - _ZN14CpRingToneViewD2Ev @ 15 NONAME - _ZNK14CpRingToneView10metaObjectEv @ 16 NONAME - _ZTI14CpRingToneView @ 17 NONAME - _ZTV14CpRingToneView @ 18 NONAME - _ZThn16_N14CpRingToneViewD0Ev @ 19 NONAME - _ZThn16_N14CpRingToneViewD1Ev @ 20 NONAME - _ZThn8_N14CpRingToneViewD0Ev @ 21 NONAME - _ZThn8_N14CpRingToneViewD1Ev @ 22 NONAME - diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/eabi/seccodeuiu.def --- a/controlpanelui/src/eabi/seccodeuiu.def Thu Jun 10 16:07:41 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -EXPORTS - _ZN15SecCodeSettings11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME - _ZN15SecCodeSettings11qt_metacastEPKc @ 2 NONAME - _ZN15SecCodeSettings13changePinCodeEv @ 3 NONAME - _ZN15SecCodeSettings14changePin2CodeEv @ 4 NONAME - _ZN15SecCodeSettings16staticMetaObjectE @ 5 NONAME DATA 16 - _ZN15SecCodeSettings17setPinCodeRequestEb @ 6 NONAME - _ZN15SecCodeSettings19getStaticMetaObjectEv @ 7 NONAME - _ZN15SecCodeSettingsC1EP7QObject @ 8 NONAME - _ZN15SecCodeSettingsC2EP7QObject @ 9 NONAME - _ZN15SecCodeSettingsD0Ev @ 10 NONAME - _ZN15SecCodeSettingsD1Ev @ 11 NONAME - _ZN15SecCodeSettingsD2Ev @ 12 NONAME - _ZN27SecCodeEditDataFormViewItem10createItemEv @ 13 NONAME - _ZN27SecCodeEditDataFormViewItem11qt_metacallEN11QMetaObject4CallEiPPv @ 14 NONAME - _ZN27SecCodeEditDataFormViewItem11qt_metacastEPKc @ 15 NONAME - _ZN27SecCodeEditDataFormViewItem16staticMetaObjectE @ 16 NONAME DATA 16 - _ZN27SecCodeEditDataFormViewItem18createCustomWidgetEv @ 17 NONAME - _ZN27SecCodeEditDataFormViewItem19getStaticMetaObjectEv @ 18 NONAME - _ZN27SecCodeEditDataFormViewItemC1EP13QGraphicsItem @ 19 NONAME - _ZN27SecCodeEditDataFormViewItemC2EP13QGraphicsItem @ 20 NONAME - _ZN27SecCodeEditDataFormViewItemD0Ev @ 21 NONAME - _ZN27SecCodeEditDataFormViewItemD1Ev @ 22 NONAME - _ZN27SecCodeEditDataFormViewItemD2Ev @ 23 NONAME - _ZNK15SecCodeSettings10metaObjectEv @ 24 NONAME - _ZNK15SecCodeSettings14pinCodeRequestEv @ 25 NONAME - _ZNK27SecCodeEditDataFormViewItem10metaObjectEv @ 26 NONAME - _ZNK27SecCodeEditDataFormViewItem16canSetModelIndexERK11QModelIndex @ 27 NONAME - _ZTI15SecCodeSettings @ 28 NONAME - _ZTI27SecCodeEditDataFormViewItem @ 29 NONAME - _ZTV15SecCodeSettings @ 30 NONAME - _ZTV27SecCodeEditDataFormViewItem @ 31 NONAME - _ZThn16_N27SecCodeEditDataFormViewItemD0Ev @ 32 NONAME - _ZThn16_N27SecCodeEditDataFormViewItemD1Ev @ 33 NONAME - _ZThn8_N27SecCodeEditDataFormViewItemD0Ev @ 34 NONAME - _ZThn8_N27SecCodeEditDataFormViewItemD1Ev @ 35 NONAME - diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/inc/cpringtoneview.h --- a/controlpanelui/src/inc/cpringtoneview.h Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/inc/cpringtoneview.h Fri Jun 25 17:12:20 2010 +0800 @@ -36,7 +36,7 @@ void selError( int errorCode, const QString& errorMessage ); private slots: - void onTypeSelected( HbListWidgetItem *item ); + void itemActivated( const QModelIndex &index ); void handleOk(const QVariant &result); void handleError(int errorCode, const QString& errorMessage); diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/inc/tonefetcherlog.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/inc/tonefetcherlog.conf Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,7 @@ +[ToneFetcher] +logdatetime = 1 +logloggername = 1 +datetimeformat = hh:mm:ss:zzz +output = debugoutput fileoutput +fileoutput/logfile = C:/data/logs/tonefetcher.log +fileoutput/truncate = 1 \ No newline at end of file diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/inc/tonefetcherlogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/inc/tonefetcherlogger.h Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,39 @@ +/* + * 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: + * The header file for tone fetcher utilities. + * + */ + +#ifndef TONEFETCHERLOGGER_H +#define TONEFETCHERLOGGER_H + +#include +#include + +#define TONEFETCHER_LOGGER_NAME QLatin1String("ToneFetcher") + +#if defined (Q_OS_SYMBIAN) + #define TF_LOGGER_CONFIG_PATH QLatin1String("C:/data/.config/tonefetcherlog.conf") +#elif defined (Q_WS_WIN) + #ifdef _DEBUG + #define TF_LOGGER_CONFIG_PATH QLatin1String("C:/controlpanel/debug/bin/tonefetcherlog.conf") + #else + #define TF_LOGGER_CONFIG_PATH QLatin1String("C:/controlpanel/release/bin/tonefetcherlog.conf") + #endif +#endif + +#define TF_LOG(str) Logger::instance(TONEFETCHER_LOGGER_NAME)->log(str); + +#endif /* TONEFETCHERLOGGER_H */ diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/inc/tonefetcherutils.cpp --- a/controlpanelui/src/tonefetcher/inc/tonefetcherutils.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/tonefetcher/inc/tonefetcherutils.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -15,6 +15,7 @@ * The source file for tone fetcher utilities. * */ + #include "tonefetcherutils.h" #include #include diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/inc/tonefetcherutils.h --- a/controlpanelui/src/tonefetcher/inc/tonefetcherutils.h Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/tonefetcher/inc/tonefetcherutils.h Fri Jun 25 17:12:20 2010 +0800 @@ -15,6 +15,7 @@ * The header file for tone fetcher utilities. * */ + #ifndef TONEFETCHERUTILS_H #define TONEFETCHERUTILS_H @@ -23,7 +24,7 @@ class ToneFetcherUtils { public: - + //replace '/' and '\' with QDir::separator() static QString normalizeSeperator(const QString &path); }; diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/src/main.cpp --- a/controlpanelui/src/tonefetcher/src/main.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/tonefetcher/src/main.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -19,10 +19,17 @@ #include "tonefetcher.h" #include "tonefetchermainwindow.h" #include +#include int main(int argc, char *argv[]) { HbApplication a(argc, argv); + + + Logger::instance(TONEFETCHER_LOGGER_NAME)->configure( + TF_LOGGER_CONFIG_PATH,QSettings::IniFormat); + + TF_LOG("Entering tonefetcher.exe..."); ToneFetcherMainWindow w; w.show(); return a.exec(); diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/src/tonefetcher.cpp --- a/controlpanelui/src/tonefetcher/src/tonefetcher.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/tonefetcher/src/tonefetcher.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -22,7 +22,7 @@ #include "tonefetcherutils.h" #include #include -#include +#include ToneFetcher::ToneFetcher(HbMainWindow *mainWindow) : XQServiceProvider(QString("tonefetcher.com.nokia.symbian.IToneFetch"), mainWindow), @@ -50,7 +50,7 @@ mMainWindow->addView(toneView); mMainWindow->setCurrentView(toneView); } else { - CPFW_LOG("ToneFetcher::fetch: ToneFetcherView failed to be created"); + TF_LOG("ToneFetcher::fetch: ToneFetcherView failed to be created"); } } } @@ -66,8 +66,7 @@ } void ToneFetcher::setSelectedPath(const QString & tonePath) -{ - QString path(ToneFetcherUtils::normalizeSeperator(tonePath)); - mReturnValue.setValue(path); +{ + mReturnValue.setValue(ToneFetcherUtils::normalizeSeperator(tonePath)); } //End of File diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/src/tonefetcher.h --- a/controlpanelui/src/tonefetcher/src/tonefetcher.h Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/tonefetcher/src/tonefetcher.h Fri Jun 25 17:12:20 2010 +0800 @@ -39,9 +39,15 @@ bool isActive(); public slots: + /* + * tone fetcher service's operation + */ void fetch(); private slots: + /* + * set the selected tone's path to be the return value + */ void setSelectedPath(const QString &tonePath); private: diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/src/tonefetchermainwindow.cpp --- a/controlpanelui/src/tonefetcher/src/tonefetchermainwindow.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/tonefetcher/src/tonefetchermainwindow.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -30,11 +30,4 @@ { delete mToneFetcher; } - -void ToneFetcherMainWindow::quit() -{ - connect(mToneFetcher, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); - mToneFetcher->complete(); -} - //End of File diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/src/tonefetchermainwindow.h --- a/controlpanelui/src/tonefetcher/src/tonefetchermainwindow.h Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/tonefetcher/src/tonefetchermainwindow.h Fri Jun 25 17:12:20 2010 +0800 @@ -30,8 +30,6 @@ explicit ToneFetcherMainWindow(QWidget *parent = 0); virtual ~ToneFetcherMainWindow(); -public slots: - void quit(); private: ToneFetcher *mToneFetcher; }; diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/src/tonefetchermodel.cpp --- a/controlpanelui/src/tonefetcher/src/tonefetchermodel.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/tonefetcher/src/tonefetchermodel.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -15,9 +15,11 @@ * The source file for tone list model */ #include "tonefetchermodel.h" +#include +#include ToneFetcherModel::ToneFetcherModel(QObject *parent) - : QStandardItemModel(parent) + : QStringListModel(parent) { } @@ -27,75 +29,37 @@ QVariant ToneFetcherModel::data(const QModelIndex &index, int role) const { - if (role == Qt::UserRole) { - return mUserDataLst.at(index.row()); + if (role == Qt::DisplayRole) { + return QFileInfo(QStringListModel::data(index, role).toString()).baseName(); } else { - return QStandardItemModel::data(index, role); - } + return QStringListModel::data(index, role); + } } -void ToneFetcherModel::insertInOrder(QStandardItem *fileName, QStandardItem *filePath, int role) -{ - QString name = fileName->text(); - QString path = filePath->text(); - int index = this->insertIndex(0, rowCount(), name); - - mUserDataLst.insert(index, path); - QStandardItemModel::insertRow(index, fileName); -} - -QString ToneFetcherModel::path(const QModelIndex &index) const -{ - QString str = data(index, Qt::UserRole).toString(); - return str; +QString ToneFetcherModel::getPath(const QModelIndex &index) const +{ + return QStringListModel::data(index, Qt::DisplayRole).toString(); } -int ToneFetcherModel::insertIndex(int low, int high, QString value) +void ToneFetcherModel::sort() { - if (low == high) { - return low; - } - int middle = (low + high - 1)/2; - QModelIndex lowItemIndex = ((QStandardItemModel *)this)->index(low, 0); - QModelIndex highItemIndex = ((QStandardItemModel *)this)->index(high - 1, 0); - QModelIndex middleItemIndex = (( QStandardItemModel *)this)->index(middle, 0); - QString lowString = data(lowItemIndex).toString(); - QString highString = data(highItemIndex).toString(); - QString middleString = data(middleItemIndex).toString(); - - if (value >= highString) { - return high; - } - if (value < lowString) { - return low; - } - high = high - 1; - while (low < high) { - middle = (low + high)/2; - middleItemIndex = ((QStandardItemModel *)this)->index(middle, 0); - middleString = data(middleItemIndex).toString(); - if (value >= middleString) { - low = middle + 1; - } else { - high = middle; - } - } - return low; + QStringList list = stringList(); + qStableSort(list.begin(), list.end(), caseSensitiveLessThan); + removeRows(0, rowCount()); + setStringList(list); +} +void ToneFetcherModel::layoutToBeChanged() +{ + emit layoutAboutToBeChanged(); } -void ToneFetcherModel::refresh() +void ToneFetcherModel::layoutHasChanged() { emit layoutChanged(); } -void ToneFetcherModel::toBeFreshed() +bool ToneFetcherModel::caseSensitiveLessThan(const QString &s1, const QString &s2) { - emit layoutAboutToBeChanged(); -} - -void ToneFetcherModel::clearAll() -{ - mUserDataLst.clear(); - QStandardItemModel::clear(); + return QFileInfo(s1).baseName().toLower() < QFileInfo(s2).baseName().toLower(); } //End of File diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/src/tonefetchermodel.h --- a/controlpanelui/src/tonefetcher/src/tonefetchermodel.h Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/tonefetcher/src/tonefetchermodel.h Fri Jun 25 17:12:20 2010 +0800 @@ -19,41 +19,31 @@ #ifndef TONEFETCHERMODEL_H #define TONEFETCHERMODEL_H -#include +#include #include // CLASS DECLARATION /** * This class is used for storing tone list items. - * inherited from QStandardItemModel so that many existing functions could be used. + * inherited from QStringListModel so that many existing functions could be used. * */ -class ToneFetcherModel : public QStandardItemModel +class ToneFetcherModel : public QStringListModel { public: explicit ToneFetcherModel( QObject *parent ); virtual ~ToneFetcherModel(); - //from QAbstractItemModel - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - void insertInOrder(QStandardItem *fileName, QStandardItem *filePath, int role = Qt::DisplayRole); - QString path(const QModelIndex &index) const; - void refresh(); - void toBeFreshed(); - void clearAll(); -private: - /* - * binary search (ascendant) for the correct index to insert. - * @param low the start of search - * @param high the end of search. - * @return the correct index - */ - int insertIndex(int low, int high, QString variant); - - /* - * save the absolute path of the tone. - */ - QStringList mUserDataLst; - + //from QStringListModel + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + QString getPath(const QModelIndex &index) const; + //sort the list + void sort(); + //sort method + bool static caseSensitiveLessThan(const QString &s1, const QString &s2); + //emit the signal of layoutToBeChanged(); + void layoutToBeChanged(); + //emit the signal of layoutChanged(); + void layoutHasChanged(); }; -#endif /* TONEFETCHERMODEL_H_ */ +#endif /* TONEFETCHERMODEL_H */ diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/src/tonefetcherview.cpp --- a/controlpanelui/src/tonefetcher/src/tonefetcherview.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/tonefetcher/src/tonefetcherview.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -46,9 +46,9 @@ } void ToneFetcherView::quit() -{ +{ + connect(mServiceProvider, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); mServiceProvider->complete(); - connect(mServiceProvider, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); } void ToneFetcherView::initToolBar() @@ -77,10 +77,12 @@ } void ToneFetcherView::on_rightAction_triggered() -{ - QString path(mWidget->getCurrentItemPath()); - emit itemSelected(path); +{ + emit itemSelected(mWidget->getCurrentItemPath()); quit(); + /*QDir dir("c:\\data\\Sounds\\Simple\\"); + dir.remove("def.aac"); + dir.remove("abc.aac"); */ } void ToneFetcherView::enableToolBar(bool enable) diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/src/tonefetcherview.h --- a/controlpanelui/src/tonefetcher/src/tonefetcherview.h Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/tonefetcher/src/tonefetcherview.h Fri Jun 25 17:12:20 2010 +0800 @@ -33,6 +33,10 @@ explicit ToneFetcherView(ToneFetcher *service); ~ToneFetcherView(); void quit(); + +signals: + void itemSelected(const QString &path); + private: void initMainWidget(); void initToolBar(); @@ -46,9 +50,6 @@ void on_rightAction_triggered(); void enableToolBar(bool enable); -signals: - void itemSelected(const QString &path); - private: ToneFetcherWidget *mWidget; ToneFetcher *mServiceProvider; //not own @@ -56,4 +57,4 @@ HbAction *mToolBarRightAction; }; -#endif /* TONEFETCHERVIEW_H_ */ +#endif /* TONEFETCHERVIEW_H */ diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp --- a/controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -46,26 +46,21 @@ mServiceEngine(0), mWaitNote(0) -{ - mSelected = false; +{ init(); connect(mServiceEngine, SIGNAL(mdeSessionOpened()), this, SLOT(mdeSessionOpened())); connect(mServiceEngine, SIGNAL(mdeSessionError(int)), this, SLOT(mdeSessionError(int))); - connect(mServiceEngine, SIGNAL(queryComplete(QStringList, QStringList)), - this, SLOT(queryComplete(QStringList, QStringList))); + connect(mServiceEngine, SIGNAL(queryComplete(QStringList)), + this, SLOT(queryComplete(QStringList))); connect(mServiceEngine, SIGNAL(queryError(int)), this, SLOT(queryError(int))); connect(mServiceEngine, - SIGNAL(notifyPreviewEvent(ToneServiceEngine::TPreviewEvent, int)), - this, SLOT(previewEvent(ToneServiceEngine::TPreviewEvent, int))); + SIGNAL(notifyPreviewEvent(int)), + this, SLOT(previewEvent(int))); connect( mServiceEngine, SIGNAL(notifyObjectChanged()), this, SLOT(onObjectChanged())); - connect( mServiceEngine, SIGNAL(notifyRefreshStart()), - this, SLOT(refreshStart())); - connect( mServiceEngine, SIGNAL(notifyRefreshFinish()), - this, SLOT(refreshFinish())); } ToneFetcherWidget::~ToneFetcherWidget() @@ -78,38 +73,28 @@ void ToneFetcherWidget::on_list_activated(const QModelIndex &index) { - QModelIndexList modelIndexList = mListView->selectionModel()->selectedIndexes(); - //stop previewing when clicking another item. - if (mServiceEngine->IsPlaying()) { - mServiceEngine->stop(); + if (mServiceEngine->isPlaying()) { + mServiceEngine->stopPlaying(); } /* * when one item is selected, reselecting it will deselect it. selecting another * will also deselect it, while the other is selected. */ - if (mSelected){ - if(mOldSeletedItem != index) { - mListView->selectionModel()->select(index, QItemSelectionModel::Select); - mOldSeletedItem = index; - emit triggerToolBar(true); - } else { - mListView->selectionModel()->select(index, QItemSelectionModel::Deselect); - mSelected = false; - emit triggerToolBar(false); - } - return; + QItemSelectionModel *selectionModel = mListView->selectionModel(); + if (mOldSeletedItem == index) { + selectionModel->select(index,QItemSelectionModel::Toggle); } - if (modelIndexList.count() > 0) { - for (QModelIndexList::const_iterator it = modelIndexList.begin(); it != modelIndexList.end(); ++it) { - if ((*it) == index) { - mSelected = true; - mOldSeletedItem = index; - emit triggerToolBar(true); - } - } - - } + + QModelIndexList modelIndexList = selectionModel->selectedIndexes(); + if (modelIndexList.isEmpty()) { + mOldSeletedItem = QModelIndex(); + } + else { + mOldSeletedItem = modelIndexList.front(); + } + emit triggerToolBar(selectionModel->hasSelection()); + } @@ -129,8 +114,9 @@ mListView->setSelectionMode(HbAbstractItemView::SingleSelection); mServiceEngine = new ToneFetcherEngine(this); - mToneModel = new ToneFetcherModel(this); - addRomFiles(); + mToneModel = new ToneFetcherModel(this); + + initRomSoundList(); connect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(on_list_activated(QModelIndex ))); @@ -144,23 +130,19 @@ void ToneFetcherWidget::mdeSessionOpened() { - mServiceEngine->getTone(); + mServiceEngine->getTones(); } -void ToneFetcherWidget::queryComplete(const QStringList &nameList, const QStringList &uriList) +void ToneFetcherWidget::queryComplete(const QStringList &uriList) { - QStandardItem *fileName = 0; - QStandardItem *filePath = 0; - for (int i = 0; i < nameList.size(); ++i) { - QString tr1 = nameList.at(i); - tr1 = uriList.at(i); - fileName = new QStandardItem(nameList.at(i)); - filePath = new QStandardItem(uriList.at(i)); - mToneModel->insertInOrder(fileName, filePath); - } - mLabel->setPlainText(QString::number(mSimpleSoundList.size() + mDigitalSoundList.size() + nameList.size()) + " tones"); - mListView->setModel(mToneModel); - mToneModel->refresh(); + addFilesFromMDE(uriList); + addFilesFromRom(); + mToneModel->sort(); + mToneModel->layoutHasChanged(); + if (!mListView->model()) { + mListView->setModel(mToneModel); + } + refreshFinish(); } void ToneFetcherWidget::queryError(int error) @@ -178,27 +160,27 @@ { QModelIndexList modelIndexList = mListView->selectionModel()->selectedIndexes(); if (modelIndexList.count() > 0) { - QModelIndex index = modelIndexList.at(0); - return mToneModel->data(index, Qt::UserRole).toString(); + QModelIndex index = modelIndexList.front(); + QString path = mToneModel->getPath(index); + return path; } return QString(); } void ToneFetcherWidget::playOrPause() { - if(mServiceEngine->IsPlaying()) { - mServiceEngine->stop(); + if(mServiceEngine->isPlaying()) { + mServiceEngine->stopPlaying(); } else { - mServiceEngine->preview(getCurrentItemPath()); + mServiceEngine->play(getCurrentItemPath()); } } -void ToneFetcherWidget::previewEvent(ToneFetcherEngine::TPreviewEvent event, int errorId) +void ToneFetcherWidget::previewEvent(int event) { - Q_UNUSED(errorId); - if (event == ToneFetcherEngine::EAudioPreviewComplete) { - //reserved + if (event == 0) { + //preview successful, reserved } else { HbMessageBox::information(QString(hbTrId("Preview Error"))); } @@ -206,41 +188,33 @@ void ToneFetcherWidget::onObjectChanged() { - if (mServiceEngine->IsPlaying()) { - mServiceEngine->stop(); + refreshStart(); + if (mServiceEngine->isPlaying()) { + mServiceEngine->stopPlaying(); } - emit triggerToolBar(false); - mToneModel->toBeFreshed(); - mToneModel->clearAll(); - mDigitalSoundList.clear(); - mSimpleSoundList.clear(); - addRomFiles(); - mServiceEngine->getTone(); + mToneModel->layoutToBeChanged(); + emit triggerToolBar(false); + mToneModel->removeRows(0, mToneModel->rowCount()); + mServiceEngine->getTones(); } -void ToneFetcherWidget::addRomFiles() -{ - QStandardItem *fileName = 0; - QStandardItem *filePath = 0; - QDir digitalSoundPath(XQUtils::romRootPath() + XQUtils::digitalSoundsPath()); - mDigitalSoundList = digitalSoundPath.entryInfoList(); - - QDir simpleSoundPath(XQUtils::romRootPath() + XQUtils::simpleSoundsPath()); - mSimpleSoundList = simpleSoundPath.entryInfoList(); +void ToneFetcherWidget::addFilesFromRom() +{ + int currentCount = mToneModel->rowCount(); + mToneModel->insertRows(currentCount, mRomSoundList.size()); + for (int i = 0; i < mRomSoundList.size(); ++i) { + mToneModel->setData(mToneModel->index(i + currentCount), + QFileInfo(mRomSoundList.at(i)).absoluteFilePath()); + } +} - for (int i = 0; i < mDigitalSoundList.size(); ++i) { - QFileInfo fileInfo = mDigitalSoundList.at(i); - fileName = new QStandardItem(fileInfo.fileName()); - filePath = new QStandardItem(fileInfo.absoluteFilePath()); - mToneModel->insertInOrder(fileName, filePath); - } - - for (int i = 0; i < mSimpleSoundList.size(); ++i) { - QFileInfo fileInfo = mSimpleSoundList.at(i); - fileName = new QStandardItem(fileInfo.fileName()); - filePath = new QStandardItem(fileInfo.absoluteFilePath()); - mToneModel->insertInOrder(fileName, filePath); - } +void ToneFetcherWidget::addFilesFromMDE(const QStringList &uriList) +{ + int currentCount = mToneModel->rowCount(); + mToneModel->insertRows(currentCount, uriList.size()); + for (int i = 0; i < uriList.size(); ++i) { + mToneModel->setData(mToneModel->index(i + currentCount), QFileInfo(uriList.at(i)).absoluteFilePath()); + } } void ToneFetcherWidget::refreshFinish() @@ -256,4 +230,11 @@ mWaitNote->open(); } } + +void ToneFetcherWidget::initRomSoundList() +{ + QDir digitalSoundPath(XQUtils::romRootPath() + XQUtils::digitalSoundsPath()); + QDir simpleSoundPath(XQUtils::romRootPath() + XQUtils::simpleSoundsPath()); + mRomSoundList = digitalSoundPath.entryInfoList() + simpleSoundPath.entryInfoList(); +} //End of File diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/src/tonefetcherwidget.h --- a/controlpanelui/src/tonefetcher/src/tonefetcherwidget.h Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/tonefetcher/src/tonefetcherwidget.h Fri Jun 25 17:12:20 2010 +0800 @@ -48,22 +48,25 @@ void itemClicked(const QString &item); void triggerToolBar(bool enable); + +private: + void init(); + void addFilesFromRom(); + void initRomSoundList(); + void addFilesFromMDE(const QStringList &uriList); + private slots: void on_list_activated(const QModelIndex &index); void mdeSessionOpened(); void mdeSessionError(int error); - void queryComplete(const QStringList &nameList, const QStringList &uriList); + void queryComplete(const QStringList &uriList); void queryError(int error ); - void previewEvent(ToneFetcherEngine::TPreviewEvent event, int errorId); + void previewEvent(int event); void onObjectChanged(); void refreshFinish(); void refreshStart(); private: - void init(); - void addRomFiles(); - -private: HbLabel *mLabel; HbListView *mListView; QGraphicsLinearLayout *mLayout; @@ -72,10 +75,8 @@ ToneFetcherView *mServiceView; ToneFetcherEngine *mServiceEngine; - QFileInfoList mSimpleSoundList; - QFileInfoList mDigitalSoundList; - bool mSelected; + QFileInfoList mRomSoundList; QModelIndex mOldSeletedItem; HbProgressDialog *mWaitNote; }; -#endif /* TONEFETCHERWIDGET_H_ */ +#endif /* TONEFETCHERWIDGET_H */ diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/tonefetcher.pri --- a/controlpanelui/src/tonefetcher/tonefetcher.pri Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/tonefetcher/tonefetcher.pri Fri Jun 25 17:12:20 2010 +0800 @@ -32,12 +32,20 @@ src/main.cpp symbian { - HEADERS += tonefetcherengine/private/symbian/toneselectionengine_p.h \ - tonefetcherengine/private/symbian/tonepreviewprivate.h + HEADERS += tonefetcherengine/private/CTonePlayer.h \ + tonefetcherengine/private/CToneSelection.h \ + tonefetcherengine/private/MTonePlayingWatcher.h \ + tonefetcherengine/private/MToneSelectionWatcher.h \ + tonefetcherengine/private/tonefetcherengine_symbian.h + - SOURCES += tonefetcherengine/private/symbian/toneselectionengine_p.cpp \ - tonefetcherengine/private/symbian/tonepreviewprivate.cpp + SOURCES += tonefetcherengine/private/CTonePlayer.cpp \ + tonefetcherengine/private/CToneSelection.cpp \ + tonefetcherengine/private/tonefetcherengine_symbian.cpp +} else { + HEADERS += tonefetcherengine/private/tonefetcherengine_stub.h + SOURCES += tonefetcherengine/private/tonefetcherengine_stub.cpp } diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/tonefetcher.pro --- a/controlpanelui/src/tonefetcher/tonefetcher.pro Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/tonefetcher/tonefetcher.pro Fri Jun 25 17:12:20 2010 +0800 @@ -39,7 +39,10 @@ -lDrmHelper \ -ldrmutility \ -lapmime \ - -lecom + -lecom \ + -lcone \ + -lapgrfx + TARGET.UID3 = 0x2002BCCA TARGET.CAPABILITY = ALL -TCB BLD_INF_RULES.prj_exports += "./service_conf.xml z:/private/2002BCCA/service_conf.xml" diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/tonefetcherengine/private/CTonePlayer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/CTonePlayer.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,626 @@ +/* + * 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: + * The source file for tone playing. + * + */ +#include "CTonePlayer.h" +#include "tonefetcherutils.h" +#include // KAudioPriorityPreview +#include // C3DRingingToneInterface +#include // for phone call states +#include +#include +#include +#include "TProfileToneSettings.h" +#include +#include +#include +#include // KProEngDefaultRingingTone +#include "MTonePlayingWatcher.h" + + +CMFPreviewHandlerBase::CMFPreviewHandlerBase() + { + iMediaType = KErrNotFound; + iRingingVolume = KErrNotFound; + iRingingType = KErrNotFound; + iVibra = KErrNotFound; + i3DEffect = KErrNotFound; + i3DEcho = KErrNotFound; + iFileSize = KErrNotFound; + iFullName = 0; + iActiveProfileRead = EFalse; + iPlayerStatus = EPlayerNotCreated; + + } + +void CMFPreviewHandlerBase::ConstructL() + { + // To allow/not allow screensaver + // Errors ignored, no actions needed if API is not available + //iProperty.Attach( KPSUidScreenSaver, KScreenSaverAllowScreenSaver ); + TRAP_IGNORE(User::LeaveIfError( iApaSession.Connect() ) ); + + TRAP_IGNORE( ReadDefaultToneL() ); + // To keep backlight on while a video is being previewed + iBacklightTimer = CPeriodic::NewL( EPriorityLow ); + } + +CMFPreviewHandlerBase::~CMFPreviewHandlerBase() + { + delete iFullName; + iProperty.Close(); + + iApaSession.Close(); + } + +void CMFPreviewHandlerBase::SetAttrL( const TDesC& aFileName ) + { + if ( aFileName.Length() ) + { + delete iFullName; + iFullName = 0; + iFullName = aFileName.AllocL(); + } + } + +TInt CMFPreviewHandlerBase::RingingVolume() + { + const TInt KDefaultVolumeLevel = 7; // see profile.hrh for volume levels + + if ( iRingingVolume != KErrNotFound ) + { + return iRingingVolume; + } + + if ( iActiveProfileRead ) + { + return iActiveProfileRingingVolume; + } + + return KDefaultVolumeLevel; + } + +TInt CMFPreviewHandlerBase::RingingType() + { + if ( iRingingType != KErrNotFound ) + { + return iRingingType; + } + + if ( iActiveProfileRead ) + { + return iActiveProfileRingingType; + } + + return ERingingTypeRinging; + } + +TInt CMFPreviewHandlerBase::Vibra() + { + if ( iVibra != KErrNotFound ) + { + return iVibra; + } + + if ( iActiveProfileRead ) + { + return iActiveProfileVibra; + } + + return 0; // in case of error vibra is off + } + +TInt CMFPreviewHandlerBase::Echo3D() + { + if ( i3DEcho != KErrNotFound ) + { + return i3DEcho; + } + + if ( iActiveProfileRead ) + { + return iActiveProfile3DEcho; + } + + return EProfile3DEchoOff; // from ProfileInternal.hrh + } + +TInt CMFPreviewHandlerBase::Effect3D() + { + if ( i3DEffect != KErrNotFound ) + { + return i3DEffect; + } + + if ( iActiveProfileRead ) + { + return iActiveProfile3DEffect; + } + + return EProfile3DEffectOff; + } + +TInt CMFPreviewHandlerBase::ConvertVolume( TInt aVolume, TInt aMaxVolume ) + { + const TInt KMinVolumeLevel = 1; + const TInt KMaxVolumeLevel = 10; + + TInt result = aMaxVolume * aVolume / KMaxVolumeLevel; + + // if user has selected minimum volume level set HW volume 1 + if ( aVolume == KMinVolumeLevel && result == 0 ) + { + result = 1; + } + + return result; + } + +void CMFPreviewHandlerBase::ReadActiveProfileL() + { + iActiveProfileRead = EFalse; + + MProfileEngine* profileEngine = CreateProfileEngineL(); + CleanupReleasePushL( *profileEngine ); + + MProfile* activeProfile = profileEngine->ActiveProfileL(); + CleanupReleasePushL( *activeProfile ); + + const MProfileTones& profileTones = activeProfile->ProfileTones(); + + const TProfileToneSettings& toneSettings = profileTones.ToneSettings(); + iActiveProfileVibra = toneSettings.iVibratingAlert; + iActiveProfileRingingVolume = toneSettings.iRingingVolume; + iActiveProfileRingingType = toneSettings.iRingingType; + + const MProfileExtraSettings& extra = activeProfile->ProfileExtraSettings(); + const MProfile3DToneSettings& threeD = extra.Profile3DToneSettings(); + + iActiveProfile3DEffect = threeD.Effect(); + iActiveProfile3DEcho = threeD.Echo(); + + CleanupStack::PopAndDestroy( activeProfile ); + CleanupStack::PopAndDestroy( profileEngine ); + + iActiveProfileRead = ETrue; + } + +void CMFPreviewHandlerBase::ReadDefaultToneL() + { + CRepository* cenrep = CRepository::NewLC( KCRUidProfileEngine ); + + User::LeaveIfError( cenrep->Get( KProEngDefaultRingingTone, iDefaultTone ) ); + CleanupStack::PopAndDestroy( cenrep ); + } + +TInt CMFPreviewHandlerBase::GetDataType( const TDesC& aFileName, TDataType& aDataType ) + { + TUid dummyUid( KNullUid ); + return iApaSession.AppForDocument( aFileName, dummyUid, aDataType ); + } + +TInt CMFPreviewHandlerBase::DoResetInactivityTimer( TAny* /*aObject*/ ) + { + User::ResetInactivityTime(); + return KErrNone; + } + +void CMFPreviewHandlerBase::DisableBackLight() + { + const TInt KResetInactivityTimerDelay = 2000000; + iBacklightTimer->Cancel(); // Just in case + // Disable backlight turn off during video preview + iBacklightTimer->Start( KResetInactivityTimerDelay, + KResetInactivityTimerDelay, + TCallBack( DoResetInactivityTimer, 0 ) ); + + } + +CTonePlayer* CTonePlayer::NewL( MTonePlayingWatcher *aWatcher ) + { + CTonePlayer* self = CTonePlayer::NewLC( aWatcher ); + CleanupStack::Pop(); + return self; + } + +CTonePlayer* CTonePlayer::NewLC( MTonePlayingWatcher *aWatcher ) + { + CTonePlayer* self = new ( ELeave ) CTonePlayer( aWatcher ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +void CTonePlayer::ConstructL() + { + iAudioPlayerStatus = EPlayerNotCreated; + CMFPreviewHandlerBase::ConstructL(); + iTonePlayerStatus = EPlayerNotCreated; + CCoeEnv* coeEnv = CCoeEnv::Static(); + coeEnv->AddForegroundObserverL( *this ); + } + +CTonePlayer::CTonePlayer( MTonePlayingWatcher *aWatcher ) : iTonePlayWatcher( aWatcher ) + { + } + +CTonePlayer::~CTonePlayer() + { + Cancel(); + + delete iAudioPlayer; + delete iTonePlayer; + delete i3dRingingTonePlugin; + } + +TBool CTonePlayer::IsPlaying() + { + if ( iAudioPlayerStatus != EPlayerNotCreated ) + { + return ETrue; + } + + if ( iTonePlayerStatus != EPlayerNotCreated ) + { + return ETrue; + } + + return EFalse; + } + +void CTonePlayer::PlayL() + { + //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" ); + + // rng mime type + _LIT( KFileListRngMimeType, "application/vnd.nokia.ringing-tone" ); + + Cancel(); // stop previous play + + if ( !iFullName || iFullName->Des().Length() == 0 ) + { + User::Leave( KErrNotFound ); + } + + TRAP_IGNORE( ReadActiveProfileL() ); + + TPtrC fileName( iFullName->Des() ); + TDataType dataType; + TInt err = GetDataType( fileName, dataType ); + if ( err == KErrNotFound ) + { + fileName.Set( iDefaultTone ); + if ( fileName.Length() == 0 ) + { + User::Leave( KErrNotFound ); + } + } + else if ( err != KErrNone ) + { + User::Leave( err ); + } + + TBool mimeTypeRng = EFalse; + + if ( err == KErrNone ) + { + if( dataType.Des().CompareF( KFileListRngMimeType ) == 0 ) + { + mimeTypeRng = ETrue; + } + } + + TInt ringingType = RingingType(); + if ( ringingType == ERingingTypeBeepOnce ) + { + // Active profile ringing tone is set to Beep Once + // Don't initialize a FileSequence but use DesSequence instead + iTonePlayer = CMdaAudioToneUtility::NewL( *this ); + iTonePlayer->PrepareToPlayDesSequence( KFileListBeepSequence() ); + iTonePlayerStatus = EPlayerInitializing; + } + else + { + if( mimeTypeRng ) + { + //Ringingtone is a RNG-file + iTonePlayer = CMdaAudioToneUtility::NewL( *this ); + iTonePlayer->PrepareToPlayFileSequence( fileName ); + iTonePlayerStatus = EPlayerInitializing; + } + else + { + delete iAudioPlayer; + iAudioPlayer = 0; + + iAudioPlayer = CDrmPlayerUtility::NewFilePlayerL( + fileName, *this, KAudioPriorityRingingTonePreview, + ( TMdaPriorityPreference )KAudioPrefRingFilePreview ); + + iAudioPlayerStatus = EPlayerInitializing; + } + } + DisableBackLight(); + } + +void CTonePlayer::Stop() + { + Cancel(); + } + +TInt CTonePlayer::ConvertVolume( TInt aVolume ) + { + TInt result = 0; + if ( iAudioPlayer ) + { + result = CMFPreviewHandlerBase::ConvertVolume( aVolume, iAudioPlayer->MaxVolume() ); + } + else if ( iTonePlayer ) + { + result = CMFPreviewHandlerBase::ConvertVolume( aVolume, iTonePlayer->MaxVolume() ); + } + + //if user has selected silent ringing type, set volume off + TInt ringingType = RingingType(); + if( ringingType == ERingingTypeSilent ) + { + result = 0; + } + + return result; + } + +void CTonePlayer::SetToneRingingType( TInt aRingingType ) + { + const TInt KToneInterval = 1000000; // 1 second pause between tones + const TInt KAscendingVolumeInterval = 3000000; // 3 seconds + + if ( !iTonePlayer ) + { + return; + } + TInt ringingVolume = RingingVolume(); + + switch( aRingingType ) + { + case ERingingTypeRinging: + case ERingingTypeSilent: + { + iTonePlayer->SetRepeats( KMdaAudioToneRepeatForever, + TTimeIntervalMicroSeconds( KToneInterval ) ); + break; + } + case ERingingTypeAscending: + { + iTonePlayer->SetRepeats( KMdaAudioToneRepeatForever, + TTimeIntervalMicroSeconds( KToneInterval ) ); + + TInt volRamp = KAscendingVolumeInterval * ringingVolume; + iTonePlayer->SetVolumeRamp( TTimeIntervalMicroSeconds( volRamp ) ); + break; + } + case ERingingTypeRingOnce: + case ERingingTypeBeepOnce: + { + iTonePlayer->SetRepeats( 0, TTimeIntervalMicroSeconds( KToneInterval ) ); + break; + } + default: + { + break; + } + } + } + +void CTonePlayer::SetAudioRingingType( TInt aRingingType ) + { + const TInt KToneInterval = 1000000; // 1 second pause between tones + const TInt KAscendingVolumeInterval = 3000000; // 3 seconds + + if ( !iAudioPlayer ) + { + return; + } + + TInt ringingVolume = RingingVolume(); + + switch( aRingingType ) + { + case ERingingTypeRinging: + case ERingingTypeSilent: + { + iAudioPlayer->SetRepeats( KMdaAudioToneRepeatForever, + TTimeIntervalMicroSeconds( KToneInterval ) ); + break; + } + case ERingingTypeAscending: + { + iAudioPlayer->SetRepeats( KMdaAudioToneRepeatForever, + TTimeIntervalMicroSeconds( KToneInterval ) ); + TInt volRamp = KAscendingVolumeInterval * ringingVolume; + iAudioPlayer->SetVolumeRamp( TTimeIntervalMicroSeconds( volRamp ) ); + break; + } + case ERingingTypeRingOnce: + { + iAudioPlayer->SetRepeats( 0, TTimeIntervalMicroSeconds( KToneInterval ) ); + break; + } + + default: + { + break; + } + } + } + +void CTonePlayer::Cancel() + { + TBool isPlaying = EFalse; + + if ( iAudioPlayer ) + { + isPlaying = ETrue; + if ( iAudioPlayerStatus == EPlayerPlayingWith3DEffect ) + { + i3dRingingTonePlugin->Stop(); + // plugin calls AudioPlayer->Stop() + iAudioPlayer->Close(); + } + if ( iAudioPlayerStatus == EPlayerPlaying ) + { + iAudioPlayer->Stop(); + iAudioPlayer->Close(); + } + + delete iAudioPlayer; + iAudioPlayer = 0; + iAudioPlayerStatus = EPlayerNotCreated; + } + + if ( iTonePlayer ) + { + isPlaying = ETrue; + if ( iTonePlayerStatus == EPlayerPlaying ) + { + iTonePlayer->CancelPlay(); + } + + delete iTonePlayer; + iTonePlayer = 0; + iTonePlayerStatus = EPlayerNotCreated; + } + + + if ( isPlaying ) + { + //User::InfoPrint(_L("cancel")); +// EnableScreenSaver( ETrue ); + iBacklightTimer->Cancel(); + } + } + +void CTonePlayer::MatoPlayComplete( TInt aError ) + { + Cancel(); + iTonePlayWatcher->HandlePreviewEvent( aError ); + } + +void CTonePlayer::MatoPrepareComplete( TInt aError ) + { + if ( aError != KErrNone ) + { + Cancel(); + + iTonePlayWatcher->HandlePreviewEvent( aError ); + return; + } + + TInt ringingVolume = RingingVolume(); + TInt ringingType = RingingType(); + TInt vibra = Vibra(); + + iTonePlayerStatus = EPlayerInitialized; + SetToneRingingType( ringingType ); + iTonePlayer->SetVolume( ConvertVolume( ringingVolume ) ); + + TMdaPriorityPreference pref = (TMdaPriorityPreference) KAudioPrefRingFilePreview; + if ( vibra ) + { + pref = (TMdaPriorityPreference) KAudioPrefRingFilePreviewVibra; + } + iTonePlayer->SetPriority( KAudioPriorityPreview, pref ); + + iTonePlayer->Play(); + iTonePlayerStatus = EPlayerPlaying; + } + +void CTonePlayer::MdapcInitComplete( TInt aError, + const TTimeIntervalMicroSeconds& /* aDuration */ ) + { + if ( aError != KErrNone ) + { + Cancel(); + iTonePlayWatcher->HandlePreviewEvent( aError ); + return; + } + + + TInt ringingVolume = RingingVolume(); + TInt ringingType = RingingType(); + TInt vibra = Vibra(); + TInt echo3D = Echo3D(); + TInt effect3D = Effect3D(); + + + + iAudioPlayerStatus = EPlayerInitialized; + SetAudioRingingType( ringingType ); + iAudioPlayer->SetVolume( ConvertVolume( ringingVolume ) ); + + TMdaPriorityPreference pref = (TMdaPriorityPreference) KAudioPrefRingFilePreview; + if ( vibra ) + { + pref = (TMdaPriorityPreference) KAudioPrefRingFilePreviewVibra; + } + iAudioPlayer->SetPriority( KAudioPriorityPreview, pref ); + + iAudioPlayerStatus = EPlayerPlaying; + + if ( effect3D == EProfile3DEffectOff ) + { + iAudioPlayer->Play(); // 3D not used + return; + } + + if ( !i3dRingingTonePlugin ) + { + TUid emptyUid = { 0 }; + TRAPD( err, i3dRingingTonePlugin = C3DRingingToneInterface::NewL( emptyUid ) ); + if ( err != KErrNone || !i3dRingingTonePlugin ) + { + iAudioPlayer->Play(); + return; + } + } + + i3dRingingTonePlugin->SetAttr( E3DRTIAttr3DEffect, effect3D ); + i3dRingingTonePlugin->SetAttr( E3DRTIAttr3DEcho, echo3D ); + i3dRingingTonePlugin->SetAttr( E3DRTIAttrDrmPlayerUtility, iAudioPlayer ); + TRAP_IGNORE( i3dRingingTonePlugin->PlayL() ); + + iAudioPlayerStatus = EPlayerPlayingWith3DEffect; + } + +void CTonePlayer::MdapcPlayComplete( TInt aError ) + { + Cancel(); + iTonePlayWatcher->HandlePreviewEvent( aError ); + } + +void CTonePlayer::HandleLosingForeground() + { + if ( IsPlaying() ) + { + Stop(); + } + } +void CTonePlayer::HandleGainingForeground() + { + + } diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/tonefetcherengine/private/CTonePlayer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/CTonePlayer.h Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,202 @@ +/* + * 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: + * The header file for tone playing. + * + */ + +#ifndef CTONEPLAYER_H +#define CTONEPLAYER_H + +#include +#include +#include +#include +#include +#include +#include // for RApaLsSession +#include + +class C3DRingingToneInterface; +class RWindow; +class MTonePlayingWatcher; +/** +* CMFPreviewHandlerBase +* +* Base class for CMFAudioPreviewHandler. + */ +class CMFPreviewHandlerBase : public CBase + + { + public: + enum TMediaFileType + { + EMediaFileTypeAudio = 0, + EMediaFileTypeVideo + }; + enum TPlayerStatus + { + EPlayerNotCreated, + EPlayerInitializing, + EPlayerReady, + EPlayerPlaying, + EPlayerInitialized, + EPlayerPlayingWith3DEffect + }; + + // these must match with the ones in Profile Engine + enum TRingingTypes + { + ERingingTypeRinging = 0, + ERingingTypeAscending, + ERingingTypeRingOnce, + ERingingTypeBeepOnce, + ERingingTypeSilent + }; + + enum TFLAllowScreenSaver + { + EFLScreenSaverAllowed = 0, EFLScreenSaverNotAllowed + }; + public: + void SetAttrL(const TDesC& aFileName); + TInt Attr(TInt aAttr); + virtual void PlayL() = 0; + virtual void Stop() = 0; + virtual TBool IsPlaying() = 0; + + protected: + virtual ~CMFPreviewHandlerBase(); + + protected: + /** + * C++ default constructor. + */ + CMFPreviewHandlerBase( ); + /** + * By default Symbian OS constructor is private. + */ + void ConstructL(); + + protected: + TInt ConvertVolume(TInt aVolume); + void ReadActiveProfileL(); + TInt GetDataType(const TDesC& aFileName, TDataType& aDataType); + void ReadDefaultToneL(); + void DisableBackLight(); + static TInt DoResetInactivityTimer(TAny* aObject); + TInt RingingVolume(); + TInt RingingType(); + TInt Vibra(); + TInt Echo3D(); + TInt Effect3D(); + static TInt ConvertVolume(TInt aVolume, TInt aMaxVolume); + + protected: + TInt iRingingVolume; + TInt iRingingType; + TInt iVibra; + TInt i3DEffect; + TInt i3DEcho; + TInt iMediaType; + TInt iFileSize; + HBufC* iFullName; + TBool iActiveProfileRead; + TInt iActiveProfileRingingVolume; + TInt iActiveProfileRingingType; + TInt iActiveProfileVibra; + TInt iActiveProfile3DEffect; + TInt iActiveProfile3DEcho; + TInt iPlayerStatus; + // handle to window + RWindow* iWindow; // does not own + // for getting file MIME types + RApaLsSession iApaSession; + // for setting screensaver on/off + RProperty iProperty; + // default ringing tone + TFileName iDefaultTone; + /** + * Timer for resetting the user inactivity timeout + */ + CPeriodic* iBacklightTimer; + }; + +// CLASS DECLARATION +/** + * This class is used for playing the tones. + * + */ + +class CTonePlayer : public CMFPreviewHandlerBase, + public MDrmAudioPlayerCallback, + public MMdaAudioToneObserver, + public MCoeForegroundObserver + { + public: + static CTonePlayer* NewL( MTonePlayingWatcher *aWatcher ); + static CTonePlayer* NewLC( MTonePlayingWatcher *aWatcher ); + virtual ~CTonePlayer(); + + + public: + void PlayL(); + void Stop(); + TBool IsPlaying(); + + private: + CTonePlayer( MTonePlayingWatcher *aWatcher ); + void ConstructL(); + void Cancel(); + void SetAudioRingingType( TInt aRingingType ); + void SetToneRingingType( TInt aRingingType ); + TInt ConvertVolume( TInt aVolume ); + + private: + // from MMdaAudioToneObserver + virtual void MatoPrepareComplete( TInt aError ); + virtual void MatoPlayComplete(TInt aError); + + private: + // from MDrmAudioPlayerCallback + void MdapcInitComplete(TInt aError, + const TTimeIntervalMicroSeconds& aDuration); + void MdapcPlayComplete(TInt aError); + + // from MCoeForegroundObserver + void HandleLosingForeground(); + void HandleGainingForeground(); + + private: + //wacher of the playing process + MTonePlayingWatcher* iTonePlayWatcher; + + // audio player + CDrmPlayerUtility* iAudioPlayer; + + /// Audioplayer status + TPlayerStatus iAudioPlayerStatus; + + /// toneplayer + CMdaAudioToneUtility* iTonePlayer; + + /// Toneplayer status + TPlayerStatus iTonePlayerStatus; + + // plugin for playing 3D effects + C3DRingingToneInterface* i3dRingingTonePlugin; + + }; + +#endif /* CTONEPLAYER_H */ diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/tonefetcherengine/private/CToneSelection.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/CToneSelection.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,405 @@ +/* + * 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: + * The source file for mde tone fetcher. + * + */ +#include "CToneSelection.h" +#include +#include +#include "tonefetcherengine.h" +#include "MToneSelectionWatcher.h" +#include +#include +#include +#include + +//refresh interval, 2 seconds. +const TInt KTimerInterval = 2 * 1000 * 1000; +const TInt KObserverCallStep = 100; +// CONSTANTS +_LIT( KMimeMp3, "mp3" ); + +CMFActiveCaller* CMFActiveCaller::NewL( CToneSelection* aObserver ) + { + CMFActiveCaller* self = new (ELeave) CMFActiveCaller( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +CMFActiveCaller::~CMFActiveCaller() + { + Cancel(); + iTimer.Close(); + } + +CMFActiveCaller::CMFActiveCaller(CToneSelection* aObserver) : CActive(CActive::EPriorityStandard) + { + iObserver = aObserver; + } + +void CMFActiveCaller::ConstructL() + { + User::LeaveIfError( iTimer.CreateLocal() ); + CActiveScheduler::Add( this ); + } + +void CMFActiveCaller::DoCancel() + { + iTimer.Cancel(); + } + +void CMFActiveCaller::RunL() + { + iObserver->ChangeObject(); + } + +void CMFActiveCaller::Request() + { + Cancel(); + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + +void CMFActiveCaller::Start( TInt aMilliseconds ) + { + Cancel(); + + if ( aMilliseconds <= 0 ) + { + Request(); // no delay - complete asap + } + else + { + iTimer.After( iStatus, aMilliseconds ); + SetActive(); + } + } + +void CMFActiveCaller::Stop() + { + Cancel(); + } + +CToneSelection* CToneSelection::NewL( MToneSelectionWatcher *aWatcher ) + { + CToneSelection* self = CToneSelection::NewLC(aWatcher); + CleanupStack::Pop( self ); + return self; + } + +CToneSelection* CToneSelection::NewLC( MToneSelectionWatcher *aWatcher ) + { + CToneSelection* self = new ( ELeave ) CToneSelection( aWatcher ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +void CToneSelection::ConstructL() + { + iSession = CMdESession::NewL( *this ); + iObjectNotificationCaller = CMFActiveCaller::NewL( this ); + } + +CToneSelection::CToneSelection( MToneSelectionWatcher *aWatcher ) : iToneSelectionWatcher( aWatcher ) + { + iMediaFileCounter = 0; + iIsQuerying = EFalse; + } + +CToneSelection::~CToneSelection() + { + iResultArray.ResetAndDestroy(); + delete iQuery; + delete iSession; + delete iObjectNotificationCaller; + } + +void CToneSelection::HandleSessionOpened( CMdESession& /*aSession*/, TInt aError ) + { + if ( aError != KErrNone ) + { + iDefNS = 0; + delete iSession; + iSession = 0; + iSessionOpen = EFalse; + iToneSelectionWatcher->HandleMdeSessionError( aError ); + } + else + { + iDefNS = &iSession->GetDefaultNamespaceDefL(); + iSessionOpen = ETrue; + TRAP_IGNORE( AddObjectObserverL() ); + iToneSelectionWatcher->HandleMdeSessionOpened(); + } + } + + + +void CToneSelection::HandleSessionError( CMdESession& /*aSession*/, TInt aError ) + { + if ( aError == KErrNone ) + { + return; + } + + delete iSession; + iSession = 0; + iSessionOpen = EFalse; + iToneSelectionWatcher->HandleMdeSessionError( aError ); + } + +void CToneSelection::HandleQueryNewResults( CMdEQuery& /*aQuery*/, + TInt /*aFirstNewItemIndex*/, + TInt /*aNewItemCount*/ ) + { + } + +void CToneSelection::HandleObjectNotification( CMdESession& /*aSession*/, + TObserverNotificationType aType, + const RArray& aObjectIdArray ) + { + /*if ( aObjectIdArray.Count() > 0 && ( aType == ENotifyAdd || aType == ENotifyModify || aType == ENotifyRemove ) ) + { + QString str("CToneSelection::HandleObjectNotification " + QString::number(aObjectIdArray.Count()) + " " + QString::number(aType)); + TF_LOG(str); + iMediaFileCounter = iMediaFileCounter + aObjectIdArray.Count(); + if ( iMediaFileCounter >= KObserverCallStep ) + { + iMediaFileCounter = 0; + iToneSelectionWatcher->HandleObjectChanged(); + } + else + { + iObjectNotificationCaller->Start(KTimerInterval); + } + }*/ + } + +void CToneSelection::AddObjectObserverL() + { + if ( iSessionOpen ) + { + TUint32 notificationType = ENotifyAdd | ENotifyModify | ENotifyRemove; + iSession->AddObjectObserverL( *this, 0, notificationType, iDefNS ); + + iSession->AddObjectPresentObserverL( *this ); + } + } + +void CToneSelection::HandleObjectPresentNotification( CMdESession& /*aSession*/, + TBool /*aPresent*/, const RArray& aObjectIdArray ) + { + + if( aObjectIdArray.Count() > 0 ) + { + //if query is executing, we do not allow the fresh of contents + if ( iIsQuerying ) + { + iMediaFileCounter = 0; + return; + } + QString str("CToneSelection::HandleObjectPresentNotification " + QString::number(aObjectIdArray.Count())); + TF_LOG(str); + iMediaFileCounter = iMediaFileCounter + aObjectIdArray.Count(); + if ( iMediaFileCounter > KObserverCallStep ) + { + iMediaFileCounter = 0; + iToneSelectionWatcher->HandleObjectChanged(); + } + else + { + iObjectNotificationCaller->Start(KTimerInterval); + } + } + } + +void CToneSelection::HandleQueryCompleted( CMdEQuery& aQuery, TInt aError ) + { + iIsQuerying = EFalse; + iResultArray.ResetAndDestroy(); + if ( aError == KErrCancel ) + { + iToneSelectionWatcher->HandleQueryError( aError ); + return; + } + else + { + CMdEObjectQuery* query = static_cast (&aQuery); + TInt count = query->Count(); + for (TInt i = 0; i < count; ++i) + { + CMdEObject* object = + (CMdEObject*) query->TakeOwnershipOfResult(i); + CleanupStack::PushL(object); + CMdEPropertyDef& propDef = + CToneSelection::PropertyDefL( iSession, CToneSelection::EAttrSongName ); + + CMdEProperty* property = 0; + TInt err = object->Property( propDef, property, 0 ); + if ( err != KErrNotFound && property ) + { + HBufC* songUri = HBufC::NewL( object->Uri().Length() ); + TPtr ptr = songUri->Des(); + ptr.Copy( object->Uri() ); + iResultArray.AppendL( songUri ); + } + CleanupStack::PopAndDestroy( object ); + } + iToneSelectionWatcher->HandleQueryComplete( iResultArray ); + } + } + +void CToneSelection::QueryTonesL() + { + LeaveIfSessionClosedL(); + delete iQuery; + iQuery = 0; + CMdEObjectDef& musicObjectDef = + iDefNS->GetObjectDefL( MdeConstants::Audio::KAudioObject ); + iQuery = iSession->NewObjectQueryL( *iDefNS, musicObjectDef, this ); + + // set attributes that are included in query result + CMdEPropertyDef& namePropertyDef = PropertyDefL( EAttrSongName ); + iQuery->AddPropertyFilterL( &namePropertyDef ); + + iQuery->SetResultMode( EQueryResultModeItem ); + + CMdELogicCondition& conditions = iQuery->Conditions(); + ExcludeMusicPropertiesL( conditions ); + iIsQuerying = ETrue; + iQuery->FindL(); + } + +void CToneSelection::LeaveIfSessionClosedL() + { + if ( !iSession || !iSessionOpen ) + { + User::Leave( KErrDisconnected ); + } + } + +CMdEPropertyDef& CToneSelection::PropertyDefL( TInt aAttr ) + { + return PropertyDefL( iSession, aAttr ); + } + +CMdEPropertyDef& CToneSelection::PropertyDefL( CMdESession* aSession, TInt aAttr ) + { + CMdEObjectDef& objectDef = + iDefNS->GetObjectDefL( MdeConstants::Audio::KAudioObject ); + + if ( aAttr == EAttrFileSize ) + { + return objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty ); + } + else if ( aAttr == EAttrMediaType ) + { + return objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty ); + } + else if ( aAttr == EAttrSongName || aAttr == EAttrFileName ) + { + return objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty ); + } + else if ( aAttr == EAttrArtist ) + { + return objectDef.GetPropertyDefL( MdeConstants::MediaObject::KArtistProperty ); + } + else if ( aAttr == EAttrAlbum ) + { + return objectDef.GetPropertyDefL( MdeConstants::Audio::KAlbumProperty ); + } + else if ( aAttr == EAttrGenre ) + { + return objectDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty ); + } + else if ( aAttr == EAttrComposer ) + { + return objectDef.GetPropertyDefL( MdeConstants::Audio::KComposerProperty ); + } + else + { + User::Leave( KErrNotSupported ); + } + } + +void CToneSelection::ExcludeMusicPropertiesL( CMdELogicCondition& aCondition ) + { + TInt sizeLimitKB = 0; + CRepository* cenrep = CRepository::NewL( KCRUidProfileEngine ); + CleanupStack::PushL( cenrep ); + User::LeaveIfError( cenrep->Get( KProEngRingingToneMaxSize, sizeLimitKB ) ); + CleanupStack::PopAndDestroy(); // cenrep + + SetAttr( CToneSelection::EAttrFileSize, sizeLimitKB ); + CMdEPropertyDef& sizeTypeDef = PropertyDefL( EAttrFileSize ); + CMdEPropertyDef& mimeTypeDef = PropertyDefL( EAttrMediaType ); + CMdEPropertyDef& artistTypeDef = PropertyDefL( EAttrArtist ); + CMdEPropertyDef& albumTypeDef = PropertyDefL( EAttrAlbum ); + CMdEPropertyDef& genreTypeDef = PropertyDefL( EAttrGenre ); + CMdEPropertyDef& composerTypeDef = PropertyDefL( EAttrComposer ); + + CMdELogicCondition& condition = + aCondition.AddLogicConditionL( ELogicConditionOperatorAnd ); + condition.AddPropertyConditionL( sizeTypeDef, TMdEIntRange(0, iMaxFileSize, EMdERangeTypeBetween) ); + condition.AddPropertyConditionL( mimeTypeDef, + ETextPropertyConditionCompareContains, KMimeMp3 ); + condition.AddPropertyConditionL( artistTypeDef ); + condition.AddPropertyConditionL( albumTypeDef ); + condition.AddPropertyConditionL( genreTypeDef ); + condition.AddPropertyConditionL( composerTypeDef ); + + condition.SetNegate( ETrue ); + } + +void CToneSelection::SetAttr( int attr, int value ) +{ + switch ( attr ) + { + case CToneSelection::EAttrFileSize: + { + iMaxFileSize = value; + break; + } + default: + { + break; + } + } +} + +void CToneSelection::ChangeObject() + { + if ( QueryReady() ) + { + iToneSelectionWatcher->HandleObjectChanged(); + } + } + +TBool CToneSelection::QueryReady() + { + if ( iQuery ) + { + return iQuery->IsComplete(); + } + + return ETrue; + } +// End of File + diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/tonefetcherengine/private/CToneSelection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/CToneSelection.h Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,170 @@ +/* + * 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: + * The header file for mde tone fetcher. + * + */ + +#ifndef CTONESELECTION_H +#define CTONESELECTION_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class MToneSelectionWatcher; +class CToneSelection; + +/** +* CMFActiveCaller +* +* CMFActiveCaller is used for generating a call from active scheduler. +* Typical use is to start some operation after a short delay. +*/ +NONSHARABLE_CLASS (CMFActiveCaller) : public CActive + { + public: + static CMFActiveCaller* NewL( CToneSelection* aObserver ); + virtual ~CMFActiveCaller(); + + private: + CMFActiveCaller( CToneSelection* aObserver ); + void ConstructL(); + + public: + void Start( TInt aMilliseconds ); + void Stop(); + void Request(); + + private: + void RunL(); + void DoCancel(); + + private: + // timer + RTimer iTimer; + + // observer that gets called + CToneSelection* iObserver; + }; + +// CLASS DECLARATION +/** + * This class is used for quering tones from mde. + * + */ +class CToneSelection : public CBase, + public MMdESessionObserver, + public MMdEQueryObserver, + public MMdEObjectObserver, + public MMdEObjectPresentObserver + { + public: + enum TStorageType + { + EPhoneMemory = 0, ERomStorage, EMassStorage, EMemoryCard + }; + + enum TQueryAttribute + { + EAttrMediaType = 20, // integer + EAttrFileSize, // integer + EAttrStorageType, // integer + EAttrMediaFileId, // integer + EAttrFileName, // string + EAttrFullName, // string + EAttrSongName, // string + EAttrArtist, // string + EAttrAlbum, // string + EAttrGenre, // string + EAttrComposer + }; + + public: + static CToneSelection* NewL( MToneSelectionWatcher *aWatcher ); + static CToneSelection* NewLC( MToneSelectionWatcher *aWatcher ); + + virtual ~CToneSelection(); + //iTimer's callback function. + void ChangeObject(); + void QueryTonesL(); + void SetAttr( int attr, int value ); + TBool QueryReady(); + + private: + CToneSelection( MToneSelectionWatcher *aWatcher ); + void ConstructL(); + void ExcludeMusicPropertiesL( CMdELogicCondition& aCondition ); + void LeaveIfSessionClosedL(); + CMdEPropertyDef& PropertyDefL(TInt aAttr); + CMdEPropertyDef& PropertyDefL(CMdESession* aSession, TInt aAttr); + + private: + // from MMdESessionObserver + void HandleSessionOpened( CMdESession& aSession, TInt aError ); + void HandleSessionError( CMdESession& aSession, TInt aError ); + + private: + // from MMdEQueryObserver (mdequery.h) + void HandleQueryNewResults( CMdEQuery& aQuery, TInt aFirstNewItemIndex, + TInt aNewItemCount ); + void HandleQueryCompleted( CMdEQuery& aQuery, TInt aError ); + private: + // from MMdEObjectObserver + void HandleObjectNotification( CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aObjectIdArray ); + + private: + // from MMdEObjectPresentObserver + void HandleObjectPresentNotification( CMdESession& aSession, + TBool aPresent, const RArray& aObjectIdArray); + void AddObjectObserverL(); + void HandleObjectChanged(); + private: + + MToneSelectionWatcher* iToneSelectionWatcher; + + // session to metadata engine + CMdESession* iSession; + + CMdENamespaceDef* iDefNS; + + // metadata query + CMdEObjectQuery* iQuery; + TBool iIsQuerying; + + // used for saving the quering result. + RPointerArray iResultArray; + + // is metadata session open + TBool iSessionOpen; + + // max audio file file size + TInt iMaxFileSize; + + TInt iMediaFileCounter; + // for generating active object calls + CMFActiveCaller* iObjectNotificationCaller; + + }; +#endif /* CTONESELECTION_H */ + diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/tonefetcherengine/private/MTonePlayingWatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/MTonePlayingWatcher.h Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,34 @@ +/* + * 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 MTONEPLAYINGWATCHER_H +#define MTONEPLAYINGWATCHER_H + +#include + +/* + * this class is used to watch tone playing event, inherited by ToneFetcherEnginePrivate + */ +class MTonePlayingWatcher + { + public: + // handle preview event + virtual void HandlePreviewEvent( TInt event ) = 0; + }; + +#endif /* MTONEPLAYINGWATCHER_H */ diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/tonefetcherengine/private/MToneSelectionWatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/MToneSelectionWatcher.h Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,47 @@ +/* + * 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 MTONESELECTIONWATCHER_H +#define MTONESELECTIONWATCHER_H + +#include +#include + +/* + * this class is used to watch MDE system change, inherited by ToneFetcherEnginePrivate + */ +class MToneSelectionWatcher + { + public: + // handle mde session error event + virtual void HandleMdeSessionError( TInt aError ) = 0; + + // handle mde session open event + virtual void HandleMdeSessionOpened() = 0; + + // handle query error event + virtual void HandleQueryError( TInt aError ) = 0; + + // handle query complete event + virtual void HandleQueryComplete( RPointerArray& ) = 0; + + // handle object changed event + virtual void HandleObjectChanged() = 0; + }; + +#endif /* MTONESELECTIONWATCHER_H */ diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/tonepreviewprivate.cpp --- a/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/tonepreviewprivate.cpp Thu Jun 10 16:07:41 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,612 +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: - * The source file for tone previewing. - * - */ -#include "tonepreviewprivate.h" -#include "tonefetcherutils.h" -#include // KAudioPriorityPreview -#include // C3DRingingToneInterface -#include // for phone call states -#include -#include -#include -#include "TProfileToneSettings.h" -#include -#include -#include -#include // KProEngDefaultRingingTone -#include -#include - -CMFPreviewHandlerBase::CMFPreviewHandlerBase( QObject *parent ) : QObject( parent ) - { - iMediaType = KErrNotFound; - iRingingVolume = KErrNotFound; - iRingingType = KErrNotFound; - iVibra = KErrNotFound; - i3DEffect = KErrNotFound; - i3DEcho = KErrNotFound; - iFileSize = KErrNotFound; - iFullName = 0; - iActiveProfileRead = EFalse; - iPlayerStatus = EPlayerNotCreated; - - } - -void CMFPreviewHandlerBase::ConstructL() - { - // To allow/not allow screensaver - // Errors ignored, no actions needed if API is not available - //iProperty.Attach( KPSUidScreenSaver, KScreenSaverAllowScreenSaver ); - TRAP_IGNORE(User::LeaveIfError( iApaSession.Connect() ) ); - - TRAP_IGNORE( ReadDefaultToneL() ); - // To keep backlight on while a video is being previewed - iBacklightTimer = CPeriodic::NewL( EPriorityLow ); - } - -CMFPreviewHandlerBase::~CMFPreviewHandlerBase() - { - delete iFullName; - iProperty.Close(); - - iApaSession.Close(); - } - -void CMFPreviewHandlerBase::SetAttr(const QString &file ) - { - if ( !file.isNull() ) - { - QString path = ToneFetcherUtils::normalizeSeperator(file); - delete iFullName; - iFullName = 0; - iFullName = XQConversions::qStringToS60Desc( path ); - } - } - -TInt CMFPreviewHandlerBase::RingingVolume() - { - const TInt KDefaultVolumeLevel = 7; // see profile.hrh for volume levels - - if ( iRingingVolume != KErrNotFound ) - { - return iRingingVolume; - } - - if ( iActiveProfileRead ) - { - return iActiveProfileRingingVolume; - } - - return KDefaultVolumeLevel; - } - -TInt CMFPreviewHandlerBase::RingingType() - { - if ( iRingingType != KErrNotFound ) - { - return iRingingType; - } - - if ( iActiveProfileRead ) - { - return iActiveProfileRingingType; - } - - return ERingingTypeRinging; - } - -TInt CMFPreviewHandlerBase::Vibra() - { - if ( iVibra != KErrNotFound ) - { - return iVibra; - } - - if ( iActiveProfileRead ) - { - return iActiveProfileVibra; - } - - return 0; // in case of error vibra is off - } - -TInt CMFPreviewHandlerBase::Echo3D() - { - if ( i3DEcho != KErrNotFound ) - { - return i3DEcho; - } - - if ( iActiveProfileRead ) - { - return iActiveProfile3DEcho; - } - - return EProfile3DEchoOff; // from ProfileInternal.hrh - } - -TInt CMFPreviewHandlerBase::Effect3D() - { - if ( i3DEffect != KErrNotFound ) - { - return i3DEffect; - } - - if ( iActiveProfileRead ) - { - return iActiveProfile3DEffect; - } - - return EProfile3DEffectOff; - } - -TInt CMFPreviewHandlerBase::ConvertVolume( TInt aVolume, TInt aMaxVolume ) - { - const TInt KMinVolumeLevel = 1; - const TInt KMaxVolumeLevel = 10; - - TInt result = aMaxVolume * aVolume / KMaxVolumeLevel; - - // if user has selected minimum volume level set HW volume 1 - if ( aVolume == KMinVolumeLevel && result == 0 ) - { - result = 1; - } - - return result; - } - -void CMFPreviewHandlerBase::ReadActiveProfileL() - { - iActiveProfileRead = EFalse; - - MProfileEngine* profileEngine = CreateProfileEngineL(); - CleanupReleasePushL( *profileEngine ); - - MProfile* activeProfile = profileEngine->ActiveProfileL(); - CleanupReleasePushL( *activeProfile ); - - const MProfileTones& profileTones = activeProfile->ProfileTones(); - - const TProfileToneSettings& toneSettings = profileTones.ToneSettings(); - iActiveProfileVibra = toneSettings.iVibratingAlert; - iActiveProfileRingingVolume = toneSettings.iRingingVolume; - iActiveProfileRingingType = toneSettings.iRingingType; - - const MProfileExtraSettings& extra = activeProfile->ProfileExtraSettings(); - const MProfile3DToneSettings& threeD = extra.Profile3DToneSettings(); - - iActiveProfile3DEffect = threeD.Effect(); - iActiveProfile3DEcho = threeD.Echo(); - - CleanupStack::PopAndDestroy( activeProfile ); - CleanupStack::PopAndDestroy( profileEngine ); - - iActiveProfileRead = ETrue; - } - -void CMFPreviewHandlerBase::ReadDefaultToneL() - { - CRepository* cenrep = CRepository::NewLC( KCRUidProfileEngine ); - - User::LeaveIfError( cenrep->Get( KProEngDefaultRingingTone, iDefaultTone ) ); - CleanupStack::PopAndDestroy( cenrep ); - } - -TInt CMFPreviewHandlerBase::GetDataType( const TDesC& aFileName, TDataType& aDataType ) - { - TUid dummyUid( KNullUid ); - return iApaSession.AppForDocument( aFileName, dummyUid, aDataType ); - } - -TInt CMFPreviewHandlerBase::DoResetInactivityTimer( TAny* /*aObject*/ ) - { - User::ResetInactivityTime(); - return KErrNone; - } - -void CMFPreviewHandlerBase::DisableBackLight() - { - const TInt KResetInactivityTimerDelay = 2000000; - iBacklightTimer->Cancel(); // Just in case - // Disable backlight turn off during video preview - iBacklightTimer->Start( KResetInactivityTimerDelay, - KResetInactivityTimerDelay, - TCallBack( DoResetInactivityTimer, 0 ) ); - - } - - - -TonePreviewPrivate::TonePreviewPrivate( QObject *parent ) : CMFPreviewHandlerBase( parent ) - { - iAudioPlayerStatus = EPlayerNotCreated; - CMFPreviewHandlerBase::ConstructL(); - iTonePlayerStatus = EPlayerNotCreated; - CCoeEnv* coeEnv = CCoeEnv::Static(); - coeEnv->AddForegroundObserverL( *this ); - } - -TonePreviewPrivate::~TonePreviewPrivate() - { - Cancel(); - - delete iAudioPlayer; - delete iTonePlayer; - delete i3dRingingTonePlugin; - } - -TBool TonePreviewPrivate::IsPlaying() - { - if ( iAudioPlayerStatus != EPlayerNotCreated ) - { - return ETrue; - } - - if ( iTonePlayerStatus != EPlayerNotCreated ) - { - return ETrue; - } - - return EFalse; - } - -void TonePreviewPrivate::Play() - { - //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" ); - - // rng mime type - _LIT( KFileListRngMimeType, "application/vnd.nokia.ringing-tone" ); - - Cancel(); // stop previous play - - if ( !iFullName || iFullName->Des().Length() == 0 ) - { - User::Leave( KErrNotFound ); - } - - TRAP_IGNORE( ReadActiveProfileL() ); - - TPtrC fileName( iFullName->Des() ); - TDataType dataType; - TInt err = GetDataType( fileName, dataType ); - if ( err == KErrNotFound ) - { - fileName.Set( iDefaultTone ); - if ( fileName.Length() == 0 ) - { - User::Leave( KErrNotFound ); - } - } - else if ( err != KErrNone ) - { - User::Leave( err ); - } - - TBool mimeTypeRng = EFalse; - - if ( err == KErrNone ) - { - if( dataType.Des().CompareF( KFileListRngMimeType ) == 0 ) - { - mimeTypeRng = ETrue; - } - } - - TInt ringingType = RingingType(); - if ( ringingType == ERingingTypeBeepOnce ) - { - // Active profile ringing tone is set to Beep Once - // Don't initialize a FileSequence but use DesSequence instead - iTonePlayer = CMdaAudioToneUtility::NewL( *this ); - iTonePlayer->PrepareToPlayDesSequence( KFileListBeepSequence() ); - iTonePlayerStatus = EPlayerInitializing; - } - else - { - if( mimeTypeRng ) - { - //Ringingtone is a RNG-file - iTonePlayer = CMdaAudioToneUtility::NewL( *this ); - iTonePlayer->PrepareToPlayFileSequence( fileName ); - iTonePlayerStatus = EPlayerInitializing; - } - else - { - delete iAudioPlayer; - iAudioPlayer = 0; - - iAudioPlayer = CDrmPlayerUtility::NewFilePlayerL( - fileName, *this, KAudioPriorityRingingTonePreview, - ( TMdaPriorityPreference )KAudioPrefRingFilePreview ); - - iAudioPlayerStatus = EPlayerInitializing; - } - } - DisableBackLight(); - } - -void TonePreviewPrivate::Stop() - { - Cancel(); - } - -TInt TonePreviewPrivate::ConvertVolume( TInt aVolume ) - { - TInt result = 0; - if ( iAudioPlayer ) - { - result = CMFPreviewHandlerBase::ConvertVolume( aVolume, iAudioPlayer->MaxVolume() ); - } - else if ( iTonePlayer ) - { - result = CMFPreviewHandlerBase::ConvertVolume( aVolume, iTonePlayer->MaxVolume() ); - } - - //if user has selected silent ringing type, set volume off - TInt ringingType = RingingType(); - if( ringingType == ERingingTypeSilent ) - { - result = 0; - } - - return result; - } - -void TonePreviewPrivate::SetToneRingingType( TInt aRingingType ) - { - const TInt KToneInterval = 1000000; // 1 second pause between tones - const TInt KAscendingVolumeInterval = 3000000; // 3 seconds - - if ( !iTonePlayer ) - { - return; - } - - - TInt ringingVolume = RingingVolume(); - - switch( aRingingType ) - { - case ERingingTypeRinging: - case ERingingTypeSilent: - { - iTonePlayer->SetRepeats( KMdaAudioToneRepeatForever, - TTimeIntervalMicroSeconds( KToneInterval ) ); - break; - } - case ERingingTypeAscending: - { - iTonePlayer->SetRepeats( KMdaAudioToneRepeatForever, - TTimeIntervalMicroSeconds( KToneInterval ) ); - - TInt volRamp = KAscendingVolumeInterval * ringingVolume; - iTonePlayer->SetVolumeRamp( TTimeIntervalMicroSeconds( volRamp ) ); - break; - } - case ERingingTypeRingOnce: - case ERingingTypeBeepOnce: - { - iTonePlayer->SetRepeats( 0, TTimeIntervalMicroSeconds( KToneInterval ) ); - break; - } - default: - { - break; - } - } - } - -void TonePreviewPrivate::SetAudioRingingType( TInt aRingingType ) - { - const TInt KToneInterval = 1000000; // 1 second pause between tones - const TInt KAscendingVolumeInterval = 3000000; // 3 seconds - - if ( !iAudioPlayer ) - { - return; - } - - TInt ringingVolume = RingingVolume(); - - switch( aRingingType ) - { - case ERingingTypeRinging: - case ERingingTypeSilent: - { - iAudioPlayer->SetRepeats( KMdaAudioToneRepeatForever, - TTimeIntervalMicroSeconds( KToneInterval ) ); - break; - } - case ERingingTypeAscending: - { - iAudioPlayer->SetRepeats( KMdaAudioToneRepeatForever, - TTimeIntervalMicroSeconds( KToneInterval ) ); - TInt volRamp = KAscendingVolumeInterval * ringingVolume; - iAudioPlayer->SetVolumeRamp( TTimeIntervalMicroSeconds( volRamp ) ); - break; - } - case ERingingTypeRingOnce: - { - iAudioPlayer->SetRepeats( 0, TTimeIntervalMicroSeconds( KToneInterval ) ); - break; - } - - default: - { - break; - } - } - } - -void TonePreviewPrivate::Cancel() - { - TBool isPlaying = EFalse; - - if ( iAudioPlayer ) - { - isPlaying = ETrue; - if ( iAudioPlayerStatus == EPlayerPlayingWith3DEffect ) - { - i3dRingingTonePlugin->Stop(); - // plugin calls AudioPlayer->Stop() - iAudioPlayer->Close(); - } - if ( iAudioPlayerStatus == EPlayerPlaying ) - { - iAudioPlayer->Stop(); - iAudioPlayer->Close(); - } - - delete iAudioPlayer; - iAudioPlayer = 0; - iAudioPlayerStatus = EPlayerNotCreated; - } - - if ( iTonePlayer ) - { - isPlaying = ETrue; - if ( iTonePlayerStatus == EPlayerPlaying ) - { - iTonePlayer->CancelPlay(); - } - - delete iTonePlayer; - iTonePlayer = 0; - iTonePlayerStatus = EPlayerNotCreated; - } - - - if ( isPlaying ) - { - //User::InfoPrint(_L("cancel")); -// EnableScreenSaver( ETrue ); - iBacklightTimer->Cancel(); - } - } - -void TonePreviewPrivate::MatoPlayComplete( TInt aError ) - { - Cancel(); - emit notifyPreviewEvent( ToneFetcherEngine::EAudioPreviewComplete, aError ); - } - -void TonePreviewPrivate::MatoPrepareComplete( TInt aError ) - { - if ( aError != KErrNone ) - { - Cancel(); - - emit notifyPreviewEvent( ToneFetcherEngine::EPreviewError, aError ); - return; - } - - TInt ringingVolume = RingingVolume(); - TInt ringingType = RingingType(); - TInt vibra = Vibra(); - - iTonePlayerStatus = EPlayerInitialized; - SetToneRingingType( ringingType ); - iTonePlayer->SetVolume( ConvertVolume( ringingVolume ) ); - - TMdaPriorityPreference pref = (TMdaPriorityPreference) KAudioPrefRingFilePreview; - if ( vibra ) - { - pref = (TMdaPriorityPreference) KAudioPrefRingFilePreviewVibra; - } - iTonePlayer->SetPriority( KAudioPriorityPreview, pref ); - - iTonePlayer->Play(); - iTonePlayerStatus = EPlayerPlaying; - } - -void TonePreviewPrivate::MdapcInitComplete( TInt aError, - const TTimeIntervalMicroSeconds& /* aDuration */ ) - { - if ( aError != KErrNone ) - { - Cancel(); - emit notifyPreviewEvent( ToneFetcherEngine::EPreviewError, aError ); - return; - } - - - TInt ringingVolume = RingingVolume(); - TInt ringingType = RingingType(); - TInt vibra = Vibra(); - TInt echo3D = Echo3D(); - TInt effect3D = Effect3D(); - - - - iAudioPlayerStatus = EPlayerInitialized; - SetAudioRingingType( ringingType ); - iAudioPlayer->SetVolume( ConvertVolume( ringingVolume ) ); - - TMdaPriorityPreference pref = (TMdaPriorityPreference) KAudioPrefRingFilePreview; - if ( vibra ) - { - pref = (TMdaPriorityPreference) KAudioPrefRingFilePreviewVibra; - } - iAudioPlayer->SetPriority( KAudioPriorityPreview, pref ); - - iAudioPlayerStatus = EPlayerPlaying; - - if ( effect3D == EProfile3DEffectOff ) - { - iAudioPlayer->Play(); // 3D not used - return; - } - - if ( !i3dRingingTonePlugin ) - { - TUid emptyUid = { 0 }; - TRAPD( err, i3dRingingTonePlugin = C3DRingingToneInterface::NewL( emptyUid ) ); - if ( err != KErrNone || !i3dRingingTonePlugin ) - { - iAudioPlayer->Play(); - return; - } - } - - i3dRingingTonePlugin->SetAttr( E3DRTIAttr3DEffect, effect3D ); - i3dRingingTonePlugin->SetAttr( E3DRTIAttr3DEcho, echo3D ); - i3dRingingTonePlugin->SetAttr( E3DRTIAttrDrmPlayerUtility, iAudioPlayer ); - TRAP_IGNORE( i3dRingingTonePlugin->PlayL() ); - - iAudioPlayerStatus = EPlayerPlayingWith3DEffect; - } - -void TonePreviewPrivate::MdapcPlayComplete( TInt aError ) - { - Cancel(); - emit notifyPreviewEvent( ToneFetcherEngine::EAudioPreviewComplete, aError ); - } - -void TonePreviewPrivate::HandleLosingForeground() - { - if ( IsPlaying() ) - { - Stop(); - } - } -void TonePreviewPrivate::HandleGainingForeground() - { - - } diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/tonepreviewprivate.h --- a/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/tonepreviewprivate.h Thu Jun 10 16:07:41 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,223 +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: - * The header file for tone previewing. - * - */ - -#ifndef TONEPREVIEWPRIVATE_H -#define TONEPREVIEWPRIVATE_H -#include -#include -#include -#include -#include -#include // for RApaLsSession -#include -#include -#include "tonefetcherengine.h" -#include - -class C3DRingingToneInterface; -class RWindow; - -/** -* CMFPreviewHandlerBase -* -* Base class for CMFAudioPreviewHandler. - */ -class CMFPreviewHandlerBase : public QObject, public CBase - -{ -Q_OBJECT -public: - - enum TMediaFileType - { - EMediaFileTypeAudio = 0, - EMediaFileTypeVideo - }; - enum TPlayerStatus - { - EPlayerNotCreated, - EPlayerInitializing, - EPlayerReady, - EPlayerPlaying, - EPlayerInitialized, - EPlayerPlayingWith3DEffect - }; - - // these must match with the ones in Profile Engine - enum TRingingTypes - { - ERingingTypeRinging = 0, - ERingingTypeAscending, - ERingingTypeRingOnce, - ERingingTypeBeepOnce, - ERingingTypeSilent - }; - - enum TFLAllowScreenSaver - { - EFLScreenSaverAllowed = 0, EFLScreenSaverNotAllowed - }; - -protected: - - virtual ~CMFPreviewHandlerBase(); - -protected: - - /** - * C++ default constructor. - */ - CMFPreviewHandlerBase( QObject *parent ); - - /** - * By default Symbian OS constructor is private. - */ - void ConstructL(); - -public: - void SetAttr(const QString &file); - TInt Attr(TInt aAttr); - virtual void Play() = 0; - virtual void Stop() = 0; - virtual TBool IsPlaying() = 0; - -protected: - TInt ConvertVolume(TInt aVolume); - void ReadActiveProfileL(); - TInt GetDataType(const TDesC& aFileName, TDataType& aDataType); - void ReadDefaultToneL(); - - - void DisableBackLight(); - - static TInt DoResetInactivityTimer(TAny* aObject); -protected: - TInt RingingVolume(); - TInt RingingType(); - TInt Vibra(); - TInt Echo3D(); - TInt Effect3D(); - -protected: - static TInt ConvertVolume(TInt aVolume, TInt aMaxVolume); - -protected: - TInt iRingingVolume; - TInt iRingingType; - TInt iVibra; - TInt i3DEffect; - TInt i3DEcho; - TInt iMediaType; - TInt iFileSize; - HBufC* iFullName; - - TBool iActiveProfileRead; - TInt iActiveProfileRingingVolume; - TInt iActiveProfileRingingType; - TInt iActiveProfileVibra; - TInt iActiveProfile3DEffect; - TInt iActiveProfile3DEcho; - - - TInt iPlayerStatus; - - // handle to window - RWindow* iWindow; // does not own - - // for getting file MIME types - RApaLsSession iApaSession; - - // for setting screensaver on/off - RProperty iProperty; - - // default ringing tone - TFileName iDefaultTone; - - // file server session - //RFs iFsSession; - - /** - * Timer for resetting the user inactivity timeout - */ - CPeriodic* iBacklightTimer; -}; - -// CLASS DECLARATION -/** - * This class is used for previewing the tones. - * - */ - -class TonePreviewPrivate : public CMFPreviewHandlerBase, - public MDrmAudioPlayerCallback, - public MMdaAudioToneObserver, - public MCoeForegroundObserver - -{ -Q_OBJECT -public: - TonePreviewPrivate( QObject *parent ); - virtual ~TonePreviewPrivate(); -signals: - void notifyPreviewEvent( ToneFetcherEngine::TPreviewEvent event, int errorId ); - -public: - void Play(); - void Stop(); - TBool IsPlaying(); - -private: - void Cancel(); - void SetAudioRingingType( TInt aRingingType ); - void SetToneRingingType( TInt aRingingType ); - TInt ConvertVolume( TInt aVolume ); - - -private: - // from MMdaAudioToneObserver - virtual void MatoPrepareComplete( TInt aError ); - virtual void MatoPlayComplete(TInt aError); - -private: - // from MDrmAudioPlayerCallback - void MdapcInitComplete(TInt aError, - const TTimeIntervalMicroSeconds& aDuration); - void MdapcPlayComplete(TInt aError); - // from MCoeForegroundObserver - void HandleLosingForeground(); - void HandleGainingForeground(); - -private: - // audio player - CDrmPlayerUtility* iAudioPlayer; - - /// Audioplayer status - TPlayerStatus iAudioPlayerStatus; - - /// toneplayer - CMdaAudioToneUtility* iTonePlayer; - - /// Toneplayer status - TPlayerStatus iTonePlayerStatus; - - // plugin for playing 3D effects - C3DRingingToneInterface* i3dRingingTonePlugin; - -}; - -#endif /* TONEPREVIEWPRIVATE_H_ */ diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/toneselectionengine_p.cpp --- a/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/toneselectionengine_p.cpp Thu Jun 10 16:07:41 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,376 +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: - * The source file for mde tone fetcher. - * - */ -#include "toneselectionengine_p.h" -#include -#include -#include -#include "tonepreviewprivate.h" -#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() - { - delete iQuery; - delete iSession; - } - -void ToneSelectionEnginePrivate::HandleSessionOpened( CMdESession& /*aSession*/, TInt aError ) - { - if ( aError != KErrNone ) - { - delete iSession; - iSession = 0; - iSessionOpen = EFalse; - emit mdeSessionError( aError ); - } - else - { - iSessionOpen = ETrue; - TRAP_IGNORE( AddObjectObserverL() ); - emit mdeSessionOpened(); - } - } - - - -void ToneSelectionEnginePrivate::HandleSessionError( CMdESession& /*aSession*/, TInt aError ) - { - if ( aError == KErrNone ) - { - return; - } - - delete iSession; - iSession = 0; - iSessionOpen = EFalse; - emit mdeSessionError( aError ); - } - - -void ToneSelectionEnginePrivate::HandleQueryNewResults( CMdEQuery& /*aQuery*/, - TInt /*aFirstNewItemIndex*/, - TInt /*aNewItemCount*/ ) - { - } - -void ToneSelectionEnginePrivate::HandleObjectNotification( CMdESession& /*aSession*/, - TObserverNotificationType aType, - const RArray& aObjectIdArray ) - { - if ( aObjectIdArray.Count() > 0 && ( aType == ENotifyAdd || aType == ENotifyModify || aType == ENotifyRemove ) ) - { - 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; - } - } - -void ToneSelectionEnginePrivate::AddObjectObserverL() - { - if ( iSessionOpen ) - { - TUint32 notificationType = ENotifyAdd | ENotifyModify | ENotifyRemove; - CMdENamespaceDef& defNS = iSession->GetDefaultNamespaceDefL(); - iSession->AddObjectObserverL( *this, 0, notificationType, &defNS ); - - iSession->AddObjectPresentObserverL( *this ); - } - } - -void ToneSelectionEnginePrivate::HandleObjectPresentNotification( CMdESession& /*aSession*/, - TBool /*aPresent*/, const RArray& aObjectIdArray ) - { - if( aObjectIdArray.Count() > 0 ) - { - const TInt KOneSecond = 1000*1000; - if ( !iFreshing ) - { - emit notifyRefreshStart(); - iFreshing = ETrue; - } - if ( !iTimerStarted ) - { - iTimer->After( 5 * KOneSecond ); - iTimerStarted = ETrue; - } - iContinue = ETrue; - } - } - -void ToneSelectionEnginePrivate::HandleQueryCompleted( CMdEQuery& aQuery, TInt aError ) - { - iNameList.clear(); - iUriList.clear(); - if ( aError == KErrCancel ) - { - emit queryError( aError ); - return; - } - else - { - CMdEObjectQuery* query = static_cast (&aQuery); - TInt count = query->Count(); - for (TInt i = 0; i < count; ++i) - { - CMdEObject* object = - (CMdEObject*) query->TakeOwnershipOfResult(i); - CleanupStack::PushL(object); - CMdEPropertyDef& propDef = - ToneSelectionEnginePrivate::PropertyDefL( iSession, ToneSelectionEnginePrivate::EAttrSongName ); - - CMdEProperty* property = 0; - TInt err = object->Property( propDef, property, 0 ); - if ( err != KErrNotFound && property ) - { - QString songName( XQConversions::s60DescToQString( property->TextValueL() ) ); - QString uriValue( XQConversions::s60DescToQString( object->Uri() ) ); - iNameList.append( songName ); - iUriList.append( uriValue ); - } - CleanupStack::PopAndDestroy(object); - } - emit queryComplete(iNameList, iUriList ); - } - } - -void ToneSelectionEnginePrivate::QueryTones() - { - LeaveIfSessionClosedL(); - - CMdENamespaceDef& defNS = iSession->GetDefaultNamespaceDefL(); - CMdEObjectDef& musicObjectDef = - defNS.GetObjectDefL( MdeConstants::Audio::KAudioObject ); - - delete iQuery; - iQuery = 0; - iQuery = iSession->NewObjectQueryL( defNS, musicObjectDef, this ); - - - // set attributes that are included in query result - CMdEPropertyDef& namePropertyDef = PropertyDefL( EAttrSongName ); - iQuery->AddPropertyFilterL( &namePropertyDef ); - - iQuery->SetResultMode( EQueryResultModeItem ); - - CMdELogicCondition& conditions = iQuery->Conditions(); - ExcludeMusicPropertiesL( conditions ); - - iQuery->FindL(); - } - -void ToneSelectionEnginePrivate::LeaveIfSessionClosedL() - { - if ( !iSession || !iSessionOpen ) - { - User::Leave( KErrDisconnected ); - } - } - -CMdEPropertyDef& ToneSelectionEnginePrivate::PropertyDefL( TInt aAttr ) - { - return PropertyDefL( iSession, aAttr ); - } - -CMdEPropertyDef& ToneSelectionEnginePrivate::PropertyDefL( CMdESession* aSession, TInt aAttr ) - { - CMdENamespaceDef& defNS = aSession->GetDefaultNamespaceDefL(); - - CMdEObjectDef& objectDef = - defNS.GetObjectDefL( MdeConstants::Audio::KAudioObject ); - - if ( aAttr == EAttrFileSize ) - { - return objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty ); - } - else if ( aAttr == EAttrMediaType ) - { - return objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty ); - } - else if ( aAttr == EAttrSongName || aAttr == EAttrFileName ) - { - return objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty ); - } - else if ( aAttr == EAttrArtist ) - { - return objectDef.GetPropertyDefL( MdeConstants::MediaObject::KArtistProperty ); - } - else if ( aAttr == EAttrAlbum ) - { - return objectDef.GetPropertyDefL( MdeConstants::Audio::KAlbumProperty ); - } - else if ( aAttr == EAttrGenre ) - { - return objectDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty ); - } - else if ( aAttr == EAttrComposer ) - { - return objectDef.GetPropertyDefL( MdeConstants::Audio::KComposerProperty ); - } - else - { - User::Leave( KErrNotSupported ); - } - - return objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty ); - } - -void ToneSelectionEnginePrivate::ExcludeMusicPropertiesL( CMdELogicCondition& aCondition ) - { - TInt sizeLimitKB = 0; - CRepository* cenrep = CRepository::NewL( KCRUidProfileEngine ); - CleanupStack::PushL( cenrep ); - User::LeaveIfError( cenrep->Get( KProEngRingingToneMaxSize, sizeLimitKB ) ); - CleanupStack::PopAndDestroy(); // cenrep - - SetAttr( ToneFetcherEngine::EAttrFileSize, sizeLimitKB ); - CMdEPropertyDef& sizeTypeDef = PropertyDefL( EAttrFileSize ); - CMdEPropertyDef& mimeTypeDef = PropertyDefL( EAttrMediaType ); - CMdEPropertyDef& artistTypeDef = PropertyDefL( EAttrArtist ); - CMdEPropertyDef& albumTypeDef = PropertyDefL( EAttrAlbum ); - CMdEPropertyDef& genreTypeDef = PropertyDefL( EAttrGenre ); - CMdEPropertyDef& composerTypeDef = PropertyDefL( EAttrComposer ); - - CMdELogicCondition& condition = - aCondition.AddLogicConditionL( ELogicConditionOperatorAnd ); - condition.AddPropertyConditionL( sizeTypeDef, TMdEIntRange(0, iMaxFileSize, EMdERangeTypeBetween) ); - condition.AddPropertyConditionL( mimeTypeDef, - ETextPropertyConditionCompareContains, KMimeMp3 ); - condition.AddPropertyConditionL( artistTypeDef ); - condition.AddPropertyConditionL( albumTypeDef ); - condition.AddPropertyConditionL( genreTypeDef ); - condition.AddPropertyConditionL( composerTypeDef ); - - condition.SetNegate( ETrue ); - } - -void ToneSelectionEnginePrivate::SetAttr( int attr, int value ) -{ - switch ( attr ) - { - case ToneFetcherEngine::EAttrFileSize: - { - iMaxFileSize = value; - break; - } - default: - { - break; - } - } -} - -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 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/toneselectionengine_p.h --- a/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/toneselectionengine_p.h Thu Jun 10 16:07:41 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,170 +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: - * The header file for mde tone fetcher. - * - */ -#ifndef TONESELECTIONENGINEPRIVATE_H -#define TONESELECTIONENGINEPRIVATE_H - -#include "toneselectionengine_p.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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. - * - */ -class ToneSelectionEnginePrivate : public QObject, - public CBase, - public MMdESessionObserver, - public MMdEQueryObserver, - public MMdEObjectObserver, - public MMdEObjectPresentObserver -{ - Q_OBJECT -public: - - enum TStorageType - { - EPhoneMemory = 0, ERomStorage, EMassStorage, EMemoryCard - }; - - enum TQueryAttribute - { - EAttrMediaType = 20, // integer - EAttrFileSize, // integer - EAttrStorageType, // integer - EAttrMediaFileId, // integer - EAttrFileName, // string - EAttrFullName, // string - EAttrSongName, // string - EAttrArtist, // string - EAttrAlbum, // string - EAttrGenre, // string - EAttrComposer - // string - }; - -public: - ToneSelectionEnginePrivate( ToneFetcherEngine *engine ); - virtual ~ToneSelectionEnginePrivate(); - void ChangeObject(); -signals: - void mdeSessionOpened(); - void mdeSessionError( int error ); - 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); - void QueryTones(); - void SetAttr( int attr, int value ); - -private: - void ExcludeMusicPropertiesL(CMdELogicCondition& aCondition); - void LeaveIfSessionClosedL(); - CMdEPropertyDef& PropertyDefL(TInt aAttr); - -private: - // from MMdESessionObserver - void HandleSessionOpened(CMdESession& aSession, TInt aError); - void HandleSessionError(CMdESession& aSession, TInt aError); - -private: - // from MMdEQueryObserver (mdequery.h) - void HandleQueryNewResults(CMdEQuery& aQuery, TInt aFirstNewItemIndex, - TInt aNewItemCount); - void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError); -private: - // from MMdEObjectObserver - void HandleObjectNotification(CMdESession& aSession, - TObserverNotificationType aType, - const RArray& aObjectIdArray); - -private: - // from MMdEObjectPresentObserver - void HandleObjectPresentNotification(CMdESession& aSession, - TBool aPresent, const RArray& aObjectIdArray); - void AddObjectObserverL(); -private: - - ToneFetcherEngine *mServiceEngine; - - // session to metadata engine - CMdESession* iSession; - - // metadata query - CMdEObjectQuery* iQuery; - - // used for saving the quering result. - //both name and uri. - QStringList iNameList; - QStringList iUriList; - - // is metadata session open - TBool iSessionOpen; - - // max audio file file size - TInt iMaxFileSize; - - // query error - TInt iQueryError; - - // for refresh - CTimeOutTimer *iTimer; - TBool iContinue; - TBool iTimerStarted; - TBool iFreshing; -}; -#endif /* TONESELECTIONENGINE_H_ */ - diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/tonefetcherengine/private/tonefetcherengine_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/tonefetcherengine_stub.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,49 @@ +/* + * 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: + * The source file for tone fetcher engine private class of other platforms. + * + */ + +#include "tonefetcherengine_stub.h" + +ToneFetcherEnginePrivate::ToneFetcherEnginePrivate() + { + + } + +virtual ~ToneFetcherEnginePrivate::ToneFetcherEnginePrivate() + { + + } + +void ToneFetcherEnginePrivate::getTones() + { + + } + +void ToneFetcherEnginePrivate::play( const QString & ) + { + + } + +bool ToneFetcherEnginePrivate::isPlaying() + { + return false; + } + +void ToneFetcherEnginePrivate::stopPlaying() + { + + } diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/tonefetcherengine/private/tonefetcherengine_stub.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/tonefetcherengine_stub.h Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,37 @@ +/* + * 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: + * The header file for tone fetcher engine private class of other platforms. + * + */ + +#ifndef TONEFETCHERENGINE_STUB_H +#define TONEFETCHERENGINE_STUB_H + +#include + +class ToneFetcherEnginePrivate : public QObject +{ + Q_OBJECT + +public: + ToneFetcherEnginePrivate(); + virtual ~ToneFetcherEnginePrivate(); + void getTones(); + void play( const QString & ); + bool isPlaying(); + void stopPlaying(); +}; + +#endif /* TONEFETCHERENGINE_STUB */ diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/tonefetcherengine/private/tonefetcherengine_symbian.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/tonefetcherengine_symbian.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,94 @@ +/* + * 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: + * The source file for tone fetcher engine private class. + * + */ + + +#include "tonefetcherengine_symbian.h" +#include "CToneSelection.h" +#include "CTonePlayer.h" +#include "tonefetcherutils.h" +#include + +ToneFetcherEnginePrivate::ToneFetcherEnginePrivate() + { + TRAPD( err, mToneSelection = CToneSelection::NewL( this ) ); + TRAPD( error, mTonePlayer = CTonePlayer::NewL( this ) ); + } + +ToneFetcherEnginePrivate::~ToneFetcherEnginePrivate() + { + mResultList.clear(); + delete mToneSelection; + delete mTonePlayer; + } + +void ToneFetcherEnginePrivate::getTones() + { + QT_TRAP_THROWING( mToneSelection->QueryTonesL() ); + } + +void ToneFetcherEnginePrivate::play(const QString &file) + { + QT_TRAP_THROWING( mTonePlayer->SetAttrL( XQConversions::qStringToS60Desc( ToneFetcherUtils::normalizeSeperator(file) )->Des() ) ); + QT_TRAP_THROWING( mTonePlayer->PlayL() ); + } + +bool ToneFetcherEnginePrivate::isPlaying() + { + return mTonePlayer->IsPlaying(); + } + +void ToneFetcherEnginePrivate::stopPlaying() + { + mTonePlayer->Stop(); + } + +void ToneFetcherEnginePrivate::HandleMdeSessionError( TInt aError ) + { + emit mdeSessionError( aError ); + } + +void ToneFetcherEnginePrivate::HandleMdeSessionOpened() + { + emit mdeSessionOpened(); + } + +void ToneFetcherEnginePrivate::HandleQueryError( TInt aError ) + { + emit queryError(aError); + } + +void ToneFetcherEnginePrivate::HandleQueryComplete( RPointerArray& aResultArray ) + { + mResultList.clear(); + for ( int i = 0; i < aResultArray.Count(); ++i ) + { + mResultList.append( XQConversions::s60DescToQString( *(aResultArray[i]) ) ); + } + aResultArray.ResetAndDestroy(); + emit queryComplete(mResultList); + } + +void ToneFetcherEnginePrivate::HandleObjectChanged() + { + emit notifyObjectChanged(); + } + +void ToneFetcherEnginePrivate::HandlePreviewEvent( TInt event ) + { + emit notifyPreviewEvent(event); + } diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/tonefetcherengine/private/tonefetcherengine_symbian.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/tonefetcherengine_symbian.h Fri Jun 25 17:12:20 2010 +0800 @@ -0,0 +1,68 @@ +/* + * 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: + * The header file for tone fetcher engine private class of symbian platform. + * + */ + +#ifndef TONEFETCHERENGINEPRIVATE_H +#define TONEFETCHERENGINEPRIVATE_H + +//#include +#include "MToneSelectionWatcher.h" +#include "MTonePlayingWatcher.h" +#include +#include + +class CToneSelection; +class CTonePlayer; + +class ToneFetcherEnginePrivate : public QObject, + public MToneSelectionWatcher, + public MTonePlayingWatcher +{ + Q_OBJECT + +public: + ToneFetcherEnginePrivate(); + virtual ~ToneFetcherEnginePrivate(); + void getTones(); + void play( const QString &file ); + bool isPlaying(); + void stopPlaying(); + +public: + //from MToneSelectionWatcher + void HandleMdeSessionError( TInt aError ); + void HandleMdeSessionOpened(); + void HandleQueryError( TInt aError ); + void HandleQueryComplete( RPointerArray& aResultArray ); + void HandleObjectChanged(); + //from MTonePlayingWatcher + void HandlePreviewEvent( TInt event ); + +signals: + void mdeSessionOpened(); + void mdeSessionError(int error); + void queryComplete(const QStringList& uriList); + void queryError(int error); + void notifyObjectChanged(); + void notifyPreviewEvent(int event); + +private: + QStringList mResultList; + CToneSelection* mToneSelection; + CTonePlayer* mTonePlayer; +}; +#endif /* TONEFETCHERENGINEPRIVATE_H */ diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.cpp --- a/controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.cpp Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.cpp Fri Jun 25 17:12:20 2010 +0800 @@ -16,31 +16,29 @@ * */ #include "tonefetcherengine.h" -#include "toneselectionengine_p.h" -#include "tonepreviewprivate.h" +#ifdef Q_OS_SYMBIAN +#include "tonefetcherengine_symbian.h" +#else +#include "tonefetcherengine_stub.h" +#endif ToneFetcherEngine::ToneFetcherEngine(QObject* parent) : QObject(parent) { - d = new ToneSelectionEnginePrivate(this); + d = new ToneFetcherEnginePrivate(); Q_ASSERT(d); - mAudioPlayer = new TonePreviewPrivate( this ); - Q_ASSERT(mAudioPlayer); + connect(d, SIGNAL(mdeSessionOpened()), this, SIGNAL(mdeSessionOpened())); connect(d, SIGNAL(mdeSessionError(int)), this, SIGNAL(mdeSessionError(int))); - connect(d, SIGNAL(queryComplete(QStringList, QStringList)), - this, SIGNAL(queryComplete(QStringList, QStringList))); + connect(d, SIGNAL(queryComplete(QStringList)), + this, SIGNAL(queryComplete(QStringList))); connect(d, SIGNAL(queryError(int)), 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))); + this, SIGNAL(notifyObjectChanged())); + connect(d, SIGNAL(notifyPreviewEvent(int)), + this, SIGNAL(notifyPreviewEvent(int))); } ToneFetcherEngine::~ToneFetcherEngine() @@ -48,25 +46,24 @@ delete d; } -void ToneFetcherEngine::getTone() +void ToneFetcherEngine::getTones() { - d->QueryTones(); + d->getTones(); } -void ToneFetcherEngine::preview(const QString &file ) -{ - mAudioPlayer->SetAttr(file); - mAudioPlayer->Play(); +void ToneFetcherEngine::play(const QString &file) +{ + d->play(file); } -bool ToneFetcherEngine::IsPlaying() +bool ToneFetcherEngine::isPlaying() { - mAudioPlayer->IsPlaying(); + return d->isPlaying(); } -void ToneFetcherEngine::stop() +void ToneFetcherEngine::stopPlaying() { - mAudioPlayer->Stop(); + d->stopPlaying(); } //End of File diff -r 2883a5458389 -r a5692c68d772 controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.h --- a/controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.h Thu Jun 10 16:07:41 2010 +0800 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.h Fri Jun 25 17:12:20 2010 +0800 @@ -19,15 +19,14 @@ #ifndef TONEFETCHERENGINE_H #define TONEFETCHERENGINE_H #include -#include "toneselectionengine_p.h" #include -class TonePreviewPrivate; -class ToneSelectionEnginePrivate; + +class ToneFetcherEnginePrivate; // CLASS DECLARATION /** * This class is used for interacting with platform based codes - * including fetching tones from MDE (Metadata Engine) and previewing tones + * including fetching tones from MDE (Metadata Engine) and playing tones * using platform-dependant interface. * */ @@ -35,69 +34,36 @@ { Q_OBJECT -public: - enum TMediaFileListAttribute { - // max media file size - EAttrFileSize = 0, - // ringing volume (TProfileRingingVolume from Profile.hrh) - EAttrVolume, - // ringing type, (TProfileRingingType from Profile.hrh) - EAttrRingingType, - // vibra on/off (Boolean) - EAttrVibra, - // 3D effect (TProfile3DToneEffect from ProfileInternal.hrh) - EAttr3DEffect, - // 3D echo (TProfile3DToneEcho from ProfileInternal.hrh) - EAttr3DEcho, - // excluded mime type text - EAttrExcludeMimeType, - // for file protection checking - EAttrAutomatedType, - // media file dialog title - EAttrTitle, - // excluded folder (see enum TFolderType) - EAttrExcludeFolder - }; - - enum State { - SessionConnected = 0, - SessionError - }; - - enum TPreviewEvent { - EAudioPreviewComplete, - EPreviewError - }; +public: explicit ToneFetcherEngine( QObject* parent = 0 ); ~ToneFetcherEngine(); /* * search the tone using MDE, not including rom files. */ - void getTone(); + void getTones(); /* * preview the tone * @param file the absolute path of the file. */ - void preview(const QString &file); + void play(const QString &file); - bool IsPlaying(); + bool isPlaying(); /* - * stop previewing + * stop playing */ - void stop(); + void stopPlaying(); + signals: void mdeSessionOpened(); void mdeSessionError(int error); - void queryComplete(const QStringList &nameList, const QStringList &uriList); + void queryComplete(const QStringList &uriList); void queryError(int error); - void notifyPreviewEvent(ToneFetcherEngine::TPreviewEvent event, int errorId); + void notifyPreviewEvent(int event); void notifyObjectChanged(); - void notifyRefreshStart(); - void notifyRefreshFinish(); + private: - ToneSelectionEnginePrivate *d; - TonePreviewPrivate *mAudioPlayer; + ToneFetcherEnginePrivate *d; }; #endif