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