67 { |
67 { |
68 // States |
68 // States |
69 |
69 |
70 QState *state_processing = new QState(this); |
70 QState *state_processing = new QState(this); |
71 QState *state_selectingImage = new QState(state_processing); |
71 QState *state_selectingImage = new QState(state_processing); |
|
72 QState *state_editingImage = new QState(state_processing); |
72 QState *state_assigningImage = new QState(state_processing); |
73 QState *state_assigningImage = new QState(state_processing); |
73 QState *state_errorMessage = new QState(this); |
74 QState *state_errorMessage = new QState(this); |
74 |
75 |
75 setInitialState(state_processing); |
76 setInitialState(state_processing); |
76 state_processing->setInitialState(state_selectingImage); |
77 state_processing->setInitialState(state_selectingImage); |
77 |
78 |
78 // Transitions |
79 // Transitions |
79 |
80 #if defined (Q_OS_SYMBIAN) && !defined (__WINSCW__) |
|
81 state_selectingImage->addTransition( |
|
82 this, SIGNAL(event_assignImage()), state_editingImage); |
|
83 #else |
80 state_selectingImage->addTransition( |
84 state_selectingImage->addTransition( |
81 this, SIGNAL(event_assignImage()), state_assigningImage); |
85 this, SIGNAL(event_assignImage()), state_assigningImage); |
|
86 #endif // Q_OS_SYMBIAN |
82 |
87 |
83 state_processing->addTransition( |
88 state_processing->addTransition( |
84 this, SIGNAL(event_error()), state_errorMessage); |
89 this, SIGNAL(event_error()), state_errorMessage); |
85 |
90 |
86 // Actions |
91 // Actions |
87 |
92 |
88 ENTRY_ACTION(state_selectingImage, action_selectingImage_start) |
93 ENTRY_ACTION(state_selectingImage, action_selectingImage_start) |
89 EXIT_ACTION(state_selectingImage, action_selectingImage_cleanup) |
94 EXIT_ACTION(state_selectingImage, action_imageHandler_cleanup) |
|
95 |
|
96 ENTRY_ACTION(state_editingImage, action_editingImage_start) |
|
97 EXIT_ACTION(state_editingImage, action_imageHandler_cleanup) |
90 |
98 |
91 ENTRY_ACTION(state_assigningImage, action_assigningImage_showWaitDialog) |
99 ENTRY_ACTION(state_assigningImage, action_assigningImage_showWaitDialog) |
92 ENTRY_ACTION(state_assigningImage, action_assigningImage_start) |
100 ENTRY_ACTION(state_assigningImage, action_assigningImage_start) |
93 EXIT_ACTION(state_assigningImage, action_assigningImage_cleanup) |
101 EXIT_ACTION(state_assigningImage, action_assigningImage_cleanup) |
94 EXIT_ACTION(state_assigningImage, action_assigningImage_hideWaitDialog) |
102 EXIT_ACTION(state_assigningImage, action_assigningImage_hideWaitDialog) |
100 |
108 |
101 */ |
109 */ |
102 void HsWallpaperSelectionState::action_selectingImage_start() |
110 void HsWallpaperSelectionState::action_selectingImage_start() |
103 { |
111 { |
104 #ifdef Q_OS_SYMBIAN |
112 #ifdef Q_OS_SYMBIAN |
105 mImageFetcher = new HsImageFetcherClient; |
113 mImageHandler = new HsImageHandlingClient; |
106 #else |
114 #else |
107 mImageFetcher = new XQAIWGetImageClient; |
115 mImageHandler = new XQAIWGetImageClient; |
108 #endif |
116 #endif |
109 |
117 |
110 connect(mImageFetcher, SIGNAL(fetchCompleted(const QString&)), |
118 connect(mImageHandler, SIGNAL(fetchCompleted(const QString&)), |
111 this, SLOT(onFetchCompleted(const QString&))); |
119 this, SLOT(onFetchCompleted(const QString&))); |
112 connect(mImageFetcher, SIGNAL(fetchFailed(int, const QString&)), |
120 connect(mImageHandler, SIGNAL(fetchFailed(int, const QString&)), |
113 this, SLOT(onFetchFailed(int, const QString&))); |
121 this, SLOT(onFetchFailed(int, const QString&))); |
114 |
122 |
115 mImageFetcher->fetch(); |
123 mImageHandler->fetch(); |
116 } |
124 } |
117 |
125 |
118 /*! |
126 /*! |
119 |
127 |
120 */ |
128 */ |
121 void HsWallpaperSelectionState::action_selectingImage_cleanup() |
129 void HsWallpaperSelectionState::action_imageHandler_cleanup() |
122 { |
130 { |
123 mImageFetcher->disconnect(this); |
131 mImageHandler->disconnect(this); |
124 mImageFetcher->deleteLater(); |
132 mImageHandler->deleteLater(); |
125 mImageFetcher = 0; |
133 mImageHandler = 0; |
126 } |
134 } |
127 |
135 |
128 /*! |
136 /*! |
129 |
137 |
130 */ |
138 */ |
178 { |
186 { |
179 // TODO: Waiting for UX decision. |
187 // TODO: Waiting for UX decision. |
180 emit event_waitInput(); |
188 emit event_waitInput(); |
181 } |
189 } |
182 |
190 |
|
191 #ifdef COVERAGE_MEASUREMENT |
|
192 #pragma CTC SKIP |
|
193 #endif //COVERAGE_MEASUREMENT |
|
194 /*! |
|
195 |
|
196 */ |
|
197 void HsWallpaperSelectionState::action_editingImage_start() |
|
198 { |
|
199 #ifdef Q_OS_SYMBIAN |
|
200 mImageHandler = new HsImageHandlingClient; |
|
201 |
|
202 connect(mImageHandler, SIGNAL(editorCompleted()), |
|
203 this, SLOT(onEditorCompleted())); |
|
204 connect(mImageHandler, SIGNAL(editorFailed(int, const QString&)), |
|
205 this, SLOT(onFetchFailed(int, const QString&))); |
|
206 |
|
207 mImageHandler->edit(mImagePath); |
|
208 #endif //Q_OS_SYMBIAN |
|
209 } |
|
210 #ifdef COVERAGE_MEASUREMENT |
|
211 #pragma CTC ENDSKIP |
|
212 #endif //COVERAGE_MEASUREMENT |
|
213 |
183 /*! |
214 /*! |
184 |
215 |
185 */ |
216 */ |
186 void HsWallpaperSelectionState::onFetchCompleted(const QString &imagePath) |
217 void HsWallpaperSelectionState::onFetchCompleted(const QString &imagePath) |
187 { |
218 { |