29
|
1 |
/*
|
|
2 |
* Copyright (c) 2008-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: 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>
|
31
|
23 |
#include <btuimodelsortfilter.h>
|
29
|
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;
|
31
|
33 |
class HbListView;
|
29
|
34 |
|
|
35 |
class BtCpUiMainView : public BtCpUiBaseView
|
|
36 |
{
|
|
37 |
Q_OBJECT
|
|
38 |
|
|
39 |
public:
|
31
|
40 |
// enum ViewIndex {
|
|
41 |
// MainView,
|
|
42 |
// SearchView,
|
|
43 |
// DeviceView,
|
|
44 |
// LastView
|
|
45 |
// };
|
|
46 |
explicit BtCpUiMainView(
|
|
47 |
BtSettingModel &settingModel,
|
|
48 |
BtDeviceModel &deviceModel,
|
|
49 |
QGraphicsItem *parent = 0 );
|
29
|
50 |
~BtCpUiMainView();
|
|
51 |
// from view manager
|
|
52 |
void createViews();
|
|
53 |
|
|
54 |
Qt::Orientation orientation();
|
|
55 |
|
|
56 |
// from base class BtCpUiBaseView
|
|
57 |
virtual void setSoftkeyBack();
|
|
58 |
virtual void activateView( const QVariant& value, int cmdId );
|
|
59 |
virtual void deactivateView();
|
|
60 |
|
|
61 |
public slots:
|
|
62 |
void commandCompleted( int cmdId, int err, const QString &diagnostic );
|
|
63 |
void changeOrientation( Qt::Orientation orientation );
|
|
64 |
void itemActivated(QModelIndex index);
|
|
65 |
void changePowerState();
|
31
|
66 |
|
29
|
67 |
void updateSettingItems(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
31
|
68 |
void deviceSelected(const QModelIndex& modelIndex);
|
29
|
69 |
void goToDiscoveryView();
|
31
|
70 |
void goToDeviceView(const QModelIndex& modelIndex);
|
29
|
71 |
|
|
72 |
// from view manager
|
|
73 |
void changeView(int targetViewId, bool fromBackButton, int cmdId, const QVariant& value = 0 );
|
|
74 |
void switchToPreviousViewReally();
|
|
75 |
virtual void switchToPreviousView();
|
|
76 |
|
|
77 |
void visibilityChanged (int index);
|
|
78 |
void changeBtLocalName();
|
|
79 |
|
|
80 |
//from delegate classes
|
|
81 |
void powerDelegateCompleted(int status);
|
|
82 |
void visibilityDelegateCompleted(int status);
|
|
83 |
void btNameDelegateCompleted(int status, QVariant param);
|
|
84 |
|
|
85 |
protected:
|
|
86 |
|
|
87 |
|
|
88 |
private:
|
|
89 |
VisibilityMode indexToVisibilityMode(int index);
|
|
90 |
int visibilityModeToIndex(VisibilityMode mode);
|
|
91 |
BtCpUiBaseView * idToView(int targetViewId);
|
|
92 |
|
|
93 |
//Functions to set the Previous Local settings in case of error
|
|
94 |
void setPrevBtLocalName();
|
|
95 |
void setPrevVisibilityMode();
|
|
96 |
|
|
97 |
private:
|
|
98 |
QAbstractItemModel* mSubModel;
|
|
99 |
HbDocumentLoader *mLoader;
|
|
100 |
HbLineEdit *mDeviceNameEdit;
|
|
101 |
HbPushButton *mPowerButton;
|
|
102 |
HbComboBox *mVisibilityMode;
|
31
|
103 |
HbListView *mDeviceList;
|
29
|
104 |
|
|
105 |
// data structures for switching between views
|
|
106 |
bool mEventFilterInstalled;
|
|
107 |
int mAutoCmdId;
|
|
108 |
Qt::Orientation mOrientation;
|
|
109 |
|
|
110 |
// from view manager
|
|
111 |
HbMainWindow* mMainWindow;
|
|
112 |
BtCpUiBaseView* mMainView;
|
|
113 |
BtCpUiBaseView* mDeviceView;
|
|
114 |
BtCpUiBaseView* mSearchView;
|
|
115 |
BtCpUiBaseView* mCurrentView;
|
|
116 |
int mCurrentViewId;
|
|
117 |
HbAction *mBackAction;
|
|
118 |
QList<int> mPreviousViewIds;
|
|
119 |
|
|
120 |
//poiter to abstract delegate, and it is instantiated at runtime
|
|
121 |
BtAbstractDelegate* mAbstractDelegate;
|
31
|
122 |
BtuiModelSortFilter *mMainFilterModel;
|
29
|
123 |
|
|
124 |
};
|
|
125 |
#endif // BTCPUIMAINVIEW_H
|