29
|
1 |
/*
|
42
|
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:
|
|
15 |
*
|
|
16 |
*/
|
29
|
17 |
|
|
18 |
#ifndef BTCPUIBASEVIEW_H
|
|
19 |
#define BTCPUIBASEVIEW_H
|
|
20 |
|
|
21 |
#include <hbview.h>
|
|
22 |
#include <qglobal.h>
|
|
23 |
#include <cpbasesettingview.h>
|
31
|
24 |
#include <btsettingmodel.h>
|
|
25 |
#include <btdevicemodel.h>
|
57
|
26 |
#include <btdelegateconsts.h>
|
|
27 |
#include <btuimodelsortfilter.h>
|
|
28 |
#include <HbAbstractViewItem>
|
|
29 |
#include <HbMenu>
|
|
30 |
|
|
31 |
class BtcpuiViewMgr;
|
|
32 |
class HbSelectionDialog;
|
|
33 |
class BtAbstractDelegate;
|
|
34 |
class HbMainWindow;
|
29
|
35 |
|
|
36 |
/*!
|
|
37 |
\class BtUiBaseView
|
|
38 |
\brief the class is the base class for all views in btapplication.
|
|
39 |
|
|
40 |
*/
|
57
|
41 |
class BtcpuiBaseView : public CpBaseSettingView
|
29
|
42 |
{
|
|
43 |
Q_OBJECT
|
|
44 |
|
|
45 |
public:
|
|
46 |
|
57
|
47 |
virtual ~BtcpuiBaseView();
|
|
48 |
|
|
49 |
virtual void activateView( const QVariant& value, bool backNavi) = 0;
|
|
50 |
virtual void deactivateView() = 0;
|
|
51 |
virtual void setPreviousView(BtcpuiBaseView *view);
|
|
52 |
void setViewMgr(BtcpuiViewMgr *mgr);
|
|
53 |
virtual void take(BtAbstractDelegate *delegate);
|
|
54 |
|
|
55 |
public slots:
|
|
56 |
|
|
57 |
virtual void backToPreviousView();
|
|
58 |
void viewByDeviceTypeDialog();
|
|
59 |
virtual void viewByDialogClosed(HbAction* action);
|
|
60 |
void contextMenuTriggered(HbAction *action);
|
|
61 |
void deviceSelected(const QModelIndex& modelIndex);
|
|
62 |
void showContextMenu(HbAbstractViewItem *item, const QPointF &coords);
|
|
63 |
void handleDelegateCompleted(int error, BtAbstractDelegate* delegate);
|
31
|
64 |
|
29
|
65 |
signals:
|
|
66 |
|
31
|
67 |
protected:
|
57
|
68 |
explicit BtcpuiBaseView(QGraphicsItem *parent = 0);
|
42
|
69 |
|
57
|
70 |
explicit BtcpuiBaseView(BtSettingModel &settingModel,
|
31
|
71 |
BtDeviceModel &deviceModel,
|
|
72 |
QGraphicsItem *parent = 0);
|
|
73 |
|
57
|
74 |
void initialise();
|
|
75 |
|
|
76 |
BtSettingModel *settingModel();
|
|
77 |
|
|
78 |
BtDeviceModel *deviceModel();
|
|
79 |
|
|
80 |
BtcpuiViewMgr *viewMgr();
|
|
81 |
|
|
82 |
bool createDelegate(BtDelegate::EditorType type,
|
|
83 |
QObject *receiver, const char *member);
|
|
84 |
|
|
85 |
bool createExecuteDelegate(BtDelegate::EditorType type,
|
|
86 |
QObject *receiver, const char *member, const QVariant ¶m);
|
31
|
87 |
|
57
|
88 |
int selectedDeviceTypes(HbAction* action);
|
29
|
89 |
|
57
|
90 |
virtual void createContextMenuActions(int majorRole);
|
|
91 |
|
29
|
92 |
protected:
|
57
|
93 |
|
|
94 |
enum devTypeSelectionList {
|
|
95 |
BtUiDevAudioDevice = 0,
|
|
96 |
BtUiDevComputer,
|
|
97 |
BtUiDevInputDevice,
|
|
98 |
BtUiDevPhone,
|
|
99 |
BtUiDevOtherDevice
|
|
100 |
};
|
|
101 |
|
|
102 |
// The view manager from which the device view can be accessed.
|
|
103 |
// not owned.
|
|
104 |
BtcpuiViewMgr *mViewMgr;
|
|
105 |
|
|
106 |
HbMainWindow *mMainWindow;
|
29
|
107 |
|
42
|
108 |
// owned
|
31
|
109 |
BtSettingModel *mSettingModel;
|
|
110 |
|
42
|
111 |
// owned
|
31
|
112 |
BtDeviceModel *mDeviceModel;
|
|
113 |
|
57
|
114 |
//The run-time singleton delegate in a btui view
|
|
115 |
BtAbstractDelegate* mDelegate;
|
|
116 |
|
|
117 |
// The view which this view is navigated from.
|
|
118 |
// We will navigate to previous view if the back action is activated.
|
|
119 |
BtcpuiBaseView *mPreviousView;
|
29
|
120 |
|
57
|
121 |
// The back action of this view.
|
|
122 |
HbAction *mBack;
|
|
123 |
|
|
124 |
HbSelectionDialog *mQuery;
|
|
125 |
|
|
126 |
HbMenu* mContextMenu;
|
|
127 |
HbAbstractViewItem *mLongPressedItem;
|
|
128 |
|
|
129 |
BtuiModelSortFilter* mBtuiModelSortFilter;
|
|
130 |
Q_DISABLE_COPY(BtcpuiBaseView)
|
29
|
131 |
};
|
|
132 |
|
|
133 |
#endif // BTCPUIBASEVIEW_H
|