# HG changeset patch # User hgs # Date 1279062586 -28800 # Node ID 808caa51b78ba900ab5b62590a8844fd0da73e35 # Parent a5692c68d7722745e91ff44798070a4126f42b72 201027 diff -r a5692c68d772 -r 808caa51b78b controlpanelplugins/themeplugin/src/cpthemechanger.cpp --- a/controlpanelplugins/themeplugin/src/cpthemechanger.cpp Fri Jun 25 17:12:20 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemechanger.cpp Wed Jul 14 07:09:46 2010 +0800 @@ -39,7 +39,9 @@ QObject(p), mCurrentTheme(0) { - connect(hbInstance->theme(),SIGNAL(changeFinished()), this, SLOT(changeFinished())); + if(hbInstance->theme()) { + connect(hbInstance->theme(),SIGNAL(changeFinished()), this, SLOT(changeFinished())); + } setCurrentTheme(); } @@ -73,8 +75,7 @@ if(mCurrentTheme && mCurrentTheme->name() == themeName) { return; - } - else { + } else { //buildThemeInfo creates new theme info. CpThemeInfo* tmpTheme = CpThemeUtil::buildThemeInfo(HbThemeServices::themePath(), themeName); @@ -124,9 +125,7 @@ */ void CpThemeChanger::changeFinished() { - setCurrentTheme(); - emit themeChangeFinished(); } diff -r a5692c68d772 -r 808caa51b78b controlpanelplugins/themeplugin/src/cpthemecontrol.cpp --- a/controlpanelplugins/themeplugin/src/cpthemecontrol.cpp Fri Jun 25 17:12:20 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.cpp Wed Jul 14 07:09:46 2010 +0800 @@ -50,6 +50,8 @@ #include #include +//time out time before showing a processing dialog. +static const int KThemeChangeTimeOutMilliSeconds = 1000; /*! Helper function to fetch the main window. @@ -241,6 +243,7 @@ //Set up the theme preview and set it to //the current view of main window. + HbMainWindow* mWindow = ::mainWindow(); if(!mThemePreview){ @@ -273,7 +276,7 @@ //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())); + QTimer::singleShot(KThemeChangeTimeOutMilliSeconds, this, SLOT(themeWaitTimeout())); mThemeChangeFinished = false; } else { @@ -292,9 +295,11 @@ //The theme preview closed, go back //to theme list view. HbMainWindow* mainWindow = ::mainWindow(); - mainWindow->removeView(mThemePreview); - mThemePreview->deleteLater(); - mThemePreview = 0; + if(mThemePreview){ + mainWindow->removeView(mThemePreview); + mThemePreview->deleteLater(); + mThemePreview = 0; + } //reset the current index to active theme, so that the selection remains on current //theme even though another list item is selected. @@ -344,16 +349,15 @@ { //If after this timeOut, theme change is still in progress, //show a processing dialog. - if(!mThemeChangeFinished) - { + if(!mThemeChangeFinished){ if(!mWaitDialog) { mWaitDialog = new HbDialog(); mWaitDialog->setDismissPolicy(HbPopup::NoDismiss); mWaitDialog->setModal(false); mWaitDialog->setTimeout(HbPopup::NoTimeout); - //TODO: need localized text for Hb Dialog // Create and set HbLabel as content widget. - HbLabel *label = new HbLabel("Processing ..."); + QString processingText = hbTrId("txt_common_info_processing") + QString("..."); + HbLabel *label = new HbLabel(processingText); label->setAlignment(Qt::AlignCenter); mWaitDialog->setContentWidget(label); } diff -r a5692c68d772 -r 808caa51b78b controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp --- a/controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp Fri Jun 25 17:12:20 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp Wed Jul 14 07:09:46 2010 +0800 @@ -49,7 +49,7 @@ foreach (const QString &path, themesPathList) { QDir themeDir; themeDir.setPath( path ) ; - QStringList list = themeDir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name); + QStringList list = themeDir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot, QDir::Name); if(list.contains("themes", Qt::CaseSensitive )) { mFileWatcher->addPath(themeDir.path() + "/themes/"); } diff -r a5692c68d772 -r 808caa51b78b controlpanelplugins/themeplugin/src/cpthemelistview.cpp --- a/controlpanelplugins/themeplugin/src/cpthemelistview.cpp Fri Jun 25 17:12:20 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemelistview.cpp Wed Jul 14 07:09:46 2010 +0800 @@ -20,9 +20,9 @@ #include #include -#include #include #include +#include #include "cpthemelistview.h" @@ -32,8 +32,7 @@ corresponding icons. Note: This class is a subclass of CpBaseSettingView for compatibility with Control Panel - framework. However, it does not use HbDataForm as its widget and as its parent does, so - it uses SetWidget to set the listview to its widget instead of an HbDataForm. + framework. */ /*! @@ -42,24 +41,35 @@ CpThemeListView::CpThemeListView(QGraphicsItem *parent) : CpBaseSettingView(0, parent), mThemeList(new HbListView(this)) { - + + //Create a layout with a heading "Select theme" at top and the list below it. HbWidget* contentWidget = new HbWidget(this); QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical); + layout->setContentsMargins(0,0,0,0); //setup the heading. - HbLabel* label = new HbLabel(hbTrId("txt_cp_title_select_theme"), contentWidget);//txt_cp_title_select_theme - layout->addItem(label); - + //Using an empty dataform as heading because the heading should + //look like an HbDataForm headiing. + HbDataForm *form = new HbDataForm(contentWidget); + form->setHeading(hbTrId("txt_cp_title_select_theme")); + + layout->addItem(form); + //Fixed vertical policy so that the heading doesn't expand. + form->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed, QSizePolicy::DefaultType); + connect(mThemeList, SIGNAL(activated(const QModelIndex&)), this, SIGNAL(newThemeSelected(const QModelIndex&))); + //set list item icons to be large. HbListViewItem* listViewItem = mThemeList->listItemPrototype(); listViewItem->setGraphicsSize(HbListViewItem::LargeIcon); //add the list to layout. layout->addItem(mThemeList); - + layout->addStretch(); + + contentWidget->setLayout(layout); setWidget(contentWidget); diff -r a5692c68d772 -r 808caa51b78b controlpanelplugins/themeplugin/src/cpthemeplugin.cpp --- a/controlpanelplugins/themeplugin/src/cpthemeplugin.cpp Fri Jun 25 17:12:20 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemeplugin.cpp Wed Jul 14 07:09:46 2010 +0800 @@ -50,7 +50,7 @@ itemDataHelper, tr("Theme"), tr("Theme Name"), - HbIcon(":/image/qgn_menu_note.svg")); + HbIcon()); return QList() << entryItem; } diff -r a5692c68d772 -r 808caa51b78b controlpanelplugins/themeplugin/src/cpthemepreview.cpp --- a/controlpanelplugins/themeplugin/src/cpthemepreview.cpp Fri Jun 25 17:12:20 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemepreview.cpp Wed Jul 14 07:09:46 2010 +0800 @@ -27,6 +27,7 @@ #include #include #include +#include #include "cpthemepreview.h" #include "cpthemeinfo.h" @@ -38,6 +39,7 @@ the theme change or press Cancel and go back to theme list view. */ + /*! constructor. */ @@ -47,20 +49,48 @@ mSoftKeyBackAction(0), mPreviewIcon(0) { - - //Create the layout and add heading and and preview icon to the layout. - QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical); + QGraphicsLinearLayout* containerLayout = new QGraphicsLinearLayout(Qt::Vertical); + QGraphicsLinearLayout* bottomLayout = new QGraphicsLinearLayout(Qt::Vertical); + + //Preview icon margins. + qreal leftMargin = 0.0; + qreal rightMargin = 0.0; + qreal topMargin = 0.0; + qreal bottomMargin = 0.0; + + style()->parameter(QString("hb-param-margin-gene-left"), leftMargin); + style()->parameter("hb-param-margin-gene-right", rightMargin); + style()->parameter("hb-param-margin-gene-top", topMargin); + style()->parameter("hb-param-margin-gene-bottom", bottomMargin); - - //setup the heading. + containerLayout->setContentsMargins(0,0,0,0); + bottomLayout->setContentsMargins(leftMargin, topMargin, rightMargin, bottomMargin); + + //Using an empty dataform as heading because the heading should + //look like an HbDataForm headiing. + HbDataForm* heading = new HbDataForm(this); QString themeHeading = HbParameterLengthLimiter("txt_cp_title_preview_1").arg(mTheme.name()); - HbLabel* label = new HbLabel(themeHeading, this); - - layout->addItem(label); + heading->setHeading(themeHeading); + + containerLayout->addItem(heading); + //Fixed vertical policy so that the heading doesn't expand. + heading->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed,QSizePolicy::DefaultType); - layout->setAlignment(layout->itemAt(0), Qt::AlignTop); - layout->itemAt(0)->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed,QSizePolicy::DefaultType); + if(mainWindow()->orientation() == Qt::Horizontal) { + mPreviewIcon = new HbIconItem(mTheme.landscapePreviewIcon(), this); + } + else { + mPreviewIcon = new HbIconItem(mTheme.portraitPreviewIcon(), this); + } + //set to ignore aspect ratio so the layout would rezise the icon correctly. + mPreviewIcon->setAspectRatioMode(Qt::IgnoreAspectRatio); + + bottomLayout->addItem(mPreviewIcon); + containerLayout->addItem(bottomLayout); + + setLayout(containerLayout); + //Create the toolbar and "Select" and "Cancel" actions. HbToolBar* mToolBar = new HbToolBar(this); @@ -77,24 +107,11 @@ QObject::connect( cancelAction, SIGNAL(triggered()), this, SIGNAL(aboutToClose())); - QObject::connect( mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(previewOrientationChanged(Qt::Orientation))); - - if(mainWindow()->orientation() == Qt::Horizontal) { - mPreviewIcon = new HbIconItem(mTheme.landscapePreviewIcon(), this); - } - else { - mPreviewIcon = new HbIconItem(mTheme.portraitPreviewIcon(), this); - } - layout->addItem(mPreviewIcon); - layout->itemAt(1)->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred,QSizePolicy::DefaultType); - setToolBar(mToolBar); - setLayout(layout); - //Setup the Back button action and set softkey. Back button //takes the user to the theme list view. mSoftKeyBackAction = new HbAction(Hb::BackNaviAction, this); @@ -102,6 +119,7 @@ this, SIGNAL(aboutToClose()) ); setNavigationAction(mSoftKeyBackAction); + } /*! @@ -122,7 +140,7 @@ /*! returns the themeName. */ -const QString& CpThemePreview::themeName() const +const QString CpThemePreview::themeName() const { return mTheme.name(); } @@ -130,7 +148,7 @@ /*! returns the repersentative themeIcon of the current theme. */ -const HbIcon& CpThemePreview::themeIcon() const +const HbIcon CpThemePreview::themeIcon() const { return mTheme.icon(); } @@ -150,10 +168,16 @@ void CpThemePreview::previewOrientationChanged(Qt::Orientation orientation) { - QGraphicsLinearLayout* previewLayout = dynamic_cast(layout()); + QGraphicsLinearLayout* containerLayout = dynamic_cast(layout()); + QGraphicsLinearLayout* previewLayout = 0; + if(containerLayout) { + //get the layout that preview icon belongs to. + previewLayout = dynamic_cast(containerLayout->itemAt(0)); + } - if(mPreviewIcon && mPreviewIcon == dynamic_cast(previewLayout->itemAt(1)) ) { - previewLayout->removeAt(1); + if(previewLayout && mPreviewIcon && mPreviewIcon == dynamic_cast(previewLayout->itemAt(0)) ) { + //Remove preview icon. + previewLayout->removeAt(0); if(orientation == Qt::Horizontal) { mPreviewIcon->setIcon(mTheme.landscapePreviewIcon()); diff -r a5692c68d772 -r 808caa51b78b controlpanelplugins/themeplugin/src/cpthemepreview.h --- a/controlpanelplugins/themeplugin/src/cpthemepreview.h Fri Jun 25 17:12:20 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemepreview.h Wed Jul 14 07:09:46 2010 +0800 @@ -41,8 +41,8 @@ explicit CpThemePreview(const CpThemeInfo &theme, QGraphicsItem *parent = 0); ~CpThemePreview(); void setThemeInfo(const CpThemeInfo& theme); - const QString& themeName() const; - const HbIcon& themeIcon() const; + const QString themeName() const; + const HbIcon themeIcon() const; signals: void applyTheme(const QString&); diff -r a5692c68d772 -r 808caa51b78b controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp --- a/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp Fri Jun 25 17:12:20 2010 +0800 +++ b/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp Wed Jul 14 07:09:46 2010 +0800 @@ -50,7 +50,7 @@ { mAirplaneModeItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); mAirplaneModeItem->setDescription(hbTrId("txt_cp_info_in_offline_mode_all_wireless_communica")); - + mAirplaneModeItem->setContentWidgetData("objectName", "airplaneModeToggle"); itemDataHelper.addConnection(mAirplaneModeItem, SIGNAL(clicked()), this, diff -r a5692c68d772 -r 808caa51b78b controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.cpp --- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.cpp Fri Jun 25 17:12:20 2010 +0800 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.cpp Wed Jul 14 07:09:46 2010 +0800 @@ -100,6 +100,7 @@ QStringList items = mScreenLockValues.values(); mScreenComboButton->setContentWidgetData( QString("items"), items ); mScreenComboButton->setContentWidgetData( QString("currentIndex"), selectedIndex); + mScreenComboButton->setContentWidgetData("objectName", "screenComboButton"); } void CpKeyScreenView::makeRotateItem(HbDataFormModel& model) @@ -117,6 +118,7 @@ state = Qt::Unchecked; } mRotateCheckbox->setContentWidgetData( QString("checkState"), state ); + mRotateCheckbox->setContentWidgetData("objectName", "rotateCheckbox"); } void CpKeyScreenView::makeBrightnessItem(HbDataFormModel& model) @@ -136,6 +138,7 @@ iconElements.insert(QString("IncreaseElement") , QVariant(":/icon/hb_vol_slider_increment.svg")); iconElements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg") ); mBrightSliderItem->setContentWidgetData( QString( "elementIcons" ), iconElements ); + mRotateCheckbox->setContentWidgetData("objectName", "brightSliderItem"); } void CpKeyScreenView::makeCallibrationItem(HbDataFormModel& model) diff -r a5692c68d772 -r 808caa51b78b controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.cpp Fri Jun 25 17:12:20 2010 +0800 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.cpp Wed Jul 14 07:09:46 2010 +0800 @@ -58,7 +58,7 @@ itemDataHelper, hbTrId("txt_cp_button_advanced_settings")); advanceSettingItem->setContentWidgetData("textAlignment", QVariant( Qt::AlignHCenter | Qt::AlignVCenter) ); - + advanceSettingItem->setContentWidgetData("objectName", "advanceSettingButton" ); appendChild(advanceSettingItem); CPFW_LOG("CpPersonalizationGroupItemData::afterLoadingConfigPlugins(), END"); } diff -r a5692c68d772 -r 808caa51b78b controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp Fri Jun 25 17:12:20 2010 +0800 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp Wed Jul 14 07:09:46 2010 +0800 @@ -137,7 +137,8 @@ //notification tones item modelItem= mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,QString(),parent); modelItem->setContentWidgetData("text", hbTrId("txt_cp_list_notification_tones")); - modelItem->setContentWidgetData( "checkState", profileSettings.mNotificationTone ? 2 : 0 ); + modelItem->setContentWidgetData("checkState", profileSettings.mNotificationTone ? 2 : 0); + modelItem->setContentWidgetData("objectName", "notificationTonesCheckBox" + QString::number(profileId)); if (profileId == EProfileWrapperGeneralId) { addConnection( modelItem, SIGNAL( stateChanged( int )), this, SLOT( on_general_notificationTones_stateChanged( int ))); } @@ -156,7 +157,7 @@ << QVariant(HbSlider::DecreaseElement) << QVariant(HbSlider::IconElement) << QVariant(HbSlider::TextElement); modelItem->setContentWidgetData("sliderElements",sliderElements); - + modelItem->setContentWidgetData("objectName", "keyTonesSlider" + QString::number(profileId)); //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3 @@ -192,7 +193,7 @@ sliderElements << QVariant(HbSlider::IncreaseElement) << QVariant(HbSlider::TrackElement) << QVariant(HbSlider::DecreaseElement); modelItem->setContentWidgetData("sliderElements",sliderElements); - + modelItem->setContentWidgetData("objectName", "vibrationSlider" + QString::number(profileId)); modelItem->setContentWidgetData( QString( "minimum" ), 0 ); modelItem->setContentWidgetData( QString( "maximum" ), 5 ); modelItem->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenVibra ); diff -r a5692c68d772 -r 808caa51b78b controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp --- a/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp Fri Jun 25 17:12:20 2010 +0800 +++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp Wed Jul 14 07:09:46 2010 +0800 @@ -54,6 +54,7 @@ HbDataFormModelItem *silenceIndicator = new HbDataFormModelItem(static_cast(SilenceIndicatorItem)); mItemList.insert(CpVolumeGroupItemData::EVolumeSilenceItem, silenceIndicator); silenceIndicator->setContentWidgetData("text",hbTrId("txt_cp_button_silence")); + silenceIndicator->setContentWidgetData("objectName", "silenceIndicatorButton"); this->appendChild(silenceIndicator); HbDataFormModelItem *masterVolume = new HbDataFormModelItem(HbDataFormModelItem::SliderItem, @@ -64,6 +65,7 @@ << QVariant(HbSlider::DecreaseElement) << QVariant(HbSlider::IconElement) << QVariant(HbSlider::TextElement); masterVolume->setContentWidgetData("sliderElements",elements); + masterVolume->setContentWidgetData("objectName","masterVolumeSlider"); QMap iconMaps; iconMaps.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); @@ -88,6 +90,7 @@ HbDataFormModelItem *masterVibra = new HbDataFormModelItem(HbDataFormModelItem::CheckBoxItem); mItemList.insert(CpVolumeGroupItemData::EVolumeMasterVibraItem, masterVibra); masterVibra->setContentWidgetData("text",hbTrId("txt_cp_list_vibrate")); + masterVibra->setContentWidgetData("objectName","masterVibraCheckBox"); this->appendChild(masterVibra); diff -r a5692c68d772 -r 808caa51b78b controlpanelui/src/cpringtoneview/src/cpringtoneview.cpp --- a/controlpanelui/src/cpringtoneview/src/cpringtoneview.cpp Fri Jun 25 17:12:20 2010 +0800 +++ b/controlpanelui/src/cpringtoneview/src/cpringtoneview.cpp Wed Jul 14 07:09:46 2010 +0800 @@ -41,7 +41,7 @@ HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.widgetml"); HbDataForm *form = qobject_cast ( widget() ); - form->setHeading("txt_cp_subhead_select_tone_type"); + form->setHeading(hbTrId("txt_cp_subhead_select_tone_type")); HbDataFormModel *model = new HbDataFormModel(); QList< QPair > tonesTypeList; diff -r a5692c68d772 -r 808caa51b78b controlpanelui/src/tonefetcher/src/tonefetcherview.cpp --- a/controlpanelui/src/tonefetcher/src/tonefetcherview.cpp Fri Jun 25 17:12:20 2010 +0800 +++ b/controlpanelui/src/tonefetcher/src/tonefetcherview.cpp Wed Jul 14 07:09:46 2010 +0800 @@ -38,7 +38,7 @@ void ToneFetcherView::initMainWidget() { - mWidget = new ToneFetcherWidget(this); + mWidget = new ToneFetcherWidget(this, this); Q_ASSERT(mWidget); setWidget(mWidget); //mWidget->setCurrentToolBarType( ToneServiceWidget::GeneralTone ); diff -r a5692c68d772 -r 808caa51b78b controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp --- a/controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp Fri Jun 25 17:12:20 2010 +0800 +++ b/controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp Wed Jul 14 07:09:46 2010 +0800 @@ -36,8 +36,8 @@ #include #include -ToneFetcherWidget::ToneFetcherWidget( ToneFetcherView *serviceView ) - : HbWidget(this), +ToneFetcherWidget::ToneFetcherWidget(HbWidget *parent, ToneFetcherView *serviceView) + : HbWidget(parent), mLabel(0), mListView(0), mLayout(0), diff -r a5692c68d772 -r 808caa51b78b controlpanelui/src/tonefetcher/src/tonefetcherwidget.h --- a/controlpanelui/src/tonefetcher/src/tonefetcherwidget.h Fri Jun 25 17:12:20 2010 +0800 +++ b/controlpanelui/src/tonefetcher/src/tonefetcherwidget.h Wed Jul 14 07:09:46 2010 +0800 @@ -39,7 +39,7 @@ Q_OBJECT public: - explicit ToneFetcherWidget(ToneFetcherView *serviceView); + explicit ToneFetcherWidget(HbWidget *parent, ToneFetcherView *serviceView); ~ToneFetcherWidget(); QString getCurrentItemPath(); void playOrPause();