- Timestamp:
- Oct 8, 2021 3:04:50 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 147370
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIApplianceUnverifiedCertificateViewer.h
r82968 r91645 5 5 6 6 /* 7 * Copyright (C) 2009-202 0Oracle Corporation7 * Copyright (C) 2009-2021 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 48 48 49 49 /** Handles translation event. */ 50 virtual void retranslateUi() /* override */;50 virtual void retranslateUi() /* override final */; 51 51 52 52 private: -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportApp.cpp
r91589 r91645 147 147 *********************************************************************************************************************************/ 148 148 149 UIWizardImportApp::UIWizardImportApp(QWidget *pParent, bool fImportFromOCIByDefault, const QString &strFileName) 149 UIWizardImportApp::UIWizardImportApp(QWidget *pParent, 150 bool fImportFromOCIByDefault, 151 const QString &strFileName) 150 152 : UIWizard(pParent, WizardType_ImportAppliance) 151 153 , m_fImportFromOCIByDefault(fImportFromOCIByDefault) … … 189 191 } 190 192 191 CAppliance UIWizardImportApp::appliance() const 192 { 193 return m_comAppliance; 194 } 195 196 bool UIWizardImportApp::setFile(const QString &strFileName) 193 bool UIWizardImportApp::setFile(const QString &strName) 197 194 { 198 195 /* Clear object: */ 199 m_com Appliance = CAppliance();200 201 if (str FileName.isEmpty())196 m_comLocalAppliance = CAppliance(); 197 198 if (strName.isEmpty()) 202 199 return false; 203 200 … … 212 209 213 210 /* Read the file to appliance: */ 214 CProgress comProgress = comAppliance.Read(str FileName);211 CProgress comProgress = comAppliance.Read(strName); 215 212 if (!comAppliance.isOk()) 216 213 { … … 237 234 238 235 /* Remember appliance: */ 239 m_com Appliance = comAppliance;236 m_comLocalAppliance = comAppliance; 240 237 241 238 /* Success finally: */ … … 245 242 bool UIWizardImportApp::isValid() const 246 243 { 247 return m_com Appliance.isNotNull();244 return m_comLocalAppliance.isNotNull(); 248 245 } 249 246 … … 251 248 { 252 249 /* Check whether there was cloud source selected: */ 253 const bool fIsSourceCloudOne = field("isSourceCloudOne").toBool(); 254 if (fIsSourceCloudOne) 255 { 256 /* Acquire prepared appliance: */ 250 if (field("isSourceCloudOne").toBool()) 251 { 252 /* Make sure cloud appliance valid: */ 257 253 CAppliance comAppliance = field("cloudAppliance").value<CAppliance>(); 258 AssertReturn( !comAppliance.isNull(), false);254 AssertReturn(comAppliance.isNotNull(), false); 259 255 260 256 /* No options for cloud VMs for now: */ … … 276 272 { 277 273 UIImportLicenseViewer ilv(this); 278 for (int i = 0; i < licAgreements.size(); ++ 274 for (int i = 0; i < licAgreements.size(); ++i) 279 275 { 280 276 const QPair<QString, QString> &lic = licAgreements.at(i); … … 287 283 /* Gather import options: */ 288 284 QVector<KImportOptions> options; 289 const MACAddressImportPolicy enmPolicy = field("macAddressImportPolicy").value<MACAddressImportPolicy>(); 290 switch (enmPolicy) 285 switch (field("macAddressImportPolicy").value<MACAddressImportPolicy>()) 291 286 { 292 287 case MACAddressImportPolicy_KeepAllMACs: options.append(KImportOptions_KeepAllMACs); break; … … 294 289 default: break; 295 290 } 296 bool fImportHDsAsVDI = field("importHDsAsVDI").toBool(); 297 if (fImportHDsAsVDI) 291 if (field("importHDsAsVDI").toBool()) 298 292 options.append(KImportOptions_ImportToVDI); 299 293 300 294 /* Import appliance: */ 301 UINotificationProgressApplianceImport *pNotification = new UINotificationProgressApplianceImport(m_com Appliance,295 UINotificationProgressApplianceImport *pNotification = new UINotificationProgressApplianceImport(m_comLocalAppliance, 302 296 options); 303 297 gpNotificationCenter->append(pNotification); … … 322 316 QList<QPair<QString, QString> > list; 323 317 324 foreach (CVirtualSystemDescription comVsd, m_com Appliance.GetVirtualSystemDescriptions())318 foreach (CVirtualSystemDescription comVsd, m_comLocalAppliance.GetVirtualSystemDescriptions()) 325 319 { 326 320 QVector<QString> strLicense; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportApp.h
r91589 r91645 59 59 }; 60 60 61 /** Constructs export appliance wizard passing @a pParent to the base-class. 62 * @param strFileName Brings appliance file name. */ 63 UIWizardImportApp(QWidget *pParent, bool fImportFromOCIByDefault, const QString &strFileName); 61 /** Constructs Import Appliance wizard passing @a pParent to the base-class. 62 * @param fImportFromOCIByDefault Brings whether wizard should start with OCI target. 63 * @param strFileName Brings local file name to import OVF/OVA from. */ 64 UIWizardImportApp(QWidget *pParent, 65 bool fImportFromOCIByDefault, 66 const QString &strFileName); 64 67 65 68 /** Prepares all. */ 66 69 virtual void prepare() /* override */; 67 70 68 /** Returns appliance. */ 69 CAppliance appliance() const; 70 /** Defines @a strFileName. */ 71 bool setFile(const QString &strFileName); 72 /** Returns whether appliance is valid. */ 73 bool isValid() const; 71 /** @name Local import fields. 72 * @{ */ 73 /** Returns local Appliance object. */ 74 CAppliance localAppliance() const { return m_comLocalAppliance; } 75 /** Defines file @a strName. */ 76 bool setFile(const QString &strName); 77 /** Returns whether appliance is valid. */ 78 bool isValid() const; 79 /** @} */ 74 80 75 /** Imports appliance. */ 76 bool importAppliance(); 81 /** @name Auxiliary stuff. 82 * @{ */ 83 /** Imports appliance. */ 84 bool importAppliance(); 85 /** @} */ 77 86 78 87 protected: 79 88 80 /** Handles translation event. */ 81 virtual void retranslateUi() /* override */; 89 /** @name Inherited stuff. 90 * @{ */ 91 /** Handles translation event. */ 92 virtual void retranslateUi() /* override final */; 93 /** @} */ 82 94 83 95 private: 84 96 85 /** Returns a list of license agreement pairs. */ 86 QList<QPair<QString, QString> > licenseAgreements() const; 97 /** @name Auxiliary stuff. 98 * @{ */ 99 /** Returns a list of license agreement pairs. */ 100 QList<QPair<QString, QString> > licenseAgreements() const; 101 /** @} */ 87 102 88 /** Holds whether default source should be Import from OCI. */ 89 bool m_fImportFromOCIByDefault; 90 /** Handles the appliance file name. */ 91 QString m_strFileName; 103 /** @name Arguments. 104 * @{ */ 105 /** Holds whether default source should be Import from OCI. */ 106 bool m_fImportFromOCIByDefault; 107 /** Handles the appliance file name. */ 108 QString m_strFileName; 109 /** @} */ 92 110 93 /** Holds the appliance wrapper instance. */ 94 CAppliance m_comAppliance; 111 /** @name Local import fields. 112 * @{ */ 113 /** Holds the local appliance wrapper instance. */ 114 CAppliance m_comLocalAppliance; 115 /** @} */ 95 116 }; 96 117 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.cpp
r91590 r91645 5 5 6 6 /* 7 * Copyright (C) 2009-202 0Oracle Corporation7 * Copyright (C) 2009-2021 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 21 21 #include <QLabel> 22 22 #include <QListWidget> 23 #include <QStacked Layout>23 #include <QStackedWidget> 24 24 #include <QTableWidget> 25 25 #include <QVBoxLayout> … … 54 54 , m_pSourceLabel(0) 55 55 , m_pSourceComboBox(0) 56 , m_pS tackedLayout(0)56 , m_pSettingsWidget1(0) 57 57 , m_pLocalContainerLayout(0) 58 58 , m_pFileLabel(0) … … 75 75 m_pSourceComboBox->clear(); 76 76 77 /* Compose hardcoded sources list , there might be few of list items: */77 /* Compose hardcoded sources list: */ 78 78 QStringList sources; 79 79 sources << "local"; … … 81 81 foreach (const QString &strShortName, sources) 82 82 { 83 /* Compose empty comboitem, fill it's data: */83 /* Compose empty item, fill it's data: */ 84 84 m_pSourceComboBox->addItem(QString()); 85 85 m_pSourceComboBox->setItemData(m_pSourceComboBox->count() - 1, strShortName, SourceData_ShortName); … … 302 302 { 303 303 /* Update page appearance according to chosen source: */ 304 m_pS tackedLayout->setCurrentIndex((int)isSourceCloudOne());304 m_pSettingsWidget1->setCurrentIndex((int)isSourceCloudOne()); 305 305 } 306 306 … … 406 406 pMainLayout->addWidget(m_pLabelDescription); 407 407 408 /* Prepare s tacked layout: */409 m_pS tackedLayout = new QStackedLayout;410 if (m_pS tackedLayout)408 /* Prepare settings widget: */ 409 m_pSettingsWidget1 = new QStackedWidget(this); 410 if (m_pSettingsWidget1) 411 411 { 412 412 /* Prepare local container: */ 413 QWidget *p LocalContainer = new QWidget(this);414 if (p LocalContainer)413 QWidget *pContainerLocal = new QWidget(m_pSettingsWidget1); 414 if (pContainerLocal) 415 415 { 416 416 /* Prepare local container layout: */ 417 m_pLocalContainerLayout = new QGridLayout(p LocalContainer);417 m_pLocalContainerLayout = new QGridLayout(pContainerLocal); 418 418 if (m_pLocalContainerLayout) 419 419 { … … 424 424 425 425 /* Prepare file label: */ 426 m_pFileLabel = new QLabel(p LocalContainer);426 m_pFileLabel = new QLabel(pContainerLocal); 427 427 if (m_pFileLabel) 428 428 m_pLocalContainerLayout->addWidget(m_pFileLabel, 0, 0, Qt::AlignRight); 429 429 430 430 /* Prepare file-path selector: */ 431 m_pFileSelector = new UIEmptyFilePathSelector(p LocalContainer);431 m_pFileSelector = new UIEmptyFilePathSelector(pContainerLocal); 432 432 if (m_pFileSelector) 433 433 { … … 441 441 } 442 442 443 /* Add into layout: */444 m_pS tackedLayout->addWidget(pLocalContainer);443 /* Add into widget: */ 444 m_pSettingsWidget1->addWidget(pContainerLocal); 445 445 } 446 446 447 447 /* Prepare cloud container: */ 448 QWidget *pC loudContainer = new QWidget(this);449 if (pC loudContainer)448 QWidget *pContainerCloud = new QWidget(m_pSettingsWidget1); 449 if (pContainerCloud) 450 450 { 451 451 /* Prepare cloud container layout: */ 452 m_pCloudContainerLayout = new QGridLayout(pC loudContainer);452 m_pCloudContainerLayout = new QGridLayout(pContainerCloud); 453 453 if (m_pCloudContainerLayout) 454 454 { … … 460 460 461 461 /* Prepare profile label: */ 462 m_pProfileLabel = new QLabel(pC loudContainer);462 m_pProfileLabel = new QLabel(pContainerCloud); 463 463 if (m_pProfileLabel) 464 464 m_pCloudContainerLayout->addWidget(m_pProfileLabel, 0, 0, Qt::AlignRight); … … 472 472 473 473 /* Prepare profile combo-box: */ 474 m_pProfileComboBox = new QIComboBox(pC loudContainer);474 m_pProfileComboBox = new QIComboBox(pContainerCloud); 475 475 if (m_pProfileComboBox) 476 476 { … … 480 480 481 481 /* Prepare profile tool-button: */ 482 m_pProfileToolButton = new QIToolButton(pC loudContainer);482 m_pProfileToolButton = new QIToolButton(pContainerCloud); 483 483 if (m_pProfileToolButton) 484 484 { … … 493 493 494 494 /* Prepare profile instance label: */ 495 m_pProfileInstanceLabel = new QLabel(pC loudContainer);495 m_pProfileInstanceLabel = new QLabel(pContainerCloud); 496 496 if (m_pProfileInstanceLabel) 497 497 m_pCloudContainerLayout->addWidget(m_pProfileInstanceLabel, 1, 0, Qt::AlignRight); 498 498 499 499 /* Prepare profile instances table: */ 500 m_pProfileInstanceList = new QListWidget(pC loudContainer);500 m_pProfileInstanceList = new QListWidget(pContainerCloud); 501 501 if (m_pProfileInstanceList) 502 502 { … … 514 514 } 515 515 516 /* Add into layout: */517 m_pS tackedLayout->addWidget(pCloudContainer);516 /* Add into widget: */ 517 m_pSettingsWidget1->addWidget(pContainerCloud); 518 518 } 519 519 520 520 /* Add into layout: */ 521 pMainLayout->add Layout(m_pStackedLayout);521 pMainLayout->addWidget(m_pSettingsWidget1); 522 522 } 523 523 } … … 525 525 /* Setup connections: */ 526 526 connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigCloudProfileRegistered, 527 this, &UIWizardImportAppPageBasic1::sltHandleSourceC hange);527 this, &UIWizardImportAppPageBasic1::sltHandleSourceComboChange); 528 528 connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigCloudProfileChanged, 529 this, &UIWizardImportAppPageBasic1::sltHandleSourceC hange);530 connect(m_pSourceComboBox, static_cast<void(QIComboBox::*)(int)>(&QIComboBox:: activated),531 this, &UIWizardImportAppPageBasic1::sltHandleSourceC hange);529 this, &UIWizardImportAppPageBasic1::sltHandleSourceComboChange); 530 connect(m_pSourceComboBox, static_cast<void(QIComboBox::*)(int)>(&QIComboBox::currentIndexChanged), 531 this, &UIWizardImportAppPageBasic1::sltHandleSourceComboChange); 532 532 connect(m_pFileSelector, &UIEmptyFilePathSelector::pathChanged, 533 533 this, &UIWizardImportAppPageBasic1::completeChanged); … … 640 640 bool UIWizardImportAppPageBasic1::isComplete() const 641 641 { 642 /* Initial result: */ 642 643 bool fResult = true; 643 644 644 /* Check appliance settings: */ 645 if (fResult) 646 { 647 const bool fOVF = !isSourceCloudOne(); 648 const bool fCSP = !fOVF; 649 650 fResult = ( fOVF 651 && UICommon::hasAllowedExtension(m_pFileSelector->path().toLower(), OVFFileExts) 652 && QFile::exists(m_pFileSelector->path())) 653 || ( fCSP 654 && !m_comCloudProfile.isNull() 655 && !m_comCloudClient.isNull() 656 && !machineId().isNull()); 657 } 658 645 /* Check whether there was cloud source selected: */ 646 if (isSourceCloudOne()) 647 fResult = !machineId().isNull(); 648 else 649 fResult = UICommon::hasAllowedExtension(m_pFileSelector->path().toLower(), OVFFileExts) 650 && QFile::exists(m_pFileSelector->path()); 651 652 /* Return result: */ 659 653 return fResult; 660 654 } … … 662 656 bool UIWizardImportAppPageBasic1::validatePage() 663 657 { 658 /* Initial result: */ 659 bool fResult = true; 660 661 /* Check whether there was cloud source selected: */ 664 662 if (isSourceCloudOne()) 665 663 { 666 664 /* Create appliance & populate form properties: */ 667 665 populateFormProperties(); 668 /* And make sure they are not null: */ 669 return m_comCloudAppliance.isNotNull() && m_comVSDForm.isNotNull(); 666 /* Which is required to continue to the next page: */ 667 fResult = m_comCloudAppliance.isNotNull() 668 && m_comVSDForm.isNotNull(); 670 669 } 671 670 else … … 681 680 m_pFileSelector->resetModified(); 682 681 } 683 684 682 /* If we have a valid ovf proceed to the appliance settings page: */ 685 return qobject_cast<UIWizardImportApp*>(wizard())->isValid(); 686 } 683 fResult = qobject_cast<UIWizardImportApp*>(wizard())->isValid(); 684 } 685 686 /* Return result: */ 687 return fResult; 687 688 } 688 689 … … 711 712 } 712 713 713 void UIWizardImportAppPageBasic1::sltHandleSourceC hange()714 { 715 /* Update tool-tip: */714 void UIWizardImportAppPageBasic1::sltHandleSourceComboChange() 715 { 716 /* Update combo tool-tip: */ 716 717 updateSourceComboToolTip(); 717 718 … … 721 722 populateProfile(); 722 723 populateProfileInstances(); 724 725 /* Notify about changes: */ 723 726 emit completeChanged(); 724 727 } … … 729 732 populateProfile(); 730 733 populateProfileInstances(); 734 735 /* Notify about changes: */ 731 736 emit completeChanged(); 732 737 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.h
r91590 r91645 5 5 6 6 /* 7 * Copyright (C) 2009-202 0Oracle Corporation7 * Copyright (C) 2009-2021 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 39 39 class QListWidget; 40 40 class QTableWidget; 41 class QStacked Layout;41 class QStackedWidget; 42 42 class QIComboBox; 43 43 class QIRichTextLabel; … … 125 125 QIComboBox *m_pSourceComboBox; 126 126 127 /** Holds the s tacked layoutinstance. */128 QStacked Layout *m_pStackedLayout;127 /** Holds the settings widget 1 instance. */ 128 QStackedWidget *m_pSettingsWidget1; 129 129 130 130 /** Holds the local container layout instance. */ … … 161 161 public: 162 162 163 /** Constructs 1st basic page. */ 163 /** Constructs 1st basic page. 164 * @param fImportFromOCIByDefault Brings whether we should propose import from OCI by default. */ 164 165 UIWizardImportAppPageBasic1(bool fImportFromOCIByDefault); 165 166 … … 170 171 171 172 /** Handles translation event. */ 172 virtual void retranslateUi() /* override */;173 virtual void retranslateUi() /* override final */; 173 174 174 175 /** Performs page initialization. */ 175 virtual void initializePage() /* override */;176 virtual void initializePage() /* override final */; 176 177 177 178 /** Returns whether page is complete. */ 178 virtual bool isComplete() const /* override */;179 virtual bool isComplete() const /* override final */; 179 180 180 181 /** Performs page validation. */ 181 virtual bool validatePage() /* override */;182 virtual bool validatePage() /* override final */; 182 183 183 184 /** Updates page appearance. */ 184 virtual void updatePageAppearance() /* override */;185 virtual void updatePageAppearance() /* override final */; 185 186 186 187 private slots: 187 188 188 /** Handles import sourcechange. */189 void sltHandleSourceC hange();190 191 /** Handles change in profile combo-box. */189 /** Handles source combo change. */ 190 void sltHandleSourceComboChange(); 191 192 /** Handles profile combo change. */ 192 193 void sltHandleProfileComboChange(); 193 194 194 /** Handles profile tool-button click. */ 195 195 void sltHandleProfileButtonClick(); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic2.cpp
r91589 r91645 5 5 6 6 /* 7 * Copyright (C) 2009-202 0Oracle Corporation7 * Copyright (C) 2009-2021 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 18 18 /* Qt includes: */ 19 19 #include <QCheckBox> 20 #include <QComboBox>21 20 #include <QGridLayout> 22 21 #include <QLabel> 23 22 #include <QPointer> 24 #include <QStacked Layout>23 #include <QStackedWidget> 25 24 #include <QVBoxLayout> 26 25 27 26 /* GUI includes: */ 27 #include "QIComboBox.h" 28 28 #include "QIRichTextLabel.h" 29 29 #include "UIApplianceImportEditorWidget.h" … … 48 48 49 49 UIWizardImportAppPage2::UIWizardImportAppPage2() 50 : m_pSettings CntLayout(0)50 : m_pSettingsWidget2(0) 51 51 , m_pApplianceWidget(0) 52 52 , m_pLabelImportFilePath(0) … … 105 105 const bool fIsSourceCloudOne = fieldImp("isSourceCloudOne").toBool(); 106 106 /* Update page appearance according to chosen source: */ 107 m_pSettings CntLayout->setCurrentIndex((int)fIsSourceCloudOne);107 m_pSettingsWidget2->setCurrentIndex((int)fIsSourceCloudOne); 108 108 } 109 109 … … 154 154 { 155 155 /* Prepare label: */ 156 m_pLabel = new QIRichTextLabel(this);157 if (m_pLabel )158 pMainLayout->addWidget(m_pLabel );159 160 /* Prepare settings container layout: */161 m_pSettings CntLayout = new QStackedLayout;162 if (m_pSettings CntLayout)156 m_pLabelDescription = new QIRichTextLabel(this); 157 if (m_pLabelDescription) 158 pMainLayout->addWidget(m_pLabelDescription); 159 160 /* Prepare settings widget 2: */ 161 m_pSettingsWidget2 = new QStackedWidget(this); 162 if (m_pSettingsWidget2) 163 163 { 164 /* Prepare appliance widgetcontainer: */165 QWidget *p ApplianceWidgetCnt = new QWidget(this);166 if (p ApplianceWidgetCnt)164 /* Prepare appliance container: */ 165 QWidget *pContainerAppliance = new QWidget(m_pSettingsWidget2); 166 if (pContainerAppliance) 167 167 { 168 /* Prepare appliance widgetlayout: */169 QGridLayout *p ApplianceWidgetLayout = new QGridLayout(pApplianceWidgetCnt);170 if (p ApplianceWidgetLayout)168 /* Prepare appliance layout: */ 169 QGridLayout *pLayoutAppliance = new QGridLayout(pContainerAppliance); 170 if (pLayoutAppliance) 171 171 { 172 p ApplianceWidgetLayout->setContentsMargins(0, 0, 0, 0);173 p ApplianceWidgetLayout->setColumnStretch(0, 0);174 p ApplianceWidgetLayout->setColumnStretch(1, 1);172 pLayoutAppliance->setContentsMargins(0, 0, 0, 0); 173 pLayoutAppliance->setColumnStretch(0, 0); 174 pLayoutAppliance->setColumnStretch(1, 1); 175 175 176 176 /* Prepare appliance widget: */ 177 m_pApplianceWidget = new UIApplianceImportEditorWidget(p ApplianceWidgetCnt);177 m_pApplianceWidget = new UIApplianceImportEditorWidget(pContainerAppliance); 178 178 if (m_pApplianceWidget) 179 179 { 180 180 m_pApplianceWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); 181 p ApplianceWidgetLayout->addWidget(m_pApplianceWidget, 0, 0, 1, 3);181 pLayoutAppliance->addWidget(m_pApplianceWidget, 0, 0, 1, 3); 182 182 } 183 183 184 184 /* Prepare path selector label: */ 185 m_pLabelImportFilePath = new QLabel(p ApplianceWidgetCnt);185 m_pLabelImportFilePath = new QLabel(pContainerAppliance); 186 186 if (m_pLabelImportFilePath) 187 187 { 188 188 m_pLabelImportFilePath->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 189 p ApplianceWidgetLayout->addWidget(m_pLabelImportFilePath, 1, 0);189 pLayoutAppliance->addWidget(m_pLabelImportFilePath, 1, 0); 190 190 } 191 191 /* Prepare path selector editor: */ 192 m_pEditorImportFilePath = new UIFilePathSelector(p ApplianceWidgetCnt);192 m_pEditorImportFilePath = new UIFilePathSelector(pContainerAppliance); 193 193 if (m_pEditorImportFilePath) 194 194 { … … 197 197 m_pEditorImportFilePath->setPath(uiCommon().virtualBox().GetSystemProperties().GetDefaultMachineFolder()); 198 198 m_pLabelImportFilePath->setBuddy(m_pEditorImportFilePath); 199 p ApplianceWidgetLayout->addWidget(m_pEditorImportFilePath, 1, 1, 1, 2);199 pLayoutAppliance->addWidget(m_pEditorImportFilePath, 1, 1, 1, 2); 200 200 } 201 201 202 202 /* Prepare MAC address policy label: */ 203 m_pLabelMACImportPolicy = new QLabel(p ApplianceWidgetCnt);203 m_pLabelMACImportPolicy = new QLabel(pContainerAppliance); 204 204 if (m_pLabelMACImportPolicy) 205 205 { 206 206 m_pLabelMACImportPolicy->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 207 p ApplianceWidgetLayout->addWidget(m_pLabelMACImportPolicy, 2, 0);207 pLayoutAppliance->addWidget(m_pLabelMACImportPolicy, 2, 0); 208 208 } 209 209 /* Prepare MAC address policy combo: */ 210 m_pComboMACImportPolicy = new Q ComboBox(pApplianceWidgetCnt);210 m_pComboMACImportPolicy = new QIComboBox(pContainerAppliance); 211 211 if (m_pComboMACImportPolicy) 212 212 { 213 213 m_pComboMACImportPolicy->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); 214 214 m_pLabelMACImportPolicy->setBuddy(m_pComboMACImportPolicy); 215 p ApplianceWidgetLayout->addWidget(m_pComboMACImportPolicy, 2, 1, 1, 2);215 pLayoutAppliance->addWidget(m_pComboMACImportPolicy, 2, 1, 1, 2); 216 216 } 217 217 218 218 /* Prepare additional options label: */ 219 m_pLabelAdditionalOptions = new QLabel(p ApplianceWidgetCnt);219 m_pLabelAdditionalOptions = new QLabel(pContainerAppliance); 220 220 if (m_pLabelAdditionalOptions) 221 221 { 222 222 m_pLabelAdditionalOptions->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 223 p ApplianceWidgetLayout->addWidget(m_pLabelAdditionalOptions, 3, 0);223 pLayoutAppliance->addWidget(m_pLabelAdditionalOptions, 3, 0); 224 224 } 225 225 /* Prepare import HDs as VDIs checkbox: */ 226 m_pCheckboxImportHDsAsVDI = new QCheckBox(p ApplianceWidgetCnt);226 m_pCheckboxImportHDsAsVDI = new QCheckBox(pContainerAppliance); 227 227 { 228 228 m_pCheckboxImportHDsAsVDI->setCheckState(Qt::Checked); 229 p ApplianceWidgetLayout->addWidget(m_pCheckboxImportHDsAsVDI, 3, 1);229 pLayoutAppliance->addWidget(m_pCheckboxImportHDsAsVDI, 3, 1); 230 230 } 231 231 232 232 /* Prepare certificate label: */ 233 m_pCertLabel = new QLabel(p ApplianceWidgetCnt);233 m_pCertLabel = new QLabel(pContainerAppliance); 234 234 if (m_pCertLabel) 235 p ApplianceWidgetLayout->addWidget(m_pCertLabel, 4, 0, 1, 3);235 pLayoutAppliance->addWidget(m_pCertLabel, 4, 0, 1, 3); 236 236 } 237 237 238 /* Add into layout: */239 m_pSettings CntLayout->addWidget(pApplianceWidgetCnt);238 /* Add into widget: */ 239 m_pSettingsWidget2->addWidget(pContainerAppliance); 240 240 } 241 241 242 242 /* Prepare form editor container: */ 243 QWidget *p FormEditorCnt = new QWidget(this);244 if (p FormEditorCnt)243 QWidget *pContainerFormEditor = new QWidget(m_pSettingsWidget2); 244 if (pContainerFormEditor) 245 245 { 246 246 /* Prepare form editor layout: */ 247 QVBoxLayout *p FormEditorLayout = new QVBoxLayout(pFormEditorCnt);248 if (p FormEditorLayout)247 QVBoxLayout *pLayoutFormEditor = new QVBoxLayout(pContainerFormEditor); 248 if (pLayoutFormEditor) 249 249 { 250 p FormEditorLayout->setContentsMargins(0, 0, 0, 0);250 pLayoutFormEditor->setContentsMargins(0, 0, 0, 0); 251 251 252 252 /* Prepare form editor widget: */ 253 m_pFormEditor = new UIFormEditorWidget(p FormEditorCnt);253 m_pFormEditor = new UIFormEditorWidget(pContainerFormEditor); 254 254 if (m_pFormEditor) 255 p FormEditorLayout->addWidget(m_pFormEditor);255 pLayoutFormEditor->addWidget(m_pFormEditor); 256 256 } 257 257 258 /* Add into layout: */259 m_pSettings CntLayout->addWidget(pFormEditorCnt);258 /* Add into widget: */ 259 m_pSettingsWidget2->addWidget(pContainerFormEditor); 260 260 } 261 261 262 262 /* Add into layout: */ 263 pMainLayout->add Layout(m_pSettingsCntLayout);263 pMainLayout->addWidget(m_pSettingsWidget2); 264 264 } 265 265 } … … 267 267 /* Setup connections: */ 268 268 connect(m_pEditorImportFilePath, &UIFilePathSelector::pathChanged, 269 this, &UIWizardImportAppPageBasic2::sltHandle PathChanged);270 connect(m_pComboMACImportPolicy, static_cast<void(Q ComboBox::*)(int)>(&QComboBox::currentIndexChanged),271 this, &UIWizardImportAppPageBasic2::sltHandleMACImportPolicyC hange);269 this, &UIWizardImportAppPageBasic2::sltHandleImportPathEditorChange); 270 connect(m_pComboMACImportPolicy, static_cast<void(QIComboBox::*)(int)>(&QIComboBox::currentIndexChanged), 271 this, &UIWizardImportAppPageBasic2::sltHandleMACImportPolicyComboChange); 272 272 273 273 /* Register fields: */ … … 285 285 m_pLabelImportFilePath->setText(tr("&Machine Base Folder:")); 286 286 287 /* Translate MAC address policy combo-box: */287 /* Translate MAC import policy label: */ 288 288 if (m_pLabelMACImportPolicy) 289 289 { … … 394 394 395 395 /* Acquire appliance: */ 396 CAppliance comAppliance = qobject_cast<UIWizardImportApp*>(wizard())-> appliance();396 CAppliance comAppliance = qobject_cast<UIWizardImportApp*>(wizard())->localAppliance(); 397 397 398 398 /* Initialize appliance widget: */ 399 399 m_pApplianceWidget->setAppliance(comAppliance); 400 400 /* Make sure we initialize appliance widget model with correct base folder path: */ 401 if (m_pEditorImportFilePath) 402 sltHandlePathChanged(m_pEditorImportFilePath->path()); 401 sltHandleImportPathEditorChange(); 403 402 404 403 /* Acquire certificate: */ … … 468 467 469 468 /* Check whether there was cloud source selected: */ 470 const bool fIsSourceCloudOne = fieldImp("isSourceCloudOne").toBool(); 471 if (fIsSourceCloudOne) 469 if (fieldImp("isSourceCloudOne").toBool()) 472 470 { 473 471 /* Make sure table has own data committed: */ … … 477 475 CVirtualSystemDescriptionForm comForm = fieldImp("vsdForm").value<CVirtualSystemDescriptionForm>(); 478 476 fResult = comForm.isNotNull(); 479 Assert(fResult);480 477 481 478 /* Give changed VSD back to appliance: */ … … 514 511 if (fIsSourceCloudOne) 515 512 { 516 m_pLabel ->setText(UIWizardImportApp::tr("These are the the suggested settings of the cloud VM import "517 "procedure, they are influencing the resulting local VM instance. "518 "You can change many of the properties shown by double-clicking "519 "on the items and disable others using the check boxes below."));513 m_pLabelDescription->setText(UIWizardImportApp::tr("These are the the suggested settings of the cloud VM import " 514 "procedure, they are influencing the resulting local VM instance. " 515 "You can change many of the properties shown by double-clicking " 516 "on the items and disable others using the check boxes below.")); 520 517 m_pFormEditor->setFocus(); 521 518 } 522 519 else 523 520 { 524 m_pLabel ->setText(UIWizardImportApp::tr("These are the virtual machines contained in the appliance "525 "and the suggested settings of the imported VirtualBox machines. "526 "You can change many of the properties shown by double-clicking "527 "on the items and disable others using the check boxes below."));521 m_pLabelDescription->setText(UIWizardImportApp::tr("These are the virtual machines contained in the appliance " 522 "and the suggested settings of the imported VirtualBox machines. " 523 "You can change many of the properties shown by double-clicking " 524 "on the items and disable others using the check boxes below.")); 528 525 m_pApplianceWidget->setFocus(); 529 526 } 530 527 } 531 528 532 void UIWizardImportAppPageBasic2::sltHandlePathChanged(const QString &strNewPath) 533 { 534 m_pApplianceWidget->setVirtualSystemBaseFolder(strNewPath); 535 } 536 537 void UIWizardImportAppPageBasic2::sltHandleMACImportPolicyChange() 529 void UIWizardImportAppPageBasic2::sltHandleImportPathEditorChange() 530 { 531 AssertPtrReturnVoid(m_pApplianceWidget); 532 AssertPtrReturnVoid(m_pEditorImportFilePath); 533 m_pApplianceWidget->setVirtualSystemBaseFolder(m_pEditorImportFilePath->path()); 534 } 535 536 void UIWizardImportAppPageBasic2::sltHandleMACImportPolicyComboChange() 538 537 { 539 538 updateMACImportPolicyComboToolTip(); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic2.h
r91589 r91645 5 5 6 6 /* 7 * Copyright (C) 2009-202 0Oracle Corporation7 * Copyright (C) 2009-2021 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 28 28 /* Forward declarations: */ 29 29 class QCheckBox; 30 class Q ComboBox;30 class QIComboBox; 31 31 class QLabel; 32 class QStacked Layout;32 class QStackedWidget; 33 33 class QIRichTextLabel; 34 34 class UIApplianceImportEditorWidget; … … 64 64 bool importHDsAsVDI() const; 65 65 66 /** Holds the settings container layoutinstance. */67 QStacked Layout *m_pSettingsCntLayout;66 /** Holds the settings widget 2 instance. */ 67 QStackedWidget *m_pSettingsWidget2; 68 68 69 69 /** Holds the appliance widget instance. */ … … 76 76 QLabel *m_pLabelMACImportPolicy; 77 77 /** Holds the MAC address combo instance. */ 78 Q ComboBox*m_pComboMACImportPolicy;78 QIComboBox *m_pComboMACImportPolicy; 79 79 /** Holds the additional options label instance. */ 80 80 QLabel *m_pLabelAdditionalOptions; … … 105 105 106 106 /** Handles translation event. */ 107 virtual void retranslateUi() /* override */;107 virtual void retranslateUi() /* override final */; 108 108 109 109 /** Performs page initialization. */ 110 virtual void initializePage() /* override */;110 virtual void initializePage() /* override final */; 111 111 /** Performs page cleanup. */ 112 virtual void cleanupPage() /* override */;112 virtual void cleanupPage() /* override final */; 113 113 114 114 /** Performs page validation. */ 115 virtual bool validatePage() /* override */;115 virtual bool validatePage() /* override final */; 116 116 117 117 /** Updates page appearance. */ 118 virtual void updatePageAppearance() /* override */;118 virtual void updatePageAppearance() /* override final */; 119 119 120 120 private slots: 121 121 122 /** Handles file path being changed to @a strNewPath. */ 123 void sltHandlePathChanged(const QString &strNewPath); 124 125 /** Handles MAC address import policy changes. */ 126 void sltHandleMACImportPolicyChange(); 122 /** Handles import path editor change. */ 123 void sltHandleImportPathEditorChange(); 124 /** Handles MAC address import policy combo change. */ 125 void sltHandleMACImportPolicyComboChange(); 127 126 128 127 private: … … 131 130 QString m_strFileName; 132 131 133 /** Holds the label instance. */134 QIRichTextLabel *m_pLabel ;132 /** Holds the description label instance. */ 133 QIRichTextLabel *m_pLabelDescription; 135 134 136 135 /** Holds the signature/certificate info label instance. */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageExpert.cpp
r91589 r91645 5 5 6 6 /* 7 * Copyright (C) 2009-202 0Oracle Corporation7 * Copyright (C) 2009-2021 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 23 23 #include <QLabel> 24 24 #include <QListWidget> 25 #include <QStacked Layout>25 #include <QStackedWidget> 26 26 #include <QTableWidget> 27 27 #include <QVBoxLayout> … … 64 64 if (m_pSourceLayout) 65 65 { 66 /* Prepare source selector: */66 /* Prepare source combo: */ 67 67 m_pSourceComboBox = new QIComboBox(m_pCntSource); 68 68 if (m_pSourceComboBox) 69 69 m_pSourceLayout->addWidget(m_pSourceComboBox, 0, 0); 70 70 71 /* Prepare s tacked layout: */72 m_pS tackedLayout = new QStackedLayout;73 if (m_pS tackedLayout)71 /* Prepare settings widget 1: */ 72 m_pSettingsWidget1 = new QStackedWidget(m_pCntSource); 73 if (m_pSettingsWidget1) 74 74 { 75 75 /* Prepare local container: */ 76 QWidget *p LocalContainer = new QWidget(m_pCntSource);77 if (p LocalContainer)76 QWidget *pContainerLocal = new QWidget(m_pSettingsWidget1); 77 if (pContainerLocal) 78 78 { 79 /* Prepare local containerlayout: */80 m_pLocalContainerLayout = new QGridLayout(p LocalContainer);79 /* Prepare local widget layout: */ 80 m_pLocalContainerLayout = new QGridLayout(pContainerLocal); 81 81 if (m_pLocalContainerLayout) 82 82 { … … 85 85 86 86 /* Prepare file-path selector: */ 87 m_pFileSelector = new UIEmptyFilePathSelector(p LocalContainer);87 m_pFileSelector = new UIEmptyFilePathSelector(pContainerLocal); 88 88 if (m_pFileSelector) 89 89 { … … 96 96 } 97 97 98 /* Add into layout: */99 m_pS tackedLayout->addWidget(pLocalContainer);98 /* Add into widget: */ 99 m_pSettingsWidget1->addWidget(pContainerLocal); 100 100 } 101 101 102 102 /* Prepare cloud container: */ 103 QWidget *pC loudContainer = new QWidget(m_pCntSource);104 if (pC loudContainer)103 QWidget *pContainerCloud = new QWidget(m_pSettingsWidget1); 104 if (pContainerCloud) 105 105 { 106 106 /* Prepare cloud container layout: */ 107 m_pCloudContainerLayout = new QGridLayout(pC loudContainer);107 m_pCloudContainerLayout = new QGridLayout(pContainerCloud); 108 108 if (m_pCloudContainerLayout) 109 109 { … … 111 111 m_pCloudContainerLayout->setRowStretch(1, 1); 112 112 113 /* Prepare sub-layout: */114 QHBoxLayout *p SubLayout= new QHBoxLayout;115 if (p SubLayout)116 { 117 p SubLayout->setContentsMargins(0, 0, 0, 0);118 p SubLayout->setSpacing(1);113 /* Prepare profile layout: */ 114 QHBoxLayout *pLayoutProfile = new QHBoxLayout; 115 if (pLayoutProfile) 116 { 117 pLayoutProfile->setContentsMargins(0, 0, 0, 0); 118 pLayoutProfile->setSpacing(1); 119 119 120 120 /* Prepare profile combo-box: */ 121 m_pProfileComboBox = new QIComboBox(pC loudContainer);121 m_pProfileComboBox = new QIComboBox(pContainerCloud); 122 122 if (m_pProfileComboBox) 123 p SubLayout->addWidget(m_pProfileComboBox);123 pLayoutProfile->addWidget(m_pProfileComboBox); 124 124 125 125 /* Prepare profile tool-button: */ 126 m_pProfileToolButton = new QIToolButton(pC loudContainer);126 m_pProfileToolButton = new QIToolButton(pContainerCloud); 127 127 if (m_pProfileToolButton) 128 128 { 129 129 m_pProfileToolButton->setIcon(UIIconPool::iconSet(":/cloud_profile_manager_16px.png", 130 130 ":/cloud_profile_manager_disabled_16px.png")); 131 p SubLayout->addWidget(m_pProfileToolButton);131 pLayoutProfile->addWidget(m_pProfileToolButton); 132 132 } 133 133 134 134 /* Add into layout: */ 135 m_pCloudContainerLayout->addLayout(p SubLayout, 0, 0);135 m_pCloudContainerLayout->addLayout(pLayoutProfile, 0, 0); 136 136 } 137 137 138 138 /* Create profile instances table: */ 139 m_pProfileInstanceList = new QListWidget(pC loudContainer);139 m_pProfileInstanceList = new QListWidget(pContainerCloud); 140 140 if (m_pProfileInstanceList) 141 141 { … … 152 152 } 153 153 154 /* Add into layout: */155 m_pS tackedLayout->addWidget(pCloudContainer);154 /* Add into widget: */ 155 m_pSettingsWidget1->addWidget(pContainerCloud); 156 156 } 157 157 158 158 /* Add into layout: */ 159 m_pSourceLayout->add Layout(m_pStackedLayout, 1, 0);159 m_pSourceLayout->addWidget(m_pSettingsWidget1, 1, 0); 160 160 } 161 161 } … … 169 169 if (m_pSettingsCnt) 170 170 { 171 /* Prepare settings containerlayout: */172 m_pSettingsCntLayout = new QStackedLayout(m_pSettingsCnt);173 if ( m_pSettingsCntLayout)171 /* Prepare settings layout: */ 172 QVBoxLayout *pLayoutSettings = new QVBoxLayout(m_pSettingsCnt); 173 if (pLayoutSettings) 174 174 { 175 /* Prepare appliance widget container: */176 QWidget *pApplianceWidgetCnt = new QWidget(m_pSettingsCnt);177 if ( pApplianceWidgetCnt)175 /* Prepare settings widget 2: */ 176 m_pSettingsWidget2 = new QStackedWidget(m_pSettingsCnt); 177 if (m_pSettingsWidget2) 178 178 { 179 /* Prepare appliance widget layout: */180 Q GridLayout *pApplianceWidgetLayout = new QGridLayout(pApplianceWidgetCnt);181 if (p ApplianceWidgetLayout)179 /* Prepare appliance container: */ 180 QWidget *pContainerAppliance = new QWidget(m_pSettingsCnt); 181 if (pContainerAppliance) 182 182 { 183 /* Prepare appliance widget: */184 m_pApplianceWidget = new UIApplianceImportEditorWidget(pApplianceWidgetCnt);185 if ( m_pApplianceWidget)183 /* Prepare appliance layout: */ 184 QGridLayout *pLayoutAppliance = new QGridLayout(pContainerAppliance); 185 if (pLayoutAppliance) 186 186 { 187 m_pApplianceWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); 188 pApplianceWidgetLayout->addWidget(m_pApplianceWidget, 0, 0, 1, 3); 187 /* Prepare appliance widget: */ 188 m_pApplianceWidget = new UIApplianceImportEditorWidget(pContainerAppliance); 189 if (m_pApplianceWidget) 190 { 191 m_pApplianceWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); 192 pLayoutAppliance->addWidget(m_pApplianceWidget, 0, 0, 1, 3); 193 } 194 195 /* Prepare import path label: */ 196 m_pLabelImportFilePath = new QLabel(pContainerAppliance); 197 if (m_pLabelImportFilePath) 198 { 199 m_pLabelImportFilePath->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 200 pLayoutAppliance->addWidget(m_pLabelImportFilePath, 1, 0); 201 } 202 /* Prepare import path selector: */ 203 m_pEditorImportFilePath = new UIFilePathSelector(pContainerAppliance); 204 if (m_pEditorImportFilePath) 205 { 206 m_pEditorImportFilePath->setResetEnabled(true); 207 m_pEditorImportFilePath->setDefaultPath(uiCommon().virtualBox().GetSystemProperties().GetDefaultMachineFolder()); 208 m_pEditorImportFilePath->setPath(uiCommon().virtualBox().GetSystemProperties().GetDefaultMachineFolder()); 209 m_pLabelImportFilePath->setBuddy(m_pEditorImportFilePath); 210 pLayoutAppliance->addWidget(m_pEditorImportFilePath, 1, 1, 1, 2); 211 } 212 213 /* Prepare MAC address policy label: */ 214 m_pLabelMACImportPolicy = new QLabel(pContainerAppliance); 215 if (m_pLabelMACImportPolicy) 216 { 217 m_pLabelMACImportPolicy->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 218 pLayoutAppliance->addWidget(m_pLabelMACImportPolicy, 2, 0); 219 } 220 /* Prepare MAC address policy combo: */ 221 m_pComboMACImportPolicy = new QIComboBox(pContainerAppliance); 222 if (m_pComboMACImportPolicy) 223 { 224 m_pComboMACImportPolicy->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); 225 m_pLabelMACImportPolicy->setBuddy(m_pComboMACImportPolicy); 226 pLayoutAppliance->addWidget(m_pComboMACImportPolicy, 2, 1, 1, 2); 227 } 228 229 /* Prepare additional options label: */ 230 m_pLabelAdditionalOptions = new QLabel(pContainerAppliance); 231 if (m_pLabelAdditionalOptions) 232 { 233 m_pLabelAdditionalOptions->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 234 pLayoutAppliance->addWidget(m_pLabelAdditionalOptions, 3, 0); 235 } 236 /* Prepare import HDs as VDIs checkbox: */ 237 m_pCheckboxImportHDsAsVDI = new QCheckBox(pContainerAppliance); 238 { 239 m_pCheckboxImportHDsAsVDI->setCheckState(Qt::Checked); 240 pLayoutAppliance->addWidget(m_pCheckboxImportHDsAsVDI, 3, 1); 241 } 189 242 } 190 243 191 /* Prepare path selector label: */ 192 m_pLabelImportFilePath = new QLabel(pApplianceWidgetCnt); 193 if (m_pLabelImportFilePath) 244 /* Add into layout: */ 245 m_pSettingsWidget2->addWidget(pContainerAppliance); 246 } 247 248 /* Prepare form editor container: */ 249 QWidget *pContainerFormEditor = new QWidget(m_pSettingsCnt); 250 if (pContainerFormEditor) 251 { 252 /* Prepare form editor layout: */ 253 QVBoxLayout *pLayoutFormEditor = new QVBoxLayout(pContainerFormEditor); 254 if (pLayoutFormEditor) 194 255 { 195 m_pLabelImportFilePath->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 196 pApplianceWidgetLayout->addWidget(m_pLabelImportFilePath, 1, 0); 256 /* Prepare form editor widget: */ 257 m_pFormEditor = new UIFormEditorWidget(pContainerFormEditor); 258 if (m_pFormEditor) 259 pLayoutFormEditor->addWidget(m_pFormEditor); 197 260 } 198 /* Prepare path selector editor: */ 199 m_pEditorImportFilePath = new UIFilePathSelector(pApplianceWidgetCnt); 200 if (m_pEditorImportFilePath) 201 { 202 m_pEditorImportFilePath->setResetEnabled(true); 203 m_pEditorImportFilePath->setDefaultPath(uiCommon().virtualBox().GetSystemProperties().GetDefaultMachineFolder()); 204 m_pEditorImportFilePath->setPath(uiCommon().virtualBox().GetSystemProperties().GetDefaultMachineFolder()); 205 m_pLabelImportFilePath->setBuddy(m_pEditorImportFilePath); 206 pApplianceWidgetLayout->addWidget(m_pEditorImportFilePath, 1, 1, 1, 2); 207 } 208 209 /* Prepare MAC address policy label: */ 210 m_pLabelMACImportPolicy = new QLabel(pApplianceWidgetCnt); 211 if (m_pLabelMACImportPolicy) 212 { 213 m_pLabelMACImportPolicy->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 214 pApplianceWidgetLayout->addWidget(m_pLabelMACImportPolicy, 2, 0); 215 } 216 /* Prepare MAC address policy combo: */ 217 m_pComboMACImportPolicy = new QComboBox(pApplianceWidgetCnt); 218 if (m_pComboMACImportPolicy) 219 { 220 m_pComboMACImportPolicy->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); 221 m_pLabelMACImportPolicy->setBuddy(m_pComboMACImportPolicy); 222 pApplianceWidgetLayout->addWidget(m_pComboMACImportPolicy, 2, 1, 1, 2); 223 } 224 225 /* Prepare additional options label: */ 226 m_pLabelAdditionalOptions = new QLabel(pApplianceWidgetCnt); 227 if (m_pLabelAdditionalOptions) 228 { 229 m_pLabelAdditionalOptions->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 230 pApplianceWidgetLayout->addWidget(m_pLabelAdditionalOptions, 3, 0); 231 } 232 /* Prepare import HDs as VDIs checkbox: */ 233 m_pCheckboxImportHDsAsVDI = new QCheckBox(pApplianceWidgetCnt); 234 { 235 m_pCheckboxImportHDsAsVDI->setCheckState(Qt::Checked); 236 pApplianceWidgetLayout->addWidget(m_pCheckboxImportHDsAsVDI, 3, 1); 237 } 261 262 /* Add into layout: */ 263 m_pSettingsWidget2->addWidget(pContainerFormEditor); 238 264 } 239 265 240 266 /* Add into layout: */ 241 m_pSettingsCntLayout->addWidget(pApplianceWidgetCnt); 242 } 243 244 /* Prepare form editor container: */ 245 QWidget *pFormEditorCnt = new QWidget(m_pSettingsCnt); 246 if (pFormEditorCnt) 247 { 248 /* Prepare form editor layout: */ 249 QVBoxLayout *pFormEditorLayout = new QVBoxLayout(pFormEditorCnt); 250 if (pFormEditorLayout) 251 { 252 /* Prepare form editor widget: */ 253 m_pFormEditor = new UIFormEditorWidget(pFormEditorCnt); 254 if (m_pFormEditor) 255 pFormEditorLayout->addWidget(m_pFormEditor); 256 } 257 258 /* Add into layout: */ 259 m_pSettingsCntLayout->addWidget(pFormEditorCnt); 267 pLayoutSettings->addWidget(m_pSettingsWidget2); 260 268 } 261 269 } … … 268 276 /* Setup connections: */ 269 277 connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigCloudProfileRegistered, 270 this, &UIWizardImportAppPageExpert::sltHandleSourceC hange);278 this, &UIWizardImportAppPageExpert::sltHandleSourceComboChange); 271 279 connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigCloudProfileChanged, 272 this, &UIWizardImportAppPageExpert::sltHandleSourceC hange);280 this, &UIWizardImportAppPageExpert::sltHandleSourceComboChange); 273 281 connect(m_pSourceComboBox, static_cast<void(QIComboBox::*)(int)>(&QIComboBox::activated), 274 this, &UIWizardImportAppPageExpert::sltHandleSourceC hange);282 this, &UIWizardImportAppPageExpert::sltHandleSourceComboChange); 275 283 connect(m_pFileSelector, &UIEmptyFilePathSelector::pathChanged, 276 this, &UIWizardImportAppPageExpert::slt FilePathChangeHandler);284 this, &UIWizardImportAppPageExpert::sltHandleImportedFileSelectorChange); 277 285 connect(m_pProfileComboBox, static_cast<void(QIComboBox::*)(int)>(&QIComboBox::currentIndexChanged), 278 286 this, &UIWizardImportAppPageExpert::sltHandleProfileComboChange); … … 282 290 this, &UIWizardImportAppPageExpert::sltHandleInstanceListChange); 283 291 connect(m_pEditorImportFilePath, &UIFilePathSelector::pathChanged, 284 this, &UIWizardImportAppPageExpert::sltHandle PathChanged);285 connect(m_pComboMACImportPolicy, static_cast<void(Q ComboBox::*)(int)>(&QComboBox::currentIndexChanged),286 this, &UIWizardImportAppPageExpert::sltHandleMACImportPolicyC hange);292 this, &UIWizardImportAppPageExpert::sltHandleImportPathEditorChange); 293 connect(m_pComboMACImportPolicy, static_cast<void(QIComboBox::*)(int)>(&QIComboBox::currentIndexChanged), 294 this, &UIWizardImportAppPageExpert::sltHandleMACImportPolicyComboChange); 287 295 288 296 /* Register fields: */ … … 307 315 m_pSourceComboBox->setItemText(0, UIWizardImportApp::tr("Local File System")); 308 316 m_pSourceComboBox->setItemData(0, UIWizardImportApp::tr("Import from local file system."), Qt::ToolTipRole); 317 309 318 /* Translate received values of Source combo-box. 310 319 * We are enumerating starting from 0 for simplicity: */ … … 417 426 418 427 /* Acquire appliance: */ 419 CAppliance comAppliance = qobject_cast<UIWizardImportApp*>(wizard())-> appliance();428 CAppliance comAppliance = qobject_cast<UIWizardImportApp*>(wizard())->localAppliance(); 420 429 if (comAppliance.isNotNull()) 421 430 { … … 423 432 m_pApplianceWidget->setAppliance(comAppliance); 424 433 /* Make sure we initialize appliance widget model with correct base folder path: */ 425 if (m_pEditorImportFilePath) 426 sltHandlePathChanged(m_pEditorImportFilePath->path()); 434 sltHandleImportPathEditorChange(); 427 435 } 428 436 } 429 437 430 438 bool UIWizardImportAppPageExpert::isComplete() const 431 {432 bool fResult = true;433 434 /* Check appliance settings: */435 if (fResult)436 {437 const bool fOVF = !isSourceCloudOne();438 const bool fCSP = !fOVF;439 440 fResult = ( fOVF441 && UICommon::hasAllowedExtension(m_pFileSelector->path().toLower(), OVFFileExts)442 && QFile::exists(m_pFileSelector->path())443 && qobject_cast<UIWizardImportApp*>(wizard())->isValid())444 || ( fCSP445 && !m_comCloudProfile.isNull()446 && !m_comCloudClient.isNull()447 && !machineId().isNull()448 && !m_comCloudAppliance.isNull()449 && !m_comVSDForm.isNull());450 }451 452 return fResult;453 }454 455 bool UIWizardImportAppPageExpert::validatePage()456 439 { 457 440 /* Initial result: */ 458 441 bool fResult = true; 459 442 443 /* Check whether there was cloud source selected: */ 444 if (isSourceCloudOne()) 445 fResult = m_comCloudAppliance.isNotNull() 446 && m_comVSDForm.isNotNull(); 447 else 448 fResult = qobject_cast<UIWizardImportApp*>(wizard())->isValid(); 449 450 /* Return result: */ 451 return fResult; 452 } 453 454 bool UIWizardImportAppPageExpert::validatePage() 455 { 456 /* Initial result: */ 457 bool fResult = true; 458 460 459 /* Lock finish button: */ 461 460 startProcessing(); 462 461 463 462 /* Check whether there was cloud source selected: */ 464 const bool fIsSourceCloudOne = fieldImp("isSourceCloudOne").toBool(); 465 if (fIsSourceCloudOne) 463 if (fieldImp("isSourceCloudOne").toBool()) 466 464 { 467 465 /* Make sure table has own data committed: */ … … 471 469 CVirtualSystemDescriptionForm comForm = fieldImp("vsdForm").value<CVirtualSystemDescriptionForm>(); 472 470 fResult = comForm.isNotNull(); 473 Assert(fResult);474 471 475 472 /* Give changed VSD back to appliance: */ … … 512 509 } 513 510 514 void UIWizardImportAppPageExpert::sltHandleSourceC hange()515 { 516 /* Update tool-tip: */511 void UIWizardImportAppPageExpert::sltHandleSourceComboChange() 512 { 513 /* Update combo tool-tip: */ 517 514 updateSourceComboToolTip(); 518 515 … … 524 521 populateFormProperties(); 525 522 refreshFormPropertiesTable(); 523 524 /* Notify about changes: */ 526 525 emit completeChanged(); 527 526 } 528 527 529 void UIWizardImportAppPageExpert::sltFilePathChangeHandler() 530 { 531 /* Check if specified file contains valid appliance: */ 532 if ( !QFile::exists(m_pFileSelector->path()) 533 || !qobject_cast<UIWizardImportApp*>(wizard())->setFile(m_pFileSelector->path())) 534 return; 535 /* Reset the modified bit afterwards: */ 536 m_pFileSelector->resetModified(); 528 void UIWizardImportAppPageExpert::sltHandleImportedFileSelectorChange() 529 { 530 /* Update local stuff (only if something changed): */ 531 if (m_pFileSelector->isModified()) 532 { 533 /* Create local appliance: */ 534 qobject_cast<UIWizardImportApp*>(wizard())->setFile(m_pFileSelector->path()); 535 m_pFileSelector->resetModified(); 536 } 537 537 538 538 /* Acquire appliance: */ 539 CAppliance comAppliance = qobject_cast<UIWizardImportApp*>(wizard())-> appliance();539 CAppliance comAppliance = qobject_cast<UIWizardImportApp*>(wizard())->localAppliance(); 540 540 /* Initialize appliance widget: */ 541 541 m_pApplianceWidget->setAppliance(comAppliance); 542 542 /* Make sure we initialize appliance widget model with correct base folder path: */ 543 if (m_pEditorImportFilePath)544 sltHandlePathChanged(m_pEditorImportFilePath->path()); 545 543 sltHandleImportPathEditorChange(); 544 545 /* Notify about changes: */ 546 546 emit completeChanged(); 547 547 } … … 554 554 populateFormProperties(); 555 555 refreshFormPropertiesTable(); 556 557 /* Notify about changes: */ 556 558 emit completeChanged(); 557 559 } … … 568 570 populateFormProperties(); 569 571 refreshFormPropertiesTable(); 572 573 /* Notify about changes: */ 570 574 emit completeChanged(); 571 575 } 572 576 573 void UIWizardImportAppPageExpert::sltHandlePathChanged(const QString &strNewPath) 574 { 575 m_pApplianceWidget->setVirtualSystemBaseFolder(strNewPath); 576 } 577 578 void UIWizardImportAppPageExpert::sltHandleMACImportPolicyChange() 577 void UIWizardImportAppPageExpert::sltHandleImportPathEditorChange() 578 { 579 AssertPtrReturnVoid(m_pApplianceWidget); 580 AssertPtrReturnVoid(m_pEditorImportFilePath); 581 m_pApplianceWidget->setVirtualSystemBaseFolder(m_pEditorImportFilePath->path()); 582 } 583 584 void UIWizardImportAppPageExpert::sltHandleMACImportPolicyComboChange() 579 585 { 580 586 updateMACImportPolicyComboToolTip(); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageExpert.h
r91589 r91645 5 5 6 6 /* 7 * Copyright (C) 2009-202 0Oracle Corporation7 * Copyright (C) 2009-2021 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 46 46 47 47 /** Constructs expert page. 48 * @param strFileName Brings appliance file name. */ 48 * @param fImportFromOCIByDefault Brings whether we should propose import from OCI by default. 49 * @param strFileName Brings appliance file name. */ 49 50 UIWizardImportAppPageExpert(bool fImportFromOCIByDefault, const QString &strFileName); 50 51 … … 57 58 58 59 /** Handles translation event. */ 59 virtual void retranslateUi() /* override */;60 virtual void retranslateUi() /* override final */; 60 61 61 62 /** Performs page initialization. */ 62 virtual void initializePage() /* override */;63 virtual void initializePage() /* override final */; 63 64 64 65 /** Returns whether page is complete. */ 65 virtual bool isComplete() const /* override */;66 virtual bool isComplete() const /* override final */; 66 67 67 68 /** Performs page validation. */ 68 virtual bool validatePage() /* override */;69 virtual bool validatePage() /* override final */; 69 70 70 71 /** Updates page appearance. */ 71 virtual void updatePageAppearance() /* override */;72 virtual void updatePageAppearance() /* override final */; 72 73 73 74 private slots: 74 75 75 /** Handles import sourcechange. */76 void sltHandleSourceC hange();76 /** Handles source combo change. */ 77 void sltHandleSourceComboChange(); 77 78 78 /** Handles file-path change. */ 79 void sltFilePathChangeHandler(); 80 81 /** Handles change in profile combo-box. */ 79 /** Handles imported file selector change. */ 80 void sltHandleImportedFileSelectorChange(); 81 /** Handles profile combo change. */ 82 82 void sltHandleProfileComboChange(); 83 83 /** Handles profile tool-button click. */ 84 84 void sltHandleProfileButtonClick(); 85 86 /** Handles change in instance list. */ 85 /** Handles instance list change. */ 87 86 void sltHandleInstanceListChange(); 88 87 89 /** Handles file path being changed to @a strNewPath. */90 void sltHandle PathChanged(const QString &strNewPath);88 /** Handles import path editor change. */ 89 void sltHandleImportPathEditorChange(); 91 90 92 /** Handles MAC address import policy c hanges. */93 void sltHandleMACImportPolicyC hange();91 /** Handles MAC address import policy combo changes. */ 92 void sltHandleMACImportPolicyComboChange(); 94 93 95 94 private:
Note:
See TracChangeset
for help on using the changeset viewer.