Changeset 71632 in vbox
- Timestamp:
- Apr 3, 2018 4:58:07 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 7 edited
-
globals/UIMessageCenter.cpp (modified) (2 diffs)
-
globals/UIMessageCenter.h (modified) (2 diffs)
-
selector/UIActionPoolSelector.cpp (modified) (3 diffs)
-
selector/UIActionPoolSelector.h (modified) (1 diff)
-
selector/UISelectorWindow.cpp (modified) (8 diffs)
-
selector/UISelectorWindow.h (modified) (2 diffs)
-
selector/graphics/chooser/UIGChooserModel.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r71459 r71632 841 841 "confirmStartMultipleMachines" /* auto-confirm id */); 842 842 } 843 844 void UIMessageCenter::cannotMoveMachine(const CMachine &machine, QWidget *pParent /* = 0 */) const 845 { 846 error(pParent, MessageType_Error, 847 tr("Failed to move the virtual machine <b>%1</b>.") 848 .arg(CMachine(machine).GetName()), 849 UIErrorString::formatErrorInfo(machine)); 850 } 851 852 void UIMessageCenter::cannotMoveMachine(const CProgress &progress, const QString &strMachineName, QWidget *pParent /* = 0 */) const 853 { 854 error(pParent, MessageType_Error, 855 tr("Failed to move the virtual machine <b>%1</b>.") 856 .arg(strMachineName), 857 UIErrorString::formatErrorInfo(progress)); 858 } 859 843 860 844 861 int UIMessageCenter::confirmSnapshotRestoring(const QString &strSnapshotName, bool fAlsoCreateNewSnapshot) const … … 2808 2825 return iResultCode; 2809 2826 } 2810 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r71630 r71632 282 282 void cannotPowerDownMachine(const CProgress &progress, const QString &strMachineName) const; 283 283 bool confirmStartMultipleMachines(const QString &strNames) const; 284 void cannotMoveMachine(const CMachine &machine, QWidget *pParent = 0) const; 285 void cannotMoveMachine(const CProgress &progress, const QString &strMachineName, QWidget *pParent = 0) const; 284 286 285 287 /* API: Snapshot warnings: */ … … 536 538 537 539 #endif /* !___UIMessageCenter_h___ */ 538 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.cpp
r71625 r71632 653 653 setName(QApplication::translate("UIActionPool", "Cl&one...")); 654 654 setStatusTip(QApplication::translate("UIActionPool", "Clone selected virtual machine")); 655 } 656 }; 657 658 /** Simple action extension, used as 'Perform Move Machine' action class. */ 659 class UIActionSimpleSelectorMachinePerformMove : public UIActionSimple 660 { 661 Q_OBJECT; 662 663 public: 664 665 /** Constructs action passing @a pParent to the base-class. */ 666 UIActionSimpleSelectorMachinePerformMove(UIActionPool *pParent) 667 : UIActionSimple(pParent, ":/vm_clone_16px.png", ":/vm_clone_disabled_16px.png") 668 {} 669 670 protected: 671 672 /** Returns shortcut extra-data ID. */ 673 virtual QString shortcutExtraDataID() const /* override */ 674 { 675 return QString("MoveVM"); 676 } 677 678 /** Returns default shortcut. */ 679 virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */ 680 { 681 return QKeySequence("Ctrl+M"); 682 } 683 684 /** Handles translation event. */ 685 virtual void retranslateUi() /* override */ 686 { 687 setName(QApplication::translate("UIActionPool", "&Move...")); 688 setStatusTip(QApplication::translate("UIActionPool", "Move selected virtual machine")); 655 689 } 656 690 }; … … 1571 1605 m_pool[UIActionIndexST_M_Machine_S_Settings] = new UIActionSimpleSelectorMachineShowSettings(this); 1572 1606 m_pool[UIActionIndexST_M_Machine_S_Clone] = new UIActionSimpleSelectorMachinePerformClone(this); 1607 m_pool[UIActionIndexST_M_Machine_S_Move] = new UIActionSimpleSelectorMachinePerformMove(this); 1573 1608 m_pool[UIActionIndexST_M_Machine_S_Remove] = new UIActionSimpleSelectorMachinePerformRemove(this); 1574 1609 m_pool[UIActionIndexST_M_Machine_S_AddGroup] = new UIActionSimpleSelectorMachinePerformGroup(this); … … 1640 1675 1641 1676 #include "UIActionPoolSelector.moc" 1642 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.h
r71630 r71632 74 74 UIActionIndexST_M_Machine_S_Settings, 75 75 UIActionIndexST_M_Machine_S_Clone, 76 UIActionIndexST_M_Machine_S_Move, 76 77 UIActionIndexST_M_Machine_S_Remove, 77 78 UIActionIndexST_M_Machine_S_AddGroup, -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r71461 r71632 671 671 } 672 672 673 void UISelectorWindow::sltOpenC loneMachineWizard()673 void UISelectorWindow::sltOpenCLonemachinewizard() 674 674 { 675 675 /* Get current item: */ … … 691 691 /* Unlock the action allowing further calls: */ 692 692 actionPool()->action(UIActionIndexST_M_Machine_S_Clone)->setEnabled(true); 693 } 694 695 void UISelectorWindow::sltPerformMoveMachine() 696 { 697 UIVMItem *pItem = currentItem(); 698 AssertMsgReturnVoid(pItem, ("Current item should be selected!\n")); 699 700 /* Open a session thru which we will modify the machine: */ 701 CSession session = vboxGlobal().openSession(pItem->id(), KLockType_Write); 702 if (session.isNull()) 703 return; 704 705 /* Get session machine: */ 706 CMachine machine = session.GetMachine(); 707 AssertMsgReturnVoid(!machine.isNull(), ("Invalid Machine!\n")); 708 709 /* Open a file dialog for the user to select a destination folder. Start with the default machine folder: */ 710 CVirtualBox vbox = vboxGlobal().virtualBox(); 711 QString strBaseFolder = vbox.GetSystemProperties().GetDefaultMachineFolder(); 712 QString strTitle = tr("Select a destination folder to move the selected virtual machine"); 713 QString strDestinationFolder = QIFileDialog::getExistingDirectory(strBaseFolder, this, strTitle); 714 if (strDestinationFolder.isEmpty()) 715 { 716 session.UnlockMachine(); 717 return; 718 } 719 CProgress progress = machine.MoveTo(strDestinationFolder, "basic"); 720 721 if (machine.isOk()) 722 { 723 /* Show machine move progress: */ 724 msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_clone_90px.png"); 725 if (!progress.isOk() || progress.GetResultCode() != 0) 726 msgCenter().cannotMoveMachine(progress, machine.GetName()); 727 } 728 else 729 msgCenter().cannotMoveMachine(machine); 730 session.UnlockMachine(); 693 731 } 694 732 … … 1662 1700 addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Settings)); 1663 1701 addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Clone)); 1702 addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Move)); 1664 1703 addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Remove)); 1665 1704 addAction(actionPool()->action(UIActionIndexST_M_Machine_S_AddGroup)); … … 1680 1719 pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Settings)); 1681 1720 pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Clone)); 1721 pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Move)); 1682 1722 pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Remove)); 1683 1723 pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_AddGroup)); … … 1702 1742 << actionPool()->action(UIActionIndexST_M_Machine_S_Settings) 1703 1743 << actionPool()->action(UIActionIndexST_M_Machine_S_Clone) 1744 << actionPool()->action(UIActionIndexST_M_Machine_S_Move) 1704 1745 << actionPool()->action(UIActionIndexST_M_Machine_S_Remove) 1705 1746 << actionPool()->action(UIActionIndexST_M_Machine_S_AddGroup) … … 2070 2111 connect(actionPool()->action(UIActionIndexST_M_Machine_S_Settings), SIGNAL(triggered()), this, SLOT(sltOpenMachineSettingsDialog())); 2071 2112 connect(actionPool()->action(UIActionIndexST_M_Machine_S_Clone), SIGNAL(triggered()), this, SLOT(sltOpenCloneMachineWizard())); 2113 connect(actionPool()->action(UIActionIndexST_M_Machine_S_Move), SIGNAL(triggered()), this, SLOT(sltPerformMoveMachine())); 2072 2114 connect(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow), SIGNAL(triggered()), this, SLOT(sltPerformStartOrShowMachine())); 2073 2115 connect(actionPool()->action(UIActionIndexST_M_Machine_T_Pause), SIGNAL(toggled(bool)), this, SLOT(sltPerformPauseOrResumeMachine(bool))); … … 2365 2407 actionPool()->action(UIActionIndexST_M_Machine_S_Settings)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_Settings, items)); 2366 2408 actionPool()->action(UIActionIndexST_M_Machine_S_Clone)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_Clone, items)); 2409 actionPool()->action(UIActionIndexST_M_Machine_S_Move)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_Move, items)); 2367 2410 actionPool()->action(UIActionIndexST_M_Machine_S_Remove)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_Remove, items)); 2368 2411 actionPool()->action(UIActionIndexST_M_Machine_S_AddGroup)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_AddGroup, items)); … … 2476 2519 } 2477 2520 case UIActionIndexST_M_Machine_S_Clone: 2521 case UIActionIndexST_M_Machine_S_Move: 2478 2522 { 2479 2523 return !m_pPaneChooser->isGroupSavingInProgress() && -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
r70185 r71632 157 157 /** Handles call to open Clone Machine wizard. */ 158 158 void sltOpenCloneMachineWizard(); 159 /** Handles the Move Machine action. */ 160 void sltPerformMoveMachine(); 159 161 /** Handles call to start or show machine. */ 160 162 void sltPerformStartOrShowMachine(); … … 387 389 388 390 #endif /* !___UISelectorWindow_h___ */ 389 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp
r71438 r71632 1269 1269 m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Settings)); 1270 1270 m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Clone)); 1271 m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Move)); 1271 1272 m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Remove)); 1272 1273 m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_AddGroup)); … … 2239 2240 COMBase::CleanupCOM(); 2240 2241 } 2241
Note:
See TracChangeset
for help on using the changeset viewer.

