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