|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef BTCPUIDEVICEVIEW_H |
|
19 #define BTCPUIDEVICEVIEW_H |
|
20 |
|
21 #include <cpbasesettingview.h> |
|
22 #include <hbaction.h> |
|
23 #include <hbtoolbar.h> |
|
24 #include "btcpuibaseview.h" |
|
25 |
|
26 class HbGroupBox; |
|
27 class HbLabel; |
|
28 class HbTextEdit; |
|
29 class HbPushButton; |
|
30 class HbIcon; |
|
31 class HbDocumentLoader; |
|
32 class HbListView; |
|
33 class HbDataFormModel; |
|
34 class HbDataFormModelItem; |
|
35 class CpSettingFormItemData; |
|
36 class BtAbstractDelegate; |
|
37 |
|
38 |
|
39 class BtCpUiDeviceView : public BtCpUiBaseView |
|
40 { |
|
41 Q_OBJECT |
|
42 |
|
43 public: |
|
44 explicit BtCpUiDeviceView( |
|
45 BtSettingModel &settingModel, |
|
46 BtDeviceModel &deviceModel, |
|
47 QGraphicsItem *parent = 0); |
|
48 virtual ~BtCpUiDeviceView(); |
|
49 virtual void activateView( const QVariant& value, int cmdId ); |
|
50 virtual void deactivateView(); |
|
51 virtual void setSoftkeyBack(); |
|
52 |
|
53 public slots: |
|
54 |
|
55 virtual void switchToPreviousView(); |
|
56 void updateDeviceData(); |
|
57 void changeBtDeviceName(); |
|
58 void pairUnpair(); |
|
59 void connectDisconnect(); |
|
60 void pairDelegateCompleted(int status); |
|
61 void unpairDelegateCompleted(int status); |
|
62 void connectDelegateCompleted(int status); |
|
63 void disconnectDelegateCompleted(int status); |
|
64 |
|
65 private: |
|
66 void clearViewData(); |
|
67 void pairDevice(); |
|
68 void unpairDevice(); |
|
69 void connectDevice(); |
|
70 void disconnectDevice(); |
|
71 void setDeviceCategory(int cod, int majorRole, int minorRole);//cod:class of device |
|
72 void setDeviceStatus(int majorRole); |
|
73 void setTextAndVisibilityOfButtons(); |
|
74 |
|
75 private: |
|
76 HbDocumentLoader *mLoader; |
|
77 HbGroupBox *mGroupBox; |
|
78 HbLabel *mDeviceIcon; |
|
79 HbTextEdit *mDeviceName; |
|
80 HbLabel *mDeviceCategory; |
|
81 HbLabel *mDeviceStatus; |
|
82 |
|
83 HbPushButton *mPair_Unpair; |
|
84 HbPushButton *mConnect_Disconnect; |
|
85 HbPushButton *mDeviceSetting; |
|
86 |
|
87 |
|
88 // data structures for switching between views |
|
89 bool mEventFilterInstalled; |
|
90 int mAutoCmdId; |
|
91 Qt::Orientation mOrientation; |
|
92 |
|
93 HbMainWindow* mMainWindow; |
|
94 BtCpUiBaseView* mMainView; |
|
95 //BtCpUiBaseView* mDeviceView; |
|
96 HbAction *mSoftKeyBackAction; |
|
97 |
|
98 QModelIndex mDeviceIndex; |
|
99 QVariant mDeviceBdAddr; |
|
100 |
|
101 //true -> device is paired; false -> device is unpaired |
|
102 bool mPairStatus; |
|
103 |
|
104 //true-> device is connected; false -> device is disconnected |
|
105 bool mConnectStatus; |
|
106 |
|
107 //true -> device is connectable |
|
108 //e.g. not possible to connect to a phone, but possible to connect to a headset |
|
109 bool mConnectable; |
|
110 |
|
111 BtAbstractDelegate* mAbstractDelegate; |
|
112 |
|
113 |
|
114 }; |
|
115 |
|
116 #endif |