Changeset 91664 in vbox
- Timestamp:
- Oct 11, 2021 3:43:02 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
-
manager/UIVirtualBoxManager.cpp (modified) (2 diffs)
-
wizards/importappliance/UIWizardImportApp.cpp (modified) (1 diff)
-
wizards/importappliance/UIWizardImportAppPageBasic1.cpp (modified) (9 diffs)
-
wizards/importappliance/UIWizardImportAppPageBasic1.h (modified) (4 diffs)
-
wizards/importappliance/UIWizardImportAppPageExpert.cpp (modified) (4 diffs)
-
wizards/importappliance/UIWizardImportAppPageExpert.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r91646 r91664 867 867 /* Initialize variables: */ 868 868 #ifdef VBOX_WS_MAC 869 constQString strTmpFile = ::darwinResolveAlias(strFileName);869 QString strTmpFile = ::darwinResolveAlias(strFileName); 870 870 #else 871 constQString strTmpFile = strFileName;871 QString strTmpFile = strFileName; 872 872 #endif 873 874 /* If there is no file-name passed, 875 * check if cloud stuff focused currently: */ 876 bool fOCIByDefault = false; 877 if ( strTmpFile.isEmpty() 878 && ( m_pWidget->isSingleCloudProviderGroupSelected() 879 || m_pWidget->isSingleCloudProfileGroupSelected() 880 || m_pWidget->isCloudMachineItemSelected())) 881 { 882 /* We can generate cloud hints as well: */ 883 fOCIByDefault = true; 884 strTmpFile = m_pWidget->fullGroupName(); 885 } 873 886 874 887 /* Lock the action preventing cascade calls: */ … … 880 893 /* Use the "safe way" to open stack of Mac OS X Sheets: */ 881 894 QWidget *pWizardParent = windowManager().realParentWindow(this); 882 UINativeWizardPointer pWizard = new UIWizardImportApp(pWizardParent, f alse /* OCI by default? */, strTmpFile);895 UINativeWizardPointer pWizard = new UIWizardImportApp(pWizardParent, fOCIByDefault, strTmpFile); 883 896 windowManager().registerNewParent(pWizard, pWizardParent); 884 897 pWizard->exec(); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportApp.cpp
r91646 r91664 278 278 { 279 279 if (m_fImportFromOCIByDefault || m_strFileName.isEmpty()) 280 addPage(new UIWizardImportAppPageBasic1(m_fImportFromOCIByDefault ));280 addPage(new UIWizardImportAppPageBasic1(m_fImportFromOCIByDefault, m_strFileName)); 281 281 addPage(new UIWizardImportAppPageBasic2(m_strFileName)); 282 282 break; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.cpp
r91646 r91664 48 48 *********************************************************************************************************************************/ 49 49 50 void UIWizardImportAppPage1::populateSources(QIComboBox *pCombo, bool fImportFromOCIByDefault) 50 void UIWizardImportAppPage1::populateSources(QIComboBox *pCombo, 51 bool fImportFromOCIByDefault, 52 const QString &strSource) 51 53 { 52 54 /* Sanity check: */ … … 64 66 /* Otherwise "OCI" or "local" should be the default one: */ 65 67 if (fImportFromOCIByDefault) 66 strOldData = "OCI";68 strOldData = strSource.isEmpty() ? "OCI" : strSource; 67 69 else 68 70 strOldData = "local"; … … 157 159 void UIWizardImportAppPage1::refreshProfileCombo(QIComboBox *pCombo, 158 160 const QString &strSource, 161 const QString &strProfileName, 159 162 bool fIsSourceCloudOne) 160 163 { … … 176 179 if (pCombo->currentIndex() != -1) 177 180 strOldData = pCombo->currentData(ProfileData_Name).toString(); 181 else if (!strProfileName.isEmpty()) 182 strOldData = strProfileName; 178 183 179 184 /* Block signals while updating: */ … … 190 195 continue; 191 196 /* Acquire profile name: */ 192 QString str ProfileName;193 if (!cloudProfileName(comProfile, str ProfileName, pParent))197 QString strCurrentProfileName; 198 if (!cloudProfileName(comProfile, strCurrentProfileName, pParent)) 194 199 continue; 195 200 196 201 /* Compose item, fill it's data: */ 197 pCombo->addItem(str ProfileName);198 pCombo->setItemData(pCombo->count() - 1, str ProfileName, ProfileData_Name);202 pCombo->addItem(strCurrentProfileName); 203 pCombo->setItemData(pCombo->count() - 1, strCurrentProfileName, ProfileData_Name); 199 204 } 200 205 … … 405 410 *********************************************************************************************************************************/ 406 411 407 UIWizardImportAppPageBasic1::UIWizardImportAppPageBasic1(bool fImportFromOCIByDefault )412 UIWizardImportAppPageBasic1::UIWizardImportAppPageBasic1(bool fImportFromOCIByDefault, const QString &strFileName) 408 413 : m_fImportFromOCIByDefault(fImportFromOCIByDefault) 414 , m_strFileName(strFileName) 409 415 , m_pLabelMain(0) 410 416 , m_pLabelDescription(0) … … 593 599 connect(m_pProfileInstanceList, &QListWidget::currentRowChanged, 594 600 this, &UIWizardImportAppPageBasic1::completeChanged); 601 602 /* Parse passed full group name if any: */ 603 if ( m_fImportFromOCIByDefault 604 && !m_strFileName.isEmpty()) 605 { 606 const QString strProviderShortName = m_strFileName.section('/', 1, 1); 607 const QString strProfileName = m_strFileName.section('/', 2, 2); 608 if (!strProviderShortName.isEmpty() && !strProfileName.isEmpty()) 609 { 610 m_strSource = strProviderShortName; 611 m_strProfileName = strProfileName; 612 } 613 } 595 614 } 596 615 … … 691 710 { 692 711 /* Populate sources: */ 693 populateSources(m_pSourceComboBox, m_fImportFromOCIByDefault); 712 populateSources(m_pSourceComboBox, 713 m_fImportFromOCIByDefault, 714 m_strSource); 694 715 /* Translate page: */ 695 716 retranslateUi(); … … 764 785 refreshProfileCombo(m_pProfileComboBox, 765 786 source(m_pSourceComboBox), 787 m_strProfileName, 766 788 wizard()->isSourceCloudOne()); 767 789 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.h
r91646 r91664 57 57 /** Populates sources. */ 58 58 void populateSources(QIComboBox *pCombo, 59 bool fImportFromOCIByDefault); 59 bool fImportFromOCIByDefault, 60 const QString &strSource); 60 61 61 62 /** Returns current source of @a pCombo specified. */ … … 71 72 void refreshProfileCombo(QIComboBox *pCombo, 72 73 const QString &strSource, 74 const QString &strProfileName, 73 75 bool fIsSourceCloudOne); 74 76 /** Refresh profile instances. */ … … 107 109 108 110 /** Constructs 1st basic page. 109 * @param fImportFromOCIByDefault Brings whether we should propose import from OCI by default. */ 110 UIWizardImportAppPageBasic1(bool fImportFromOCIByDefault); 111 * @param fImportFromOCIByDefault Brings whether we should propose import from OCI by default. 112 * @param strFileName Brings appliance file name. */ 113 UIWizardImportAppPageBasic1(bool fImportFromOCIByDefault, const QString &strFileName); 111 114 112 115 protected: … … 145 148 146 149 /** Holds whether default source should be Import from OCI. */ 147 bool m_fImportFromOCIByDefault; 150 bool m_fImportFromOCIByDefault; 151 /** Handles the appliance file name. */ 152 QString m_strFileName; 153 154 /** Holds the cached source. */ 155 QString m_strSource; 156 /** Holds the cached profile name. */ 157 QString m_strProfileName; 148 158 149 159 /** Holds the main label instance. */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageExpert.cpp
r91646 r91664 324 324 connect(m_pCheckboxImportHDsAsVDI, &QCheckBox::stateChanged, 325 325 this, &UIWizardImportAppPageExpert::sltHandleImportHDsAsVDICheckBoxChange); 326 327 /* Parse passed full group name if any: */ 328 if ( m_fImportFromOCIByDefault 329 && !m_strFileName.isEmpty()) 330 { 331 const QString strProviderShortName = m_strFileName.section('/', 1, 1); 332 const QString strProfileName = m_strFileName.section('/', 2, 2); 333 if (!strProviderShortName.isEmpty() && !strProfileName.isEmpty()) 334 { 335 m_strSource = strProviderShortName; 336 m_strProfileName = strProfileName; 337 } 338 } 326 339 } 327 340 … … 399 412 m_pToolBox->setCurrentPage(0); 400 413 /* Populate sources: */ 401 populateSources(m_pSourceComboBox, m_fImportFromOCIByDefault); 414 populateSources(m_pSourceComboBox, 415 m_fImportFromOCIByDefault, 416 m_strSource); 402 417 /* Translate page: */ 403 418 retranslateUi(); … … 471 486 /* If we have file name passed, 472 487 * check if specified file contains valid appliance: */ 473 if ( !m_strFileName.isEmpty() 488 if ( !m_fImportFromOCIByDefault 489 && !m_strFileName.isEmpty() 474 490 && !wizard()->setFile(m_strFileName)) 475 491 { … … 513 529 refreshProfileCombo(m_pProfileComboBox, 514 530 source(m_pSourceComboBox), 531 m_strProfileName, 515 532 wizard()->isSourceCloudOne()); 516 533 sltHandleProfileComboChange(); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageExpert.h
r91646 r91664 101 101 QString m_strFileName; 102 102 103 /** Holds the cached source. */ 104 QString m_strSource; 105 /** Holds the cached profile name. */ 106 QString m_strProfileName; 107 103 108 /** Holds the tool-box instance. */ 104 109 UIToolBox *m_pToolBox;
Note:
See TracChangeset
for help on using the changeset viewer.

