1 /* |
|
2 * Copyright (c) 2009 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: FtuWizard class definition |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef FTUWIZARD_H |
|
20 #define FTUWIZARD_H |
|
21 |
|
22 #include "ftuwizardmodellib.h" |
|
23 |
|
24 #include <QFileInfo> |
|
25 #include <QObject> |
|
26 #include <QRectF> |
|
27 #include <QDate> |
|
28 #include <hbmenu> |
|
29 |
|
30 class QGraphicsWidget; |
|
31 |
|
32 /** |
|
33 * @ingroup group_ftuwizardmodel |
|
34 * @brief Represents a wizard plugin visualization information. |
|
35 * |
|
36 * FtuWizardSetting struct contains the information needed to construct the GUI in |
|
37 * the FTU fw. |
|
38 * |
|
39 * @lib ?library |
|
40 * @since S60 ?S60_version |
|
41 */ |
|
42 |
|
43 typedef struct { |
|
44 /** |
|
45 * The default icon to be shown in table of contents UI component. |
|
46 */ |
|
47 QFileInfo mTocDefaultIcon; |
|
48 /** |
|
49 * The pressed icon to be shown in table of contents UI component. |
|
50 */ |
|
51 QFileInfo mTocPressedIcon; |
|
52 /** |
|
53 * The focussed icon to be shown in table of contents UI component. |
|
54 */ |
|
55 QFileInfo mTocFocussedIcon; |
|
56 /** |
|
57 * The text to be shown in table of contents UI component. |
|
58 */ |
|
59 QString mTocLabel; |
|
60 /** |
|
61 * Informs Framework whether a plugin is having any ftu view or not. |
|
62 * It should be set to false by plugin if it has any FTU view to be shown |
|
63 * when the plugin is activated. It should be set to true if plugin |
|
64 * is invoking any service/wizard, when plugin is selected/activated. |
|
65 */ |
|
66 bool mNoViews; |
|
67 } FtuWizardSetting; |
|
68 |
|
69 /** |
|
70 * @ingroup group_ftuwizardmodel |
|
71 * @brief Represents a wizard plugin in the framework. |
|
72 * |
|
73 * FtuWizard is an interface through which setting wizard plugin can be |
|
74 * executed in the FTU fw. |
|
75 * |
|
76 * @lib ?library |
|
77 * @since S60 ?S60_version |
|
78 */ |
|
79 |
|
80 class FTUWIZARDMODEL_EXPORT FtuWizard : public QObject |
|
81 { |
|
82 Q_OBJECT |
|
83 public: |
|
84 /** |
|
85 * The reason why the FTU fw and the wizard plugin is being shut down. |
|
86 */ |
|
87 enum ShutdownReason {MemoryLow, GraphicsMemoryLow, NormalBoot}; |
|
88 |
|
89 public: |
|
90 |
|
91 /** |
|
92 * Destructor. |
|
93 * @since S60 ?S60_version. |
|
94 */ |
|
95 virtual ~FtuWizard(){} |
|
96 |
|
97 /** |
|
98 * Called by the FTU fw during initialize cycle of the wizard, it is during |
|
99 * this phase the wizard widget |
|
100 * usually creates its initial view. |
|
101 * Once the initialization is done, wizardInitialized signal must be |
|
102 * emitted. |
|
103 * @param cenrepOwnerId Id of the owner of Cenrep holding wizard completion Information. |
|
104 * @param wizardIdx Index of the Cenrep key for a wizard. |
|
105 * If wizard is invoking another application, it should provide cenrepOwnerId and wizardIdx |
|
106 * to the application. Application should write 1 into the wizardIdx cenrep on completion. |
|
107 |
|
108 * @since S60 ?S60_version. |
|
109 */ |
|
110 virtual void initializeWizard(qint32 cenrepOwnerId, int wizardIdx) = 0; |
|
111 |
|
112 /** |
|
113 * Called by the FTU fw when the wizard becomes the current wizard. |
|
114 * @since S60 ?S60_version. |
|
115 */ |
|
116 virtual void activateWizard() = 0; |
|
117 |
|
118 /** |
|
119 * Called by the FTU fw when the wizard is no longer being displayed. |
|
120 */ |
|
121 virtual void deactivateWizard() = 0; |
|
122 |
|
123 /** |
|
124 * Called by the FTU fw before the wizard destructor is called. |
|
125 * @param reason The reason why the ftu fw is being killed. |
|
126 * @return The mode how wizard plugin is shut down. |
|
127 * true means the wizard can be deleted immediately. |
|
128 * false means the wizard signals with shutdownDone when it can |
|
129 * be released. |
|
130 */ |
|
131 virtual bool shutdownWizard(ShutdownReason reason) = 0; |
|
132 |
|
133 /** |
|
134 * Called by the FTU fw to set the wizard size. |
|
135 * @param geometry The rectangle allocated to this wizard. |
|
136 */ |
|
137 virtual void resizeWizard(const QRectF& geometry) = 0; |
|
138 |
|
139 /** |
|
140 * This wizard setting values is queryed by the FTU fw to get the display |
|
141 * properties of the wizard required to be shown in the FTU fw's table of |
|
142 * contents view and menu strip (e.g the icon & name of the wizard). |
|
143 * The information must be available once the plugin instance has been |
|
144 * created. |
|
145 * @return The plugin wizard gui settings. |
|
146 */ |
|
147 virtual const FtuWizardSetting& wizardSettings() = 0; |
|
148 |
|
149 /** |
|
150 * Called by FTU fw when back button is clicked in the plugin view. |
|
151 * In this method the wizard plugin can implement internally showing and |
|
152 * hiding GUI elements if the plugin has multiple 'views'. |
|
153 * @return true if back event is handled internally in wizard plugin |
|
154 * false if the FTU fw is to handle the event. |
|
155 */ |
|
156 virtual bool handleBackEvent() = 0; |
|
157 |
|
158 /** |
|
159 * Called by FTU fw to get the date when the settings have been saved. |
|
160 * @return The date when wizard settings have been completed. |
|
161 */ |
|
162 virtual QDate wizardCompletedDate() = 0; |
|
163 |
|
164 protected: |
|
165 |
|
166 /** |
|
167 * Constructor. |
|
168 * @since S60 ?S60_version. |
|
169 */ |
|
170 FtuWizard(){} |
|
171 |
|
172 |
|
173 signals: |
|
174 /** |
|
175 * Emit this signal to update the text of the info text widget. |
|
176 * @param caller The calling wizard plugin instance. |
|
177 * @param text The info text to be shown. |
|
178 */ |
|
179 void infoTextUpdated(FtuWizard *caller, QString text); |
|
180 |
|
181 /** |
|
182 * Emit this signal notify the progress on wizard settings. |
|
183 * @param caller The calling wizard plugin instance. |
|
184 * @param showCompleteness True if the progress is being indicated on the |
|
185 * UI. |
|
186 * @param completenessPercentage The progress of the settings operation. |
|
187 */ |
|
188 void progressUpdated(FtuWizard *caller, bool showProgess, |
|
189 int progressPercentage); |
|
190 |
|
191 /** |
|
192 * Emit this signal when changing the view inside the wizard plugin. |
|
193 * @param caller The calling wizard plugin instance. |
|
194 * @param viewWidget The new plugin view widget to be shown. |
|
195 */ |
|
196 void viewChanged(FtuWizard *caller, QGraphicsWidget* viewWidget); |
|
197 |
|
198 /** |
|
199 * Adds an over-lay widget on top of the current view, used to add an |
|
200 * overlay animation on top of the current view |
|
201 * @param caller The calling wizard plugin instance. |
|
202 * @param overlay The overlay widget to be added. |
|
203 */ |
|
204 void overlayAdded(FtuWizard *caller, QGraphicsWidget* overlay); |
|
205 |
|
206 /** |
|
207 * Removes the overlay widget added by addOverlay signal. |
|
208 * @param caller The calling wizard plugin instance. |
|
209 * @param overlay The overlay widget to be removed. |
|
210 */ |
|
211 void overlayRemoved(FtuWizard *caller, QGraphicsWidget* overlay); |
|
212 |
|
213 /** |
|
214 * Emit this signal to indicate initialization is done. |
|
215 * @param caller The calling wizard plugin instance. |
|
216 * @param success True if succeeded, false otherwise. |
|
217 */ |
|
218 void wizardInitialized(FtuWizard *caller, bool success); |
|
219 |
|
220 /** |
|
221 * Emit this signal to indicate that the wizard plugin can be deleted. |
|
222 * Note that this signal does not need to be emitted if true is returned |
|
223 * from shutdownWizard. |
|
224 * @param caller The calling wizard plugin instance. |
|
225 */ |
|
226 void shutdownCompleted(FtuWizard *caller); |
|
227 |
|
228 /** |
|
229 * Emit this signal to indicate that the wizard plugin wants a custom view menu to be shown. |
|
230 * from shutdownWizard. |
|
231 * @param caller The calling wizard plugin instance. |
|
232 * @param menu The HbMenu instance that needs to be shown on the view |
|
233 */ |
|
234 void updateMainMenu(FtuWizard *caller, HbMenu * menu); |
|
235 |
|
236 /** |
|
237 * Emit this signal to indicate that the wizard plugin wants to be deactivated. |
|
238 * Wizard is deactivated and Table of Contents is shown by the application. |
|
239 * @param caller The calling wizard plugin instance. |
|
240 */ |
|
241 void wizardDeactivated(FtuWizard *caller); |
|
242 |
|
243 }; |
|
244 |
|
245 #endif // FTUWIZARD_H |
|
246 |
|