90 Hb::WindowFlagNoBackground flag is set for the HbMainWindow. Normally the |
94 Hb::WindowFlagNoBackground flag is set for the HbMainWindow. Normally the |
91 standard background item fills the entire screen so the background is not |
95 standard background item fills the entire screen so the background is not |
92 really visible. |
96 really visible. |
93 |
97 |
94 HbMainWindow has a signalling mechanism for helping control the |
98 HbMainWindow has a signalling mechanism for helping control the |
95 application's view construction. viewReady()-signal is emitted |
99 application's view construction. The viewReady() signal is emitted when a |
96 when view's internal construction is completed and basic parts of |
100 view's internal construction is completed and basic parts of view are |
97 view are already drawn. Same signal is also emitted when current |
101 already drawn. Same signal is also emitted when current view has |
98 view is switched. This helps applications to split the view |
102 changed. This helps applications to split the view construction to |
99 construction to reasonable tasks. For example the lower priority |
103 reasonable tasks. For example the lower priority tasks like opening network |
100 tasks like opening network connection or preparing other currently |
104 connection or preparing other currently hidden application views can happen |
101 hidden application views can happen on background when first view |
105 on background when first view is already drawn. |
102 is already drawn. |
|
103 |
106 |
104 Example of simple Hb application constructing HbMainWindow: |
107 Example of simple Hb application constructing HbMainWindow: |
105 |
108 |
106 \include mainwindow1/main.cpp |
109 \include mainwindow1/main.cpp |
107 |
110 |
170 \fn void HbMainWindow::viewReady() |
173 \fn void HbMainWindow::viewReady() |
171 |
174 |
172 This signal is emitted first time when window content is drawn on screen. |
175 This signal is emitted first time when window content is drawn on screen. |
173 It will only be emitted again when current view is changed and drawn on screen. |
176 It will only be emitted again when current view is changed and drawn on screen. |
174 |
177 |
|
178 This means that this signal is emitted in the following cases: |
|
179 |
|
180 - When the mainwindow is fully constructed, this happens shortly after |
|
181 painting it for the first time. |
|
182 |
|
183 - When a new view is added using addView() or insertView() after the |
|
184 mainwindow is fully constructed and the newly added view becomes the |
|
185 current view. It will not be emitted when calling addView() or |
|
186 insertView() before showing the mainwindow or entering the event loop |
|
187 because in that case the signal will anyway be emitted later, when the |
|
188 mainwindow becomes ready. It is also not emitted when the newly added view |
|
189 does not become the current view. |
|
190 |
|
191 - When the current view is changed using setCurrentView(). |
|
192 |
175 If the view switch is animated, the signal is emitted only after the effect has |
193 If the view switch is animated, the signal is emitted only after the effect has |
176 completed. |
194 completed. |
177 |
195 |
178 Application developers may connect to this signal to do lower priority construction |
196 Application developers may connect to this signal to do lower priority construction |
179 tasks. Note however that when thinking about the tasks, it is important to keep the UI |
197 tasks. Note however that when thinking about the tasks, it is important to keep the UI |
180 responsive all the time. |
198 responsive all the time. |
181 */ |
199 */ |
182 |
200 |
183 /*! |
201 /*! |
|
202 \fn void HbMainWindow::obscured() |
|
203 |
|
204 This signal is emited whenever the window is completely overlaped by another |
|
205 window. |
|
206 |
|
207 Application developers can use this signal to pause or stop painting when |
|
208 the window is not visible to the user at all. |
|
209 |
|
210 This signal has real implementation only for Symbian and X11 platforms. On |
|
211 desktop platforms it is simulated via a settings window option. |
|
212 |
|
213 The typical use case is to use the obscured() and revealed() signals in |
|
214 connection with device dialogs (global pop-ups): When such a dialog is |
|
215 shown, the application loses foreground (focus), but it may still be |
|
216 partially visible because the dialogs will not fill the entire screen. To |
|
217 get notified about such cases, combine your application's |
|
218 foreground-background handling with handling also these signals. |
|
219 |
|
220 Consider this as a best-effort solution only, the exact behavior depends on |
|
221 the platform and may have limitations. For example on Symbian transparent |
|
222 windows will never obscure another window, regardless of the content. |
|
223 |
|
224 These signals are not a replacement to the focus-based ApplicationActivate |
|
225 and ApplicationDeactivate events. An application may lose the focus |
|
226 completely (i.e. lose foreground) even when it is still partially visible to |
|
227 the user. |
|
228 |
|
229 \sa revealed() |
|
230 \sa isObscured() |
|
231 */ |
|
232 |
|
233 /*! |
|
234 \fn void HbMainWindow::revealed() |
|
235 |
|
236 This signal is emited whenever the window is visible to the user partially |
|
237 or completely. |
|
238 |
|
239 This signal has real implementation only for Symbian and X11 platforms. On |
|
240 desktop platforms it is simulated via the settings option. |
|
241 |
|
242 Consider this as a best-effort solution only, the exact behavior depends on |
|
243 the platform and may have limitations. For example on Symbian transparent |
|
244 windows may cause the revealed signal to be emitted even when the content is |
|
245 not really visible. |
|
246 |
|
247 These signals are not a replacement to the focus-based ApplicationActivate |
|
248 and ApplicationDeactivate events. An application may lose the focus |
|
249 completely (i.e. lose foreground) even when it is still partially visible to |
|
250 the user. |
|
251 |
|
252 \sa obscured() |
|
253 \sa isObscured() |
|
254 */ |
|
255 |
|
256 /*! |
184 \class HbRootItem |
257 \class HbRootItem |
185 |
258 |
186 \brief The parent of all graphics items (including the clipping item (HbScreen) |
259 \brief The parent of all graphics items (including the clipping item (HbScreen) |
187 and the background item). Basically it is a HbWidget with polishing disabled |
260 and the background item). Basically it is a HbWidget with polishing disabled |
188 (so we won't waste time with that). |
261 (so we won't waste time with that). |
191 */ |
264 */ |
192 |
265 |
193 class HbRootItem : public HbWidget |
266 class HbRootItem : public HbWidget |
194 { |
267 { |
195 public: |
268 public: |
196 explicit HbRootItem( QGraphicsItem *parent = 0 ); |
269 explicit HbRootItem(QGraphicsItem *parent = 0); |
197 ~HbRootItem() {} |
270 ~HbRootItem() {} |
198 private: |
271 private: |
199 bool event(QEvent *event); |
272 bool event(QEvent *event); |
200 }; |
273 }; |
201 |
274 |
202 /*! |
275 /*! |
203 Constructs an HbMainWindow object with \a parent. |
276 Constructs an HbMainWindow object with \a parent. |
204 |
277 |
205 \a windowFlags can be used for specifying special functionality to HbMainWindow. |
278 \a windowFlags can be used for specifying special functionality to HbMainWindow. |
206 |
279 |
207 \sa Hb::WindowFlag |
280 \sa Hb::WindowFlag |
208 */ |
281 */ |
209 HbMainWindow::HbMainWindow(QWidget *parent, Hb::WindowFlags windowFlags): |
282 HbMainWindow::HbMainWindow(QWidget *parent, Hb::WindowFlags windowFlags): |
210 QGraphicsView(parent), d_ptr(new HbMainWindowPrivate) |
283 QGraphicsView(parent), d_ptr(new HbMainWindowPrivate) |
211 { |
284 { |
212 Q_D(HbMainWindow); |
285 Q_D(HbMainWindow); |
213 d->q_ptr = this; |
286 d->q_ptr = this; |
214 |
287 |
215 // No need for any default (e.g. blank white) background for this window. |
288 // No need for any default (e.g. blank white) background for this window. |
216 // Setting this attribute is mandatory in order to have a flicker-less |
|
217 // startup (both with and without splash screen). |
|
218 setAttribute(Qt::WA_NoSystemBackground); |
289 setAttribute(Qt::WA_NoSystemBackground); |
|
290 setOptimizationFlag(QGraphicsView::DontSavePainterState); |
219 |
291 |
220 // Continue with basic initialization. Note: Prefer doing everything that is |
292 // Continue with basic initialization. Note: Prefer doing everything that is |
221 // not absolutely compulsory in _q_delayedConstruction instead. |
293 // not absolutely compulsory in _q_delayedConstruction instead. |
222 |
294 |
223 d->init(); |
295 d->init(); |
249 } else if (HbMainWindowOrientation::instance()->isEnabled()) { |
321 } else if (HbMainWindowOrientation::instance()->isEnabled()) { |
250 d->mOrientation = HbMainWindowOrientation::instance()->sensorOrientation(); |
322 d->mOrientation = HbMainWindowOrientation::instance()->sensorOrientation(); |
251 d->mAutomaticOrientationSwitch = true; |
323 d->mAutomaticOrientationSwitch = true; |
252 } else { |
324 } else { |
253 d->mOrientation = d->mDefaultOrientation; |
325 d->mOrientation = d->mDefaultOrientation; |
254 d->mAutomaticOrientationSwitch = false; |
326 d->mAutomaticOrientationSwitch = false; |
255 } |
327 } |
256 |
328 |
257 #if defined(Q_WS_S60) || defined(HB_Q_WS_MAEMO) |
329 #if defined(Q_WS_S60) || defined(HB_Q_WS_MAEMO) |
258 setWindowState(Qt::WindowFullScreen); |
330 setWindowState(Qt::WindowFullScreen); |
259 #endif//Q_WS_S60 |
331 #endif//Q_WS_S60 |
260 |
332 |
261 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
333 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
262 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
334 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
263 setFrameShape(QFrame::NoFrame); |
335 setFrameStyle(QFrame::NoFrame); |
264 |
336 |
265 // create scene and style |
337 // create scene and style |
266 d->mScene = new HbGraphicsScene(this); |
338 d->mScene = new HbGraphicsScene(this); |
267 |
339 |
268 // workaround for problems with BSP tree implementation in Qt |
340 // workaround for problems with BSP tree implementation in Qt |
269 d->mScene->setItemIndexMethod(QGraphicsScene::NoIndex); |
341 d->mScene->setItemIndexMethod(QGraphicsScene::NoIndex); |
270 |
342 |
271 d->mScene->setSceneRect(0, 0, pSize.width(), pSize.height()); |
343 d->mScene->setSceneRect(0, 0, pSize.width(), pSize.height()); |
272 setScene(d->mScene); |
344 setScene(d->mScene); |
273 |
345 |
274 // add root item |
346 // add root item |
275 d->mRootItem = new HbRootItem; |
347 d->mRootItem = new HbRootItem; |
276 d->mRootItem->setZValue(HbPrivate::RootItemZValue); |
348 d->mRootItem->setZValue(HbPrivate::RootItemZValue); |
290 d->mViewStackWidget = new HbContentWidget(this, d->mClippingItem); |
362 d->mViewStackWidget = new HbContentWidget(this, d->mClippingItem); |
291 d->mEffectItem = d->mViewStackWidget; |
363 d->mEffectItem = d->mViewStackWidget; |
292 d->mClippingItem->setStackWidget(d->mViewStackWidget); |
364 d->mClippingItem->setStackWidget(d->mViewStackWidget); |
293 connect(d->mViewStackWidget, SIGNAL(currentChanged(int)), |
365 connect(d->mViewStackWidget, SIGNAL(currentChanged(int)), |
294 this, SLOT(_q_viewChanged())); |
366 this, SLOT(_q_viewChanged())); |
295 connect(d->mViewStackWidget, SIGNAL(widgetRemoved(QGraphicsWidget*)), |
367 connect(d->mViewStackWidget, SIGNAL(widgetRemoved(QGraphicsWidget *)), |
296 this, SLOT(_q_viewRemoved(QGraphicsWidget*))); |
368 this, SLOT(_q_viewRemoved(QGraphicsWidget *))); |
297 |
369 |
298 // create Titlebar (container for indicators, titlepane and secondary softkey |
370 // create Titlebar (container for indicator button, titlepane and navigation button |
299 d->mTitleBar = new HbTitleBar(this, d->mClippingItem); |
371 d->mTitleBar = new HbTitleBar(this, d->mClippingItem); |
300 d->mTitleBar->setZValue(HbPrivate::TitleBarZValue); |
372 d->mTitleBar->setZValue(HbPrivate::TitleBarZValue); |
301 |
373 |
302 // create StatusBar (container for clock, indicators, and battery and signal icons) |
374 // create StatusBar (container for clock, indicators, and battery and signal icons) |
303 d->mStatusBar = new HbStatusBar(this, d->mClippingItem); |
375 d->mStatusBar = new HbStatusBar(this, d->mClippingItem); |
304 d->mStatusBar->setZValue(HbPrivate::StatusBarZValue); |
376 d->mStatusBar->setZValue(HbPrivate::StatusBarZValue); |
305 |
377 |
306 // At this point the mainwindow is considered more or less fully constructed. |
378 // At this point the mainwindow is considered more or less fully constructed. |
307 HbInstancePrivate::d_ptr()->addWindow(this); |
379 HbInstancePrivate::d_ptr()->addWindow(this); |
308 |
380 |
309 QRectF rect(0,0,pSize.width(),pSize.height()); |
381 QRectF rect(0, 0, pSize.width(), pSize.height()); |
310 resize(pSize); |
382 resize(pSize); |
311 d->mLayoutRect = rect; |
383 d->mLayoutRect = rect; |
312 d->mRootItem->setGeometry(rect); |
384 d->mRootItem->setGeometry(rect); |
313 d->mClippingItem->setGeometry(rect); |
385 d->mClippingItem->setGeometry(rect); |
314 setSceneRect(0, 0, pSize.width(), pSize.height()); |
386 setSceneRect(0, 0, pSize.width(), pSize.height()); |
315 setTransformationAnchor(QGraphicsView::AnchorViewCenter); |
387 setTransformationAnchor(QGraphicsView::AnchorViewCenter); |
316 |
388 |
359 |
436 |
360 HbInstancePrivate::d_ptr()->removeWindow(this); |
437 HbInstancePrivate::d_ptr()->removeWindow(this); |
361 delete d_ptr; |
438 delete d_ptr; |
362 |
439 |
363 // to workaround problem when creating/destroying multiple hbmainwindow's in unit tests (win env) |
440 // to workaround problem when creating/destroying multiple hbmainwindow's in unit tests (win env) |
364 #ifdef Q_OS_WIN |
441 #ifdef Q_OS_WIN |
365 destroy(); |
442 destroy(); |
366 #endif |
443 #endif |
367 } |
444 } |
368 |
445 |
369 /*! |
446 /*! |
370 Adds a \a widget to the HbMainWindow object. Passing 0 in |
447 Adds a \a widget to the HbMainWindow object. Passing 0 in |
371 \a widget creates an empty HbView. |
448 \a widget creates an empty HbView. |
372 |
449 |
373 The \a widget can be either a HbView or QGraphicsWidget. If it is |
450 The \a widget can be either a HbView or QGraphicsWidget. If it is |
374 the QGraphicsWidget then HbMainWindow will create a HbView and set |
451 a QGraphicsWidget (or any subclass that is not HbView) then |
375 \a widget as the new HbView's content widget. |
452 HbMainWindow will create a HbView and set \a widget as the new |
|
453 HbView's content widget. |
|
454 |
|
455 When \a widget is a HbView, use HbView::setWidget() to set the content |
|
456 widget for the view. Note that you should never attach child items or set a layout |
|
457 directly to the HbView instance, even though HbView is also a HbWidget. |
|
458 Instead, create a content widget, set it to the view via HbView::setWidget(), |
|
459 and attach children or set a layout to that. |
|
460 |
|
461 Use setCurrentView() to switch between the added views. (only one of them is visible at a time) |
|
462 The view-specific decorators (toolbar, Options menu, title in the titlebar) and of course |
|
463 the visibility of the view's content widgets will be updated and managed automatically by the framework |
|
464 when switching views. |
|
465 |
|
466 For a detailed description of views see the HbView class. |
|
467 |
|
468 Note that using view switching (i.e. several HbView instances, setCurrentView(), etc.) in |
|
469 Hb applications is not mandatory, it is purely optional. For applications that are not really |
|
470 view based (e.g. because they only have one screen of content or because they have more "fluid" UI where |
|
471 the traditional view separation does not make that much sense) it may sometimes be better (and may provide more freedom) |
|
472 to have just one view and manage the content entirely via the content widget of that one view. |
|
473 (one can still use HbStackedLayout and manual visibility management of child widgets to achieve a traditional view-like look, |
|
474 even when the Hb view management is not used) |
|
475 |
|
476 After calling addView() the caller does not need to care about |
|
477 destroying \a widget, the framework will take care of that by |
|
478 reparenting \a widget if needed. |
376 |
479 |
377 A HbMainWindow should only have one of each view and adding a view |
480 A HbMainWindow should only have one of each view and adding a view |
378 it already has will not cause the same view to be in the |
481 it already has will not cause the same view to be in the |
379 HbMainWindow twice. |
482 HbMainWindow twice. |
380 |
483 |
381 After calling addView() the caller does not need to care about |
|
382 destroying \a widget, the framework will take care of that by |
|
383 reparenting \a widget if needed. |
|
384 |
|
385 \return the new view |
484 \return the new view |
386 |
485 |
387 \sa insertView removeView |
486 \sa insertView() removeView() setCurrentView() |
|
487 \sa HbView HbStackedLayout |
388 */ |
488 */ |
389 HbView *HbMainWindow::addView(QGraphicsWidget *widget) |
489 HbView *HbMainWindow::addView(QGraphicsWidget *widget) |
390 { |
490 { |
391 Q_D(HbMainWindow); |
491 Q_D(HbMainWindow); |
392 HbView *view = 0; |
492 HbView *view = 0; |
697 Q_D(const HbMainWindow); |
812 Q_D(const HbMainWindow); |
698 return d->mBgItem ? d->mBgItem->imageName(orientation) : QString(); |
813 return d->mBgItem ? d->mBgItem->imageName(orientation) : QString(); |
699 } |
814 } |
700 |
815 |
701 /*! |
816 /*! |
|
817 Sets the background image drawing mode. This setting controls how |
|
818 the background image is displayed. |
|
819 |
|
820 By default the mode is set to Hb::ScaleBackgroundToFit. |
|
821 |
|
822 \sa backgroundImageMode() |
|
823 \sa Hb::BackgroundImageMode |
|
824 */ |
|
825 void HbMainWindow::setBackgroundImageMode(Hb::BackgroundImageMode mode) |
|
826 { |
|
827 Q_D(HbMainWindow); |
|
828 if (d->mBgItem) { |
|
829 d->mBgItem->setImageMode(mode); |
|
830 } |
|
831 } |
|
832 |
|
833 /*! |
|
834 Returns the currently set background image drawing mode. |
|
835 |
|
836 \sa setBackgroundImageMode() |
|
837 \sa Hb::BackgroundImageMode |
|
838 */ |
|
839 Hb::BackgroundImageMode HbMainWindow::backgroundImageMode() const |
|
840 { |
|
841 Q_D(const HbMainWindow); |
|
842 return d->mBgItem ? d->mBgItem->imageMode() : Hb::ScaleBackgroundToFit; |
|
843 } |
|
844 |
|
845 /*! |
702 Sets the animations enabled when the orientation is changed automatically. |
846 Sets the animations enabled when the orientation is changed automatically. |
703 By default animations are enabled. |
847 By default animations are enabled. |
704 |
848 |
705 \sa automaticOrientationEffectEnabled() |
849 \sa automaticOrientationEffectEnabled() |
706 */ |
850 */ |
707 |
851 |
708 void HbMainWindow::setAutomaticOrientationEffectEnabled(bool enabled) |
852 void HbMainWindow::setAutomaticOrientationEffectEnabled(bool enabled) |
709 { |
853 { |
710 Q_D(HbMainWindow); |
854 Q_D(HbMainWindow); |
711 d->mAutomaticOrientationChangeAnimation = enabled; |
855 d->mAutomaticOrientationChangeAnimation = enabled; |
712 } |
856 } |
713 |
857 |
714 /*! |
858 /*! |
715 Returns boolean value to signify whether animations enabled/disabled during |
859 Returns boolean value to signify whether animations enabled/disabled during |
716 automatic orientation change. By default animations are enabled. |
860 automatic orientation change. By default animations are enabled. |
717 |
861 |
718 \sa setAutomaticOrientationEffectEnabled() |
862 \sa setAutomaticOrientationEffectEnabled() |
719 */ |
863 */ |
720 bool HbMainWindow::automaticOrientationEffectEnabled() const |
864 bool HbMainWindow::automaticOrientationEffectEnabled() const |
731 QGraphicsView::changeEvent(event); |
875 QGraphicsView::changeEvent(event); |
732 if (event->type() == QEvent::LayoutDirectionChange) { |
876 if (event->type() == QEvent::LayoutDirectionChange) { |
733 // Notify layout direction change to the icon framework |
877 // Notify layout direction change to the icon framework |
734 HbLayoutDirectionNotifier::instance()->notifyLayoutDirectionChange(); |
878 HbLayoutDirectionNotifier::instance()->notifyLayoutDirectionChange(); |
735 |
879 |
736 broadcastEvent( HbEvent::WindowLayoutDirectionChanged ); |
880 broadcastEvent(HbEvent::WindowLayoutDirectionChanged); |
737 |
881 |
738 foreach (QGraphicsItem *item, items()) { |
882 foreach(QGraphicsItem * item, items()) { |
739 if (item->isWidget() && !item->parentItem() ) { |
883 if (item->isWidget() && !item->parentItem()) { |
740 QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item); |
884 QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item); |
741 if (!widget->testAttribute(Qt::WA_SetLayoutDirection)){ |
885 if (!widget->testAttribute(Qt::WA_SetLayoutDirection)) { |
742 widget->setLayoutDirection(layoutDirection()); |
886 widget->setLayoutDirection(layoutDirection()); |
743 widget->setAttribute(Qt::WA_SetLayoutDirection, false); |
887 widget->setAttribute(Qt::WA_SetLayoutDirection, false); |
744 } |
888 } |
745 } |
889 } |
746 } |
890 } |
818 */ |
962 */ |
819 void HbMainWindow::resizeEvent(QResizeEvent *event) |
963 void HbMainWindow::resizeEvent(QResizeEvent *event) |
820 { |
964 { |
821 Q_D(HbMainWindow); |
965 Q_D(HbMainWindow); |
822 |
966 |
823 if ( !HbMainWindowPrivate::dragToResizeEnabled ) { |
967 if (!HbMainWindowPrivate::dragToResizeEnabled) { |
824 // determine the default orientation width < height -> portrait |
968 // determine the default orientation width < height -> portrait |
825 if (event->size().width() < event->size().height()) |
969 if (event->size().width() < event->size().height()) { |
826 d->mDefaultOrientation = Qt::Vertical; |
970 d->mDefaultOrientation = Qt::Vertical; |
827 else |
971 } else { |
828 d->mDefaultOrientation = Qt::Horizontal; |
972 d->mDefaultOrientation = Qt::Horizontal; |
|
973 } |
829 d->mForceSetOrientation = true; |
974 d->mForceSetOrientation = true; |
830 d->setTransformedOrientation(d->mOrientation, false); |
975 d->setTransformedOrientation(d->mOrientation, false); |
831 d->mForceSetOrientation = false; |
976 d->mForceSetOrientation = false; |
832 } else { |
977 } else { |
833 // RnD feature for resizing the window by dragging |
978 // RnD feature for resizing the window by dragging |
834 QSize newSize(event->size()); |
979 QSize newSize(event->size()); |
835 setSceneRect(0,0,newSize.width(),newSize.height()); |
980 setSceneRect(0, 0, newSize.width(), newSize.height()); |
836 d->mClippingItem->resize(newSize); |
981 d->mClippingItem->resize(newSize); |
837 if (d->mBgItem) { |
982 if (d->mBgItem) { |
838 d->mBgItem->resize(newSize); |
983 d->mBgItem->resize(newSize); |
839 } |
984 } |
840 } |
985 } |
841 } |
986 } |
842 |
987 |
843 /*! |
988 /*! |
844 Reimplemented from QObject::customEvent(). |
989 Reimplemented from QObject::customEvent(). |
845 */ |
990 */ |
846 void HbMainWindow::customEvent( QEvent *event ) |
991 void HbMainWindow::customEvent(QEvent *event) |
847 { |
992 { |
848 Q_D(HbMainWindow); |
993 Q_D(HbMainWindow); |
849 if (event->type() == HbMainWindowPrivate::IdleEvent) { // called asyncronously after the application start-up |
994 if (event->type() == HbMainWindowPrivate::IdleEvent) { // called asyncronously after the application start-up |
850 if (!d->mIdleEventHandled) { |
995 if (!d->mIdleEventHandled) { |
851 d->mIdleEventHandled = true; |
996 d->mIdleEventHandled = true; |
852 if ( HbFeatureManager::instance()->featureStatus( HbFeatureManager::TheTestUtility ) ) { |
997 if (HbFeatureManager::instance()->featureStatus(HbFeatureManager::TheTestUtility)) { |
853 // create the test utility |
998 // create the test utility |
854 if ( !d->mTheTestUtility ) { |
999 if (!d->mTheTestUtility) { |
855 d->mTheTestUtility = new HbTheTestUtility(this); |
1000 d->mTheTestUtility = new HbTheTestUtility(this); |
856 } |
1001 } |
857 } |
1002 } |
858 // get rid of the splash screen widget (it is not visible to the user anyway at this point) |
1003 #ifdef Q_OS_SYMBIAN |
|
1004 // Disable surface transparency unless we were really asked to be transparent. |
|
1005 // Must be done before destroying the splash screen widget. |
|
1006 if (!testAttribute(Qt::WA_TranslucentBackground)) { |
|
1007 RWindow *const window = static_cast<RWindow *>(effectiveWinId()->DrawableWindow()); |
|
1008 window->SetSurfaceTransparency(false); |
|
1009 } |
|
1010 #endif |
|
1011 // Get rid of the splash screen widget. (it is not visible to the user anyway at this point) |
859 HbSplashScreen::destroy(); |
1012 HbSplashScreen::destroy(); |
860 } |
1013 } |
861 // Notify that mainwindow is (most probably) ready. |
1014 // Notify that mainwindow is (most probably) ready. |
862 // The signal must be emitted always, even when there was no need to do anything. |
1015 // The signal must be emitted always, even when there was no need to do anything. |
863 emit d->idleEventDispatched(); |
1016 emit d->idleEventDispatched(); |
864 } else if(event->type() == HbMainWindowPrivate::IdleOrientationEvent) { // complete the orientation change effect chain |
1017 } else if (event->type() == HbMainWindowPrivate::IdleOrientationEvent) { // complete the orientation change effect chain |
865 if (d->mEffectItem && d->mOrientationChangeOngoing) { |
1018 if (d->mEffectItem && d->mOrientationChangeOngoing && d->mOrientationEffectFinished) { |
866 HbEffect::start(d->mEffectItem, "rootItemFinalPhase", this, "rootItemFinalPhaseDone"); |
1019 HbEffect::start(d->mEffectItem, "rootItemFinalPhase", this, "rootItemFinalPhaseDone"); |
867 } |
1020 } |
868 } else if (event->type() == HbMainWindowPrivate::IdleOrientationFinalEvent) { |
1021 } else if (event->type() == HbMainWindowPrivate::IdleOrientationFinalEvent) { |
869 if (d->mAnimateOrientationSwitch) { |
1022 if (d->mAnimateOrientationSwitch) { |
870 HbEffect::start(d->mTitleBar, "titlebar", "appear_orient"); |
1023 HbEffect::start(d->mTitleBar, "titlebar", "appear_orient"); |
871 HbEffect::start(d->mStatusBar, "statusbar", "appear_orient"); |
1024 HbEffect::start(d->mStatusBar, "statusbar", "appear_orient"); |
872 if (d->mCurrentToolbar) { |
1025 if (d->mCurrentToolbar) { |
873 HbToolBarPrivate *toolBarD = HbToolBarPrivate::d_ptr(d->mCurrentToolbar); |
1026 HbToolBarPrivate *toolBarD = HbToolBarPrivate::d_ptr(d->mCurrentToolbar); |
874 toolBarD->startAppearOrientEffect(); |
1027 toolBarD->startAppearOrientEffect(); |
875 } |
1028 } else { |
876 d->mOrientationChangeOngoing = false; |
1029 foreach(HbView * view, views()) { |
|
1030 view->toolBar()->resetTransform(); |
|
1031 view->toolBar()->setOpacity(1); |
|
1032 view->toolBar()->show(); |
|
1033 HbToolBarPrivate::d_ptr(view->toolBar())->mOrientationEffectsRunning = false; |
|
1034 } |
|
1035 } |
|
1036 d->updateOrientationChangeStatus(); |
877 if (d->mAutomaticOrientationSwitch && HbMainWindowOrientation::instance()->isEnabled()) { |
1037 if (d->mAutomaticOrientationSwitch && HbMainWindowOrientation::instance()->isEnabled()) { |
878 d->setTransformedOrientation(HbMainWindowOrientation::instance()->sensorOrientation(), d->mAnimateOrientationSwitch); |
1038 d->setTransformedOrientation(HbMainWindowOrientation::instance()->sensorOrientation(), d->mAnimateOrientationSwitch); |
879 } |
1039 } else if (d->mRequestedOrientation != d->mOrientation) { |
880 else if (d->mRequestedOrientation != d->mOrientation) { |
|
881 d->setTransformedOrientation(d->mRequestedOrientation, d->mAnimateOrientationSwitch); |
1040 d->setTransformedOrientation(d->mRequestedOrientation, d->mAnimateOrientationSwitch); |
882 } |
1041 } |
883 } else { |
1042 } else { |
884 // cancel() with clearEffect cannot be used because the effects may have already been canceled. |
1043 // cancel() with clearEffect cannot be used because the effects may have already been canceled. |
885 if (d->mTitleBar) { |
1044 if (d->mTitleBar) { |