diff options
author | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2021-09-15 19:24:39 +0000 |
---|---|---|
committer | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2021-09-15 19:24:39 +0000 |
commit | 11e894f0692d5ba49f736932c209be220606d13f (patch) | |
tree | 12bc501ffdc597d849fe67d93090c53a6fdc41e8 /src | |
parent | 53eb1aaf9acb4aa330cd1e25f29ff031295f8489 (diff) | |
download | VirtualBox-svn-11e894f0692d5ba49f736932c209be220606d13f.tar.gz |
FE/Qt: bugref:9996: Export Appliance wizard: Get rid of UIWizardExportAppDefs.h; Moving UIApplianceExportEditorWidget include directly to required place; This also means no more applianceWidget field blinking around, new localAppliance field is used instead of it for consistency with cloud stuff.
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@91262 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src')
7 files changed, 39 insertions, 67 deletions
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.cpp index 153a672be9c..cb77060ac0c 100644 --- a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.cpp +++ b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.cpp @@ -26,7 +26,6 @@ #include "UIModalWindowManager.h" #include "UINotificationCenter.h" #include "UIWizardExportApp.h" -#include "UIWizardExportAppDefs.h" #include "UIWizardExportAppPageBasic1.h" #include "UIWizardExportAppPageBasic2.h" #include "UIWizardExportAppPageBasic3.h" @@ -71,14 +70,9 @@ bool UIWizardExportApp::exportAppliance() } else { - /* Get export appliance widget & fetch all settings from the appliance editor: */ - UIApplianceExportEditorWidget *pExportApplianceWidget = field("applianceWidget").value<ExportAppliancePointer>(); - AssertPtrReturn(pExportApplianceWidget, false); - pExportApplianceWidget->prepareExport(); - - /* Acquire the appliance: */ - CAppliance *pComAppliance = pExportApplianceWidget->appliance(); - AssertPtrReturn(pComAppliance, false); + /* Get appliance: */ + CAppliance comAppliance = field("localAppliance").value<CAppliance>(); + AssertReturn(comAppliance.isNotNull(), false); /* We need to know every filename which will be created, so that we can ask the user for confirmation of overwriting. * For that we iterating over all virtual systems & fetch all descriptions of the type HardDiskImage. Also add the @@ -99,7 +93,7 @@ bool UIWizardExportApp::exportAppliance() files << fi.baseName() + ".mf"; /* Add all hard disk images: */ - CVirtualSystemDescriptionVector vsds = pComAppliance->GetVirtualSystemDescriptions(); + CVirtualSystemDescriptionVector vsds = comAppliance.GetVirtualSystemDescriptions(); for (int i = 0; i < vsds.size(); ++i) { QVector<KVirtualSystemDescriptionType> types; @@ -112,7 +106,7 @@ bool UIWizardExportApp::exportAppliance() } /* Initialize VFS explorer: */ - CVFSExplorer comExplorer = pComAppliance->CreateVFSExplorer(uri(false /* fWithFile */)); + CVFSExplorer comExplorer = comAppliance.CreateVFSExplorer(uri(false /* fWithFile */)); if (comExplorer.isNotNull()) { CProgress comProgress = comExplorer.Update(); @@ -129,7 +123,7 @@ bool UIWizardExportApp::exportAppliance() return msgCenter().cannotCheckFiles(comExplorer, this); } else - return msgCenter().cannotCheckFiles(*pComAppliance, this); + return msgCenter().cannotCheckFiles(comAppliance, this); /* Confirm overwriting for existing files: */ QVector<QString> exists = comExplorer.Exists(files); @@ -154,7 +148,7 @@ bool UIWizardExportApp::exportAppliance() } /* Export the VMs, on success we are finished: */ - return exportVMs(*pComAppliance); + return exportVMs(comAppliance); } } diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppDefs.h b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppDefs.h deleted file mode 100644 index 7df3b2e0a68..00000000000 --- a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppDefs.h +++ /dev/null @@ -1,35 +0,0 @@ -/* $Id$ */ -/** @file - * VBox Qt GUI - UIWizardExportAppDefs class declaration. - */ - -/* - * Copyright (C) 2009-2021 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - */ - -#ifndef FEQT_INCLUDED_SRC_wizards_exportappliance_UIWizardExportAppDefs_h -#define FEQT_INCLUDED_SRC_wizards_exportappliance_UIWizardExportAppDefs_h -#ifndef RT_WITHOUT_PRAGMA_ONCE -# pragma once -#endif - -/* Qt includes: */ -#include <QMetaType> -#include <QPointer> - -/* GUI includes: */ -#include "UIApplianceExportEditorWidget.h" - -/* Typedefs: */ -typedef QPointer<UIApplianceExportEditorWidget> ExportAppliancePointer; -Q_DECLARE_METATYPE(ExportAppliancePointer); - -#endif /* !FEQT_INCLUDED_SRC_wizards_exportappliance_UIWizardExportAppDefs_h */ diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp index 7bf6cfa3bcb..b433766e32d 100644 --- a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp +++ b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp @@ -39,7 +39,6 @@ #include "UIVirtualBoxEventHandler.h" #include "UIVirtualBoxManager.h" #include "UIWizardExportApp.h" -#include "UIWizardExportAppDefs.h" #include "UIWizardExportAppPageBasic2.h" /* COM includes: */ diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp index d3126e0ee00..c73563ba8ef 100644 --- a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp +++ b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp @@ -22,13 +22,13 @@ /* GUI includes: */ #include "QILabelSeparator.h" #include "QIRichTextLabel.h" +#include "UIApplianceExportEditorWidget.h" #include "UICommon.h" #include "UIMessageCenter.h" #include "UIWizardExportApp.h" #include "UIWizardExportAppPageBasic3.h" /* COM includes: */ -#include "CAppliance.h" #include "CMachine.h" #include "CVirtualSystemDescriptionForm.h" @@ -39,6 +39,7 @@ UIWizardExportAppPage3::UIWizardExportAppPage3() : m_pSettingsCntLayout(0) + , m_pApplianceWidget(0) { } @@ -97,6 +98,12 @@ void UIWizardExportAppPage3::refreshFormPropertiesTable() m_pFormEditor->setVirtualSystemDescriptionForm(comForm); } +CAppliance UIWizardExportAppPage3::localAppliance() const +{ + CAppliance *pAppliance = m_pApplianceWidget->appliance(); + return pAppliance ? *pAppliance : CAppliance(); +} + /********************************************************************************************************************************* * Class UIWizardExportAppPageBasic3 implementation. * @@ -173,11 +180,8 @@ UIWizardExportAppPageBasic3::UIWizardExportAppPageBasic3() } } - /* Register classes: */ - qRegisterMetaType<ExportAppliancePointer>(); - /* Register fields: */ - registerField("applianceWidget", this, "applianceWidget"); + registerField("localAppliance", this, "localAppliance"); } void UIWizardExportAppPageBasic3::retranslateUi() @@ -246,6 +250,12 @@ bool UIWizardExportAppPageBasic3::validatePage() msgCenter().cannotAcquireVirtualSystemDescriptionFormProperty(comForm); } } + /* Otherwise if there was local target selected: */ + else + { + /* Prepare export: */ + m_pApplianceWidget->prepareExport(); + } /* Try to export appliance: */ if (fResult) @@ -286,7 +296,6 @@ void UIWizardExportAppPageBasic3::sltHandleCustomButtonClicked(int iId) if (iId == QWizard::CustomButton2) { /* Reset widget to default: */ - AssertPtrReturnVoid(m_pApplianceWidget.data()); m_pApplianceWidget->restoreDefaults(); } } diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.h b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.h index dac1e54ee8c..59aa82b386d 100644 --- a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.h +++ b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.h @@ -28,12 +28,15 @@ /* GUI includes: */ #include "UIExtraDataDefs.h" #include "UIFormEditorWidget.h" -#include "UIWizardExportAppDefs.h" #include "UIWizardPage.h" +/* COM includes: */ +#include "CAppliance.h" + /* Forward declarations: */ class QStackedLayout; class QIRichTextLabel; +class UIApplianceExportEditorWidget; class UIWizardExportApp; @@ -53,16 +56,16 @@ protected: /** Refreshes form properties table. */ void refreshFormPropertiesTable(); - /** Returns the appliance widget reference. */ - ExportAppliancePointer applianceWidget() const { return m_pApplianceWidget; } + /** Returns Local Appliance object. */ + CAppliance localAppliance() const; /** Holds the settings container layout instance. */ QStackedLayout *m_pSettingsCntLayout; /** Holds the appliance widget reference. */ - ExportAppliancePointer m_pApplianceWidget; + UIApplianceExportEditorWidget *m_pApplianceWidget; /** Holds the Form Editor widget instance. */ - UIFormEditorWidgetPointer m_pFormEditor; + UIFormEditorWidgetPointer m_pFormEditor; }; @@ -70,7 +73,7 @@ protected: class UIWizardExportAppPageBasic3 : public UIWizardPage, public UIWizardExportAppPage3 { Q_OBJECT; - Q_PROPERTY(ExportAppliancePointer applianceWidget READ applianceWidget); + Q_PROPERTY(CAppliance localAppliance READ localAppliance); public: diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp index d510739a663..cbee747d4c6 100644 --- a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp +++ b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp @@ -40,7 +40,6 @@ #include "UIVirtualBoxEventHandler.h" #include "UIVirtualBoxManager.h" #include "UIWizardExportApp.h" -#include "UIWizardExportAppDefs.h" #include "UIWizardExportAppPageExpert.h" @@ -422,9 +421,6 @@ UIWizardExportAppPageExpert::UIWizardExportAppPageExpert(const QStringList &sele connect(m_pProfileToolButton, &QIToolButton::clicked, this, &UIWizardExportAppPageExpert::sltHandleProfileButtonClick); - /* Register classes: */ - qRegisterMetaType<ExportAppliancePointer>(); - /* Register fields: */ registerField("machineNames", this, "machineNames"); registerField("machineIDs", this, "machineIDs"); @@ -440,7 +436,7 @@ UIWizardExportAppPageExpert::UIWizardExportAppPageExpert(const QStringList &sele registerField("vsd", this, "vsd"); registerField("vsdExportForm", this, "vsdExportForm"); registerField("cloudExportMode", this, "cloudExportMode"); - registerField("applianceWidget", this, "applianceWidget"); + registerField("localAppliance", this, "localAppliance"); } void UIWizardExportAppPageExpert::retranslateUi() @@ -633,6 +629,12 @@ bool UIWizardExportAppPageExpert::validatePage() msgCenter().cannotAcquireVirtualSystemDescriptionFormProperty(comForm); } } + /* Otherwise if there was local target selected: */ + else + { + /* Prepare export: */ + m_pApplianceWidget->prepareExport(); + } /* Try to export appliance: */ if (fResult) diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.h b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.h index 4e8fc00137a..aea096dff8b 100644 --- a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.h +++ b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.h @@ -50,7 +50,7 @@ class UIWizardExportAppPageExpert : public UIWizardPage, Q_PROPERTY(CVirtualSystemDescription vsd READ vsd); Q_PROPERTY(CVirtualSystemDescriptionForm vsdExportForm READ vsdExportForm); Q_PROPERTY(CloudExportMode cloudExportMode READ cloudExportMode); - Q_PROPERTY(ExportAppliancePointer applianceWidget READ applianceWidget); + Q_PROPERTY(CAppliance localAppliance READ localAppliance); public: |