150 void FtuWizardActivatedState::onExit(QEvent *event) |
140 void FtuWizardActivatedState::onExit(QEvent *event) |
151 { |
141 { |
152 QState::onExit(event); |
142 QState::onExit(event); |
153 mMainWindow->currentView()->takeMenu(); |
143 mMainWindow->currentView()->takeMenu(); |
154 disconnect(mBackAction, SIGNAL(triggered()), |
144 disconnect(mBackAction, SIGNAL(triggered()), |
155 this, SLOT(handleBackEvent())); |
145 this, SLOT(handleBackEvent())); |
|
146 |
|
147 |
|
148 disconnect(mActiveWizard, SIGNAL(wizardDeactivated(FtuWizard *)), |
|
149 this, SLOT(handleGotoToC())); |
156 |
150 |
157 disconnect(mActiveWizard, SIGNAL(viewChanged(FtuWizard *, |
151 disconnect(mActiveWizard, SIGNAL(viewChanged(FtuWizard *, |
158 QGraphicsWidget* )), |
152 QGraphicsWidget* )), |
159 this, SLOT(changeWizardView(FtuWizard*, QGraphicsWidget*))); |
153 this, SLOT(changeWizardView(FtuWizard*, QGraphicsWidget*))); |
160 |
154 |
161 disconnect(mActiveWizard, SIGNAL(fullScreenModeRequested(FtuWizard *)), |
155 |
162 this, SLOT(enableFullScreenMode(FtuWizard*))); |
156 disconnect(mActiveWizard, SIGNAL(infoTextUpdated(FtuWizard *, QString )), |
163 |
157 this, SLOT(updateInfoText(FtuWizard *, QString))); |
164 disconnect(mActiveWizard, SIGNAL(partialScreenModeRequested(FtuWizard * )), |
158 |
165 this, SLOT(enablePartialScreenMode(FtuWizard*))); |
159 //disconnect from the existing wizard's updateMainMenu signal |
166 |
160 disconnect(mActiveWizard,SIGNAL(updateMainMenu(FtuWizard *, HbMenu * )), |
|
161 this,SLOT(updateMainMenu(FtuWizard *, HbMenu * ))); |
|
162 } |
|
163 |
|
164 // --------------------------------------------------------------------------- |
|
165 // FtuWizardActivatedState::setActiveWizardConnections |
|
166 // --------------------------------------------------------------------------- |
|
167 // |
|
168 void FtuWizardActivatedState::setActiveWizardConnections() |
|
169 { |
|
170 // first disconnect possible old connections with active wizard |
|
171 disconnect(mActiveWizard, SIGNAL(wizardDeactivated(FtuWizard *)), |
|
172 this, SLOT(handleGotoToC())); |
|
173 |
|
174 disconnect(mActiveWizard, SIGNAL(viewChanged(FtuWizard *, |
|
175 QGraphicsWidget* )), |
|
176 this, SLOT(changeWizardView(FtuWizard*, QGraphicsWidget*))); |
|
177 |
167 disconnect(mActiveWizard, SIGNAL(infoTextUpdated(FtuWizard *, QString )), |
178 disconnect(mActiveWizard, SIGNAL(infoTextUpdated(FtuWizard *, QString )), |
168 this, SLOT(updateInfoText(FtuWizard *, QString))); |
179 this, SLOT(updateInfoText(FtuWizard *, QString))); |
169 |
180 |
170 //disconnect from the existing existing wizard's updateMainMenu signal |
181 //disconnect from the existing existing wizard's updateMainMenu signal |
171 disconnect(mActiveWizard,SIGNAL(updateMainMenu(FtuWizard *, HbMenu * )), |
182 disconnect(mActiveWizard,SIGNAL(updateMainMenu(FtuWizard *, HbMenu * )), |
172 this,SLOT(updateMainMenu(FtuWizard *, HbMenu * ))); |
183 this,SLOT(updateMainMenu(FtuWizard *, HbMenu * ))); |
173 } |
|
174 |
|
175 // --------------------------------------------------------------------------- |
|
176 // FtuWizardActivatedState::setActiveWizardConnections |
|
177 // --------------------------------------------------------------------------- |
|
178 // |
|
179 void FtuWizardActivatedState::setActiveWizardConnections() |
|
180 { |
|
181 // first disconnect possible old connections with active wizard |
|
182 disconnect(mActiveWizard, SIGNAL(viewChanged(FtuWizard *, |
|
183 QGraphicsWidget* )), |
|
184 this, SLOT(changeWizardView(FtuWizard*, QGraphicsWidget*))); |
|
185 |
|
186 disconnect(mActiveWizard, SIGNAL(fullScreenModeRequested(FtuWizard *)), |
|
187 this, SLOT(enableFullScreenMode(FtuWizard*))); |
|
188 |
|
189 disconnect(mActiveWizard, SIGNAL(partialScreenModeRequested(FtuWizard * )), |
|
190 this, SLOT(enablePartialScreenMode(FtuWizard*))); |
|
191 |
|
192 disconnect(mActiveWizard, SIGNAL(infoTextUpdated(FtuWizard *, QString )), |
|
193 this, SLOT(updateInfoText(FtuWizard *, QString))); |
|
194 |
|
195 //disconnect from the existing existing wizard's updateMainMenu signal |
|
196 disconnect(mActiveWizard,SIGNAL(updateMainMenu(FtuWizard *, HbMenu * )), |
|
197 this,SLOT(updateMainMenu(FtuWizard *, HbMenu * ))); |
|
198 |
184 |
199 // then connect new ones to active wizard |
185 // then connect new ones to active wizard |
200 connect(mActiveWizard, SIGNAL(viewChanged(FtuWizard *, QGraphicsWidget* )), |
186 connect(mActiveWizard, SIGNAL(viewChanged(FtuWizard *, QGraphicsWidget* )), |
201 this, SLOT(changeWizardView(FtuWizard*, QGraphicsWidget*))); |
187 this, SLOT(changeWizardView(FtuWizard*, QGraphicsWidget*))); |
202 |
188 |
203 connect(mActiveWizard, SIGNAL(fullScreenModeRequested(FtuWizard *)), |
|
204 this, SLOT(enableFullScreenMode(FtuWizard*))); |
|
205 |
|
206 connect(mActiveWizard, SIGNAL(partialScreenModeRequested(FtuWizard * )), |
|
207 this, SLOT(enablePartialScreenMode(FtuWizard*))); |
|
208 |
|
209 connect(mActiveWizard, SIGNAL(infoTextUpdated(FtuWizard *, QString )), |
189 connect(mActiveWizard, SIGNAL(infoTextUpdated(FtuWizard *, QString )), |
210 this, SLOT(updateInfoText(FtuWizard *, QString))); |
190 this, SLOT(updateInfoText(FtuWizard *, QString))); |
211 |
191 |
212 // connect to the updateMainMenu wizard signal |
192 // connect to the updateMainMenu wizard signal |
213 connect(mActiveWizard,SIGNAL(updateMainMenu(FtuWizard *, HbMenu * )), |
193 connect(mActiveWizard,SIGNAL(updateMainMenu(FtuWizard *, HbMenu * )), |
214 this,SLOT(updateMainMenu(FtuWizard *, HbMenu * ))); |
194 this,SLOT(updateMainMenu(FtuWizard *, HbMenu * ))); |
|
195 |
|
196 connect(mActiveWizard, SIGNAL(wizardDeactivated(FtuWizard *)), |
|
197 this, SLOT(handleGotoToC())); |
215 } |
198 } |
216 |
199 |
217 // --------------------------------------------------------------------------- |
200 // --------------------------------------------------------------------------- |
218 // FtuWizardActivatedState::content |
201 // FtuWizardActivatedState::content |
219 // --------------------------------------------------------------------------- |
202 // --------------------------------------------------------------------------- |
279 int index = wizards.indexOf(mActiveWizard); |
266 int index = wizards.indexOf(mActiveWizard); |
280 |
267 |
281 // temp solution to skip edge indexes - start |
268 // temp solution to skip edge indexes - start |
282 if (index == 0) { index++; } |
269 if (index == 0) { index++; } |
283 if (index == wizards.count()-1) { index--; } |
270 if (index == wizards.count()-1) { index--; } |
284 // temp solution to skip edge indexes - end |
|
285 |
|
286 // create model index for active wizard |
|
287 QModelIndex modelIndex = mMenustrip->model()->index(index, 0); |
|
288 // scroll to correct position in menustrip |
|
289 HbAbstractItemView::ScrollHint hint = HbAbstractItemView::PositionAtCenter; |
|
290 mMenustrip->scrollTo(modelIndex, hint); |
|
291 } |
271 } |
292 } |
272 } |
293 } |
273 } |
294 |
274 |
295 // --------------------------------------------------------------------------- |
|
296 // FtuWizardActivatedState::enableFullScreenMode |
|
297 // --------------------------------------------------------------------------- |
|
298 // |
|
299 void FtuWizardActivatedState::enableFullScreenMode(FtuWizard *caller) |
|
300 { |
|
301 if(caller == mActiveWizard) |
|
302 { |
|
303 mPluginDisplayMode = FullScreen; |
|
304 // Remove menustrip |
|
305 mMenustrip->setVisible(false); |
|
306 caller->resizeWizard(calculateWizardGeometry()); |
|
307 } |
|
308 } |
|
309 |
|
310 // --------------------------------------------------------------------------- |
|
311 // FtuWizardActivatedState::enablePartialScreenMode |
|
312 // --------------------------------------------------------------------------- |
|
313 // |
|
314 void FtuWizardActivatedState::enablePartialScreenMode(FtuWizard *caller) |
|
315 { |
|
316 if(caller == mActiveWizard) |
|
317 { |
|
318 mPluginDisplayMode = PartialScreen; |
|
319 mMenustrip->setVisible(true); |
|
320 caller->resizeWizard(calculateWizardGeometry()); |
|
321 } |
|
322 } |
|
323 |
275 |
324 // --------------------------------------------------------------------------- |
276 // --------------------------------------------------------------------------- |
325 // FtuWizardActivatedState::updateInfoText |
277 // FtuWizardActivatedState::updateInfoText |
326 // --------------------------------------------------------------------------- |
278 // --------------------------------------------------------------------------- |
327 // |
279 // |
339 // --------------------------------------------------------------------------- |
291 // --------------------------------------------------------------------------- |
340 // |
292 // |
341 HbMainWindow* FtuWizardActivatedState::mainWindow() |
293 HbMainWindow* FtuWizardActivatedState::mainWindow() |
342 { |
294 { |
343 return hbInstance->allMainWindows().at(0); |
295 return hbInstance->allMainWindows().at(0); |
344 } |
|
345 |
|
346 // --------------------------------------------------------------------------- |
|
347 // FtuWizardActivatedState::constructGrid |
|
348 // --------------------------------------------------------------------------- |
|
349 // |
|
350 void FtuWizardActivatedState::constructGrid() |
|
351 { |
|
352 // fetch grid view from docml |
|
353 mMenustrip = qobject_cast<HbGridView *>(mDocumentLoader->findWidget(WIZARD_GRID_VIEW)); |
|
354 // set row amount for grid |
|
355 mMenustrip->setRowCount(gridRowCount); |
|
356 |
|
357 mMenustrip->setScrollDirections(Qt::Horizontal); |
|
358 |
|
359 FtuContentService* ftuContentService = content(); |
|
360 // get wizards |
|
361 QList<FtuWizard*> wizards = ftuContentService->wizards(); |
|
362 |
|
363 QStandardItemModel* model = new QStandardItemModel(this); |
|
364 |
|
365 for(int i = 0 ; i < wizards.size() ; ++i) |
|
366 { |
|
367 // get wizard settings |
|
368 const FtuWizardSetting& settings = wizards.at(i)->wizardSettings(); |
|
369 QStandardItem* item = new QStandardItem(); |
|
370 HbIcon icon(settings.mMenustripDefaultIcon.absoluteFilePath()); |
|
371 |
|
372 // item->setBackground(QBrush(Qt::lightGray)); |
|
373 item->setData(icon, Qt::DecorationRole); |
|
374 |
|
375 QStringList data; |
|
376 data << settings.mMenustripLabel; |
|
377 |
|
378 item->setData(QVariant(data), Qt::DisplayRole); |
|
379 |
|
380 model->appendRow(item); |
|
381 } |
|
382 // set above defined model for menustrip |
|
383 mMenustrip->setModel(model); |
|
384 |
|
385 connect(mMenustrip, SIGNAL(activated(const QModelIndex)), |
|
386 this, SLOT(activateWizard(const QModelIndex))); |
|
387 } |
296 } |
388 |
297 |
389 // --------------------------------------------------------------------------- |
298 // --------------------------------------------------------------------------- |
390 // FtuWizardActivatedState::activateWizard |
299 // FtuWizardActivatedState::activateWizard |
391 // --------------------------------------------------------------------------- |
300 // --------------------------------------------------------------------------- |