controlpanelui/src/cpplugins/personalizationplugin/src/cpmastervolumevaluecontroller.cpp
changeset 12 624337f114fe
parent 11 10d0dd0e43f1
child 14 23411a3be0db
child 19 36aa4756ee82
equal deleted inserted replaced
11:10d0dd0e43f1 12:624337f114fe
     1 
       
     2 /*
       
     3  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4  * All rights reserved.
       
     5  * This component and the accompanying materials are made available
       
     6  * under the terms of "Eclipse Public License v1.0""
       
     7  * which accompanies this distribution, and is available
       
     8  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     9  *
       
    10  * Initial Contributors:
       
    11  * Nokia Corporation - initial contribution.
       
    12  *
       
    13  * Contributors:
       
    14  *
       
    15  * Description:  
       
    16  *
       
    17  */
       
    18 
       
    19 #include "cpmastervolumevaluecontroller.h"
       
    20 #include <cpitemdatahelper.h>
       
    21 #include <hbdataformmodelitem.h>
       
    22 
       
    23 #ifdef Q_OS_SYMBIAN
       
    24 	#include <cpprofilemodel.h>
       
    25 #endif
       
    26 
       
    27 CpMasterVolumeValueController::CpMasterVolumeValueController(CpProfileModel *profileModel,
       
    28 															 HbDataFormModelItem *masterVolumeItem,
       
    29 															 CpItemDataHelper &itemDataHelper,
       
    30 															 HbDataFormModelItem *profileItem)
       
    31 															 : mProfileModel(profileModel),
       
    32 															 mMasterVolumeItem(masterVolumeItem),
       
    33 															 mProfileItem(profileItem)
       
    34 {
       
    35 	//itemDataHelper.addConnection(mMasterVolumeItem,SIGNAL(beepActivated()),this,SLOT(onBeepActivated()));
       
    36 	itemDataHelper.addConnection(mMasterVolumeItem,SIGNAL(silentActivated()),this,SLOT(onSilentActivated()));
       
    37 	itemDataHelper.addConnection(mMasterVolumeItem,SIGNAL(normalValueChanged(int)),this,SLOT(onNormalValueChanged(int)));
       
    38 	updateMasterVolumeValue();
       
    39 }
       
    40 
       
    41 CpMasterVolumeValueController::~CpMasterVolumeValueController()
       
    42 {
       
    43 
       
    44 }
       
    45 
       
    46 /*void CpMasterVolumeValueController::onBeepActivated()
       
    47 {
       
    48 #ifdef Q_OS_SYMBIAN
       
    49 	mProfileModel->activateBeep();
       
    50 #endif
       
    51 }*/
       
    52 
       
    53 void CpMasterVolumeValueController::onSilentActivated()
       
    54 {
       
    55 #ifdef Q_OS_SYMBIAN
       
    56 	//mProfileModel->activateSilent();
       
    57     int err = mProfileModel->activateProfile(EProfileWrapperSilentId);
       
    58     if (err == KErrNone) {
       
    59         //update the radio buttonlist of profile
       
    60         mProfileItem->setContentWidgetData("selected",2);
       
    61         //mMasterVolumeItem->setContentWidgetData("value",0);
       
    62         //mMasterVolumeItem->setContentWidgetData("enabled",false);
       
    63         updateMasterVolumeValue();
       
    64     }
       
    65 #endif
       
    66 }
       
    67 
       
    68 void CpMasterVolumeValueController::onNormalValueChanged(int value)
       
    69 {
       
    70 #ifdef Q_OS_SYMBIAN
       
    71 	mProfileModel->setRingVolume(value);
       
    72 #endif
       
    73 }
       
    74 
       
    75 void CpMasterVolumeValueController::updateMasterVolumeValue()
       
    76 {
       
    77 #ifdef Q_OS_SYMBIAN
       
    78 	/*if (mProfileModel->isBeep()) {
       
    79 		mMasterVolumeItem->setContentWidgetData(QString("value"),QVariant(1));
       
    80 	}
       
    81 	else*/
       
    82     if (mProfileModel->isSilent()) {
       
    83 		mMasterVolumeItem->setContentWidgetData(QString("value"),QVariant(0));
       
    84 		
       
    85 		mMasterVolumeItem->setEnabled(false);
       
    86 	}
       
    87 	else {
       
    88 		mMasterVolumeItem->setContentWidgetData(QString("value"),QVariant(mProfileModel->ringVolume()));
       
    89 	}
       
    90 #endif
       
    91 }
       
    92