diff options
author | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2023-04-13 15:46:10 +0000 |
---|---|---|
committer | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2023-04-13 15:46:10 +0000 |
commit | efe14edcaedb6b4dc670e33b65e222b112546b50 (patch) | |
tree | e0db8d0528dfaa5e4c3e27ceeed53e177e61568f | |
parent | b60962f914ddca1b5f050706f21fe5205bd75eff (diff) | |
download | VirtualBox-svn-efe14edcaedb6b4dc670e33b65e222b112546b50.tar.gz |
FE/Qt: bugref:6669: !VirtualBox Manager: Move New VD wizard onto non-modal rails; This is only for the case used in Media Manager, while Media Selector still using modal case, which is Ok.
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@99390 cfe28804-0f27-0410-a406-dd0f0b0b656f
10 files changed, 46 insertions, 6 deletions
diff --git a/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneGlobal.cpp b/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneGlobal.cpp index 89b98ea3e5e..c51bafa043d 100644 --- a/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneGlobal.cpp +++ b/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneGlobal.cpp @@ -165,6 +165,8 @@ void UIToolPaneGlobal::openTool(UIToolType enmType) /* Configure pane: */ m_pPaneMedia->setProperty("ToolType", QVariant::fromValue(UIToolType_Media)); + connect(m_pPaneMedia, &UIMediumManagerWidget::sigCreateMedium, + this, &UIToolPaneGlobal::sigCreateMedium); connect(m_pPaneMedia, &UIMediumManagerWidget::sigCopyMedium, this, &UIToolPaneGlobal::sigCopyMedium); diff --git a/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneGlobal.h b/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneGlobal.h index c7a645752cc..894f3ba3015 100644 --- a/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneGlobal.h +++ b/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneGlobal.h @@ -60,6 +60,8 @@ class UIToolPaneGlobal : public QWidget signals: + /** Notifies listeners about creation procedure was requested. */ + void sigCreateMedium(); /** Notifies listeners about copy procedure was requested for medium with specified @a uMediumId. */ void sigCopyMedium(const QUuid &uMediumId); diff --git a/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp b/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp index 253e1ad8cf1..5f851f8978d 100644 --- a/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp +++ b/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp @@ -78,6 +78,7 @@ #include "UIWizardExportApp.h" #include "UIWizardImportApp.h" #include "UIWizardNewCloudVM.h" +#include "UIWizardNewVD.h" #include "UIWizardNewVM.h" #ifdef VBOX_GUI_WITH_NETWORK_MANAGER # include "UIUpdateManager.h" @@ -824,6 +825,12 @@ void UIVirtualBoxManager::sltHandleToolTypeChange() } } +void UIVirtualBoxManager::sltCreateMedium() +{ + /* Open Create VD Wizard: */ + sltOpenWizard(WizardType_NewVD); +} + void UIVirtualBoxManager::sltCopyMedium(const QUuid &uMediumId) { /* Configure wizard variables: */ @@ -1038,6 +1045,18 @@ void UIVirtualBoxManager::sltOpenWizard(WizardType enmType) case WizardType_AddCloudVM: m_wizards[enmType] = new UIWizardAddCloudVM(this, m_pWidget->fullGroupName()); break; + case WizardType_NewVD: + { + const QString strFolder = uiCommon().defaultFolderPathForType(UIMediumDeviceType_HardDisk); + const QString strDiskName = uiCommon().findUniqueFileName(strFolder, "NewVirtualDisk"); + const CGuestOSType comGuestOSType = uiCommon().virtualBox().GetGuestOSType("Other"); + const qulonglong uDiskSize = comGuestOSType.GetRecommendedHDD(); + m_wizards[enmType] = new UIWizardNewVD(this, + strDiskName, + strFolder, + uDiskSize); + break; + } case WizardType_CloneVD: m_wizards[enmType] = new UIWizardCloneVD(this, m_uMediumId); break; @@ -2278,6 +2297,8 @@ void UIVirtualBoxManager::prepareConnections() this, &UIVirtualBoxManager::sltHandleCloudMachineStateChange); connect(m_pWidget, &UIVirtualBoxManagerWidget::sigToolTypeChange, this, &UIVirtualBoxManager::sltHandleToolTypeChange); + connect(m_pWidget, &UIVirtualBoxManagerWidget::sigCreateMedium, + this, &UIVirtualBoxManager::sltCreateMedium); connect(m_pWidget, &UIVirtualBoxManagerWidget::sigCopyMedium, this, &UIVirtualBoxManager::sltCopyMedium); connect(m_pWidget, &UIVirtualBoxManagerWidget::sigMachineSettingsLinkClicked, diff --git a/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h b/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h index d1094df5221..2ffaa858811 100644 --- a/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h +++ b/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h @@ -156,6 +156,8 @@ private slots: /** Handles signal about Tool type change. */ void sltHandleToolTypeChange(); + /** Handles create medium request. */ + void sltCreateMedium(); /** Handles copy medium request. */ void sltCopyMedium(const QUuid &uMediumId); diff --git a/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp b/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp index 8765d039388..a6c645df94f 100644 --- a/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp +++ b/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp @@ -671,6 +671,8 @@ void UIVirtualBoxManagerWidget::prepareWidgets() { if (m_pPaneChooser->isGlobalItemSelected()) m_pPaneToolsGlobal->setActive(true); + connect(m_pPaneToolsGlobal, &UIToolPaneGlobal::sigCreateMedium, + this, &UIVirtualBoxManagerWidget::sigCreateMedium); connect(m_pPaneToolsGlobal, &UIToolPaneGlobal::sigCopyMedium, this, &UIVirtualBoxManagerWidget::sigCopyMedium); connect(m_pPaneToolsGlobal, &UIToolPaneGlobal::sigSwitchToMachineActivityPane, diff --git a/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h b/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h index 62a026d8d19..6b728abdd4b 100644 --- a/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h +++ b/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h @@ -103,6 +103,8 @@ signals: /** @name Tools / Media pane stuff. * @{ */ + /** Notifies listeners about creation procedure was requested. */ + void sigCreateMedium(); /** Notifies listeners about copy procedure was requested for medium with specified @a uMediumId. */ void sigCopyMedium(const QUuid &uMediumId); /** @} */ diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp index 7388a96ee81..bf2a60ca03c 100644 --- a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp +++ b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp @@ -471,7 +471,14 @@ void UIMediumManagerWidget::sltAddMedium() void UIMediumManagerWidget::sltCreateMedium() { - uiCommon().openMediumCreatorDialog(m_pActionPool, this, currentMediumType()); + /* What's with current medium type? */ + const UIMediumDeviceType enmMediumType = currentMediumType(); + + /* Ask listener to start hard-disk creation: */ + if (enmMediumType == UIMediumDeviceType_HardDisk) + emit sigCreateMedium(); + else + uiCommon().openMediumCreatorDialog(m_pActionPool, this, currentMediumType()); } void UIMediumManagerWidget::sltCopyMedium() diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h index 10a57bb2205..b7349336312 100644 --- a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h +++ b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h @@ -112,6 +112,8 @@ class UIMediumManagerWidget : public QIWithRetranslateUI<QWidget> signals: + /** Notifies listeners about creation procedure was requested. */ + void sigCreateMedium(); /** Notifies listeners about copy procedure was requested for medium with specified @a uMediumId. */ void sigCopyMedium(const QUuid &uMediumId); diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp index 7fbc2bdd165..4a58052b53f 100644 --- a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp +++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp @@ -38,9 +38,8 @@ UIWizardNewVD::UIWizardNewVD(QWidget *pParent, const QString &strDefaultName, const QString &strDefaultPath, - qulonglong uDefaultSize, - WizardMode mode) - : UINativeWizard(pParent, WizardType_NewVD, mode, "create-virtual-hard-disk-image" /* help keyword */) + qulonglong uDefaultSize) + : UINativeWizard(pParent, WizardType_NewVD, WizardMode_Auto, "create-virtual-hard-disk-image" /* help keyword */) , m_strDefaultName(strDefaultName) , m_strDefaultPath(strDefaultPath) , m_uDefaultSize(uDefaultSize) diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.h b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.h index 24fdbff3b70..decff5ab2cf 100644 --- a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.h +++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.h @@ -47,8 +47,9 @@ class SHARED_LIBRARY_STUFF UIWizardNewVD : public UINativeWizard public: UIWizardNewVD(QWidget *pParent, - const QString &strDefaultName, const QString &strDefaultPath, - qulonglong uDefaultSize, WizardMode mode = WizardMode_Auto); + const QString &strDefaultName, + const QString &strDefaultPath, + qulonglong uDefaultSize); bool createVirtualDisk(); |