- Timestamp:
- Sep 14, 2018 11:11:00 AM (6 years ago)
- 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 46 46 47 47 UIVirtualBoxManagerWidget::UIVirtualBoxManagerWidget(UIVirtualBoxManager *pParent) 48 : m_fPolished(false) 49 , m_pActionPool(pParent->actionPool()) 48 : m_pActionPool(pParent->actionPool()) 50 49 , m_pSplitter(0) 51 50 , m_pToolBar(0) … … 127 126 void UIVirtualBoxManagerWidget::switchToTool(ToolTypeMachine enmType) 128 127 { 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 134 128 /* Open corresponding tool: */ 135 129 m_pPaneToolsMachine->openTool(enmType); 130 136 131 /* If that was 'Details' => pass there current items: */ 137 132 if ( enmType == ToolTypeMachine_Details … … 154 149 void UIVirtualBoxManagerWidget::switchToTool(ToolTypeGlobal enmType) 155 150 { 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 161 151 /* Open corresponding tool: */ 162 152 m_pPaneToolsGlobal->openTool(enmType); … … 216 206 m_pToolBar->updateLayout(); 217 207 #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 }263 208 } 264 209 … … 616 561 : Qt::ToolButtonIconOnly); 617 562 } 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 }637 563 } 638 564 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h
r74249 r74260 115 115 /** Handles translation event. */ 116 116 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 */;122 117 /** @} */ 123 118 … … 126 121 /** @name Common stuff. 127 122 * @{ */ 128 /** Handles polishing in the async way. */129 void sltHandlePolishEvent();130 131 123 /** Handles signal about Chooser-pane index change. 132 124 * @param fUpdateDetails Brings whether details should be updated. … … 174 166 /** @} */ 175 167 176 /** Holds whether the dialog is polished. */177 bool m_fPolished : 1;178 179 168 /** Holds the action-pool instance. */ 180 169 UIActionPool *m_pActionPool; … … 185 174 /** Holds the main toolbar instance. */ 186 175 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;192 176 193 177 /** Holds the Chooser-pane instance. */
Note:
See TracChangeset
for help on using the changeset viewer.