29
|
1 |
/*
|
42
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
29
|
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;
|
42
|
34 |
class HbGroupBox;
|
47
|
35 |
class HbDataForm;
|
29
|
36 |
|
|
37 |
class BtCpUiMainView : public BtCpUiBaseView
|
|
38 |
{
|
|
39 |
Q_OBJECT
|
|
40 |
|
|
41 |
public:
|
31
|
42 |
explicit BtCpUiMainView(
|
|
43 |
BtSettingModel &settingModel,
|
|
44 |
BtDeviceModel &deviceModel,
|
|
45 |
QGraphicsItem *parent = 0 );
|
29
|
46 |
~BtCpUiMainView();
|
|
47 |
// from view manager
|
|
48 |
void createViews();
|
|
49 |
|
|
50 |
Qt::Orientation orientation();
|
|
51 |
|
|
52 |
// from base class BtCpUiBaseView
|
|
53 |
virtual void setSoftkeyBack();
|
42
|
54 |
virtual void activateView( const QVariant& value, bool fromBackButton );
|
29
|
55 |
virtual void deactivateView();
|
|
56 |
|
|
57 |
public slots:
|
|
58 |
void changeOrientation( Qt::Orientation orientation );
|
|
59 |
void changePowerState();
|
42
|
60 |
void visibilityChanged (int index);
|
|
61 |
void changeBtLocalName();
|
31
|
62 |
|
29
|
63 |
void updateSettingItems(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
31
|
64 |
void deviceSelected(const QModelIndex& modelIndex);
|
29
|
65 |
void goToDiscoveryView();
|
31
|
66 |
void goToDeviceView(const QModelIndex& modelIndex);
|
29
|
67 |
virtual void switchToPreviousView();
|
42
|
68 |
|
29
|
69 |
//from delegate classes
|
|
70 |
void powerDelegateCompleted(int status);
|
|
71 |
void visibilityDelegateCompleted(int status);
|
|
72 |
void btNameDelegateCompleted(int status, QVariant param);
|
42
|
73 |
void allActionTriggered();
|
|
74 |
void pairActionTriggered();
|
29
|
75 |
|
42
|
76 |
private slots:
|
|
77 |
void changeView(int targetViewId, bool fromBackButton, const QVariant& value = 0 );
|
29
|
78 |
|
42
|
79 |
private:
|
|
80 |
enum filterType {
|
|
81 |
BtuiAll = 0,
|
|
82 |
BtuiPaired
|
|
83 |
};
|
29
|
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 |
|
42
|
94 |
void updateDeviceListFilter(BtCpUiMainView::filterType filter);
|
|
95 |
|
29
|
96 |
private:
|
42
|
97 |
|
29
|
98 |
HbDocumentLoader *mLoader;
|
42
|
99 |
|
29
|
100 |
HbLineEdit *mDeviceNameEdit;
|
|
101 |
HbPushButton *mPowerButton;
|
|
102 |
HbComboBox *mVisibilityMode;
|
31
|
103 |
HbListView *mDeviceList;
|
42
|
104 |
|
29
|
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;
|
31
|
118 |
BtuiModelSortFilter *mMainFilterModel;
|
29
|
119 |
|
42
|
120 |
HbAction *mAllAction;
|
|
121 |
HbAction *mPairAction;
|
47
|
122 |
HbDataForm *mDataForm;
|
|
123 |
HbAction* mRemovePairedDevices;
|
|
124 |
HbAction* mRemoveDevices;
|
|
125 |
HbMenu* mSubMenu;
|
29
|
126 |
};
|
|
127 |
#endif // BTCPUIMAINVIEW_H
|