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 <QPair> |
23 #include <QSet> |
24 #include <QSet> |
|
25 #include <QSharedPointer> |
24 #include <QString> |
26 #include <QString> |
25 #include <qnamespace.h> |
27 #include <qnamespace.h> |
26 #include <HbDocumentLoader> |
28 #include <HbDocumentLoader> |
27 #include "hsmenustates_global.h" |
29 #include "hsmenustates_global.h" |
28 |
30 |
29 class QActionGroup; |
31 class QActionGroup; |
30 class HbAction; |
32 class HbAction; |
31 class HbGroupBox; |
33 class HbGroupBox; |
32 class HbLineEdit; |
34 class HbLineEdit; |
33 class HbListView; |
35 class HbListView; |
34 class HbSearchPanel; |
|
35 class HbToolBar; |
36 class HbToolBar; |
36 class HbView; |
37 class HbView; |
37 class HbWidget; |
38 class HbWidget; |
38 class HbToolBarExtension; |
39 class HbToolBarExtension; |
39 class HbPushButton; |
40 class HbPushButton; |
40 |
41 |
41 enum HsViewContext { |
42 enum HsStateContext { |
42 HsAllAppsContext, |
43 HsAllAppsContext = 0, |
43 HsAllCollectionsContext, |
44 HsAllCollectionsContext, |
44 HsInstalledAppsContext, |
45 HsInstalledAppsContext, |
45 HsCollectionContext, |
46 HsCollectionContext, |
|
47 InvalidStateContext |
46 }; |
48 }; |
47 |
49 |
48 enum HsOperationalContext { |
50 enum HsOperationalContext { |
49 HsItemViewContext, |
51 HsItemViewContext = 0, |
50 HsSearchContext, |
|
51 HsButtonContext, |
52 HsButtonContext, |
52 HsEmptyLabelContext |
53 HsEmptyLabelContext, |
|
54 InvalidOperationalContext |
53 }; |
55 }; |
54 |
56 |
55 HS_STATES_TEST_CLASS(MenuStatesTest) |
57 HS_STATES_TEST_CLASS(MenuStatesTest) |
56 |
58 |
57 class HsMenuViewBuilder |
59 class HsMenuViewBuilder |
69 HbToolBar *toolBar() const; |
71 HbToolBar *toolBar() const; |
70 QActionGroup *toolBarActionGroup() const; |
72 QActionGroup *toolBarActionGroup() const; |
71 HbToolBarExtension *toolBarExtension() const; |
73 HbToolBarExtension *toolBarExtension() const; |
72 |
74 |
73 // mandatory context dependent widgets accessors |
75 // mandatory context dependent widgets accessors |
74 HbView *currentView() const; |
76 HbView *currentView(); |
75 HbListView *currentListView() const; |
77 HbListView *currentListView(); |
76 |
78 |
77 |
79 |
78 // optional widgets accessors |
80 // optional widgets accessors |
79 HbGroupBox *currentViewLabel() const; |
81 HbGroupBox *currentViewLabel(); |
80 HbSearchPanel *currentSearchPanel() const; |
82 HbPushButton *currentAddContentButton(); |
81 HbPushButton *collectionButton() const; |
|
82 |
83 |
83 |
84 |
84 void setViewContext(HsViewContext viewContext); |
85 void setStateContext(HsStateContext stateContext); |
85 void setOperationalContext(HsOperationalContext operationalContext); |
86 void setOperationalContext(HsOperationalContext operationalContext); |
86 bool build(); |
|
87 |
87 |
88 private: |
88 private: |
89 void init(); |
89 typedef QPair<HsStateContext, HsOperationalContext> Context; |
|
90 typedef QMap<Context, QSharedPointer<HbDocumentLoader> > LoaderMap; |
90 |
91 |
91 bool parseSection(const QString §ionName = QString()); |
92 QSharedPointer<HbDocumentLoader> |
|
93 parseDocument(const QString &documentBaseName); |
|
94 |
|
95 QSharedPointer<HbDocumentLoader> readContextConfiguration(); |
|
96 |
|
97 Context context() const; |
|
98 |
|
99 QSharedPointer<HbDocumentLoader> currentLoader(); |
92 |
100 |
93 |
101 |
94 bool readContextConfiguration(HsViewContext, HsOperationalContext); |
102 QSet<QObject *> mLoadedObjects; |
95 |
103 |
96 |
104 |
97 void searchPanelVisibilityChange(bool visible); |
|
98 |
|
99 HbLineEdit *searchPanelLineEdit() const; |
|
100 |
|
101 QMap<HsViewContext, QString > mViewContextToStringMap; |
|
102 QMap<HsOperationalContext, QString > mOperationalContextToStringMap; |
|
103 |
|
104 HbDocumentLoader mDocumentLoader; |
|
105 QSet<QObject *> mLoadedObjects; |
|
106 |
|
107 const QString DOCUMENT_FILE_NAME; |
|
108 const QString ALL_APPS_ACTION_NAME; |
105 const QString ALL_APPS_ACTION_NAME; |
109 const QString ALL_COLLECTIONS_ACTION_NAME; |
106 const QString ALL_COLLECTIONS_ACTION_NAME; |
110 const QString SEARCH_ACTION_NAME; |
107 const QString SEARCH_ACTION_NAME; |
111 const QString OVI_STORE_ACTION_NAME; |
108 const QString OVI_STORE_ACTION_NAME; |
112 const QString OPERATOR_ACTION_NAME; |
109 const QString OPERATOR_ACTION_NAME; |
113 const QString SEARCH_PANEL_NAME; |
|
114 const QString BUTTON_NAME; |
|
115 const QString TOOL_BAR_NAME; |
|
116 |
110 |
117 QActionGroup *mToolBarActionGroup; |
111 QActionGroup *mToolBarActionGroup; |
118 HbToolBar *mToolBar; |
112 HbToolBar *mToolBar; |
119 HbToolBarExtension *mToolBarExtension; |
113 HbToolBarExtension *mToolBarExtension; |
120 HbAction *mToolBarExtensionAction; |
114 HbAction *mToolBarExtensionAction; |
121 |
115 |
122 HsViewContext mViewContext; |
116 HsStateContext mStateContext; |
123 HsOperationalContext mOperationalContext; |
117 HsOperationalContext mOperationalContext; |
124 |
118 |
125 HS_STATES_TEST_FRIEND_CLASS(MenuStatesTest) |
119 HS_STATES_TEST_FRIEND_CLASS(MenuStatesTest) |
|
120 |
|
121 LoaderMap mLoaderMap; |
|
122 QSharedPointer<HbDocumentLoader> mCommonObjectsLoader; |
126 }; |
123 }; |
127 |
124 |
128 #endif // HSMENUVIEWBUILDER_H |
125 #endif // HSMENUVIEWBUILDER_H |