- Timestamp:
- Oct 4, 2021 10:57:58 AM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceExportEditorWidget.cpp
r91538 r91539 22 22 #include "QITreeView.h" 23 23 #include "UIApplianceExportEditorWidget.h" 24 #include "UICommon.h"25 24 #include "UIMessageCenter.h" 26 27 /* COM includes: */28 #include "CAppliance.h"29 25 30 26 … … 67 63 } 68 64 69 CAppliance *UIApplianceExportEditorWidget::init()65 void UIApplianceExportEditorWidget::setAppliance(const CAppliance &comAppliance) 70 66 { 71 if (m_pAppliance) 72 delete m_pAppliance; 73 CVirtualBox comVBox = uiCommon().virtualBox(); 74 /* Create a appliance object: */ 75 m_pAppliance = new CAppliance(comVBox.CreateAppliance()); 76 return m_pAppliance; 77 } 67 /* Cache newly passed appliance: */ 68 m_comAppliance = comAppliance; 78 69 79 void UIApplianceExportEditorWidget::populate()80 {81 70 /* Cleanup previous stuff: */ 82 71 if (m_pModel) … … 84 73 85 74 /* Prepare model: */ 86 QVector<CVirtualSystemDescription> vsds = m_ pAppliance->GetVirtualSystemDescriptions();75 QVector<CVirtualSystemDescription> vsds = m_comAppliance.GetVirtualSystemDescriptions(); 87 76 m_pModel = new UIApplianceModel(vsds, m_pTreeViewSettings); 88 77 if (m_pModel) … … 114 103 115 104 /* Check for warnings & if there are one display them: */ 116 const QVector<QString> warnings = m_ pAppliance->GetWarnings();105 const QVector<QString> warnings = m_comAppliance.GetWarnings(); 117 106 const bool fWarningsEnabled = warnings.size() > 0; 118 107 foreach (const QString &strText, warnings) … … 123 112 void UIApplianceExportEditorWidget::prepareExport() 124 113 { 125 if (m_ pAppliance)114 if (m_comAppliance.isNotNull()) 126 115 m_pModel->putBack(); 127 116 } -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceExportEditorWidget.h
r91538 r91539 25 25 #include "UIApplianceEditorWidget.h" 26 26 27 /* Forward declarations: */28 class CAppliance; 27 /* COM includes: */ 28 #include "CAppliance.h" 29 29 30 30 /** UIApplianceEditorWidget subclass for Export Appliance wizard. */ … … 38 38 UIApplianceExportEditorWidget(QWidget *pParent = 0); 39 39 40 /** Inits the widget by creating appliance instance. */ 41 CAppliance *init(); 42 43 /** Populates widget contents. */ 44 void populate(); 40 /** Assigns @a comAppliance and populates widget contents. */ 41 void setAppliance(const CAppliance &comAppliance); 45 42 46 43 /** Prepares export by pushing edited data back to appliance. */ 47 44 void prepareExport(); 45 46 private: 47 48 /** Holds the appliance wrapper instance. */ 49 CAppliance m_comAppliance; 48 50 }; 49 51 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp
r91460 r91539 318 318 /* Enable include ISO check-box: */ 319 319 pCheckBox->setEnabled(true); 320 } 321 } 322 323 void UIWizardExportAppPage2::refreshLocalStuff(CAppliance &comLocalAppliance, 324 const QList<QUuid> &machineIDs, 325 const QString &strUri) 326 { 327 /* Clear stuff: */ 328 comLocalAppliance = CAppliance(); 329 330 /* Create appliance: */ 331 CVirtualBox comVBox = uiCommon().virtualBox(); 332 CAppliance comAppliance = comVBox.CreateAppliance(); 333 if (!comVBox.isOk()) 334 { 335 msgCenter().cannotCreateAppliance(comVBox); 336 return; 337 } 338 339 /* Remember appliance: */ 340 comLocalAppliance = comAppliance; 341 342 /* Iterate over all the selected machine uuids: */ 343 foreach (const QUuid &uMachineId, machineIDs) 344 { 345 /* Get the machine with the uMachineId: */ 346 CVirtualBox comVBox = uiCommon().virtualBox(); 347 CMachine comMachine = comVBox.FindMachine(uMachineId.toString()); 348 if (!comVBox.isOk()) 349 return msgCenter().cannotFindMachineById(comVBox, uMachineId); 350 /* Add the export description to our appliance object: */ 351 CVirtualSystemDescription comVsd = comMachine.ExportTo(comLocalAppliance, strUri); 352 if (!comMachine.isOk()) 353 return msgCenter().cannotExportAppliance(comMachine, comLocalAppliance.GetPath()); 354 /* Add some additional fields the user may change: */ 355 comVsd.AddDescription(KVirtualSystemDescriptionType_Product, "", ""); 356 comVsd.AddDescription(KVirtualSystemDescriptionType_ProductUrl, "", ""); 357 comVsd.AddDescription(KVirtualSystemDescriptionType_Vendor, "", ""); 358 comVsd.AddDescription(KVirtualSystemDescriptionType_VendorUrl, "", ""); 359 comVsd.AddDescription(KVirtualSystemDescriptionType_Version, "", ""); 360 comVsd.AddDescription(KVirtualSystemDescriptionType_License, "", ""); 320 361 } 321 362 } … … 1006 1047 && wizard()->vsdExportForm().isNotNull(); 1007 1048 } 1049 else 1050 { 1051 /* Update local stuff: */ 1052 updateLocalStuff(); 1053 /* Which is required to continue to the next page: */ 1054 fResult = wizard()->localAppliance().isNotNull(); 1055 } 1008 1056 1009 1057 /* Return result: */ … … 1093 1141 /* Update profile: */ 1094 1142 updateProfile(); 1143 } 1144 1145 void UIWizardExportAppPageBasic2::updateLocalStuff() 1146 { 1147 /* Create appliance: */ 1148 CAppliance comAppliance; 1149 refreshLocalStuff(comAppliance, wizard()->machineIDs(), wizard()->uri()); 1150 wizard()->setLocalAppliance(comAppliance); 1095 1151 } 1096 1152 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.h
r91460 r91539 97 97 void refreshIncludeISOsCheckBoxAccess(QCheckBox *pCheckBox, 98 98 bool fIsFormatCloudOne); 99 /** Refresh local stuff. */ 100 void refreshLocalStuff(CAppliance &comLocalAppliance, 101 const QList<QUuid> &machineIDs, 102 const QString &strUri); 99 103 100 104 /** Refresh profile combo. */ … … 189 193 /** Updates format. */ 190 194 void updateFormat(); 195 196 /** Update local stuff. */ 197 void updateLocalStuff(); 198 191 199 /** Updates profile. */ 192 200 void updateProfile(); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp
r91467 r91539 50 50 51 51 void UIWizardExportAppPage3::refreshApplianceSettingsWidget(UIApplianceExportEditorWidget *pApplianceWidget, 52 const QList<QUuid> &machineIDs, 53 const QString &strUri, 52 const CAppliance &comAppliance, 54 53 bool fIsFormatCloudOne) 55 54 { … … 58 57 return; 59 58 60 /* Acquire appliance: */ 61 CAppliance *pAppliance = pApplianceWidget->init(); 62 if (pAppliance->isOk()) 63 { 64 /* Iterate over all the selected machine uuids: */ 65 foreach (const QUuid &uMachineId, machineIDs) 66 { 67 /* Get the machine with the uMachineId: */ 68 CVirtualBox comVBox = uiCommon().virtualBox(); 69 CMachine comMachine = comVBox.FindMachine(uMachineId.toString()); 70 if (comVBox.isOk() && comMachine.isNotNull()) 71 { 72 /* Add the export description to our appliance object: */ 73 CVirtualSystemDescription comVsd = comMachine.ExportTo(*pAppliance, strUri); 74 if (comMachine.isOk() && comVsd.isNotNull()) 75 { 76 /* Add some additional fields the user may change: */ 77 comVsd.AddDescription(KVirtualSystemDescriptionType_Product, "", ""); 78 comVsd.AddDescription(KVirtualSystemDescriptionType_ProductUrl, "", ""); 79 comVsd.AddDescription(KVirtualSystemDescriptionType_Vendor, "", ""); 80 comVsd.AddDescription(KVirtualSystemDescriptionType_VendorUrl, "", ""); 81 comVsd.AddDescription(KVirtualSystemDescriptionType_Version, "", ""); 82 comVsd.AddDescription(KVirtualSystemDescriptionType_License, "", ""); 83 } 84 else 85 return msgCenter().cannotExportAppliance(comMachine, pAppliance->GetPath()); 86 } 87 else 88 return msgCenter().cannotFindMachineById(comVBox, uMachineId); 89 } 90 /* Make sure the settings widget get the new descriptions: */ 91 pApplianceWidget->populate(); 92 } 59 /* Sanity check: */ 60 AssertReturnVoid(comAppliance.isNotNull()); 61 62 /* Make sure the settings widget get the new appliance: */ 63 pApplianceWidget->setAppliance(comAppliance); 93 64 } 94 65 … … 101 72 return; 102 73 74 /* Sanity check: */ 75 AssertReturnVoid(comVsdForm.isNotNull()); 76 103 77 /* Make sure the properties table get the new description form: */ 104 if (comVsdForm.isNotNull()) 105 pFormEditor->setVirtualSystemDescriptionForm(comVsdForm); 78 pFormEditor->setVirtualSystemDescriptionForm(comVsdForm); 106 79 } 107 80 … … 208 181 refreshStackedWidget(m_pSettingsWidget2, wizard()->isFormatCloudOne()); 209 182 /* Refresh corresponding widgets: */ 210 refreshApplianceSettingsWidget(m_pApplianceWidget, wizard()-> machineIDs(), wizard()->uri(), wizard()->isFormatCloudOne());183 refreshApplianceSettingsWidget(m_pApplianceWidget, wizard()->localAppliance(), wizard()->isFormatCloudOne()); 211 184 refreshFormPropertiesTable(m_pFormEditor, wizard()->vsdExportForm(), wizard()->isFormatCloudOne()); 212 185 … … 295 268 /* Prepare export: */ 296 269 m_pApplianceWidget->prepareExport(); 297 wizard()->setLocalAppliance(*m_pApplianceWidget->appliance());298 270 299 271 /* Try to export appliance: */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.h
r91467 r91539 48 48 /** Refreshes appliance settings widget. */ 49 49 void refreshApplianceSettingsWidget(UIApplianceExportEditorWidget *pApplianceWidget, 50 const QList<QUuid> &machineIDs, 51 const QString &strUri, 50 const CAppliance &comAppliance, 52 51 bool fIsFormatCloudOne); 53 52 /** Refreshes form properties table. */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp
r91467 r91539 85 85 , m_pApplianceWidget(0) 86 86 , m_pFormEditor(0) 87 , m_fLaunching( 0)87 , m_fLaunching(false) 88 88 { 89 89 /* Create widgets: */ … … 660 660 /* Prepare export: */ 661 661 if (fResult) 662 {663 662 m_pApplianceWidget->prepareExport(); 664 wizard()->setLocalAppliance(*m_pApplianceWidget->appliance());665 }666 663 667 664 /* Try to export appliance: */ … … 750 747 refreshFileSelectorPath(m_pFileSelector, m_strFileSelectorName, m_strFileSelectorExt, wizard()->isFormatCloudOne()); 751 748 749 /* Update local stuff: */ 750 updateLocalStuff(); 752 751 /* Update cloud stuff: */ 753 752 updateCloudStuff(); … … 775 774 refreshCloudExportMode(m_exportModeButtons, wizard()->isFormatCloudOne()); 776 775 776 /* Update local stuff: */ 777 updateLocalStuff(); 777 778 /* Update profile: */ 778 779 updateProfile(); 780 } 781 782 void UIWizardExportAppPageExpert::updateLocalStuff() 783 { 784 /* Create appliance: */ 785 CAppliance comAppliance; 786 refreshLocalStuff(comAppliance, wizard()->machineIDs(), wizard()->uri()); 787 wizard()->setLocalAppliance(comAppliance); 779 788 } 780 789 … … 815 824 816 825 /* Refresh corresponding widgets: */ 817 refreshApplianceSettingsWidget(m_pApplianceWidget, wizard()-> machineIDs(), wizard()->uri(), wizard()->isFormatCloudOne());826 refreshApplianceSettingsWidget(m_pApplianceWidget, wizard()->localAppliance(), wizard()->isFormatCloudOne()); 818 827 refreshFormPropertiesTable(m_pFormEditor, wizard()->vsdExportForm(), wizard()->isFormatCloudOne()); 819 828 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.h
r91467 r91539 114 114 /** Updates format. */ 115 115 void updateFormat(); 116 117 /** Update local stuff. */ 118 void updateLocalStuff(); 119 116 120 /** Updates profile. */ 117 121 void updateProfile();
Note:
See TracChangeset
for help on using the changeset viewer.