homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsmenuviewbuilder.h
changeset 46 23b5d6a29cce
parent 35 f9ce957a272c
child 55 03646e8da489
equal deleted inserted replaced
39:4e8ebe173323 46:23b5d6a29cce
    18 #ifndef HSMENUVIEWBUILDER_H
    18 #ifndef HSMENUVIEWBUILDER_H
    19 #define HSMENUVIEWBUILDER_H
    19 #define HSMENUVIEWBUILDER_H
    20 
    20 
    21 #include <QFlags>
    21 #include <QFlags>
    22 #include <QMap>
    22 #include <QMap>
       
    23 #include <QSet>
    23 #include <QString>
    24 #include <QString>
    24 #include <qnamespace.h>
    25 #include <qnamespace.h>
    25 #include <hbdocumentloader.h>
    26 #include <HbDocumentLoader>
    26 
    27 
       
    28 class QActionGroup;
    27 class HbAction;
    29 class HbAction;
    28 class HbGroupBox;
    30 class HbGroupBox;
    29 class HbLineEdit;
    31 class HbLineEdit;
    30 class HbListView;
    32 class HbListView;
    31 class HbSearchPanel;
    33 class HbSearchPanel;
    32 class HbToolBar;
    34 class HbToolBar;
    33 class HbView;
    35 class HbView;
    34 class HbWidget;
    36 class HbWidget;
       
    37 class HbToolBarExtension;
       
    38 
       
    39 enum HsViewContext {
       
    40     HsAllAppsContext,
       
    41     HsAllCollectionsContext,
       
    42     HsInstalledAppsContext,
       
    43     HsCollectionContext,
       
    44 };
       
    45 
       
    46 enum HsOperationalContext {
       
    47     HsItemViewContext,
       
    48     HsSearchContext
       
    49 };
       
    50 
    35 
    51 
    36 class HsMenuViewBuilder
    52 class HsMenuViewBuilder
    37 {
    53 {
    38 public:
    54 public:
    39     HsMenuViewBuilder();
    55     HsMenuViewBuilder();
    40     ~HsMenuViewBuilder();
    56     ~HsMenuViewBuilder();
    41 
    57 
    42     bool setLabelVisible(bool);
    58     // mandatory context independent widgets accessors
    43     bool setSearchPanelVisible(bool);
       
    44     bool isLabelVisible() const;
       
    45     bool isSearchPanelVisible() const;
       
    46 
       
    47     HbView *view() const;
       
    48     HbListView *listView() const;
       
    49     HbGroupBox *label() const;
       
    50     HbSearchPanel *searchPanel() const;
       
    51     HbAction *allAppsAction() const;
    59     HbAction *allAppsAction() const;
    52     HbAction *allCollectionsAction() const;
    60     HbAction *allCollectionsAction() const;
    53     HbAction *searchAction() const;
    61     HbAction *searchAction() const;
    54     HbAction *oviStoreAction() const;
    62     HbAction *oviStoreAction() const;
       
    63     HbAction *operatorAction() const;
    55     HbToolBar *toolBar() const;
    64     HbToolBar *toolBar() const;
       
    65     QActionGroup *toolBarActionGroup() const;
       
    66     HbToolBarExtension *toolBarExtension() const;
       
    67 
       
    68     // mandatory context dependent widgets accessors
       
    69     HbView *currentView() const;
       
    70     HbListView *currentListView() const;
       
    71 
       
    72 
       
    73     // optional widgets accessors
       
    74     HbGroupBox *currentViewLabel() const;
       
    75     HbSearchPanel *currentSearchPanel() const;
       
    76 
       
    77 
       
    78     void setViewContext(HsViewContext viewContext);
       
    79     void setOperationalContext(HsOperationalContext operationalContext);
       
    80     bool build();
       
    81 
       
    82 private:
       
    83     void init();
       
    84 
       
    85     bool parseSection(const QString &sectionName = QString());
       
    86 
       
    87 
       
    88     bool readContextConfiguration(HsViewContext, HsOperationalContext);
       
    89 
       
    90 
       
    91     void searchPanelVisibilityChange(bool visible);
       
    92 
    56     HbLineEdit *searchPanelLineEdit() const;
    93     HbLineEdit *searchPanelLineEdit() const;
    57 private:
       
    58 
    94 
    59     bool parseSection(const QString &sectionName);
    95     QMap<HsViewContext, QString > mViewContextToStringMap;
       
    96     QMap<HsOperationalContext, QString > mOperationalContextToStringMap;
    60 
    97 
    61     HbDocumentLoader mDocumentLoader;
    98     HbDocumentLoader mDocumentLoader;
    62 
    99     QSet<QObject *> mLoadedObjects;
    63     QObject mParent;
       
    64 
       
    65     enum ViewOption {
       
    66         Default = 0x0,
       
    67         Label = 0x1,
       
    68         Search = 0x2
       
    69     };
       
    70 
       
    71     Q_DECLARE_FLAGS(ViewOptions, ViewOption)
       
    72     ViewOptions mViewOptions;
       
    73     QMap<ViewOptions, QString> mSections;
       
    74 
       
    75     void buildSectionKeyMap();
       
    76 
   100 
    77     const QString DOCUMENT_FILE_NAME;
   101     const QString DOCUMENT_FILE_NAME;
       
   102     const QString COMMON_SECTION_NAME;
    78     const QString ALL_APPS_ACTION_NAME;
   103     const QString ALL_APPS_ACTION_NAME;
    79     const QString ALL_COLLECTIONS_ACTION_NAME;
   104     const QString ALL_COLLECTIONS_ACTION_NAME;
    80     const QString SEARCH_ACTION_NAME;
   105     const QString SEARCH_ACTION_NAME;
    81     const QString OVI_STORE_ACTION_NAME;
   106     const QString OVI_STORE_ACTION_NAME;
    82     const QString VIEW_NAME;
   107     const QString OPERATOR_ACTION_NAME;
    83     const QString CONTAINER_NAME;
   108     const QString SEARCH_PANEL_NAME;
    84     const QString LIST_VIEW_NAME;
       
    85     const QString TOOL_BAR_NAME;
   109     const QString TOOL_BAR_NAME;
    86     const QString SEARCH_PANEL_NAME;
   110 
    87     const QString LABEL_NAME;
   111     QActionGroup *mToolBarActionGroup;
    88     const QString LIST_VIEW_SECTION_NAME;
   112     HbToolBar *mToolBar;
    89     const QString LIST_LABELED_VIEW_SECTION_NAME;
   113     HbToolBarExtension *mToolBarExtension;
    90     const QString LIST_SEARCH_VIEW_SECTION_NAME;
   114     HbAction *mToolBarExtensionAction;
    91     const QString LIST_SEARCH_LABELED_VIEW_SECTION_NAME;
   115 
       
   116     HsViewContext mViewContext;
       
   117     HsOperationalContext mOperationalContext;
    92 };
   118 };
    93 
   119 
    94 #endif // HSMENUVIEWBUILDER_H
   120 #endif // HSMENUVIEWBUILDER_H