controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.cpp
changeset 12 624337f114fe
parent 11 10d0dd0e43f1
child 14 23411a3be0db
equal deleted inserted replaced
11:10d0dd0e43f1 12:624337f114fe
    13  *
    13  *
    14  * Description:  
    14  * Description:  
    15  *
    15  *
    16  */
    16  */
    17 #include "cppersonalizationgroupitemdata.h"
    17 #include "cppersonalizationgroupitemdata.h"
       
    18 #include <cplogger.h>
    18 #include <hbdataformmodelitem.h>
    19 #include <hbdataformmodelitem.h>
    19 #include <cpsettingformentryitemdataimpl.h>
    20 #include <cpsettingformentryitemdataimpl.h>
    20 #include <cpbasesettingview.h>
    21 #include <cpbasesettingview.h>
    21 #include <cpitemdatahelper.h>
    22 #include <cpitemdatahelper.h>
    22 #include <hbmessagebox.h>
    23 #include <hbmessagebox.h>
    23 #include "cppersonalizationcustomviewitem.h"
       
    24 #include "cpmastervolumevaluecontroller.h"
       
    25 #include <cpprofilemodel.h>
    24 #include <cpprofilemodel.h>
       
    25 #include "cppersonalizationadvanceview.h"
       
    26 #include "cppersonalizationentryitemdata.h"
    26 
    27 
    27 
    28 
    28 CpPersonalizationGroupItemData::CpPersonalizationGroupItemData(HbDataFormModelItem::DataItemType type,
    29 CpPersonalizationGroupItemData::CpPersonalizationGroupItemData(HbDataFormModelItem::DataItemType type,
    29                                                                const QString &label,
    30                                                                const QString &label,
    30                                                                const QString &configFile,
    31                                                                const QString &configFile,
    31                                                                const HbDataFormModelItem *parent):
    32                                                                const HbDataFormModelItem *parent):
    32                                                                CpCategorySettingFormItemData(type, label, configFile, parent),
    33                                                                CpCategorySettingFormItemData(type, label, configFile, parent)
    33                                                                mMasterVolume(0),
    34                                                                
    34                                                                mMasterVibra(0),
       
    35                                                                mRingTone(0),
       
    36 															   mMessageTone(0),
       
    37 															   mEmailTone(0),
       
    38 															   mReminderTone(0),
       
    39 															   mClockTone(0),
       
    40 															   mSayCallerName(0),
       
    41                                                                mProfileModel(0),
       
    42 															   mMasterVolumeValueController(0)
       
    43 {
    35 {
    44 	mProfileModel = new CpProfileModel();
    36     CPFW_LOG("CpPersonalizationGroupItemData::CpPersonalizationGroupItemData(), START");
       
    37 	CPFW_LOG("CpPersonalizationGroupItemData::CpPersonalizationGroupItemData(), END");
    45 }
    38 }
    46 
    39 
    47 CpPersonalizationGroupItemData::~CpPersonalizationGroupItemData()
    40 CpPersonalizationGroupItemData::~CpPersonalizationGroupItemData()
    48 {
    41 {
    49 	delete mProfileModel;
       
    50 	delete mMasterVolumeValueController;
       
    51 }
    42 }
    52 
    43 
    53 void CpPersonalizationGroupItemData::beforeLoadingConfigPlugins(CpItemDataHelper &itemDataHelper)
    44 void CpPersonalizationGroupItemData::beforeLoadingConfigPlugins(CpItemDataHelper &itemDataHelper)
    54 {
    45 {
    55     /*
       
    56 	itemDataHelper.addItemPrototype(new CpPersonalizationCustomViewItem);
       
    57 
    46 
    58 	mMasterVolume = new HbDataFormModelItem(static_cast<HbDataFormModelItem::DataItemType>(MasterVolumeSliderItem));
    47     // keep this interface for development in the futrue
    59 	mMasterVolumeValueController = new CpMasterVolumeValueController(mProfileModel,mMasterVolume,itemDataHelper);
    48     CPFW_LOG("CpPersonalizationGroupItemData::beforeLoadingConfigPlugins(), START");
    60 
    49 
    61     //mMasterVolume->setContentWidgetData("maxmum",10);
    50 	CPFW_LOG("CpPersonalizationGroupItemData::beforeLoadingConfigPlugins(), END");
    62     //mMasterVolume->setContentWidgetData("minmum",1);
    51 }
    63 	//itemDataHelper.addConnection(mMasterVolume,SIGNAL(valueChanged (int)),this,SLOT(masterVolumeValueChanged(int)) );
    52 void CpPersonalizationGroupItemData::afterLoadingConfigPlugins(CpItemDataHelper &itemDataHelper)
    64     this->appendChild(mMasterVolume);
    53 {
    65     mMasterVibra = new HbDataFormModelItem(HbDataFormModelItem::CheckBoxItem,
    54     CPFW_LOG("CpPersonalizationGroupItemData::afterLoadingConfigPlugins(), START");
    66                                                                  QString());
    55     CpSettingFormEntryItemData *advanceSettingItem = 
    67     mMasterVibra->setContentWidgetData("text",QObject::tr("Vibrating alerts"));
    56             new CpSettingFormEntryItemDataImpl<CpPersonalizationAdvanceView>(itemDataHelper, hbTrId("txt_cp_button_advanced_settings"));
    68 	itemDataHelper.addConnection(mMasterVibra,SIGNAL(stateChanged(int)),this,SLOT(onVibraValueChange(int)));
    57     appendChild(advanceSettingItem);
    69 
    58     CPFW_LOG("CpPersonalizationGroupItemData::afterLoadingConfigPlugins(), END");
    70 
       
    71 	if (mProfileModel->vibraStatus()) {
       
    72 		mMasterVibra->setContentWidgetData("checkState", Qt::Checked);
       
    73 	}
       
    74 	else {
       
    75 		mMasterVibra->setContentWidgetData("checkState", Qt::Unchecked);
       
    76 	}
       
    77 
       
    78     this->appendChild(mMasterVibra);
       
    79 	   
       
    80     */
       
    81 
       
    82 
       
    83 	mRingTone = new CpSettingFormEntryItemDataImpl<CpBaseSettingView>(itemDataHelper,
       
    84 																		tr("Ring tone"),
       
    85 																		tr("Nokia tone"));
       
    86 	this->appendChild(mRingTone);
       
    87 	
       
    88 	/*mSayCallerName = new HbDataFormModelItem(HbDataFormModelItem::CheckBoxItem, QString());
       
    89 	mSayCallerName->setContentWidgetData("text", tr("Say caller's name"));
       
    90 	this->appendChild(mSayCallerName);*/
       
    91 	
       
    92 	
       
    93 	mMessageTone = new CpSettingFormEntryItemDataImpl<CpBaseSettingView>(itemDataHelper,
       
    94 																		tr("Message tone"),
       
    95 																		tr("Nokia message tone"));
       
    96 	this->appendChild(mMessageTone);
       
    97 	mEmailTone = new CpSettingFormEntryItemDataImpl<CpBaseSettingView>(itemDataHelper,
       
    98 																		tr("E-mail tone"),
       
    99 																		tr("Nokia e-mail tone"));
       
   100 	this->appendChild(mEmailTone);
       
   101 	mReminderTone = new CpSettingFormEntryItemDataImpl<CpBaseSettingView>(itemDataHelper,
       
   102 																		tr("Reminder tone"),
       
   103 																		tr("Nokia calendar tone"));
       
   104 	this->appendChild(mReminderTone);
       
   105 	mClockTone = new CpSettingFormEntryItemDataImpl<CpBaseSettingView>(itemDataHelper,
       
   106 																		tr("Clock tone"),
       
   107 																		tr("Nokia clock tone"));
       
   108 	this->appendChild(mClockTone);
       
   109 
       
   110 	
       
   111 }
    59 }
   112 
    60 
   113 void CpPersonalizationGroupItemData::masterVolumeValueChanged(int value)
       
   114 {
       
   115 	Q_UNUSED(value);
       
   116     HbMessageBox::information(QString("volume changed to:%1").arg(value));
       
   117 }
       
   118 void CpPersonalizationGroupItemData::onVibraValueChange(int isVibra)
       
   119 {
       
   120 	//Q_UNUSED(isVibra);
       
   121 	if (isVibra) {
       
   122 		mProfileModel->setVibraStatus(true);
       
   123 	}
       
   124 	else {
       
   125 		mProfileModel->setVibraStatus(false);
       
   126 	}
       
   127 }
       
   128 
       
   129