|
1 /* |
|
2 * Copyright (c) 2010 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: Model for handling indicator data. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef SNSRINDICATORMODEL_H |
|
19 #define SNSRINDICATORMODEL_H |
|
20 |
|
21 #include <qobject.h> |
|
22 #include "snsrindicatorinfo.h" |
|
23 #include "snsrtest_global.h" |
|
24 |
|
25 SCREENSAVER_TEST_CLASS(T_SnsrIndicators) |
|
26 |
|
27 class HbIndicatorInterface; |
|
28 #ifdef Q_OS_SYMBIAN |
|
29 class XQSettingsManager; |
|
30 class XQSettingsKey; |
|
31 #endif //Q_OS_SYMBIAN |
|
32 |
|
33 class SnsrIndicatorModel : public QObject |
|
34 { |
|
35 Q_OBJECT |
|
36 |
|
37 public: |
|
38 |
|
39 SnsrIndicatorModel(QObject *parent = 0); |
|
40 virtual ~SnsrIndicatorModel(); |
|
41 |
|
42 public slots: |
|
43 |
|
44 void handleActiveIndicators(const QList<HbIndicatorInterface*> &activeIndicators); |
|
45 void handleActivatedIndicator(HbIndicatorInterface *activatedIndicator); |
|
46 void handleDeactivatedIndicator(HbIndicatorInterface *deactivatedIndicator); |
|
47 |
|
48 void handleUpdatedIndicator(); |
|
49 |
|
50 void initializeIndicatorWidget(); |
|
51 |
|
52 #ifdef Q_OS_SYMBIAN |
|
53 void offlineValueChanged( const XQSettingsKey &key, const QVariant &value); |
|
54 #endif // Q_OS_SYMBIAN |
|
55 |
|
56 signals: |
|
57 |
|
58 void indicatorsUpdated(const QList<SnsrIndicatorInfo> &activeIndicators); |
|
59 void allIndicatorsDeactivated(); |
|
60 |
|
61 private: |
|
62 |
|
63 bool addIndicator(const SnsrIndicatorInfo &indicatorInfo); |
|
64 bool isIndicatorAlreadyAdded(const SnsrIndicatorInfo &indicatorInfo) const; |
|
65 |
|
66 bool findAndRemoveIndicator(const SnsrIndicatorInfo &indicatorInfo); |
|
67 |
|
68 bool showIndicatorInScreensaver(const HbIndicatorInterface &indicatorInterface, |
|
69 SnsrIndicatorInfo &indicatorInfo); |
|
70 |
|
71 void connectToIndicatorsUpdateSignal(const HbIndicatorInterface &indicatorInterface); |
|
72 |
|
73 bool anyActiveIndicators() const; |
|
74 |
|
75 void emitChangeSignal(); |
|
76 void updateIndicatorsToShowList(); |
|
77 |
|
78 void initializeOfflineModeIndication(); |
|
79 void getCurrentOfflineState(); |
|
80 |
|
81 private: |
|
82 |
|
83 bool mOfflineStateOn; |
|
84 SnsrIndicatorInfo mOfflineIndicatorInfo; |
|
85 #ifdef Q_OS_SYMBIAN |
|
86 XQSettingsKey *mOfflineKey; |
|
87 XQSettingsManager *mSettingsManager; |
|
88 #endif //Q_OS_SYMBIAN |
|
89 |
|
90 // Save universal indicator statuses into these 2 lists. |
|
91 // Active notification indicators in reversed chronological order: |
|
92 // the first item is the most recent. |
|
93 QList<SnsrIndicatorInfo> mNotificationIndicators; |
|
94 // Screensaver should show only silent indicator from this category. |
|
95 QList<SnsrIndicatorInfo> mSettingIndicators; |
|
96 |
|
97 // This is a combined ordered list of all indicators that should |
|
98 // be shown in UI: offline + notification indicators + |
|
99 // settings indicators |
|
100 QList<SnsrIndicatorInfo> mIndicatorsToShow; |
|
101 |
|
102 Q_DISABLE_COPY(SnsrIndicatorModel) |
|
103 SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrIndicators) |
|
104 }; |
|
105 |
|
106 #endif // SNSRINDICATORMODEL_H |
|
107 |