- Timestamp:
- Sep 17, 2018 5:35:06 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp
r74265 r74319 244 244 m_pPaneToolsMachine->setCurrentItem(pItem); 245 245 246 /// @todo implement! 247 /* Update Machine tab-bar availability: */ 248 //m_pToolbarTools->setTabBarEnabledMachine(pItem && pItem->accessible()); 246 /* Update Machine Tools availability: */ 247 m_pPaneTools->setToolsEnabled(UIToolsClass_Machine, pItem && pItem->accessible()); 249 248 250 249 /* If current item exists & accessible: */ … … 321 320 { 322 321 ToolTypeGlobal enmType = ToolTypeGlobal_Invalid; 323 switch (m_pPaneTools->toolsType()) 322 if (!m_pPaneTools->areToolsEnabled(UIToolsClass_Global)) 323 enmType = ToolTypeGlobal_Desktop; 324 else 324 325 { 325 case UIToolsType_Media: enmType = ToolTypeGlobal_VirtualMedia; break; 326 case UIToolsType_Network: enmType = ToolTypeGlobal_HostNetwork; break; 327 default: break; 326 switch (m_pPaneTools->toolsType()) 327 { 328 case UIToolsType_Media: enmType = ToolTypeGlobal_VirtualMedia; break; 329 case UIToolsType_Network: enmType = ToolTypeGlobal_HostNetwork; break; 330 default: break; 331 } 328 332 } 329 333 if (enmType != ToolTypeGlobal_Invalid) … … 334 338 { 335 339 ToolTypeMachine enmType = ToolTypeMachine_Invalid; 336 switch (m_pPaneTools->toolsType()) 340 if (!m_pPaneTools->areToolsEnabled(UIToolsClass_Machine)) 341 enmType = ToolTypeMachine_Desktop; 342 else 337 343 { 338 case UIToolsType_Details: enmType = ToolTypeMachine_Details; break; 339 case UIToolsType_Snapshots: enmType = ToolTypeMachine_Snapshots; break; 340 case UIToolsType_Logs: enmType = ToolTypeMachine_LogViewer; break; 341 default: break; 344 switch (m_pPaneTools->toolsType()) 345 { 346 case UIToolsType_Details: enmType = ToolTypeMachine_Details; break; 347 case UIToolsType_Snapshots: enmType = ToolTypeMachine_Snapshots; break; 348 case UIToolsType_Logs: enmType = ToolTypeMachine_LogViewer; break; 349 default: break; 350 } 342 351 } 343 352 if (enmType != ToolTypeMachine_Invalid) -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UITools.cpp
r74249 r74319 68 68 { 69 69 return m_pToolsModel->toolsType(); 70 } 71 72 void UITools::setToolsEnabled(UIToolsClass enmClass, bool fEnabled) 73 { 74 m_pToolsModel->setToolsEnabled(enmClass, fEnabled); 75 } 76 77 bool UITools::areToolsEnabled(UIToolsClass enmClass) const 78 { 79 return m_pToolsModel->areToolsEnabled(enmClass); 70 80 } 71 81 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UITools.h
r74265 r74319 97 97 /** Returns current tools type. */ 98 98 UIToolsType toolsType() const; 99 100 /** Defines whether certain @a enmClass of tools is @a fEnabled.*/ 101 void setToolsEnabled(UIToolsClass enmClass, bool fEnabled); 102 /** Returns whether certain class of tools is enabled.*/ 103 bool areToolsEnabled(UIToolsClass enmClass) const; 99 104 /** @} */ 100 105 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.cpp
r74265 r74319 138 138 } 139 139 140 void UIToolsModel::setToolsEnabled(UIToolsClass enmClass, bool fEnabled) 141 { 142 /* Update linked values: */ 143 m_statesToolsEnabled[enmClass] = fEnabled; 144 foreach (UIToolsItem *pItem, items()) 145 if (pItem->itemClass() == enmClass) 146 pItem->setEnabled(m_statesToolsEnabled.value(enmClass)); 147 } 148 149 bool UIToolsModel::areToolsEnabled(UIToolsClass enmClass) const 150 { 151 return m_statesToolsEnabled.value(enmClass); 152 } 153 140 154 void UIToolsModel::setCurrentItem(UIToolsItem *pItem) 141 155 { … … 328 342 return QObject::eventFilter(pWatched, pEvent); 329 343 344 /* Do not handle disabled items: */ 345 if (!currentItem()->isEnabled()) 346 return QObject::eventFilter(pWatched, pEvent); 347 330 348 /* Checking event-type: */ 331 349 switch (pEvent->type()) … … 375 393 void UIToolsModel::prepareItems() 376 394 { 395 /* Enable all classes of tools initially: */ 396 m_statesToolsEnabled[UIToolsClass_Global] = true; 397 m_statesToolsEnabled[UIToolsClass_Machine] = true; 398 377 399 /* Prepare classes: */ 378 400 QList<UIToolsClass> classes; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.h
r74265 r74319 103 103 /** Returns current tools type. */ 104 104 UIToolsType toolsType() const; 105 106 /** Defines whether certain @a enmClass of tools is @a fEnabled.*/ 107 void setToolsEnabled(UIToolsClass enmClass, bool fEnabled); 108 /** Returns whether certain class of tools is enabled.*/ 109 bool areToolsEnabled(UIToolsClass enmClass) const; 105 110 /** @} */ 106 111 … … 232 237 /** Holds current tools class. */ 233 238 UIToolsClass m_enmCurrentClass; 239 240 /** Holds whether tools of particular class are enabled. */ 241 QMap<UIToolsClass, bool> m_statesToolsEnabled; 234 242 /** @} */ 235 243
Note:
See TracChangeset
for help on using the changeset viewer.