controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.cpp
changeset 10 0a74be98a8bc
child 11 10d0dd0e43f1
equal deleted inserted replaced
0:254040eb3b7d 10:0a74be98a8bc
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0""
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:  
       
    15  *
       
    16  */
       
    17 #include "cppersonalizationgroupitemdata.h"
       
    18 #include <hbdataformmodelitem.h>
       
    19 #include <cpsettingformentryitemdataimpl.h>
       
    20 #include <cpbasesettingview.h>
       
    21 #include <cpitemdatahelper.h>
       
    22 #include <hbmessagebox.h>
       
    23 #include "cppersonalizationcustomviewitem.h"
       
    24 #include "cpmastervolumevaluecontroller.h"
       
    25 #include <cpprofilemodel.h>
       
    26 
       
    27 
       
    28 CpPersonalizationGroupItemData::CpPersonalizationGroupItemData(HbDataFormModelItem::DataItemType type,
       
    29                                                                const QString &label,
       
    30                                                                const QString &configFile,
       
    31                                                                const HbDataFormModelItem *parent):
       
    32                                                                CpCategorySettingFormItemData(type, label, configFile, parent),
       
    33                                                                mMasterVolume(0),
       
    34                                                                mMasterVibra(0),
       
    35                                                                mRingTone(0),
       
    36 															   mMessageTone(0),
       
    37 															   mEmailTone(0),
       
    38 															   mReminderTone(0),
       
    39 															   mClockTone(0),
       
    40                                                                mProfileModel(0),
       
    41 															   mMasterVolumeValueController(0)
       
    42 {
       
    43 	mProfileModel = new CpProfileModel();
       
    44 }
       
    45 
       
    46 CpPersonalizationGroupItemData::~CpPersonalizationGroupItemData()
       
    47 {
       
    48 	delete mProfileModel;
       
    49 	delete mMasterVolumeValueController;
       
    50 }
       
    51 
       
    52 void CpPersonalizationGroupItemData::beforeLoadingConfigPlugins(CpItemDataHelper &itemDataHelper)
       
    53 {
       
    54     
       
    55 	itemDataHelper.addItemPrototype(new CpPersonalizationCustomViewItem);
       
    56 
       
    57 	mMasterVolume = new HbDataFormModelItem(static_cast<HbDataFormModelItem::DataItemType>(MasterVolumeSliderItem));
       
    58 	mMasterVolumeValueController = new CpMasterVolumeValueController(mProfileModel,mMasterVolume,itemDataHelper);
       
    59 
       
    60     //mMasterVolume->setContentWidgetData("maxmum",10);
       
    61     //mMasterVolume->setContentWidgetData("minmum",1);
       
    62 	//itemDataHelper.addConnection(mMasterVolume,SIGNAL(valueChanged (int)),this,SLOT(masterVolumeValueChanged(int)) );
       
    63     this->appendChild(mMasterVolume);
       
    64     mMasterVibra = new HbDataFormModelItem(HbDataFormModelItem::CheckBoxItem,
       
    65                                                                  QString());
       
    66     mMasterVibra->setContentWidgetData("text",QObject::tr("Vibrating alerts"));
       
    67 	itemDataHelper.addConnection(mMasterVibra,SIGNAL(stateChanged(int)),this,SLOT(onVibraValueChange(int)));
       
    68 
       
    69 
       
    70 	if (mProfileModel->vibraStatus()) {
       
    71 		mMasterVibra->setContentWidgetData("checkState", Qt::Checked);
       
    72 	}
       
    73 	else {
       
    74 		mMasterVibra->setContentWidgetData("checkState", Qt::Unchecked);
       
    75 	}
       
    76 
       
    77     this->appendChild(mMasterVibra);
       
    78 	   
       
    79 
       
    80 
       
    81 	mRingTone = new CpSettingFormEntryItemDataImpl<CpBaseSettingView>(itemDataHelper,
       
    82 																		tr("Ring tone"),
       
    83 																		tr("Nokia tone"));
       
    84 	this->appendChild(mRingTone);
       
    85 	mMessageTone = new CpSettingFormEntryItemDataImpl<CpBaseSettingView>(itemDataHelper,
       
    86 																		tr("Message tone"),
       
    87 																		tr("Nokia message tone"));
       
    88 	this->appendChild(mMessageTone);
       
    89 	mEmailTone = new CpSettingFormEntryItemDataImpl<CpBaseSettingView>(itemDataHelper,
       
    90 																		tr("E-mail tone"),
       
    91 																		tr("Nokia e-mail tone"));
       
    92 	this->appendChild(mEmailTone);
       
    93 	mReminderTone = new CpSettingFormEntryItemDataImpl<CpBaseSettingView>(itemDataHelper,
       
    94 																		tr("Reminder tone"),
       
    95 																		tr("Nokia calendar tone"));
       
    96 	this->appendChild(mReminderTone);
       
    97 	mClockTone = new CpSettingFormEntryItemDataImpl<CpBaseSettingView>(itemDataHelper,
       
    98 																		tr("Clock tone"),
       
    99 																		tr("Nokia clock tone"));
       
   100 	this->appendChild(mClockTone);
       
   101 
       
   102 	
       
   103 }
       
   104 
       
   105 void CpPersonalizationGroupItemData::masterVolumeValueChanged(int value)
       
   106 {
       
   107 	Q_UNUSED(value);
       
   108     HbMessageBox::launchInformationMessageBox(QString("volume changed to:%1").arg(value));
       
   109 }
       
   110 void CpPersonalizationGroupItemData::onVibraValueChange(int isVibra)
       
   111 {
       
   112 	//Q_UNUSED(isVibra);
       
   113 	if (isVibra) {
       
   114 		mProfileModel->setVibraStatus(true);
       
   115 	}
       
   116 	else {
       
   117 		mProfileModel->setVibraStatus(false);
       
   118 	}
       
   119 }
       
   120 
       
   121