Changeset 75086 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Oct 25, 2018 6:11:38 PM (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
r75081 r75086 151 151 m_pPaneToolsMachine->openTool(enmType); 152 152 153 /* If that was 'Details' => pass there current items: */154 if (enmType == UIToolType_Details)155 m_pPaneToolsMachine->setItems(currentItems());156 /* If that was 'Snapshot' or 'LogViewer' => pass there current or null machine: */157 if (enmType == UIToolType_Snapshots || enmType == UIToolType_Logs)158 {159 UIVirtualMachineItem *pItem = currentItem();160 m_pPaneToolsMachine->setMachine(pItem ? pItem->machine() : CMachine());161 }162 163 153 /* Let the parent know: */ 164 154 emit sigToolTypeChange(); … … 229 219 void UIVirtualBoxManagerWidget::sltHandleChooserPaneIndexChange(bool fUpdateDetails /* = true */, 230 220 bool fUpdateSnapshots /* = true */, 231 bool fUpdateLog Viewer/* = true */)221 bool fUpdateLogs /* = true */) 232 222 { 233 223 /* Let the parent know: */ … … 249 239 /* If machine or group item is selected and we are on global tools pane => switch to machine tools pane: */ 250 240 if ( (isMachineItemSelected() || isGroupItemSelected()) 251 241 && m_pStackedWidget->currentWidget() != m_pPaneToolsMachine) 252 242 { 253 243 /* Just start animation and return, do nothing else.. */ … … 263 253 /* Get current item: */ 264 254 UIVirtualMachineItem *pItem = currentItem(); 265 266 /* Update Tools-pane: */ 255 const bool fCurrentItemIsOk = pItem && pItem->accessible(); 256 257 /* Update machine tools availability: */ 258 m_pPaneTools->setToolsEnabled(UIToolClass_Machine, fCurrentItemIsOk); 259 260 /* Propagate current item anyway: */ 267 261 m_pPaneToolsMachine->setCurrentItem(pItem); 268 262 269 /* Update Machine Tools availability: */ 270 m_pPaneTools->setToolsEnabled(UIToolClass_Machine, pItem && pItem->accessible()); 271 272 /* If current item exists & accessible: */ 273 if (pItem && pItem->accessible()) 274 { 275 /* If Error pane is chosen currently => open tool currently chosen in Tools-pane: */ 263 /* If current item is Ok: */ 264 if (fCurrentItemIsOk) 265 { 266 /* If Error-pane is chosen currently => open tool currently chosen in Tools-pane: */ 276 267 if (m_pPaneToolsMachine->currentTool() == UIToolType_Error) 277 268 sltHandleToolsPaneIndexChange(); 278 269 279 /* Update Details-pane (if requested): */270 /* Propagate current items to update the Details-pane (if requested): */ 280 271 if (fUpdateDetails) 281 272 m_pPaneToolsMachine->setItems(currentItems()); 282 /* Update the Snapshots-pane or/and Logviewer-pane (if requested): */283 if (fUpdateSnapshots || fUpdateLog Viewer)273 /* Propagate current machine to update the Snapshots-pane or/and Logviewer-pane (if requested): */ 274 if (fUpdateSnapshots || fUpdateLogs) 284 275 m_pPaneToolsMachine->setMachine(pItem->machine()); 285 276 } … … 289 280 m_pPaneToolsMachine->openTool(UIToolType_Error); 290 281 291 /* Note that the machine becomes inaccessible (or if the last VM gets 292 * deleted), we have to update all fields, ignoring input arguments. */ 282 /* Propagate last access error to update the Error-pane (if machine selected but inaccessible): */ 293 283 if (pItem) 294 {295 /* The VM is inaccessible: */296 284 m_pPaneToolsMachine->setErrorDetails(UIErrorString::formatErrorInfo(pItem->accessError())); 297 } 298 299 /* Update Details-pane (in any case): */ 285 286 /* Propagate current items to update the Details-pane (in any case): */ 300 287 m_pPaneToolsMachine->setItems(currentItems()); 301 /* Update Snapshots-paneand Logviewer-pane (in any case): */288 /* Propagate current machine to update the Snapshots-pane or/and Logviewer-pane (in any case): */ 302 289 m_pPaneToolsMachine->setMachine(CMachine()); 303 290 } … … 343 330 void UIVirtualBoxManagerWidget::sltHandleToolsPaneIndexChange() 344 331 { 332 /* Acquire current class/type: */ 333 const UIToolClass enmCurrentClass = m_pPaneTools->toolsClass(); 334 const UIToolType enmCurrentType = m_pPaneTools->toolsType(); 335 336 /* Invent default for fallback case: */ 337 const UIToolType enmDefaultType = enmCurrentClass == UIToolClass_Global ? UIToolType_Welcome 338 : enmCurrentClass == UIToolClass_Machine ? UIToolType_Details 339 : UIToolType_Invalid; 340 AssertReturnVoid(enmDefaultType != UIToolType_Invalid); 341 342 /* Calculate new type to choose: */ 343 const UIToolType enmNewType = UIToolStuff::isTypeOfClass(enmCurrentType, enmCurrentClass) 344 ? enmCurrentType : enmDefaultType; 345 346 /* Choose new type: */ 345 347 switch (m_pPaneTools->toolsClass()) 346 348 { 347 case UIToolClass_Global: 348 { 349 const UIToolType enmType = m_pPaneTools->areToolsEnabled(UIToolClass_Global) 350 ? m_pPaneTools->toolsType() 351 : UIToolType_Welcome; 352 switchToGlobalTool(enmType); 353 break; 354 } 355 case UIToolClass_Machine: 356 { 357 const UIToolType enmType = m_pPaneTools->areToolsEnabled(UIToolClass_Machine) 358 ? m_pPaneTools->toolsType() 359 : UIToolType_Details; 360 switchToMachineTool(enmType); 361 break; 362 } 363 default: 364 break; 349 case UIToolClass_Global: switchToGlobalTool(enmNewType); break; 350 case UIToolClass_Machine: switchToMachineTool(enmNewType); break; 351 default: break; 365 352 } 366 353 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h
r75054 r75086 136 136 * @param fUpdateDetails Brings whether details should be updated. 137 137 * @param fUpdateSnapshots Brings whether snapshots should be updated. 138 * @param fUpdateLog ViewerBrings whether log-viewer should be updated. */138 * @param fUpdateLogs Brings whether log-viewer should be updated. */ 139 139 void sltHandleChooserPaneIndexChange(bool fUpdateDetails = true, 140 140 bool fUpdateSnapshots = true, 141 bool fUpdateLog Viewer= true);141 bool fUpdateLogs = true); 142 142 /** Handles signal about Chooser-pane index change the default way. */ 143 143 void sltHandleChooserPaneIndexChangeDefault() { sltHandleChooserPaneIndexChange(); }
Note:
See TracChangeset
for help on using the changeset viewer.