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: Main View of BT Application |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef BTCPUIMAINVIEW_H |
|
19 #define BTCPUIMAINVIEW_H |
|
20 |
|
21 #include "btcpuibaseview.h" |
|
22 #include <btqtconstants.h> |
|
23 #include <btuimodelsortfilter.h> |
|
24 |
|
25 class HbLabel; |
|
26 class HbLineEdit; |
|
27 class HbPushButton; |
|
28 class HbIcon; |
|
29 class HbComboBox; |
|
30 class HbDocumentLoader; |
|
31 class HbGridView; |
|
32 class BtAbstractDelegate; |
|
33 class HbListView; |
|
34 class HbGroupBox; |
|
35 class HbDataForm; |
|
36 |
|
37 class BtCpUiMainView : public BtCpUiBaseView |
|
38 { |
|
39 Q_OBJECT |
|
40 |
|
41 public: |
|
42 explicit BtCpUiMainView( |
|
43 BtSettingModel &settingModel, |
|
44 BtDeviceModel &deviceModel, |
|
45 QGraphicsItem *parent = 0 ); |
|
46 ~BtCpUiMainView(); |
|
47 // from view manager |
|
48 void createViews(); |
|
49 |
|
50 Qt::Orientation orientation(); |
|
51 |
|
52 // from base class BtCpUiBaseView |
|
53 virtual void setSoftkeyBack(); |
|
54 virtual void activateView( const QVariant& value, bool fromBackButton ); |
|
55 virtual void deactivateView(); |
|
56 |
|
57 public slots: |
|
58 void changeOrientation( Qt::Orientation orientation ); |
|
59 void changePowerState(); |
|
60 void visibilityChanged (int index); |
|
61 void changeBtLocalName(); |
|
62 |
|
63 void updateSettingItems(const QModelIndex &topLeft, const QModelIndex &bottomRight); |
|
64 void deviceSelected(const QModelIndex& modelIndex); |
|
65 void goToDiscoveryView(); |
|
66 void goToDeviceView(const QModelIndex& modelIndex); |
|
67 virtual void switchToPreviousView(); |
|
68 |
|
69 //from delegate classes |
|
70 void powerDelegateCompleted(int status); |
|
71 void visibilityDelegateCompleted(int status); |
|
72 void btNameDelegateCompleted(int status, QVariant param); |
|
73 void allActionTriggered(); |
|
74 void pairActionTriggered(); |
|
75 |
|
76 private slots: |
|
77 void changeView(int targetViewId, bool fromBackButton, const QVariant& value = 0 ); |
|
78 |
|
79 private: |
|
80 enum filterType { |
|
81 BtuiAll = 0, |
|
82 BtuiPaired |
|
83 }; |
|
84 |
|
85 private: |
|
86 VisibilityMode indexToVisibilityMode(int index); |
|
87 int visibilityModeToIndex(VisibilityMode mode); |
|
88 BtCpUiBaseView * idToView(int targetViewId); |
|
89 |
|
90 //Functions to set the Previous Local settings in case of error |
|
91 void setPrevBtLocalName(); |
|
92 void setPrevVisibilityMode(); |
|
93 |
|
94 void updateDeviceListFilter(BtCpUiMainView::filterType filter); |
|
95 |
|
96 private: |
|
97 |
|
98 HbDocumentLoader *mLoader; |
|
99 |
|
100 HbLineEdit *mDeviceNameEdit; |
|
101 HbPushButton *mPowerButton; |
|
102 HbComboBox *mVisibilityMode; |
|
103 HbListView *mDeviceList; |
|
104 |
|
105 Qt::Orientation mOrientation; |
|
106 |
|
107 // from view manager |
|
108 HbMainWindow* mMainWindow; |
|
109 BtCpUiBaseView* mMainView; |
|
110 BtCpUiBaseView* mDeviceView; |
|
111 BtCpUiBaseView* mSearchView; |
|
112 BtCpUiBaseView* mCurrentView; |
|
113 int mCurrentViewId; |
|
114 QList<int> mPreviousViewIds; |
|
115 |
|
116 //poiter to abstract delegate, and it is instantiated at runtime |
|
117 BtAbstractDelegate* mAbstractDelegate; |
|
118 BtuiModelSortFilter *mMainFilterModel; |
|
119 |
|
120 HbAction *mAllAction; |
|
121 HbAction *mPairAction; |
|
122 HbDataForm *mDataForm; |
|
123 HbAction* mRemovePairedDevices; |
|
124 HbAction* mRemoveDevices; |
|
125 HbMenu* mSubMenu; |
|
126 }; |
|
127 #endif // BTCPUIMAINVIEW_H |
|