src/hbcore/gui/hbmainwindow_p.cpp
changeset 28 b7da29130b0e
parent 21 4633027730f5
child 30 80e4d18b72f5
equal deleted inserted replaced
23:e6ad4ef83b23 28:b7da29130b0e
   202                 // a splash screen containing a toolbar is shown before the
   202                 // a splash screen containing a toolbar is shown before the
   203                 // mainwindow.
   203                 // mainwindow.
   204                 if (mViewStackWidget->isSwitchingViews() || !mToolbarWasAdded) {
   204                 if (mViewStackWidget->isSwitchingViews() || !mToolbarWasAdded) {
   205                     toolBarD->suppressNextAppearEffect();
   205                     toolBarD->suppressNextAppearEffect();
   206                     mToolbarWasAdded = true;
   206                     mToolbarWasAdded = true;
       
   207                 } else if (mOrientationChangeOngoing && !mAnimateOrientationSwitch) {
       
   208                     toolBarD->suppressNextAppearEffect();
   207                 }
   209                 }
   208                 mScene->addItem(toolBar); // top level
   210                 mScene->addItem(toolBar); // top level
   209             }
   211             }
   210 
   212 
   211             toolBar->setZValue(HbPrivate::ToolBarZValue);
   213             toolBar->setZValue(HbPrivate::ToolBarZValue);
   468     HbDeviceProfile o = HbDeviceProfile::profile(q);
   470     HbDeviceProfile o = HbDeviceProfile::profile(q);
   469     newSize = o.logicalSize();
   471     newSize = o.logicalSize();
   470 
   472 
   471     // do some sanity checking for the size got from device profile
   473     // do some sanity checking for the size got from device profile
   472     if (newSize.isNull() || ((newSize.width()*newSize.height()) < QVga_res)) {  // the resolution must be at least QVGA..
   474     if (newSize.isNull() || ((newSize.width()*newSize.height()) < QVga_res)) {  // the resolution must be at least QVGA..
   473         qWarning("Orient. change error: size from device profile is faulty!");
   475         hbWarning("Orient. change error: size from device profile is faulty!");
   474     }
   476     }
   475 
   477 
   476     q->setSceneRect(0, 0, newSize.width(), newSize.height());
   478     q->setSceneRect(0, 0, newSize.width(), newSize.height());
   477 
   479 
   478     if (mBgItem) {
   480     if (mBgItem) {
   570     bool ok = HbEffectInternal::add(
   572     bool ok = HbEffectInternal::add(
   571                   QStringList() << "HB_view" << "HB_view" << "HB_view" << "HB_view",
   573                   QStringList() << "HB_view" << "HB_view" << "HB_view" << "HB_view",
   572                   QStringList() << "view_show_normal" << "view_hide_normal" <<  "view_show_back" << "view_hide_back",
   574                   QStringList() << "view_show_normal" << "view_hide_normal" <<  "view_show_back" << "view_hide_back",
   573                   QStringList() << "show" << "hide" << "show_back" << "hide_back");
   575                   QStringList() << "show" << "hide" << "show_back" << "hide_back");
   574     if (!ok) {
   576     if (!ok) {
   575         qWarning("HbMainWindow: addViewEffects: atomic registration for show/hide effects failed");
   577         hbWarning("HbMainWindow: addViewEffects: atomic registration for show/hide effects failed");
   576     }
   578     }
   577 
   579 
   578     // Register the alternative default.
   580     // Register the alternative default.
   579     ok = HbEffectInternal::add(
   581     ok = HbEffectInternal::add(
   580              QStringList() << "HB_view" << "HB_view" << "HB_view" << "HB_view",
   582              QStringList() << "HB_view" << "HB_view" << "HB_view" << "HB_view",
   581              QStringList() << "view_show_normal_alt" << "view_hide_normal_alt" << "view_show_back_alt" << "view_hide_back_alt",
   583              QStringList() << "view_show_normal_alt" << "view_hide_normal_alt" << "view_show_back_alt" << "view_hide_back_alt",
   582              QStringList() << "show_alt" << "hide_alt" << "show_alt_back" << "hide_alt_back");
   584              QStringList() << "show_alt" << "hide_alt" << "show_alt_back" << "hide_alt_back");
   583     if (!ok) {
   585     if (!ok) {
   584         qWarning("HbMainWindow: addViewEffects: atomic registration for alternative show/hide effects failed");
   586         hbWarning("HbMainWindow: addViewEffects: atomic registration for alternative show/hide effects failed");
   585     }
   587     }
   586 
   588 
   587     // Register titlebar effects.
   589     // Register titlebar effects.
   588     // These should be overridable in general (so we use HbEffect and no HB_ prefix).
   590     // These should be overridable in general (so we use HbEffect and no HB_ prefix).
   589     ok = HbEffect::add(
   591     ok = HbEffect::add(
   590              QStringList() << "titlebar" << "titlebar" << "titlebar" << "titlebar",
   592              QStringList() << "titlebar" << "titlebar" << "titlebar" << "titlebar",
   591              QStringList() << "titlebar_disappear" <<  "titlebar_appear" << "titlebar_orient_disappear" << "titlebar_orient_appear",
   593              QStringList() << "titlebar_disappear" <<  "titlebar_appear" << "titlebar_orient_disappear" << "titlebar_orient_appear",
   592              QStringList() << "disappear" << "appear" <<  "disappear_orient" << "appear_orient");
   594              QStringList() << "disappear" << "appear" <<  "disappear_orient" << "appear_orient");
   593     if (!ok) {
   595     if (!ok) {
   594         qWarning("HbMainWindow: addViewEffects: atomic registration for titlebar effects failed");
   596         hbWarning("HbMainWindow: addViewEffects: atomic registration for titlebar effects failed");
   595     }
   597     }
   596 
   598 
   597     // Register statusbar effects.
   599     // Register statusbar effects.
   598     ok = HbEffect::add(
   600     ok = HbEffect::add(
   599              QStringList() << "statusbar" << "statusbar" << "statusbar" << "statusbar",
   601              QStringList() << "statusbar" << "statusbar" << "statusbar" << "statusbar",
   600              QStringList() << "statusbar_disappear" <<  "statusbar_appear" << "statusbar_orient_disappear" << "statusbar_orient_appear",
   602              QStringList() << "statusbar_disappear" <<  "statusbar_appear" << "statusbar_orient_disappear" << "statusbar_orient_appear",
   601              QStringList() << "disappear" << "appear" <<  "disappear_orient" << "appear_orient");
   603              QStringList() << "disappear" << "appear" <<  "disappear_orient" << "appear_orient");
   602     if (!ok) {
   604     if (!ok) {
   603         qWarning("HbMainWindow: addViewEffects: atomic registration for statusbar effects failed");
   605         hbWarning("HbMainWindow: addViewEffects: atomic registration for statusbar effects failed");
   604     }
   606     }
   605 }
   607 }
   606 
   608 
   607 /*
   609 /*
   608     Updates UI according to current view and sync it with the tab bar.
   610     Updates UI according to current view and sync it with the tab bar.
   810     Q_Q(HbMainWindow);
   812     Q_Q(HbMainWindow);
   811 
   813 
   812     HbView *view = q->currentView();
   814     HbView *view = q->currentView();
   813     if (view) {
   815     if (view) {
   814         const Hb::SceneItems visibleItems(view->visibleItems());
   816         const Hb::SceneItems visibleItems(view->visibleItems());
   815         view->setTitleBarVisible(visibleItems & Hb::TitleBarItem); // also handles updating of the navigation button
   817 
   816         view->setStatusBarVisible(visibleItems & Hb::StatusBarItem);
   818         // set statusbar and titlebar flag
       
   819         HbView::HbViewFlags flags = view->viewFlags();
       
   820         flags = (visibleItems & Hb::StatusBarItem) ?
       
   821                     flags &~ HbView::ViewStatusBarHidden :
       
   822                     flags |  HbView::ViewStatusBarHidden;
       
   823         flags = (visibleItems & Hb::TitleBarItem) ?
       
   824                     flags &~ HbView::ViewTitleBarHidden :
       
   825                     flags |  HbView::ViewTitleBarHidden;
       
   826         view->setViewFlags( flags ); // also handles updating of the navigation button
   817 
   827 
   818         // ToolBar is a special case, since it depens on the current view's toolbar
   828         // ToolBar is a special case, since it depens on the current view's toolbar
   819         if (visibleItems & Hb::ToolBarItem) {
   829         if (visibleItems & Hb::ToolBarItem) {
   820             if (q->currentView()) {
   830             if (q->currentView()) {
   821                 addToolBarToLayout(HbViewPrivate::d_ptr(q->currentView())->toolBar);
   831                 addToolBarToLayout(HbViewPrivate::d_ptr(q->currentView())->toolBar);