Changeset 107337 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Dec 16, 2024 5:43:57 PM (5 weeks ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 1 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r107301 r107337 706 706 else 707 707 VirtualBox_QT_MOCHDRS += \ 708 src/manager/UIGlobalToolsManagerWidget.h \ 708 709 src/manager/UIMachineManagerWidget.h \ 709 710 src/manager/UIVirtualBoxManagerAdvancedWidget.h … … 1241 1242 else 1242 1243 VirtualBox_SOURCES += \ 1244 src/manager/UIGlobalToolsManagerWidget.cpp \ 1243 1245 src/manager/UIMachineManagerWidget.cpp \ 1244 1246 src/manager/UIVirtualBoxManagerAdvancedWidget.cpp -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIGlobalToolsManagerWidget.cpp
r107303 r107337 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UI VirtualBoxManagerAdvancedWidget class implementation.3 * VBox Qt GUI - UIGlobalToolsManagerWidget class implementation. 4 4 */ 5 5 … … 27 27 28 28 /* Qt includes: */ 29 #include <QApplication>29 // #include <QApplication> 30 30 #include <QHBoxLayout> 31 #include <QStackedWidget> 32 #include <QStyle> 33 #include <QTimer> 34 #include <QToolButton> 35 #include <QVBoxLayout> 31 // #include <QStyle> 32 // #include <QToolButton> 33 // #include <QVBoxLayout> 36 34 37 35 /* GUI includes: */ 38 #include "QISplitter.h"39 #include "QIToolBar.h"40 36 #include "UIActionPoolManager.h" 41 37 #include "UIChooser.h" 42 38 #include "UICommon.h" 43 #include "UIDesktopWidgetWatchdog.h"44 39 #include "UIExtraDataManager.h" 45 #include "UIGlobalSession.h"46 #include "UI LoggingDefs.h"47 #include "UIMessageCenter.h"40 // #include "UILoggingDefs.h" 41 #include "UIMachineManagerWidget.h" 42 // #include "UIMessageCenter.h" 48 43 #include "UINotificationCenter.h" 49 #include "UISlidingAnimation.h"50 #include "UITabBar.h"44 // #include "UISlidingAnimation.h" 45 // #include "UITabBar.h" 51 46 #include "UIToolPaneGlobal.h" 52 47 #include "UIToolPaneMachine.h" 53 48 #include "UITools.h" 54 #include "UITranslationEventListener.h" 55 #include "UIVirtualBoxEventHandler.h" 56 #include "UIVirtualBoxManager.h" 49 // #include "UITranslationEventListener.h" 50 // #include "UIVirtualBoxEventHandler.h" 57 51 #include "UIVirtualBoxManagerAdvancedWidget.h" 58 #include "UIVirtualMachineItemCloud.h" 59 #include "UIVirtualMachineItemLocal.h" 60 #if defined(VBOX_WS_MAC) && (defined(RT_ARCH_ARM64) || defined(RT_ARCH_ARM32)) 61 # include "UIIconPool.h" 62 # include "UIVersion.h" 63 #endif /* VBOX_WS_MAC && (RT_ARCH_ARM64 || RT_ARCH_ARM32) */ 52 #include "UIGlobalToolsManagerWidget.h" 53 // #include "UIVirtualMachineItemCloud.h" 54 // #include "UIVirtualMachineItemLocal.h" 64 55 #ifndef VBOX_WS_MAC 65 # include "UIMenuBar.h"56 // # include "UIMenuBar.h" 66 57 #endif 67 58 68 /* COM includes: */ 69 #if defined(VBOX_WS_MAC) && (defined(RT_ARCH_ARM64) || defined(RT_ARCH_ARM32)) 70 # include "CSystemProperties.h" 71 #endif /* VBOX_WS_MAC && (RT_ARCH_ARM64 || RT_ARCH_ARM32) */ 72 73 74 UIVirtualBoxManagerAdvancedWidget::UIVirtualBoxManagerAdvancedWidget(UIVirtualBoxManager *pParent) 75 : m_pActionPool(pParent->actionPool()) 76 , m_pSplitter(0) 77 , m_pToolBar(0) 78 , m_pPaneChooser(0) 79 , m_pStackedWidget(0) 80 , m_pPaneToolsGlobal(0) 81 , m_pPaneToolsMachine(0) 82 , m_pMenuToolsGlobal(0) 83 , m_pMenuToolsMachine(0) 84 , m_enmSelectionType(SelectionType_Invalid) 85 , m_fSelectedMachineItemAccessible(false) 86 , m_pSplitterSettingsSaveTimer(0) 59 60 UIGlobalToolsManagerWidget::UIGlobalToolsManagerWidget(UIVirtualBoxManagerAdvancedWidget *pParent, 61 UIActionPool *pActionPool) 62 : QWidget(pParent) 63 , m_pActionPool(pActionPool) 64 , m_pMenu(0) 65 , m_pPane(0) 87 66 { 88 67 prepare(); 89 68 } 90 69 91 UI VirtualBoxManagerAdvancedWidget::~UIVirtualBoxManagerAdvancedWidget()70 UIGlobalToolsManagerWidget::~UIGlobalToolsManagerWidget() 92 71 { 93 72 cleanup(); 94 73 } 95 74 96 void UIVirtualBoxManagerAdvancedWidget::updateToolBarMenuButtons(bool fSeparateMenuSection) 97 { 98 QToolButton *pButton = qobject_cast<QToolButton*>(m_pToolBar->widgetForAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow))); 99 if (pButton) 100 pButton->setPopupMode(fSeparateMenuSection ? QToolButton::MenuButtonPopup : QToolButton::DelayedPopup); 101 } 102 103 UIVirtualMachineItem *UIVirtualBoxManagerAdvancedWidget::currentItem() const 104 { 105 return m_pPaneChooser->currentItem(); 106 } 107 108 QList<UIVirtualMachineItem*> UIVirtualBoxManagerAdvancedWidget::currentItems() const 109 { 110 return m_pPaneChooser->currentItems(); 111 } 112 113 bool UIVirtualBoxManagerAdvancedWidget::isItemAccessible(UIVirtualMachineItem *pItem /* = 0 */) const 114 { 115 if (!pItem) 116 pItem = currentItem(); 117 return pItem && pItem->accessible(); 118 } 119 120 bool UIVirtualBoxManagerAdvancedWidget::isGroupItemSelected() const 121 { 122 return m_pPaneChooser->isGroupItemSelected(); 123 } 124 125 bool UIVirtualBoxManagerAdvancedWidget::isGlobalItemSelected() const 126 { 127 return m_pPaneChooser->isGlobalItemSelected(); 128 } 129 130 bool UIVirtualBoxManagerAdvancedWidget::isMachineItemSelected() const 131 { 132 return m_pPaneChooser->isMachineItemSelected(); 133 } 134 135 bool UIVirtualBoxManagerAdvancedWidget::isLocalMachineItemSelected() const 136 { 137 return m_pPaneChooser->isLocalMachineItemSelected(); 138 } 139 140 bool UIVirtualBoxManagerAdvancedWidget::isCloudMachineItemSelected() const 141 { 142 return m_pPaneChooser->isCloudMachineItemSelected(); 143 } 144 145 bool UIVirtualBoxManagerAdvancedWidget::isSingleGroupSelected() const 146 { 147 return m_pPaneChooser->isSingleGroupSelected(); 148 } 149 150 bool UIVirtualBoxManagerAdvancedWidget::isSingleLocalGroupSelected() const 151 { 152 return m_pPaneChooser->isSingleLocalGroupSelected(); 153 } 154 155 bool UIVirtualBoxManagerAdvancedWidget::isSingleCloudProviderGroupSelected() const 156 { 157 return m_pPaneChooser->isSingleCloudProviderGroupSelected(); 158 } 159 160 bool UIVirtualBoxManagerAdvancedWidget::isSingleCloudProfileGroupSelected() const 161 { 162 return m_pPaneChooser->isSingleCloudProfileGroupSelected(); 163 } 164 165 bool UIVirtualBoxManagerAdvancedWidget::isAllItemsOfOneGroupSelected() const 166 { 167 return m_pPaneChooser->isAllItemsOfOneGroupSelected(); 168 } 169 170 UIVirtualBoxManagerAdvancedWidget::SelectionType UIVirtualBoxManagerAdvancedWidget::selectionType() const 171 { 172 return isSingleLocalGroupSelected() 173 ? SelectionType_SingleLocalGroupItem 174 : isSingleCloudProviderGroupSelected() || isSingleCloudProfileGroupSelected() 175 ? SelectionType_SingleCloudGroupItem 176 : isGlobalItemSelected() 177 ? SelectionType_FirstIsGlobalItem 178 : isLocalMachineItemSelected() 179 ? SelectionType_FirstIsLocalMachineItem 180 : isCloudMachineItemSelected() 181 ? SelectionType_FirstIsCloudMachineItem 182 : SelectionType_Invalid; 183 } 184 185 QString UIVirtualBoxManagerAdvancedWidget::fullGroupName() const 186 { 187 return m_pPaneChooser->fullGroupName(); 188 } 189 190 bool UIVirtualBoxManagerAdvancedWidget::isGroupSavingInProgress() const 191 { 192 return m_pPaneChooser->isGroupSavingInProgress(); 193 } 194 195 bool UIVirtualBoxManagerAdvancedWidget::isCloudProfileUpdateInProgress() const 196 { 197 return m_pPaneChooser->isCloudProfileUpdateInProgress(); 198 } 199 200 void UIVirtualBoxManagerAdvancedWidget::openGroupNameEditor() 201 { 202 m_pPaneChooser->openGroupNameEditor(); 203 } 204 205 void UIVirtualBoxManagerAdvancedWidget::disbandGroup() 206 { 207 m_pPaneChooser->disbandGroup(); 208 } 209 210 void UIVirtualBoxManagerAdvancedWidget::removeMachine() 211 { 212 m_pPaneChooser->removeMachine(); 213 } 214 215 void UIVirtualBoxManagerAdvancedWidget::moveMachineToGroup(const QString &strName /* = QString() */) 216 { 217 m_pPaneChooser->moveMachineToGroup(strName); 218 } 219 220 QStringList UIVirtualBoxManagerAdvancedWidget::possibleGroupsForMachineToMove(const QUuid &uId) 221 { 222 return m_pPaneChooser->possibleGroupsForMachineToMove(uId); 223 } 224 225 QStringList UIVirtualBoxManagerAdvancedWidget::possibleGroupsForGroupToMove(const QString &strFullName) 226 { 227 return m_pPaneChooser->possibleGroupsForGroupToMove(strFullName); 228 } 229 230 void UIVirtualBoxManagerAdvancedWidget::refreshMachine() 231 { 232 m_pPaneChooser->refreshMachine(); 233 } 234 235 void UIVirtualBoxManagerAdvancedWidget::sortGroup() 236 { 237 m_pPaneChooser->sortGroup(); 238 } 239 240 void UIVirtualBoxManagerAdvancedWidget::setMachineSearchWidgetVisibility(bool fVisible) 241 { 242 m_pPaneChooser->setMachineSearchWidgetVisibility(fVisible); 243 } 244 245 void UIVirtualBoxManagerAdvancedWidget::setToolsTypeGlobal(UIToolType enmType, bool fMakeSureItsVisible /* = false */) 246 { 247 /* Make sure global item is selected if requested: */ 248 if (fMakeSureItsVisible) 249 { 250 AssertPtrReturnVoid(m_pPaneChooser); 251 m_pPaneChooser->setCurrentGlobal(); 252 } 253 254 /* Change the tool to requested type: */ 255 AssertPtrReturnVoid(m_pMenuToolsGlobal); 256 m_pMenuToolsGlobal->setToolsType(enmType); 257 } 258 259 UIToolType UIVirtualBoxManagerAdvancedWidget::toolsTypeGlobal() const 260 { 261 return m_pMenuToolsGlobal ? m_pMenuToolsGlobal->toolsType() : UIToolType_Invalid; 262 } 263 264 void UIVirtualBoxManagerAdvancedWidget::setToolsTypeMachine(UIToolType enmType) 265 { 266 /* Change the tool to requested type: */ 267 AssertPtrReturnVoid(m_pMenuToolsMachine); 268 m_pMenuToolsMachine->setToolsType(enmType); 269 } 270 271 UIToolType UIVirtualBoxManagerAdvancedWidget::toolsTypeMachine() const 272 { 273 return m_pMenuToolsMachine ? m_pMenuToolsMachine->toolsType() : UIToolType_Invalid; 274 } 275 276 UIToolType UIVirtualBoxManagerAdvancedWidget::currentGlobalTool() const 277 { 278 return m_pPaneToolsGlobal ? m_pPaneToolsGlobal->currentTool() : UIToolType_Invalid; 279 } 280 281 UIToolType UIVirtualBoxManagerAdvancedWidget::currentMachineTool() const 282 { 283 return m_pPaneToolsMachine ? m_pPaneToolsMachine->currentTool() : UIToolType_Invalid; 284 } 285 286 bool UIVirtualBoxManagerAdvancedWidget::isGlobalToolOpened(UIToolType enmType) const 287 { 288 return m_pPaneToolsGlobal ? m_pPaneToolsGlobal->isToolOpened(enmType) : false; 289 } 290 291 bool UIVirtualBoxManagerAdvancedWidget::isMachineToolOpened(UIToolType enmType) const 292 { 293 return m_pPaneToolsMachine ? m_pPaneToolsMachine->isToolOpened(enmType) : false; 294 } 295 296 void UIVirtualBoxManagerAdvancedWidget::switchGlobalToolTo(UIToolType enmType) 297 { 75 UIToolType UIGlobalToolsManagerWidget::menuToolType() const 76 { 77 AssertPtrReturn(toolMenu(), UIToolType_Invalid); 78 return toolMenu()->toolsType(); 79 } 80 81 void UIGlobalToolsManagerWidget::setMenuToolType(UIToolType enmType) 82 { 83 /* Sanity check: */ 84 AssertReturnVoid(enmType != UIToolType_Invalid); 85 /* Make sure new tool type is of Global class: */ 86 AssertReturnVoid(UIToolStuff::isTypeOfClass(enmType, UIToolClass_Global)); 87 88 AssertPtrReturnVoid(toolMenu()); 89 toolMenu()->setToolsType(enmType); 90 } 91 92 UIToolType UIGlobalToolsManagerWidget::toolType() const 93 { 94 AssertPtrReturn(toolPane(), UIToolType_Invalid); 95 return toolPane()->currentTool(); 96 } 97 98 bool UIGlobalToolsManagerWidget::isToolOpened(UIToolType enmType) const 99 { 100 /* Sanity check: */ 101 AssertReturn(enmType != UIToolType_Invalid, false); 102 /* Make sure new tool type is of Global class: */ 103 AssertReturn(UIToolStuff::isTypeOfClass(enmType, UIToolClass_Global), false); 104 105 AssertPtrReturn(toolPane(), false); 106 return toolPane()->isToolOpened(enmType); 107 } 108 109 void UIGlobalToolsManagerWidget::switchToolTo(UIToolType enmType) 110 { 111 /* Sanity check: */ 112 AssertReturnVoid(enmType != UIToolType_Invalid); 113 /* Make sure new tool type is of Global class: */ 114 AssertReturnVoid(UIToolStuff::isTypeOfClass(enmType, UIToolClass_Global)); 115 298 116 /* Open corresponding tool: */ 299 m_pPaneToolsGlobal->openTool(enmType); 117 AssertPtrReturnVoid(toolPane()); 118 toolPane()->openTool(enmType); 119 120 /* Special handling for Machines Global tool, 121 * notify machine tool-pane it's active: */ 122 if (enmType == UIToolType_Machines) 123 { 124 toolPane()->setActive(false); 125 toolPaneMachine()->setActive(true); 126 } 127 /* Otherwise, notify global tool-pane it's active: */ 128 else 129 { 130 toolPaneMachine()->setActive(false); 131 toolPane()->setActive(true); 132 } 133 134 /* Special handling for Activities Global tool, 135 * start unconditionally updating all cloud VMs: */ 136 if (enmType == UIToolType_Activities) 137 { 138 chooser()->setKeepCloudNodesUpdated(true); 139 toolPane()->setCloudMachineItems(chooser()->cloudMachineItems()); 140 } 141 /* Otherwise, stop unconditionally updating all cloud VMs, 142 * (tho they will still be updated if selected) */ 143 else 144 chooser()->setKeepCloudNodesUpdated(false); 300 145 301 146 /* Let the parent know: */ 302 emit sigToolTypeChangeGlobal(); 303 304 /* Update toolbar: */ 305 updateToolbar(); 306 307 /* Handle current tool type change: */ 308 handleCurrentToolTypeChange(enmType); 309 } 310 311 void UIVirtualBoxManagerAdvancedWidget::switchMachineToolTo(UIToolType enmType) 312 { 313 /* Open corresponding tool: */ 314 m_pPaneToolsMachine->openTool(enmType); 315 316 /* Let the parent know: */ 317 emit sigToolTypeChangeMachine(); 318 319 /* Update toolbar: */ 320 updateToolbar(); 321 322 /* Handle current tool type change: */ 323 handleCurrentToolTypeChange(enmType); 324 } 325 326 void UIVirtualBoxManagerAdvancedWidget::closeGlobalTool(UIToolType enmType) 327 { 328 m_pPaneToolsGlobal->closeTool(enmType); 329 } 330 331 void UIVirtualBoxManagerAdvancedWidget::closeMachineTool(UIToolType enmType) 332 { 333 m_pPaneToolsMachine->closeTool(enmType); 334 } 335 336 bool UIVirtualBoxManagerAdvancedWidget::isCurrentStateItemSelected() const 337 { 338 return m_pPaneToolsMachine->isCurrentStateItemSelected(); 339 } 340 341 QUuid UIVirtualBoxManagerAdvancedWidget::currentSnapshotId() 342 { 343 return m_pPaneToolsMachine->currentSnapshotId(); 344 } 345 346 QString UIVirtualBoxManagerAdvancedWidget::currentHelpKeyword() const 347 { 348 QString strHelpKeyword; 349 if (isGlobalItemSelected()) 350 strHelpKeyword = m_pPaneToolsGlobal->currentHelpKeyword(); 351 else if (isMachineItemSelected()) 352 strHelpKeyword = m_pPaneToolsMachine->currentHelpKeyword(); 353 return strHelpKeyword; 354 } 355 356 void UIVirtualBoxManagerAdvancedWidget::sltHandleToolBarContextMenuRequest(const QPoint &position) 357 { 358 /* Populate toolbar actions: */ 359 QList<QAction*> actions; 360 /* Add 'Show Toolbar Text' action: */ 361 QAction *pShowToolBarText = new QAction(UIVirtualBoxManager::tr("Show Toolbar Text"), 0); 362 if (pShowToolBarText) 363 { 364 pShowToolBarText->setCheckable(true); 365 pShowToolBarText->setChecked(m_pToolBar->toolButtonStyle() == Qt::ToolButtonTextUnderIcon); 366 actions << pShowToolBarText; 367 } 368 369 /* Prepare the menu position: */ 370 QPoint globalPosition = position; 371 QWidget *pSender = qobject_cast<QWidget*>(sender()); 372 if (pSender) 373 globalPosition = pSender->mapToGlobal(position); 374 375 /* Execute the menu: */ 376 QAction *pResult = QMenu::exec(actions, globalPosition); 377 378 /* Handle the menu execution result: */ 379 if (pResult == pShowToolBarText) 380 { 381 m_pToolBar->setUseTextLabels(pResult->isChecked()); 382 gEDataManager->setSelectorWindowToolBarTextVisible(pResult->isChecked()); 383 } 384 } 385 386 void UIVirtualBoxManagerAdvancedWidget::sltRetranslateUI() 387 { 388 /* Make sure chosen item fetched: */ 389 sltHandleChooserPaneIndexChange(); 390 } 391 392 void UIVirtualBoxManagerAdvancedWidget::sltHandleCommitData() 147 emit sigToolTypeChange(); 148 } 149 150 void UIGlobalToolsManagerWidget::closeTool(UIToolType enmType) 151 { 152 /* Sanity check: */ 153 AssertReturnVoid(enmType != UIToolType_Invalid); 154 /* Make sure new tool type is of Global class: */ 155 AssertReturnVoid(UIToolStuff::isTypeOfClass(enmType, UIToolClass_Global)); 156 157 AssertPtrReturnVoid(toolPane()); 158 toolPane()->closeTool(enmType); 159 } 160 161 QString UIGlobalToolsManagerWidget::currentHelpKeyword() const 162 { 163 AssertPtrReturn(toolPane(), QString()); 164 return toolPane()->currentHelpKeyword(); 165 } 166 167 void UIGlobalToolsManagerWidget::sltHandleCommitData() 393 168 { 394 169 // WORKAROUND: … … 398 173 } 399 174 400 void UIVirtualBoxManagerAdvancedWidget::sltHandleMachineStateChange(const QUuid &uId) 401 { 402 // WORKAROUND: 403 // In certain intermediate states VM info can be NULL which 404 // causing annoying assertions, such updates can be ignored? 405 CVirtualBox comVBox = gpGlobalSession->virtualBox(); 406 CMachine comMachine = comVBox.FindMachine(uId.toString()); 407 if (comVBox.isOk() && comMachine.isNotNull()) 408 { 409 switch (comMachine.GetState()) 410 { 411 case KMachineState_DeletingSnapshot: 412 return; 413 default: 414 break; 415 } 416 } 417 418 /* Recache current machine item information: */ 419 recacheCurrentMachineItemInformation(); 420 } 421 422 void UIVirtualBoxManagerAdvancedWidget::sltHandleSettingsExpertModeChange() 423 { 424 /* Update toolbar to show/hide corresponding actions: */ 425 updateToolbar(); 426 427 /* Update tools restrictions for currently selected item: */ 428 if (currentItem()) 429 updateToolsMenuMachine(currentItem()); 430 else 431 updateToolsMenuGlobal(); 432 } 433 434 void UIVirtualBoxManagerAdvancedWidget::sltHandleSplitterMove() 435 { 436 /* Create timer if isn't exist already: */ 437 if (!m_pSplitterSettingsSaveTimer) 438 { 439 m_pSplitterSettingsSaveTimer = new QTimer(this); 440 if (m_pSplitterSettingsSaveTimer) 441 { 442 m_pSplitterSettingsSaveTimer->setInterval(300); 443 m_pSplitterSettingsSaveTimer->setSingleShot(true); 444 connect(m_pSplitterSettingsSaveTimer, &QTimer::timeout, 445 this, &UIVirtualBoxManagerAdvancedWidget::sltSaveSplitterSettings); 446 } 447 } 448 /* [Re]start timer finally: */ 449 m_pSplitterSettingsSaveTimer->start(); 450 } 451 452 void UIVirtualBoxManagerAdvancedWidget::sltSaveSplitterSettings() 453 { 454 const QList<int> splitterSizes = m_pSplitter->sizes(); 455 LogRel2(("GUI: UIVirtualBoxManagerAdvancedWidget: Saving splitter as: Size=%d,%d\n", 456 splitterSizes.at(0), splitterSizes.at(1))); 457 gEDataManager->setSelectorWindowSplitterHints(splitterSizes); 458 } 459 460 void UIVirtualBoxManagerAdvancedWidget::sltHandleToolBarResize(const QSize &newSize) 461 { 462 emit sigToolBarHeightChange(newSize.height()); 463 } 464 465 void UIVirtualBoxManagerAdvancedWidget::sltHandleChooserPaneIndexChange() 466 { 467 /* Let the parent know: */ 468 emit sigChooserPaneIndexChange(); 469 470 /* If global item is selected and we are on machine tools pane => switch to global tools pane: */ 471 if ( isGlobalItemSelected() 472 && m_pStackedWidget->currentWidget() != m_pPaneToolsGlobal) 473 { 474 m_pStackedWidget->setCurrentWidget(m_pPaneToolsGlobal); 475 m_pPaneToolsMachine->setActive(false); 476 m_pPaneToolsGlobal->setActive(true); 477 /* Handle current tool type change: */ 478 handleCurrentToolTypeChange(m_pMenuToolsGlobal->toolsType()); 479 } 480 481 else 482 483 /* If machine or group item is selected and we are on global tools pane => switch to machine tools pane: */ 484 if ( (isMachineItemSelected() || isGroupItemSelected()) 485 && m_pStackedWidget->currentWidget() != m_pPaneToolsMachine) 486 { 487 m_pStackedWidget->setCurrentWidget(m_pPaneToolsMachine); 488 m_pPaneToolsGlobal->setActive(false); 489 m_pPaneToolsMachine->setActive(true); 490 /* Handle current tool type change: */ 491 handleCurrentToolTypeChange(m_pMenuToolsMachine->toolsType()); 492 } 493 494 /* Update tools restrictions for currently selected item: */ 495 UIVirtualMachineItem *pItem = currentItem(); 496 if (pItem) 497 updateToolsMenuMachine(pItem); 498 else 499 updateToolsMenuGlobal(); 500 501 /* Recache current machine item information: */ 502 recacheCurrentMachineItemInformation(); 503 504 /* Calculate new selection type and item accessibility status: */ 505 const SelectionType enmSelectedItemType = selectionType(); 506 const bool fCurrentItemIsOk = isItemAccessible(); 507 508 /* Update toolbar if selection type or item accessibility status got changed: */ 509 if ( m_enmSelectionType != enmSelectedItemType 510 || m_fSelectedMachineItemAccessible != fCurrentItemIsOk) 511 updateToolbar(); 512 513 /* Remember selection type and item accessibility status: */ 514 m_enmSelectionType = enmSelectedItemType; 515 m_fSelectedMachineItemAccessible = fCurrentItemIsOk; 516 } 517 518 void UIVirtualBoxManagerAdvancedWidget::sltHandleCloudProfileStateChange(const QString &strProviderShortName, 519 const QString &strProfileName) 520 { 521 RT_NOREF(strProviderShortName, strProfileName); 522 523 /* If Global Activity Overview tool is currently chosen: */ 524 if ( m_pStackedWidget->currentWidget() == m_pPaneToolsGlobal 525 && m_pPaneToolsGlobal->currentTool() == UIToolType_Activities) 526 m_pPaneToolsGlobal->setCloudMachineItems(m_pPaneChooser->cloudMachineItems()); 527 } 528 529 void UIVirtualBoxManagerAdvancedWidget::sltHandleCloudMachineStateChange(const QUuid &uId) 530 { 531 /* Not for global items: */ 532 if (isGlobalItemSelected()) 533 return; 534 535 /* Acquire current item: */ 536 UIVirtualMachineItem *pItem = currentItem(); 537 const bool fCurrentItemIsOk = isItemAccessible(pItem); 538 539 /* If current item is Ok: */ 540 if (fCurrentItemIsOk) 541 { 542 /* If Error-pane is chosen currently => switch to tool currently chosen in Tools-menu: */ 543 if (m_pPaneToolsMachine->currentTool() == UIToolType_Error) 544 switchMachineToolTo(m_pMenuToolsMachine->toolsType()); 545 546 /* If we still have same item selected: */ 547 if (pItem && pItem->id() == uId) 548 { 549 /* Propagate current items to update the Details-pane: */ 550 m_pPaneToolsMachine->setItems(currentItems()); 551 } 552 } 553 else 554 { 555 /* Make sure Error pane raised: */ 556 if (m_pPaneToolsMachine->currentTool() != UIToolType_Error) 557 m_pPaneToolsMachine->openTool(UIToolType_Error); 558 559 /* If we still have same item selected: */ 560 if (pItem && pItem->id() == uId) 561 { 562 /* Propagate current items to update the Details-pane (in any case): */ 563 m_pPaneToolsMachine->setItems(currentItems()); 564 /* Propagate last access error to update the Error-pane (if machine selected but inaccessible): */ 565 m_pPaneToolsMachine->setErrorDetails(pItem->accessError()); 566 } 567 } 568 569 /* Pass the signal further: */ 570 emit sigCloudMachineStateChange(uId); 571 } 572 573 void UIVirtualBoxManagerAdvancedWidget::sltHandleToolMenuRequested(const QPoint &position, UIVirtualMachineItem *pItem) 574 { 575 /* Update tools menu beforehand: */ 576 UITools *pMenu = pItem ? m_pMenuToolsMachine : m_pMenuToolsGlobal; 577 AssertPtrReturnVoid(pMenu); 578 if (pItem) 579 updateToolsMenuMachine(pItem); 580 else 581 updateToolsMenuGlobal(); 582 583 /* Compose popup-menu geometry first of all: */ 584 QRect ourGeo = QRect(position, pMenu->minimumSizeHint()); 585 /* Adjust location only to properly fit into available geometry space: */ 586 const QRect availableGeo = gpDesktop->availableGeometry(position); 587 ourGeo = gpDesktop->normalizeGeometry(ourGeo, availableGeo, false /* resize? */); 588 589 /* Move, resize and show: */ 590 pMenu->move(ourGeo.topLeft()); 591 pMenu->show(); 592 // WORKAROUND: 593 // Don't want even to think why, but for Qt::Popup resize to 594 // smaller size often being ignored until it is actually shown. 595 pMenu->resize(ourGeo.size()); 596 } 597 598 void UIVirtualBoxManagerAdvancedWidget::sltSwitchToMachineActivityPane(const QUuid &uMachineId) 599 { 600 AssertPtrReturnVoid(m_pPaneChooser); 601 AssertPtrReturnVoid(m_pMenuToolsMachine); 602 m_pPaneChooser->setCurrentMachine(uMachineId); 603 m_pMenuToolsMachine->setToolsType(UIToolType_VMActivity); 604 } 605 606 void UIVirtualBoxManagerAdvancedWidget::sltSwitchToActivityOverviewPane() 607 { 608 AssertPtrReturnVoid(m_pPaneChooser); 609 AssertPtrReturnVoid(m_pMenuToolsGlobal); 610 m_pMenuToolsGlobal->setToolsType(UIToolType_Activities); 611 m_pPaneChooser->setCurrentGlobal(); 612 } 613 614 void UIVirtualBoxManagerAdvancedWidget::prepare() 175 void UIGlobalToolsManagerWidget::sltHandleSettingsExpertModeChange() 176 { 177 /* Update tools restrictions: */ 178 updateToolsMenuGlobal(); 179 } 180 181 void UIGlobalToolsManagerWidget::sltHandleCloudProfileStateChange(const QString &, const QString &) 182 { 183 /* If Global Activities tool is currently chosen: */ 184 AssertPtrReturnVoid(toolPane()); 185 if (toolType() == UIToolType_Activities) 186 { 187 /* Propagate a set of cloud machine items to Global tool-pane: */ 188 toolPane()->setCloudMachineItems(chooser()->cloudMachineItems()); 189 } 190 } 191 192 void UIGlobalToolsManagerWidget::sltHandleToolsMenuIndexChange(UIToolType enmType) 193 { 194 switchToolTo(enmType); 195 } 196 197 void UIGlobalToolsManagerWidget::sltSwitchToActivitiesTool() 198 { 199 setMenuToolType(UIToolType_Activities); 200 } 201 202 void UIGlobalToolsManagerWidget::prepare() 615 203 { 616 204 /* Prepare everything: */ … … 620 208 /* Load settings: */ 621 209 loadSettings(); 622 623 /* Translate UI: */ 624 sltRetranslateUI(); 625 connect(&translationEventListener(), &UITranslationEventListener::sigRetranslateUI, 626 this, &UIVirtualBoxManagerAdvancedWidget::sltRetranslateUI); 627 628 /* Make sure current Chooser-pane index fetched: */ 629 sltHandleChooserPaneIndexChange(); 630 } 631 632 void UIVirtualBoxManagerAdvancedWidget::prepareWidgets() 633 { 634 /* Create main-layout: */ 635 QHBoxLayout *pLayoutMain = new QHBoxLayout(this); 636 if (pLayoutMain) 210 } 211 212 void UIGlobalToolsManagerWidget::prepareWidgets() 213 { 214 /* Create layout: */ 215 QHBoxLayout *pLayout = new QHBoxLayout(this); 216 if (pLayout) 637 217 { 638 218 /* Configure layout: */ 639 pLayoutMain->setSpacing(0); 640 pLayoutMain->setContentsMargins(0, 0, 0, 0); 641 642 /* Create splitter: */ 643 m_pSplitter = new QISplitter; 644 if (m_pSplitter) 219 pLayout->setContentsMargins(0, 0, 0, 0); 220 221 /* Create tools-menu: */ 222 m_pMenu = new UITools(this, UIToolClass_Global, actionPool()); 223 if (toolMenu()) 645 224 { 646 /* Create Chooser-pane: */647 m_pPaneChooser = new UIChooser(this, actionPool());648 if (m_pPaneChooser)649 {650 /* Add into splitter: */651 m_pSplitter->addWidget(m_pPaneChooser);652 }653 654 /* Create right widget: */655 QWidget *pWidgetRight = new QWidget;656 if (pWidgetRight)657 {658 /* Create right-layout: */659 QVBoxLayout *pLayoutRight = new QVBoxLayout(pWidgetRight);660 if(pLayoutRight)661 {662 /* Configure layout: */663 pLayoutRight->setSpacing(0);664 pLayoutRight->setContentsMargins(0, 0, 0, 0);665 666 /* Create Main toolbar: */667 m_pToolBar = new QIToolBar;668 if (m_pToolBar)669 {670 /* Configure toolbar: */671 const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize);672 m_pToolBar->setIconSize(QSize(iIconMetric, iIconMetric));673 m_pToolBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);674 m_pToolBar->setContextMenuPolicy(Qt::CustomContextMenu);675 m_pToolBar->setUseTextLabels(true);676 677 #if defined(VBOX_WS_MAC) && (defined(RT_ARCH_ARM64) || defined(RT_ARCH_ARM32))678 /* Check whether we should show Dev Preview tag: */679 bool fShowDevPreviewTag = false;680 const CVirtualBox comVBox = gpGlobalSession->virtualBox();681 if (comVBox.isNotNull())682 {683 const CSystemProperties comSystemProps = comVBox.GetSystemProperties();684 if (comVBox.isOk() && comSystemProps.isNotNull())685 fShowDevPreviewTag =686 comSystemProps.GetSupportedPlatformArchitectures().contains(KPlatformArchitecture_x86);687 }688 /* Enable Dev Preview tag: */689 if (fShowDevPreviewTag)690 {691 m_pToolBar->emulateMacToolbar();692 m_pToolBar->enableBranding(UIIconPool::iconSet(":/explosion_hazard_32px.png"),693 "Dev Preview", // do we need to make it NLS?694 QColor(246, 179, 0),695 74 /* width of BETA label */);696 }697 #endif /* VBOX_WS_MAC && (RT_ARCH_ARM64 || RT_ARCH_ARM32) */698 699 /* Add toolbar into layout: */700 pLayoutRight->addWidget(m_pToolBar);701 }702 703 /* Create stacked-widget: */704 m_pStackedWidget = new QStackedWidget;705 if (m_pStackedWidget)706 {707 /* Create Global Tools-pane: */708 m_pPaneToolsGlobal = new UIToolPaneGlobal(actionPool());709 if (m_pPaneToolsGlobal)710 {711 if (m_pPaneChooser->isGlobalItemSelected())712 m_pPaneToolsGlobal->setActive(true);713 connect(m_pPaneToolsGlobal, &UIToolPaneGlobal::sigCreateMedium,714 this, &UIVirtualBoxManagerAdvancedWidget::sigCreateMedium);715 connect(m_pPaneToolsGlobal, &UIToolPaneGlobal::sigCopyMedium,716 this, &UIVirtualBoxManagerAdvancedWidget::sigCopyMedium);717 connect(m_pPaneToolsGlobal, &UIToolPaneGlobal::sigSwitchToMachineActivityPane,718 this, &UIVirtualBoxManagerAdvancedWidget::sltSwitchToMachineActivityPane);719 720 /* Add into stack: */721 m_pStackedWidget->addWidget(m_pPaneToolsGlobal);722 }723 724 /* Create Machine Tools-pane: */725 m_pPaneToolsMachine = new UIToolPaneMachine(actionPool());726 if (m_pPaneToolsMachine)727 {728 if (!m_pPaneChooser->isGlobalItemSelected())729 m_pPaneToolsMachine->setActive(true);730 connect(m_pPaneToolsMachine, &UIToolPaneMachine::sigCurrentSnapshotItemChange,731 this, &UIVirtualBoxManagerAdvancedWidget::sigCurrentSnapshotItemChange);732 connect(m_pPaneToolsMachine, &UIToolPaneMachine::sigSwitchToActivityOverviewPane,733 this, &UIVirtualBoxManagerAdvancedWidget::sltSwitchToActivityOverviewPane);734 connect(m_pPaneToolsMachine, &UIToolPaneMachine::sigDetachToolPane,735 this, &UIVirtualBoxManagerAdvancedWidget::sigDetachToolPane);736 737 /* Add into stack: */738 m_pStackedWidget->addWidget(m_pPaneToolsMachine);739 }740 741 /* Choose which pane should be active initially: */742 if (m_pPaneChooser->isGlobalItemSelected())743 m_pStackedWidget->setCurrentWidget(m_pPaneToolsGlobal);744 else745 m_pStackedWidget->setCurrentWidget(m_pPaneToolsMachine);746 747 /* Add into layout: */748 pLayoutRight->addWidget(m_pStackedWidget, 1);749 }750 }751 752 /* Add into splitter: */753 m_pSplitter->addWidget(pWidgetRight);754 }755 756 /* Set the initial distribution. The right site is bigger. */757 m_pSplitter->setStretchFactor(0, 2);758 m_pSplitter->setStretchFactor(1, 3);759 760 225 /* Add into layout: */ 761 pLayout Main->addWidget(m_pSplitter);226 pLayout->addWidget(toolMenu()); 762 227 } 763 228 764 /* Create Global Tools-menu: */ 765 m_pMenuToolsGlobal = new UITools(this, UIToolClass_Global, actionPool()); 766 /* Create Machine Tools-menu: */ 767 m_pMenuToolsMachine = new UITools(this, UIToolClass_Machine, actionPool()); 229 /* Create tools-pane: */ 230 m_pPane = new UIToolPaneGlobal(actionPool()); 231 if (toolPane()) 232 { 233 /// @todo make sure it's used properly 234 toolPane()->setActive(true); 235 236 /* Add into layout: */ 237 pLayout->addWidget(toolPane()); 238 } 768 239 } 769 240 770 241 /* Create notification-center: */ 771 242 UINotificationCenter::create(this); 772 773 /* Update toolbar finally: */ 774 updateToolbar(); 775 776 /* Bring the VM list to the focus: */ 777 m_pPaneChooser->setFocus(); 778 } 779 780 void UIVirtualBoxManagerAdvancedWidget::prepareConnections() 243 } 244 245 void UIGlobalToolsManagerWidget::prepareConnections() 781 246 { 782 247 /* UICommon connections: */ 783 248 connect(&uiCommon(), &UICommon::sigAskToCommitData, 784 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleCommitData); 785 786 /* Global VBox event handlers: */ 787 connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineStateChange, 788 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleMachineStateChange); 249 this, &UIGlobalToolsManagerWidget::sltHandleCommitData); 789 250 790 251 /* Global VBox extra-data event handlers: */ 791 252 connect(gEDataManager, &UIExtraDataManager::sigSettingsExpertModeChange, 792 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleSettingsExpertModeChange); 793 794 /* Splitter connections: */ 795 connect(m_pSplitter, &QISplitter::splitterMoved, 796 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleSplitterMove); 797 798 /* Tool-bar connections: */ 799 connect(m_pToolBar, &QIToolBar::customContextMenuRequested, 800 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleToolBarContextMenuRequest); 801 connect(m_pToolBar, &QIToolBar::sigResized, 802 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleToolBarResize); 253 this, &UIGlobalToolsManagerWidget::sltHandleSettingsExpertModeChange); 803 254 804 255 /* Chooser-pane connections: */ 805 connect(m_pPaneChooser, &UIChooser::sigSelectionChanged, 806 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleChooserPaneIndexChange); 807 connect(m_pPaneChooser, &UIChooser::sigSelectionInvalidated, 808 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleChooserPaneSelectionInvalidated); 809 connect(m_pPaneChooser, &UIChooser::sigToggleStarted, 810 m_pPaneToolsMachine, &UIToolPaneMachine::sigToggleStarted); 811 connect(m_pPaneChooser, &UIChooser::sigToggleFinished, 812 m_pPaneToolsMachine, &UIToolPaneMachine::sigToggleFinished); 813 connect(m_pPaneChooser, &UIChooser::sigGroupSavingStateChanged, 814 this, &UIVirtualBoxManagerAdvancedWidget::sigGroupSavingStateChanged); 815 connect(m_pPaneChooser, &UIChooser::sigCloudUpdateStateChanged, 816 this, &UIVirtualBoxManagerAdvancedWidget::sigCloudUpdateStateChanged); 817 connect(m_pPaneChooser, &UIChooser::sigToolMenuRequested, 818 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleToolMenuRequested); 819 connect(m_pPaneChooser, &UIChooser::sigCloudProfileStateChange, 820 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleCloudProfileStateChange); 821 connect(m_pPaneChooser, &UIChooser::sigCloudMachineStateChange, 822 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleCloudMachineStateChange); 823 connect(m_pPaneChooser, &UIChooser::sigStartOrShowRequest, 824 this, &UIVirtualBoxManagerAdvancedWidget::sigStartOrShowRequest); 825 connect(m_pPaneChooser, &UIChooser::sigMachineSearchWidgetVisibilityChanged, 826 this, &UIVirtualBoxManagerAdvancedWidget::sigMachineSearchWidgetVisibilityChanged); 827 828 /* Details-pane connections: */ 829 connect(m_pPaneToolsMachine, &UIToolPaneMachine::sigLinkClicked, 830 this, &UIVirtualBoxManagerAdvancedWidget::sigMachineSettingsLinkClicked); 256 connect(chooser(), &UIChooser::sigCloudProfileStateChange, 257 this, &UIGlobalToolsManagerWidget::sltHandleCloudProfileStateChange); 258 259 /* Tools-menu connections: */ 260 connect(toolMenu(), &UITools::sigSelectionChanged, 261 this, &UIGlobalToolsManagerWidget::sltHandleToolsMenuIndexChange); 831 262 832 263 /* Tools-pane connections: */ 833 connect(m_pMenuToolsGlobal, &UITools::sigSelectionChanged, 834 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleGlobalToolsMenuIndexChange); 835 connect(m_pMenuToolsMachine, &UITools::sigSelectionChanged, 836 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleMachineToolsMenuIndexChange); 837 } 838 839 void UIVirtualBoxManagerAdvancedWidget::loadSettings() 840 { 841 /* Restore splitter handle position: */ 842 { 843 QList<int> sizes = gEDataManager->selectorWindowSplitterHints(); 844 /* If both hints are zero, we have the 'default' case: */ 845 if (sizes.at(0) == 0 && sizes.at(1) == 0) 846 { 847 sizes[0] = (int)(width() * .9 * (1.0 / 3)); 848 sizes[1] = (int)(width() * .9 * (2.0 / 3)); 849 } 850 LogRel2(("GUI: UIVirtualBoxManagerAdvancedWidget: Restoring splitter to: Size=%d,%d\n", 851 sizes.at(0), sizes.at(1))); 852 m_pSplitter->setSizes(sizes); 853 } 854 855 /* Restore toolbar settings: */ 856 { 857 m_pToolBar->setUseTextLabels(gEDataManager->selectorWindowToolBarTextVisible()); 858 } 859 860 /* Open tools last chosen in Tools-menu: */ 861 switchGlobalToolTo(m_pMenuToolsGlobal->toolsType()); 862 switchMachineToolTo(m_pMenuToolsMachine->toolsType()); 863 } 864 865 void UIVirtualBoxManagerAdvancedWidget::updateToolbar() 866 { 867 /* Make sure toolbar exists: */ 868 AssertPtrReturnVoid(m_pToolBar); 869 870 /* Clear initially: */ 871 m_pToolBar->clear(); 872 873 /* If global item selected: */ 874 if (isGlobalItemSelected()) 875 { 876 switch (currentGlobalTool()) 877 { 878 case UIToolType_Welcome: 879 { 880 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Application_S_Preferences)); 881 m_pToolBar->addSeparator(); 882 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_File_S_ImportAppliance)); 883 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_File_S_ExportAppliance)); 884 m_pToolBar->addSeparator(); 885 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Welcome_S_New)); 886 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Welcome_S_Add)); 887 break; 888 } 889 case UIToolType_Extensions: 890 { 891 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Extension_S_Install)); 892 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Extension_S_Uninstall)); 893 break; 894 } 895 case UIToolType_Media: 896 { 897 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Add)); 898 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Create)); 899 m_pToolBar->addSeparator(); 900 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Copy)); 901 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Move)); 902 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Remove)); 903 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Release)); 904 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Clear)); 905 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_T_Search)); 906 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_T_Details)); 907 m_pToolBar->addSeparator(); 908 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Medium_S_Refresh)); 909 break; 910 } 911 case UIToolType_Network: 912 { 913 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Network_S_Create)); 914 m_pToolBar->addSeparator(); 915 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Network_S_Remove)); 916 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Network_T_Details)); 917 //m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Network_S_Refresh)); 918 break; 919 } 920 case UIToolType_Cloud: 921 { 922 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Cloud_S_Add)); 923 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Cloud_S_Import)); 924 m_pToolBar->addSeparator(); 925 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Cloud_S_Remove)); 926 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Cloud_T_Details)); 927 m_pToolBar->addSeparator(); 928 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Cloud_S_TryPage)); 929 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Cloud_S_Help)); 930 break; 931 } 932 case UIToolType_Activities: 933 { 934 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_VMActivityOverview_M_Columns)); 935 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_VMActivityOverview_S_SwitchToMachineActivity)); 936 QToolButton *pButton = 937 qobject_cast<QToolButton*>(m_pToolBar->widgetForAction(actionPool()->action(UIActionIndexMN_M_VMActivityOverview_M_Columns))); 938 if (pButton) 939 { 940 pButton->setPopupMode(QToolButton::InstantPopup); 941 pButton->setAutoRaise(true); 942 } 943 break; 944 } 945 946 default: 947 break; 948 } 949 } 950 951 else 952 953 /* If machine or group item selected: */ 954 if (isMachineItemSelected() || isGroupItemSelected()) 955 { 956 switch (currentMachineTool()) 957 { 958 case UIToolType_Details: 959 { 960 if (isSingleGroupSelected()) 961 { 962 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_New)); 963 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Add)); 964 m_pToolBar->addSeparator(); 965 if (isSingleLocalGroupSelected()) 966 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Discard)); 967 else if ( isSingleCloudProviderGroupSelected() 968 || isSingleCloudProfileGroupSelected()) 969 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Group_M_Stop_S_Terminate)); 970 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Group_M_StartOrShow)); 971 } 972 else 973 { 974 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_New)); 975 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Add)); 976 m_pToolBar->addSeparator(); 977 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Settings)); 978 if (isLocalMachineItemSelected()) 979 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard)); 980 else if (isCloudMachineItemSelected()) 981 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_Stop_S_Terminate)); 982 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow)); 983 } 984 break; 985 } 986 case UIToolType_Snapshots: 987 { 988 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Snapshot_S_Take)); 989 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Snapshot_S_Delete)); 990 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Snapshot_S_Restore)); 991 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Snapshot_T_Properties)); 992 if (gEDataManager->isSettingsInExpertMode()) 993 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Snapshot_S_Clone)); 994 m_pToolBar->addSeparator(); 995 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Settings)); 996 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard)); 997 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow)); 998 break; 999 } 1000 case UIToolType_Logs: 1001 { 1002 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_S_Save)); 1003 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_T_Find)); 1004 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_T_Filter)); 1005 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_T_Bookmark)); 1006 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_T_Preferences)); 1007 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_S_Refresh)); 1008 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_S_Reload)); 1009 m_pToolBar->addSeparator(); 1010 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Settings)); 1011 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard)); 1012 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow)); 1013 break; 1014 } 1015 case UIToolType_VMActivity: 1016 { 1017 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Activity_S_Export)); 1018 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Activity_S_ToVMActivityOverview)); 1019 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Activity_T_Preferences)); 1020 m_pToolBar->addSeparator(); 1021 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Settings)); 1022 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard)); 1023 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow)); 1024 break; 1025 } 1026 case UIToolType_FileManager: 1027 { 1028 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_FileManager_T_Preferences)); 1029 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_FileManager_T_Operations)); 1030 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_FileManager_T_Log)); 1031 m_pToolBar->addSeparator(); 1032 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Settings)); 1033 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard)); 1034 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow)); 1035 break; 1036 } 1037 case UIToolType_Error: 1038 { 1039 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_New)); 1040 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Add)); 1041 m_pToolBar->addSeparator(); 1042 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Refresh)); 1043 break; 1044 } 1045 default: 1046 break; 1047 } 1048 } 1049 } 1050 1051 void UIVirtualBoxManagerAdvancedWidget::cleanupConnections() 1052 { 1053 /* Tool-bar connections: */ 1054 disconnect(m_pToolBar, &QIToolBar::customContextMenuRequested, 1055 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleToolBarContextMenuRequest); 1056 disconnect(m_pToolBar, &QIToolBar::sigResized, 1057 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleToolBarResize); 264 connect(toolPaneMachine(), &UIToolPaneMachine::sigSwitchToActivityOverviewPane, 265 this, &UIGlobalToolsManagerWidget::sltSwitchToActivitiesTool); 266 } 267 268 void UIGlobalToolsManagerWidget::loadSettings() 269 { 270 /* Open tool last chosen in tools-menu: */ 271 switchToolTo(toolMenu()->toolsType()); 272 } 273 274 void UIGlobalToolsManagerWidget::cleanupConnections() 275 { 276 /* Global VBox extra-data event handlers: */ 277 disconnect(gEDataManager, &UIExtraDataManager::sigSettingsExpertModeChange, 278 this, &UIGlobalToolsManagerWidget::sltHandleSettingsExpertModeChange); 1058 279 1059 280 /* Chooser-pane connections: */ 1060 disconnect(m_pPaneChooser, &UIChooser::sigSelectionChanged, 1061 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleChooserPaneIndexChange); 1062 disconnect(m_pPaneChooser, &UIChooser::sigSelectionInvalidated, 1063 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleChooserPaneSelectionInvalidated); 1064 disconnect(m_pPaneChooser, &UIChooser::sigToggleStarted, 1065 m_pPaneToolsMachine, &UIToolPaneMachine::sigToggleStarted); 1066 disconnect(m_pPaneChooser, &UIChooser::sigToggleFinished, 1067 m_pPaneToolsMachine, &UIToolPaneMachine::sigToggleFinished); 1068 disconnect(m_pPaneChooser, &UIChooser::sigGroupSavingStateChanged, 1069 this, &UIVirtualBoxManagerAdvancedWidget::sigGroupSavingStateChanged); 1070 disconnect(m_pPaneChooser, &UIChooser::sigCloudUpdateStateChanged, 1071 this, &UIVirtualBoxManagerAdvancedWidget::sigCloudUpdateStateChanged); 1072 disconnect(m_pPaneChooser, &UIChooser::sigToolMenuRequested, 1073 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleToolMenuRequested); 1074 disconnect(m_pPaneChooser, &UIChooser::sigCloudProfileStateChange, 1075 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleCloudProfileStateChange); 1076 disconnect(m_pPaneChooser, &UIChooser::sigCloudMachineStateChange, 1077 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleCloudMachineStateChange); 1078 disconnect(m_pPaneChooser, &UIChooser::sigStartOrShowRequest, 1079 this, &UIVirtualBoxManagerAdvancedWidget::sigStartOrShowRequest); 1080 disconnect(m_pPaneChooser, &UIChooser::sigMachineSearchWidgetVisibilityChanged, 1081 this, &UIVirtualBoxManagerAdvancedWidget::sigMachineSearchWidgetVisibilityChanged); 1082 1083 /* Details-pane connections: */ 1084 disconnect(m_pPaneToolsMachine, &UIToolPaneMachine::sigLinkClicked, 1085 this, &UIVirtualBoxManagerAdvancedWidget::sigMachineSettingsLinkClicked); 281 disconnect(chooser(), &UIChooser::sigCloudProfileStateChange, 282 this, &UIGlobalToolsManagerWidget::sltHandleCloudProfileStateChange); 283 284 /* Tools-menu connections: */ 285 disconnect(toolMenu(), &UITools::sigSelectionChanged, 286 this, &UIGlobalToolsManagerWidget::sltHandleToolsMenuIndexChange); 1086 287 1087 288 /* Tools-pane connections: */ 1088 disconnect(m_pMenuToolsGlobal, &UITools::sigSelectionChanged, 1089 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleGlobalToolsMenuIndexChange); 1090 disconnect(m_pMenuToolsMachine, &UITools::sigSelectionChanged, 1091 this, &UIVirtualBoxManagerAdvancedWidget::sltHandleMachineToolsMenuIndexChange); 1092 } 1093 1094 void UIVirtualBoxManagerAdvancedWidget::cleanupWidgets() 289 disconnect(toolPaneMachine(), &UIToolPaneMachine::sigSwitchToActivityOverviewPane, 290 this, &UIGlobalToolsManagerWidget::sltSwitchToActivitiesTool); 291 } 292 293 void UIGlobalToolsManagerWidget::cleanupWidgets() 1095 294 { 1096 295 UINotificationCenter::destroy(); 1097 296 } 1098 297 1099 void UI VirtualBoxManagerAdvancedWidget::cleanup()298 void UIGlobalToolsManagerWidget::cleanup() 1100 299 { 1101 300 /* Ask sub-dialogs to commit data: */ … … 1106 305 } 1107 306 1108 void UIVirtualBoxManagerAdvancedWidget::recacheCurrentMachineItemInformation(bool fDontRaiseErrorPane /* = false */) 1109 { 1110 /* Sanity check, this method is for machine or group of machine items: */ 1111 if (!isMachineItemSelected() && !isGroupItemSelected()) 1112 return; 1113 1114 /* Get current item: */ 1115 UIVirtualMachineItem *pItem = currentItem(); 1116 const bool fCurrentItemIsOk = isItemAccessible(pItem); 1117 1118 /* If current item is Ok: */ 1119 if (fCurrentItemIsOk) 1120 { 1121 /* If Error-pane is chosen currently => switch to tool currently chosen in Tools-menu: */ 1122 if (m_pPaneToolsMachine->currentTool() == UIToolType_Error) 1123 switchMachineToolTo(m_pMenuToolsMachine->toolsType()); 1124 1125 /* Propagate current items to the Tools pane: */ 1126 m_pPaneToolsMachine->setItems(currentItems()); 1127 } 1128 /* Otherwise if we were not asked separately to calm down: */ 1129 else if (!fDontRaiseErrorPane) 1130 { 1131 /* Make sure Error pane raised: */ 1132 if (m_pPaneToolsMachine->currentTool() != UIToolType_Error) 1133 m_pPaneToolsMachine->openTool(UIToolType_Error); 1134 1135 /* Propagate last access error to the Error-pane: */ 1136 if (pItem) 1137 m_pPaneToolsMachine->setErrorDetails(pItem->accessError()); 1138 } 1139 } 1140 1141 void UIVirtualBoxManagerAdvancedWidget::updateToolsMenuGlobal() 307 UITools *UIGlobalToolsManagerWidget::toolMenu() const 308 { 309 return m_pMenu; 310 } 311 312 UIToolPaneGlobal *UIGlobalToolsManagerWidget::toolPane() const 313 { 314 return m_pPane; 315 } 316 317 UIMachineManagerWidget *UIGlobalToolsManagerWidget::machineManager() const 318 { 319 return toolPane()->machineManager(); 320 } 321 322 UIChooser *UIGlobalToolsManagerWidget::chooser() const 323 { 324 return machineManager()->chooser(); 325 } 326 327 UIToolPaneMachine *UIGlobalToolsManagerWidget::toolPaneMachine() const 328 { 329 return machineManager()->toolPane(); 330 } 331 332 void UIGlobalToolsManagerWidget::updateToolsMenuGlobal() 1142 333 { 1143 334 /* Update global tools restrictions: */ … … 1147 338 restrictedTypes << UIToolType_Media 1148 339 << UIToolType_Network; 1149 if (restrictedTypes.contains( m_pMenuToolsGlobal->toolsType()))1150 m_pMenuToolsGlobal->setToolsType(UIToolType_Welcome);340 if (restrictedTypes.contains(toolMenu()->toolsType())) 341 setMenuToolType(UIToolType_Welcome); 1151 342 const QList restrictions(restrictedTypes.begin(), restrictedTypes.end()); 1152 m_pMenuToolsGlobal->setRestrictedToolTypes(restrictions);343 toolMenu()->setRestrictedToolTypes(restrictions); 1153 344 1154 345 /* Take restrictions into account, closing all restricted tools: */ 1155 346 foreach (const UIToolType &enmRestrictedType, restrictedTypes) 1156 m_pPaneToolsGlobal->closeTool(enmRestrictedType); 1157 } 1158 1159 void UIVirtualBoxManagerAdvancedWidget::updateToolsMenuMachine(UIVirtualMachineItem *pItem) 1160 { 1161 /* Get current item state: */ 1162 const bool fCurrentItemIsOk = isItemAccessible(pItem); 1163 1164 /* Update machine tools restrictions: */ 1165 QSet<UIToolType> restrictedTypes; 1166 const bool fExpertMode = gEDataManager->isSettingsInExpertMode(); 1167 if (!fExpertMode) 1168 restrictedTypes << UIToolType_FileManager; 1169 if (pItem && pItem->itemType() != UIVirtualMachineItemType_Local) 1170 restrictedTypes << UIToolType_Snapshots 1171 << UIToolType_Logs 1172 << UIToolType_FileManager; 1173 if (restrictedTypes.contains(m_pMenuToolsMachine->toolsType())) 1174 m_pMenuToolsMachine->setToolsType(UIToolType_Details); 1175 const QList restrictions(restrictedTypes.begin(), restrictedTypes.end()); 1176 m_pMenuToolsMachine->setRestrictedToolTypes(restrictions); 1177 /* Update machine menu items availability: */ 1178 m_pMenuToolsMachine->setItemsEnabled(fCurrentItemIsOk); 1179 1180 /* Take restrictions into account, closing all restricted tools: */ 1181 foreach (const UIToolType &enmRestrictedType, restrictedTypes) 1182 m_pPaneToolsMachine->closeTool(enmRestrictedType); 1183 } 1184 1185 void UIVirtualBoxManagerAdvancedWidget::handleCurrentToolTypeChange(UIToolType enmType) 1186 { 1187 /* This method's behavior depends first of all of currently selected tool class. 1188 * But keep in mind, it is called for both Global and Machine type changes. */ 1189 1190 /* If Global tools currently chosen: */ 1191 if (m_pStackedWidget->currentWidget() == m_pPaneToolsGlobal) 1192 { 1193 /* For the Global tool type changes, 1194 * start unconditionally updating all cloud VMs, 1195 * if Activity Overview tool currently chosen (even if VMs are not selected): */ 1196 if (UIToolStuff::isTypeOfClass(enmType, UIToolClass_Global)) 1197 { 1198 bool fActivityOverviewActive = enmType == UIToolType_Activities; 1199 m_pPaneChooser->setKeepCloudNodesUpdated(fActivityOverviewActive); 1200 if (fActivityOverviewActive) 1201 m_pPaneToolsGlobal->setCloudMachineItems(m_pPaneChooser->cloudMachineItems()); 1202 } 1203 } 1204 /* If Machine tools currently chosen: */ 1205 else 1206 { 1207 /* Stop unconditionally updating all cloud VMs, 1208 * (tho they will still be updated if selected): */ 1209 m_pPaneChooser->setKeepCloudNodesUpdated(false); 1210 } 1211 } 347 toolPane()->closeTool(enmRestrictedType); 348 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIGlobalToolsManagerWidget.h
r107303 r107337 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UI VirtualBoxManagerAdvancedWidget class declaration.3 * VBox Qt GUI - UIGlobalToolsManagerWidget class declaration. 4 4 */ 5 5 … … 26 26 */ 27 27 28 #ifndef FEQT_INCLUDED_SRC_manager_UI VirtualBoxManagerAdvancedWidget_h29 #define FEQT_INCLUDED_SRC_manager_UI VirtualBoxManagerAdvancedWidget_h28 #ifndef FEQT_INCLUDED_SRC_manager_UIGlobalToolsManagerWidget_h 29 #define FEQT_INCLUDED_SRC_manager_UIGlobalToolsManagerWidget_h 30 30 #ifndef RT_WITHOUT_PRAGMA_ONCE 31 31 # pragma once … … 33 33 34 34 /* Qt includes: */ 35 #include <QUuid>36 35 #include <QWidget> 37 36 … … 40 39 41 40 /* Forward declarations: */ 42 class QStackedWidget;43 class QTimer;44 class QISplitter;45 class QIToolBar;46 41 class UIActionPool; 47 42 class UIChooser; 43 class UIMachineManagerWidget; 48 44 class UIToolPaneGlobal; 49 45 class UIToolPaneMachine; 50 46 class UITools; 51 class UIVirtualBoxManager; 52 class UIVirtualMachineItem; 47 class UIVirtualBoxManagerAdvancedWidget; 53 48 54 49 /** QWidget extension used as VirtualBox Manager Widget instance. */ 55 class UI VirtualBoxManagerAdvancedWidget : public QWidget50 class UIGlobalToolsManagerWidget : public QWidget 56 51 { 57 52 Q_OBJECT; 58 53 59 /** Possible selection types. */60 enum SelectionType61 {62 SelectionType_Invalid,63 SelectionType_SingleLocalGroupItem,64 SelectionType_SingleCloudGroupItem,65 SelectionType_FirstIsGlobalItem,66 SelectionType_FirstIsLocalMachineItem,67 SelectionType_FirstIsCloudMachineItem68 };69 70 54 signals: 71 72 /** @name Tool-bar stuff.73 * @{ */74 /* Notifies listeners about tool-bar height change. */75 void sigToolBarHeightChange(int iHeight);76 /** @} */77 78 /** @name Chooser pane stuff.79 * @{ */80 /** Notifies about Chooser-pane index change. */81 void sigChooserPaneIndexChange();82 /** Notifies about Chooser-pane group saving change. */83 void sigGroupSavingStateChanged();84 /** Notifies about Chooser-pane cloud update change. */85 void sigCloudUpdateStateChanged();86 87 /** Notifies about state change for cloud machine with certain @a uId. */88 void sigCloudMachineStateChange(const QUuid &uId);89 90 /** Notify listeners about start or show request. */91 void sigStartOrShowRequest();92 /** Notifies listeners about machine search widget visibility changed to @a fVisible. */93 void sigMachineSearchWidgetVisibilityChanged(bool fVisible);94 /** @} */95 55 96 56 /** @name Tools pane stuff. 97 57 * @{ */ 98 /** Notifies about Global Tool type change. */ 99 void sigToolTypeChangeGlobal(); 100 /** Notifies about Machine Tool type change. */ 101 void sigToolTypeChangeMachine(); 102 /** @} */ 103 104 /** @name Tools / Media pane stuff. 105 * @{ */ 106 /** Notifies listeners about creation procedure was requested. */ 107 void sigCreateMedium(); 108 /** Notifies listeners about copy procedure was requested for medium with specified @a uMediumId. */ 109 void sigCopyMedium(const QUuid &uMediumId); 110 /** @} */ 111 112 /** @name Tools / Details pane stuff. 113 * @{ */ 114 /** Notifies aboud Details-pane link clicked. */ 115 void sigMachineSettingsLinkClicked(const QString &strCategory, const QString &strControl, const QUuid &uId); 116 /** @} */ 117 118 /** @name Tools / Snapshots pane stuff. 119 * @{ */ 120 /** Notifies listeners about current Snapshots pane item change. */ 121 void sigCurrentSnapshotItemChange(); 122 /** @} */ 123 124 /** @name Tools / Generic pane stuff. 125 * @{ */ 126 /** Notifies listeners about request to detach pane with tool type @p enmToolType. */ 127 void sigDetachToolPane(UIToolType enmToolType); 58 /** Notifies about Tool type change. */ 59 void sigToolTypeChange(); 128 60 /** @} */ 129 61 130 62 public: 131 63 132 /** Constructs VirtualBox Manager widget. */ 133 UIVirtualBoxManagerAdvancedWidget(UIVirtualBoxManager *pParent); 64 /** Constructs VirtualBox Manager widget passing @a pParent to the base-class. 65 * @param pActionPool Brings the action-pool reference. */ 66 UIGlobalToolsManagerWidget(UIVirtualBoxManagerAdvancedWidget *pParent, UIActionPool *pActionPool); 134 67 /** Destructs VirtualBox Manager widget. */ 135 virtual ~UI VirtualBoxManagerAdvancedWidget() RT_OVERRIDE;68 virtual ~UIGlobalToolsManagerWidget() RT_OVERRIDE; 136 69 137 70 /** @name Common stuff. … … 141 74 /** @} */ 142 75 143 /** @name Tool-bar stuff.144 * @{ */145 /** Updates tool-bar menu buttons. */146 void updateToolBarMenuButtons(bool fSeparateMenuSection);147 /** @} */148 149 /** @name Chooser pane stuff.150 * @{ */151 /** Returns current-item. */152 UIVirtualMachineItem *currentItem() const;153 /** Returns a list of current-items. */154 QList<UIVirtualMachineItem*> currentItems() const;155 156 /** Returns whether passed @a pItem accessible, by default it's the current one. */157 bool isItemAccessible(UIVirtualMachineItem *pItem = 0) const;158 159 /** Returns whether group item is selected. */160 bool isGroupItemSelected() const;161 /** Returns whether global item is selected. */162 bool isGlobalItemSelected() const;163 /** Returns whether machine item is selected. */164 bool isMachineItemSelected() const;165 /** Returns whether local machine item is selected. */166 bool isLocalMachineItemSelected() const;167 /** Returns whether cloud machine item is selected. */168 bool isCloudMachineItemSelected() const;169 170 /** Returns whether single group is selected. */171 bool isSingleGroupSelected() const;172 /** Returns whether single local group is selected. */173 bool isSingleLocalGroupSelected() const;174 /** Returns whether single cloud provider group is selected. */175 bool isSingleCloudProviderGroupSelected() const;176 /** Returns whether single cloud profile group is selected. */177 bool isSingleCloudProfileGroupSelected() const;178 /** Returns whether all items of one group are selected. */179 bool isAllItemsOfOneGroupSelected() const;180 181 /** Returns current selection type. */182 SelectionType selectionType() const;183 184 /** Returns full name of currently selected group. */185 QString fullGroupName() const;186 187 /** Returns whether group saving is in progress. */188 bool isGroupSavingInProgress() const;189 /** Returns whether at least one cloud profile currently being updated. */190 bool isCloudProfileUpdateInProgress() const;191 192 /** Opens group name editor. */193 void openGroupNameEditor();194 /** Disbands group. */195 void disbandGroup();196 /** Removes machine. */197 void removeMachine();198 /** Moves machine to a group with certain @a strName. */199 void moveMachineToGroup(const QString &strName = QString());200 /** Returns possible groups for machine with passed @a uId to move to. */201 QStringList possibleGroupsForMachineToMove(const QUuid &uId);202 /** Returns possible groups for group with passed @a strFullName to move to. */203 QStringList possibleGroupsForGroupToMove(const QString &strFullName);204 /** Refreshes machine. */205 void refreshMachine();206 /** Sorts group. */207 void sortGroup();208 /** Toggle machine search widget to be @a fVisible. */209 void setMachineSearchWidgetVisibility(bool fVisible);210 /** @} */211 212 76 /** @name Tools pane stuff. 213 77 * @{ */ 214 /** Defines Global tools @a enmType and @a fMakeSureItsVisible if requested. */215 void setToolsTypeGlobal(UIToolType enmType, bool fMakeSureItsVisible = false);216 /** Returns Global tools type. */217 UIToolType toolsTypeGlobal() const;78 /** Returns menu tool type. */ 79 UIToolType menuToolType() const; 80 /** Defines menu tool @a enmType. */ 81 void setMenuToolType(UIToolType enmType); 218 82 219 /** Defines Machine tools @a enmType. */ 220 void setToolsTypeMachine(UIToolType enmType); 221 /** Returns Machine tools type. */ 222 UIToolType toolsTypeMachine() const; 223 224 /** Returns a type of curent Global tool. */ 225 UIToolType currentGlobalTool() const; 226 /** Returns a type of curent Machine tool. */ 227 UIToolType currentMachineTool() const; 228 /** Returns whether Global tool of passed @a enmType is opened. */ 229 bool isGlobalToolOpened(UIToolType enmType) const; 230 /** Returns whether Machine tool of passed @a enmType is opened. */ 231 bool isMachineToolOpened(UIToolType enmType) const; 232 /** Switches Global tool to passed @a enmType. */ 233 void switchGlobalToolTo(UIToolType enmType); 234 /** Switches Machine tool to passed @a enmType. */ 235 void switchMachineToolTo(UIToolType enmType); 236 /** Closes Global tool of passed @a enmType. */ 237 void closeGlobalTool(UIToolType enmType); 238 /** Closes Machine tool of passed @a enmType. */ 239 void closeMachineTool(UIToolType enmType); 240 /** @} */ 241 242 /** @name Tools / Snapshot pane stuff. 243 * @{ */ 244 /** Returns whether current-state item of Snapshot pane is selected. */ 245 bool isCurrentStateItemSelected() const; 246 247 /** Returns currently selected snapshot ID if any. */ 248 QUuid currentSnapshotId(); 83 /** Returns pane tool type. */ 84 UIToolType toolType() const; 85 /** Returns whether pane has tool of passed @a enmType. */ 86 bool isToolOpened(UIToolType enmType) const; 87 /** Switches tool to passed @a enmType. */ 88 void switchToolTo(UIToolType enmType); 89 /** Closes tool of passed @a enmType. */ 90 void closeTool(UIToolType enmType); 249 91 /** @} */ 250 92 … … 255 97 /** @} */ 256 98 257 public slots:258 259 /** @name Tool-bar stuff.260 * @{ */261 /** Handles tool-bar context-menu request for passed @a position. */262 void sltHandleToolBarContextMenuRequest(const QPoint &position);263 /** @} */264 265 99 private slots: 266 267 /** @name Event handling stuff.268 * @{ */269 /** Handles translation event. */270 void sltRetranslateUI();271 /** @} */272 100 273 101 /** @name General stuff. … … 275 103 /** Handles request to commit data. */ 276 104 void sltHandleCommitData(); 277 /** @} */278 279 /** @name CVirtualBox event handling stuff.280 * @{ */281 /** Handles CVirtualBox event about state change for machine with @a uId. */282 void sltHandleMachineStateChange(const QUuid &uId);283 105 /** @} */ 284 106 … … 289 111 /** @} */ 290 112 291 /** @name Splitter stuff.292 * @{ */293 /** Handles signal about splitter move. */294 void sltHandleSplitterMove();295 /** Handles request to save splitter settings. */296 void sltSaveSplitterSettings();297 /** @} */298 299 /** @name Tool-bar stuff.300 * @{ */301 /** Handles signal about tool-bar resize to @a newSize. */302 void sltHandleToolBarResize(const QSize &newSize);303 /** @} */304 305 113 /** @name Chooser pane stuff. 306 114 * @{ */ 307 /** Handles signal about Chooser-pane index change. */308 void sltHandleChooserPaneIndexChange();309 310 /** Handles signal about Chooser-pane selection invalidated. */311 void sltHandleChooserPaneSelectionInvalidated() { recacheCurrentMachineItemInformation(true /* fDontRaiseErrorPane */); }312 313 115 /** Handles state change for cloud profile with certain @a strProviderShortName and @a strProfileName. */ 314 116 void sltHandleCloudProfileStateChange(const QString &strProviderShortName, 315 117 const QString &strProfileName); 316 /** Handles state change for cloud machine with certain @a uId. */317 void sltHandleCloudMachineStateChange(const QUuid &uId);318 118 /** @} */ 319 119 320 120 /** @name Tools pane stuff. 321 121 * @{ */ 322 /** Handles tool popup-menu request. */ 323 void sltHandleToolMenuRequested(const QPoint &position, UIVirtualMachineItem *pItem); 122 /** Handles signal about Tools-menu index change. 123 * @param enmType Brings current tool type. */ 124 void sltHandleToolsMenuIndexChange(UIToolType enmType); 324 125 325 /** Handles signal about global Tools-menu index change. 326 * @param enmType Brings current tool type. */ 327 void sltHandleGlobalToolsMenuIndexChange(UIToolType enmType) { switchGlobalToolTo(enmType); } 328 /** Handles signal about machine Tools-menu index change. 329 * @param enmType Brings current tool type. */ 330 void sltHandleMachineToolsMenuIndexChange(UIToolType enmType) { switchMachineToolTo(enmType); } 331 332 /** Handles signal requesting switch to Activity pane of machine with @a uMachineId. */ 333 void sltSwitchToMachineActivityPane(const QUuid &uMachineId); 334 /** Handles signal requesting switch to Resources pane. */ 335 void sltSwitchToActivityOverviewPane(); 126 /** Handles signal requesting switch to Activities tool. */ 127 void sltSwitchToActivitiesTool(); 336 128 /** @} */ 337 129 … … 349 141 void loadSettings(); 350 142 351 /** Updates toolbar. */352 void updateToolbar();353 354 143 /** Cleanups connections. */ 355 144 void cleanupConnections(); … … 362 151 /** @name Tools stuff. 363 152 * @{ */ 364 /** Recaches current machine item information. 365 * @param fDontRaiseErrorPane Brings whether we should not raise error-pane. */ 366 void recacheCurrentMachineItemInformation(bool fDontRaiseErrorPane = false); 153 /** Returns tool-menu instance. */ 154 UITools *toolMenu() const; 155 /** Returns tool-pane instance. */ 156 UIToolPaneGlobal *toolPane() const; 157 /** Returns Machine Manager reference. */ 158 UIMachineManagerWidget *machineManager() const; 159 /** Returns Machine Manager's Chooser-pane reference. */ 160 UIChooser *chooser() const; 161 /** Returns Machine Manager's Tool-pane instance. */ 162 UIToolPaneMachine *toolPaneMachine() const; 367 163 368 164 /** Updates Global tools menu. */ 369 165 void updateToolsMenuGlobal(); 370 /** Updates Machine tools menu for @a pItem specified. */371 void updateToolsMenuMachine(UIVirtualMachineItem *pItem);372 373 /** Handles current tool @a enmType change. */374 void handleCurrentToolTypeChange(UIToolType enmType);375 166 /** @} */ 376 167 … … 378 169 UIActionPool *m_pActionPool; 379 170 380 /** Holds the central splitter instance. */ 381 QISplitter *m_pSplitter; 382 383 /** Holds the main toolbar instance. */ 384 QIToolBar *m_pToolBar; 385 386 /** Holds the Chooser-pane instance. */ 387 UIChooser *m_pPaneChooser; 388 /** Holds the stacked-widget. */ 389 QStackedWidget *m_pStackedWidget; 171 /** Holds the Global Tools-menu instance. */ 172 UITools *m_pMenu; 390 173 /** Holds the Global Tools-pane instance. */ 391 UIToolPaneGlobal *m_pPaneToolsGlobal; 392 /** Holds the Machine Tools-pane instance. */ 393 UIToolPaneMachine *m_pPaneToolsMachine; 394 /** Holds the Global Tools-menu instance. */ 395 UITools *m_pMenuToolsGlobal; 396 /** Holds the Machine Tools-menu instance. */ 397 UITools *m_pMenuToolsMachine; 398 399 /** Holds the last selection type. */ 400 SelectionType m_enmSelectionType; 401 /** Holds whether the last selected item was accessible. */ 402 bool m_fSelectedMachineItemAccessible; 403 404 /** Holds the splitter settings save timer. */ 405 QTimer *m_pSplitterSettingsSaveTimer; 174 UIToolPaneGlobal *m_pPane; 406 175 }; 407 176 408 #endif /* !FEQT_INCLUDED_SRC_manager_UI VirtualBoxManagerAdvancedWidget_h */177 #endif /* !FEQT_INCLUDED_SRC_manager_UIGlobalToolsManagerWidget_h */
Note:
See TracChangeset
for help on using the changeset viewer.