VirtualBox

Changeset 74260 in vbox for trunk


Ignore:
Timestamp:
Sep 14, 2018 11:11:00 AM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: VirtualBox Manager UI: Remove old way of saving/restoring tool order settings, it's no more used.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp

    r74249 r74260  
    4646
    4747UIVirtualBoxManagerWidget::UIVirtualBoxManagerWidget(UIVirtualBoxManager *pParent)
    48     : m_fPolished(false)
    49     , m_pActionPool(pParent->actionPool())
     48    : m_pActionPool(pParent->actionPool())
    5049    , m_pSplitter(0)
    5150    , m_pToolBar(0)
     
    127126void UIVirtualBoxManagerWidget::switchToTool(ToolTypeMachine enmType)
    128127{
    129     /* First, make sure corresponding tool set opened: */
    130     if (   !actionPool()->action(UIActionIndexST_M_Tools_T_Machine)->isChecked()
    131         && actionPool()->action(UIActionIndexST_M_Tools_T_Machine)->property("watch_child_activation").toBool())
    132         actionPool()->action(UIActionIndexST_M_Tools_T_Machine)->setChecked(true);
    133 
    134128    /* Open corresponding tool: */
    135129    m_pPaneToolsMachine->openTool(enmType);
     130
    136131    /* If that was 'Details' => pass there current items: */
    137132    if (   enmType == ToolTypeMachine_Details
     
    154149void UIVirtualBoxManagerWidget::switchToTool(ToolTypeGlobal enmType)
    155150{
    156     /* First, make sure corresponding tool set opened: */
    157     if (   !actionPool()->action(UIActionIndexST_M_Tools_T_Global)->isChecked()
    158         && actionPool()->action(UIActionIndexST_M_Tools_T_Global)->property("watch_child_activation").toBool())
    159         actionPool()->action(UIActionIndexST_M_Tools_T_Global)->setChecked(true);
    160 
    161151    /* Open corresponding tool: */
    162152    m_pPaneToolsGlobal->openTool(enmType);
     
    216206    m_pToolBar->updateLayout();
    217207#endif
    218 }
    219 
    220 void UIVirtualBoxManagerWidget::showEvent(QShowEvent *pEvent)
    221 {
    222     /* Call to base-class: */
    223     QIWithRetranslateUI<QWidget>::showEvent(pEvent);
    224 
    225     /* Is polishing required? */
    226     if (!m_fPolished)
    227     {
    228         /* Pass the show-event to polish-event: */
    229         polishEvent(pEvent);
    230         /* Mark as polished: */
    231         m_fPolished = true;
    232     }
    233 }
    234 
    235 void UIVirtualBoxManagerWidget::polishEvent(QShowEvent *)
    236 {
    237     /* Call for async polishing finally: */
    238     QMetaObject::invokeMethod(this, "sltHandlePolishEvent", Qt::QueuedConnection);
    239 }
    240 
    241 void UIVirtualBoxManagerWidget::sltHandlePolishEvent()
    242 {
    243     /* Get current item: */
    244     UIVirtualMachineItem *pItem = currentItem();
    245 
    246     /* Make sure there is accessible VM item chosen: */
    247     if (pItem && pItem->accessible())
    248     {
    249         // WORKAROUND:
    250         // By some reason some of X11 DEs unable to update() tab-bars on startup.
    251         // Let's just _create_ them later, asynchronously after the showEvent().
    252         /* Restore previously opened Machine tools at startup: */
    253         QMap<ToolTypeMachine, QAction*> mapActionsMachine;
    254         mapActionsMachine[ToolTypeMachine_Details] = actionPool()->action(UIActionIndexST_M_Tools_M_Machine_S_Details);
    255         mapActionsMachine[ToolTypeMachine_Snapshots] = actionPool()->action(UIActionIndexST_M_Tools_M_Machine_S_Snapshots);
    256         mapActionsMachine[ToolTypeMachine_LogViewer] = actionPool()->action(UIActionIndexST_M_Tools_M_Machine_S_LogViewer);
    257         for (int i = m_orderMachine.size() - 1; i >= 0; --i)
    258             if (m_orderMachine.at(i) != ToolTypeMachine_Invalid)
    259                 mapActionsMachine.value(m_orderMachine.at(i))->trigger();
    260         /* Make sure further action triggering cause tool type switch as well: */
    261         actionPool()->action(UIActionIndexST_M_Tools_T_Machine)->setProperty("watch_child_activation", true);
    262     }
    263208}
    264209
     
    616561                                       : Qt::ToolButtonIconOnly);
    617562    }
    618 
    619     /* Restore toolbar Machine/Global tools orders:  */
    620     {
    621         m_orderMachine = gEDataManager->selectorWindowToolsOrderMachine();
    622         m_orderGlobal = gEDataManager->selectorWindowToolsOrderGlobal();
    623 
    624         /* We can restore previously opened Global tools right here: */
    625         QMap<ToolTypeGlobal, QAction*> mapActionsGlobal;
    626         mapActionsGlobal[ToolTypeGlobal_VirtualMedia] = actionPool()->action(UIActionIndexST_M_Tools_M_Global_S_VirtualMediaManager);
    627         mapActionsGlobal[ToolTypeGlobal_HostNetwork] = actionPool()->action(UIActionIndexST_M_Tools_M_Global_S_HostNetworkManager);
    628         for (int i = m_orderGlobal.size() - 1; i >= 0; --i)
    629             if (m_orderGlobal.at(i) != ToolTypeGlobal_Invalid)
    630                 mapActionsGlobal.value(m_orderGlobal.at(i))->trigger();
    631         /* Make sure further action triggering cause tool type switch as well: */
    632         actionPool()->action(UIActionIndexST_M_Tools_T_Global)->setProperty("watch_child_activation", true);
    633 
    634         /* But we can't restore previously opened Machine tools here,
    635          * see the reason in corresponding async sltHandlePolishEvent slot. */
    636     }
    637563}
    638564
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h

    r74249 r74260  
    115115        /** Handles translation event. */
    116116        virtual void retranslateUi() /* override */;
    117 
    118         /** Handles show @a pEvent. */
    119         virtual void showEvent(QShowEvent *pEvent) /* override */;
    120         /** Handles first show @a pEvent. */
    121         virtual void polishEvent(QShowEvent *pEvent) /* override */;
    122117    /** @} */
    123118
     
    126121    /** @name Common stuff.
    127122      * @{ */
    128         /** Handles polishing in the async way. */
    129         void sltHandlePolishEvent();
    130 
    131123        /** Handles signal about Chooser-pane index change.
    132124          * @param  fUpdateDetails    Brings whether details should be updated.
     
    174166    /** @} */
    175167
    176     /** Holds whether the dialog is polished. */
    177     bool  m_fPolished : 1;
    178 
    179168    /** Holds the action-pool instance. */
    180169    UIActionPool *m_pActionPool;
     
    185174    /** Holds the main toolbar instance. */
    186175    UIToolBar *m_pToolBar;
    187 
    188     /** Holds the Machine Tools order. */
    189     QList<ToolTypeMachine>  m_orderMachine;
    190     /** Holds the Global Tools order. */
    191     QList<ToolTypeGlobal>   m_orderGlobal;
    192176
    193177    /** Holds the Chooser-pane instance. */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette