Changeset 78993 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jun 5, 2019 1:02:13 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp
r78992 r78993 17 17 18 18 /* Qt includes: */ 19 #include <QStackedLayout> 19 20 #include <QVBoxLayout> 20 21 … … 30 31 #include "CAppliance.h" 31 32 #include "CMachine.h" 33 #include "CVirtualSystemDescriptionForm.h" 32 34 33 35 … … 37 39 38 40 UIWizardExportAppPage3::UIWizardExportAppPage3() 39 { 41 : m_pSettingsCntLayout(0) 42 { 43 } 44 45 void UIWizardExportAppPage3::updatePageAppearance() 46 { 47 /* Check whether there was cloud target selected: */ 48 const bool fIsFormatCloudOne = fieldImp("isFormatCloudOne").toBool(); 49 /* Update page appearance according to chosen source: */ 50 m_pSettingsCntLayout->setCurrentIndex((int)fIsFormatCloudOne); 40 51 } 41 52 … … 59 70 if (comMachine.isOk() && comVsd.isNotNull()) 60 71 { 61 if (fieldImp("isFormatCloudOne").toBool()) 62 { 63 /* Acquire Cloud Client parameters: */ 64 const AbstractVSDParameterList cloudClientParameters = 65 fieldImp("cloudClientParameters").value<AbstractVSDParameterList>(); 66 /* Pass them as a list of hints to help editor with names/values: */ 67 m_pApplianceWidget->setVsdHints(cloudClientParameters); 68 /* Add corresponding Cloud Client fields with default values: */ 69 foreach (const AbstractVSDParameter ¶meter, cloudClientParameters) 70 { 71 QString strValue; 72 switch (parameter.kind) 73 { 74 case ParameterKind_Bool: 75 strValue = QString("true"); 76 break; 77 case ParameterKind_Double: 78 strValue = QString::number(parameter.get.value<AbstractVSDParameterDouble>().minimum); 79 break; 80 case ParameterKind_String: 81 strValue = parameter.get.value<AbstractVSDParameterString>().value; 82 break; 83 case ParameterKind_Array: 84 { 85 const QString strFirst = parameter.get.value<AbstractVSDParameterArray>().values.value(0).first; 86 const QString strSecond = parameter.get.value<AbstractVSDParameterArray>().values.value(0).second; 87 strValue = strSecond.isNull() ? strFirst : strSecond; 88 break; 89 } 90 default: 91 break; 92 } 93 comVsd.AddDescription(parameter.type, strValue, ""); 94 } 95 } 96 else 97 { 98 /* Add some additional fields the user may change: */ 99 comVsd.AddDescription(KVirtualSystemDescriptionType_Product, "", ""); 100 comVsd.AddDescription(KVirtualSystemDescriptionType_ProductUrl, "", ""); 101 comVsd.AddDescription(KVirtualSystemDescriptionType_Vendor, "", ""); 102 comVsd.AddDescription(KVirtualSystemDescriptionType_VendorUrl, "", ""); 103 comVsd.AddDescription(KVirtualSystemDescriptionType_Version, "", ""); 104 comVsd.AddDescription(KVirtualSystemDescriptionType_License, "", ""); 105 } 72 /* Add some additional fields the user may change: */ 73 comVsd.AddDescription(KVirtualSystemDescriptionType_Product, "", ""); 74 comVsd.AddDescription(KVirtualSystemDescriptionType_ProductUrl, "", ""); 75 comVsd.AddDescription(KVirtualSystemDescriptionType_Vendor, "", ""); 76 comVsd.AddDescription(KVirtualSystemDescriptionType_VendorUrl, "", ""); 77 comVsd.AddDescription(KVirtualSystemDescriptionType_Version, "", ""); 78 comVsd.AddDescription(KVirtualSystemDescriptionType_License, "", ""); 106 79 } 107 80 else … … 116 89 } 117 90 91 void UIWizardExportAppPage3::refreshFormPropertiesTable() 92 { 93 /* Acquire VSD form: */ 94 CVirtualSystemDescriptionForm comForm = fieldImp("vsdForm").value<CVirtualSystemDescriptionForm>(); 95 /* Make sure the properties table get the new description form: */ 96 if (comForm.isNotNull()) 97 m_pFormEditor->setVirtualSystemDescriptionForm(comForm); 98 } 99 118 100 119 101 /********************************************************************************************************************************* … … 135 117 } 136 118 137 /* Create appliance widget: */ 138 m_pApplianceWidget = new UIApplianceExportEditorWidget; 139 if (m_pApplianceWidget) 140 { 141 m_pApplianceWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); 119 /* Create settings container layout: */ 120 m_pSettingsCntLayout = new QStackedLayout; 121 if (m_pSettingsCntLayout) 122 { 123 /* Create appliance widget container: */ 124 QWidget *pApplianceWidgetCnt = new QWidget(this); 125 if (pApplianceWidgetCnt) 126 { 127 /* Create appliance widget layout: */ 128 QVBoxLayout *pApplianceWidgetLayout = new QVBoxLayout(pApplianceWidgetCnt); 129 if (pApplianceWidgetLayout) 130 { 131 pApplianceWidgetLayout->setContentsMargins(0, 0, 0, 0); 132 133 /* Create appliance widget: */ 134 m_pApplianceWidget = new UIApplianceExportEditorWidget; 135 if (m_pApplianceWidget) 136 { 137 m_pApplianceWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); 138 139 /* Add into layout: */ 140 pApplianceWidgetLayout->addWidget(m_pApplianceWidget); 141 } 142 } 143 144 /* Add into layout: */ 145 m_pSettingsCntLayout->addWidget(pApplianceWidgetCnt); 146 } 147 148 /* Create form editor container: */ 149 QWidget *pFormEditorCnt = new QWidget(this); 150 if (pFormEditorCnt) 151 { 152 /* Create form editor layout: */ 153 QVBoxLayout *pFormEditorLayout = new QVBoxLayout(pFormEditorCnt); 154 if (pFormEditorLayout) 155 { 156 pFormEditorLayout->setContentsMargins(0, 0, 0, 0); 157 158 /* Create form editor widget: */ 159 m_pFormEditor = new UIFormEditorWidget(pFormEditorCnt); 160 if (m_pFormEditor) 161 { 162 /* Add into layout: */ 163 pFormEditorLayout->addWidget(m_pFormEditor); 164 } 165 } 166 167 /* Add into layout: */ 168 m_pSettingsCntLayout->addWidget(pFormEditorCnt); 169 } 142 170 143 171 /* Add into layout: */ 144 pMainLayout->add Widget(m_pApplianceWidget);172 pMainLayout->addLayout(m_pSettingsCntLayout); 145 173 } 146 174 } … … 148 176 /* Register classes: */ 149 177 qRegisterMetaType<ExportAppliancePointer>(); 178 150 179 /* Register fields: */ 151 180 registerField("applianceWidget", this, "applianceWidget"); … … 166 195 retranslateUi(); 167 196 168 /* Refresh appliance settings widget: */ 169 refreshApplianceSettingsWidget(); 197 /* Check whether there was cloud target selected: */ 198 const bool fIsFormatCloudOne = field("isFormatCloudOne").toBool(); 199 if (fIsFormatCloudOne) 200 refreshFormPropertiesTable(); 201 else 202 refreshApplianceSettingsWidget(); 170 203 } 171 204 … … 177 210 /* Lock finish button: */ 178 211 startProcessing(); 212 213 /* Check whether there was cloud target selected: */ 214 const bool fIsFormatCloudOne = fieldImp("isFormatCloudOne").toBool(); 215 if (fIsFormatCloudOne) 216 { 217 /* Check whether we have proper VSD form: */ 218 CVirtualSystemDescriptionForm comForm = fieldImp("vsdForm").value<CVirtualSystemDescriptionForm>(); 219 fResult = comForm.isNotNull(); 220 Assert(fResult); 221 222 /* Give changed VSD back to appliance: */ 223 if (fResult) 224 { 225 comForm.GetVirtualSystemDescription(); 226 fResult = comForm.isOk(); 227 if (!fResult) 228 msgCenter().cannotAcquireVirtualSystemDescriptionFormProperty(comForm); 229 } 230 } 179 231 180 232 /* Try to export appliance: */ … … 191 243 void UIWizardExportAppPageBasic3::updatePageAppearance() 192 244 { 245 /* Call to base-class: */ 246 UIWizardExportAppPage3::updatePageAppearance(); 247 193 248 /* Check whether there was cloud target selected: */ 194 249 const bool fIsFormatCloudOne = field("isFormatCloudOne").toBool(); 195 250 if (fIsFormatCloudOne) 251 { 196 252 m_pLabel->setText(UIWizardExportApp::tr("This is the descriptive information which will be used to determine settings " 197 253 "for a cloud storage your VM being exported to. You can change it by double " 198 254 "clicking on individual lines.")); 255 m_pFormEditor->setFocus(); 256 } 199 257 else 258 { 200 259 m_pLabel->setText(UIWizardExportApp::tr("This is the descriptive information which will be added to the virtual " 201 260 "appliance. You can change it by double clicking on individual lines.")); 202 } 261 m_pApplianceWidget->setFocus(); 262 } 263 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.h
r78992 r78993 28 28 /* GUI includes: */ 29 29 #include "UIExtraDataDefs.h" 30 #include "UIFormEditorWidget.h" 30 31 #include "UIWizardExportAppDefs.h" 31 32 #include "UIWizardPage.h" 32 33 33 34 /* Forward declarations: */ 34 class QJsonDocument; 35 class QJsonValue; 35 class QStackedLayout; 36 36 class QIRichTextLabel; 37 37 class UIWizardExportApp; … … 46 46 UIWizardExportAppPage3(); 47 47 48 /** Updates page appearance. */ 49 virtual void updatePageAppearance(); 50 48 51 /** Refreshes appliance settings widget. */ 49 52 void refreshApplianceSettingsWidget(); 53 /** Refreshes form properties table. */ 54 void refreshFormPropertiesTable(); 50 55 51 56 /** Returns the appliance widget reference. */ 52 57 ExportAppliancePointer applianceWidget() const { return m_pApplianceWidget; } 53 58 59 /** Holds the settings container layout instance. */ 60 QStackedLayout *m_pSettingsCntLayout; 61 54 62 /** Holds the appliance widget reference. */ 55 ExportAppliancePointer m_pApplianceWidget; 63 ExportAppliancePointer m_pApplianceWidget; 64 /** Holds the Form Editor widget instance. */ 65 UIFormEditorWidgetPointer m_pFormEditor; 56 66 }; 57 67 … … 87 97 88 98 /** Updates page appearance. */ 89 v oid updatePageAppearance();99 virtual void updatePageAppearance() /* override */; 90 100 91 101 private: -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp
r78989 r78993 25 25 #include <QListWidget> 26 26 #include <QRadioButton> 27 #include <QStackedLayout> 27 28 #include <QStackedWidget> 28 29 #include <QTableWidget> … … 36 37 #include "UIEmptyFilePathSelector.h" 37 38 #include "UIIconPool.h" 39 #include "UIMessageCenter.h" 38 40 #include "UIVirtualBoxManager.h" 39 41 #include "UIWizardExportApp.h" … … 90 92 if (pApplianceCntLayout) 91 93 { 92 /* Create appliance widget: */93 m_p ApplianceWidget = new UIApplianceExportEditorWidget;94 if (m_p ApplianceWidget)94 /* Create settings container layout: */ 95 m_pSettingsCntLayout = new QStackedLayout; 96 if (m_pSettingsCntLayout) 95 97 { 96 m_pApplianceWidget->setMinimumHeight(250); 97 m_pApplianceWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); 98 /* Create appliance widget container: */ 99 QWidget *pApplianceWidgetCnt = new QWidget(this); 100 if (pApplianceWidgetCnt) 101 { 102 /* Create appliance widget layout: */ 103 QVBoxLayout *pApplianceWidgetLayout = new QVBoxLayout(pApplianceWidgetCnt); 104 if (pApplianceWidgetLayout) 105 { 106 pApplianceWidgetLayout->setContentsMargins(0, 0, 0, 0); 107 108 /* Create appliance widget: */ 109 m_pApplianceWidget = new UIApplianceExportEditorWidget; 110 if (m_pApplianceWidget) 111 { 112 m_pApplianceWidget->setMinimumHeight(250); 113 m_pApplianceWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); 114 115 /* Add into layout: */ 116 pApplianceWidgetLayout->addWidget(m_pApplianceWidget); 117 } 118 } 119 120 /* Add into layout: */ 121 m_pSettingsCntLayout->addWidget(pApplianceWidgetCnt); 122 } 123 124 /* Create form editor container: */ 125 QWidget *pFormEditorCnt = new QWidget(this); 126 if (pFormEditorCnt) 127 { 128 /* Create form editor layout: */ 129 QVBoxLayout *pFormEditorLayout = new QVBoxLayout(pFormEditorCnt); 130 if (pFormEditorLayout) 131 { 132 pFormEditorLayout->setContentsMargins(0, 0, 0, 0); 133 134 /* Create form editor widget: */ 135 m_pFormEditor = new UIFormEditorWidget(pFormEditorCnt); 136 if (m_pFormEditor) 137 { 138 /* Add into layout: */ 139 pFormEditorLayout->addWidget(m_pFormEditor); 140 } 141 } 142 143 /* Add into layout: */ 144 m_pSettingsCntLayout->addWidget(pFormEditorCnt); 145 } 98 146 99 147 /* Add into layout: */ 100 pApplianceCntLayout->add Widget(m_pApplianceWidget);148 pApplianceCntLayout->addLayout(m_pSettingsCntLayout); 101 149 } 102 150 } … … 498 546 refreshIncludeISOsCheckBoxAccess(); 499 547 500 /* Refresh appliance settings: */ 501 refreshApplianceSettingsWidget(); 548 /* Check whether there was cloud target selected: */ 549 const bool fIsFormatCloudOne = field("isFormatCloudOne").toBool(); 550 if (fIsFormatCloudOne) 551 refreshFormPropertiesTable(); 552 else 553 refreshApplianceSettingsWidget(); 502 554 } 503 555 … … 542 594 startProcessing(); 543 595 596 /* Check whether there was cloud target selected: */ 597 const bool fIsFormatCloudOne = fieldImp("isFormatCloudOne").toBool(); 598 if (fIsFormatCloudOne) 599 { 600 /* Check whether we have proper VSD form: */ 601 CVirtualSystemDescriptionForm comForm = fieldImp("vsdForm").value<CVirtualSystemDescriptionForm>(); 602 fResult = comForm.isNotNull(); 603 Assert(fResult); 604 605 /* Give changed VSD back to appliance: */ 606 if (fResult) 607 { 608 comForm.GetVirtualSystemDescription(); 609 fResult = comForm.isOk(); 610 if (!fResult) 611 msgCenter().cannotAcquireVirtualSystemDescriptionFormProperty(comForm); 612 } 613 } 614 544 615 /* Try to export appliance: */ 545 fResult = qobject_cast<UIWizardExportApp*>(wizard())->exportAppliance(); 616 if (fResult) 617 fResult = qobject_cast<UIWizardExportApp*>(wizard())->exportAppliance(); 546 618 547 619 /* Unlock finish button: */ … … 556 628 /* Refresh required settings: */ 557 629 refreshFileSelectorName(); 558 refreshApplianceSettingsWidget(); 630 631 /* Check whether there was cloud target selected: */ 632 const bool fIsFormatCloudOne = field("isFormatCloudOne").toBool(); 633 if (fIsFormatCloudOne) 634 refreshFormPropertiesTable(); 635 else 636 refreshApplianceSettingsWidget(); 559 637 560 638 /* Broadcast complete-change: */ … … 569 647 /* Refresh required settings: */ 570 648 UIWizardExportAppPage2::updatePageAppearance(); 649 UIWizardExportAppPage3::updatePageAppearance(); 571 650 refreshFileSelectorExtension(); 572 651 refreshManifestCheckBoxAccess(); … … 575 654 populateAccountProperties(); 576 655 populateFormProperties(); 577 refreshApplianceSettingsWidget(); 656 657 /* Check whether there was cloud target selected: */ 658 const bool fIsFormatCloudOne = field("isFormatCloudOne").toBool(); 659 if (fIsFormatCloudOne) 660 refreshFormPropertiesTable(); 661 else 662 refreshApplianceSettingsWidget(); 663 664 /* Broadcast complete-change: */ 578 665 emit completeChanged(); 579 666 } … … 585 672 m_strFileSelectorName = QFileInfo(m_pFileSelector->path()).completeBaseName(); 586 673 587 /* Refresh required settings: */674 /* Broadcast complete-change: */ 588 675 emit completeChanged(); 589 676 } … … 600 687 populateAccountProperties(); 601 688 populateFormProperties(); 602 refreshApplianceSettingsWidget(); 689 690 /* Check whether there was cloud target selected: */ 691 const bool fIsFormatCloudOne = field("isFormatCloudOne").toBool(); 692 if (fIsFormatCloudOne) 693 refreshFormPropertiesTable(); 694 else 695 refreshApplianceSettingsWidget(); 696 697 /* Broadcast complete-change: */ 603 698 emit completeChanged(); 604 699 }
Note:
See TracChangeset
for help on using the changeset viewer.