|
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 : mProfileModle(profileModel), |
|
31 mMasterVolumeItem(masterVolumeItem) |
|
32 { |
|
33 itemDataHelper.addConnection(mMasterVolumeItem,SIGNAL(beepActivated()),this,SLOT(onBeepActivated())); |
|
34 itemDataHelper.addConnection(mMasterVolumeItem,SIGNAL(silentActivated()),this,SLOT(onSilentActivated())); |
|
35 itemDataHelper.addConnection(mMasterVolumeItem,SIGNAL(normalValueChanged(int)),this,SLOT(onNormalValueChanged(int))); |
|
36 updateMasterVolumeValue(); |
|
37 } |
|
38 |
|
39 CpMasterVolumeValueController::~CpMasterVolumeValueController() |
|
40 { |
|
41 |
|
42 } |
|
43 |
|
44 void CpMasterVolumeValueController::onBeepActivated() |
|
45 { |
|
46 #ifdef Q_OS_SYMBIAN |
|
47 mProfileModle->activateBeep(); |
|
48 #endif |
|
49 } |
|
50 |
|
51 void CpMasterVolumeValueController::onSilentActivated() |
|
52 { |
|
53 #ifdef Q_OS_SYMBIAN |
|
54 mProfileModle->activateSilent(); |
|
55 #endif |
|
56 } |
|
57 |
|
58 void CpMasterVolumeValueController::onNormalValueChanged(int value) |
|
59 { |
|
60 #ifdef Q_OS_SYMBIAN |
|
61 mProfileModle->setRingVolume(value); |
|
62 #endif |
|
63 } |
|
64 |
|
65 void CpMasterVolumeValueController::updateMasterVolumeValue() |
|
66 { |
|
67 #ifdef Q_OS_SYMBIAN |
|
68 if (mProfileModle->isBeep()) { |
|
69 mMasterVolumeItem->setContentWidgetData(QString("value"),QVariant(1)); |
|
70 } |
|
71 else if (mProfileModle->isSilent()) { |
|
72 mMasterVolumeItem->setContentWidgetData(QString("value"),QVariant(0)); |
|
73 } |
|
74 else { |
|
75 mMasterVolumeItem->setContentWidgetData(QString("value"),QVariant(mProfileModle->ringVolume()+1)); |
|
76 } |
|
77 #endif |
|
78 } |
|
79 |