bluetoothengine/btui/btcpplugin/btcpuibaseview.h
changeset 63 bcf742120177
parent 41 0b2439c3e397
equal deleted inserted replaced
52:4545c04e61e1 63:bcf742120177
    21 #include <hbview.h>
    21 #include <hbview.h>
    22 #include <qglobal.h>
    22 #include <qglobal.h>
    23 #include <cpbasesettingview.h>
    23 #include <cpbasesettingview.h>
    24 #include <btsettingmodel.h>
    24 #include <btsettingmodel.h>
    25 #include <btdevicemodel.h>
    25 #include <btdevicemodel.h>
       
    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;
    26 
    35 
    27 /*!
    36 /*!
    28     \class BtUiBaseView
    37     \class BtUiBaseView
    29     \brief the class is the base class for all views in btapplication.
    38     \brief the class is the base class for all views in btapplication.
    30 
    39 
    31  */
    40  */
    32 class BtCpUiBaseView : public CpBaseSettingView
    41 class BtcpuiBaseView : public CpBaseSettingView
    33 {
    42 {
    34     Q_OBJECT
    43     Q_OBJECT
    35 
    44 
    36 public:
    45 public:
    37     
    46     
    38     virtual ~BtCpUiBaseView();
    47     virtual ~BtcpuiBaseView();
    39     virtual void activateView( const QVariant& value, bool fromBackButton ) = 0;
    48     
    40     virtual void deactivateView() = 0;    
    49     virtual void activateView( const QVariant& value, bool backNavi) = 0;
    41     virtual void switchToPreviousView() = 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);
    42     
    64     
    43 signals:
    65 signals:
    44 
    66 
    45 protected:
    67 protected:
    46     explicit BtCpUiBaseView(QGraphicsItem *parent = 0);
    68     explicit BtcpuiBaseView(QGraphicsItem *parent = 0);
    47     
    69     
    48     explicit BtCpUiBaseView( 
    70     explicit BtcpuiBaseView(BtSettingModel &settingModel, 
    49             BtSettingModel &settingModel, 
       
    50             BtDeviceModel &deviceModel, 
    71             BtDeviceModel &deviceModel, 
    51             QGraphicsItem *parent = 0);
    72             QGraphicsItem *parent = 0);
    52     
    73     
    53     virtual void setSoftkeyBack() = 0;
    74     void initialise();
       
    75     
       
    76     BtSettingModel *settingModel();
       
    77     
       
    78     BtDeviceModel *deviceModel();
       
    79     
       
    80     BtcpuiViewMgr *viewMgr();
    54 
    81 
    55     BtSettingModel &getSettingModel();
    82     bool createDelegate(BtDelegate::EditorType type,
    56     BtDeviceModel &getDeviceModel();
    83             QObject *receiver, const char *member);
    57     
    84     
       
    85     bool createExecuteDelegate(BtDelegate::EditorType type,
       
    86             QObject *receiver, const char *member, const QVariant &param);    
       
    87 
       
    88     int selectedDeviceTypes(HbAction* action);
       
    89     
       
    90     virtual void createContextMenuActions(int majorRole);
       
    91 
    58 protected:
    92 protected:
       
    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;
    59     
   107     
    60     // owned
   108     // owned
    61     BtSettingModel *mSettingModel;
   109     BtSettingModel *mSettingModel;
    62     
   110     
    63     // owned
   111     // owned
    64     BtDeviceModel *mDeviceModel;
   112     BtDeviceModel *mDeviceModel;
    65     
   113     
    66     QGraphicsItem *mParent;
   114     //The run-time singleton delegate in a btui view
    67     int mPreviousViewId;
   115     BtAbstractDelegate* mDelegate;
    68     
   116     
    69     Q_DISABLE_COPY(BtCpUiBaseView)
   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;
       
   120     
       
   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)
    70 };
   131 };
    71 
   132 
    72 #endif // BTCPUIBASEVIEW_H
   133 #endif // BTCPUIBASEVIEW_H