VirtualBox

Changeset 91664 in vbox


Ignore:
Timestamp:
Oct 11, 2021 3:43:02 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9996: UIWizardImportApp: Provide wizard with hint to open required cloud provider and profile if any of them is acquirable.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r91646 r91664  
    867867    /* Initialize variables: */
    868868#ifdef VBOX_WS_MAC
    869     const QString strTmpFile = ::darwinResolveAlias(strFileName);
     869    QString strTmpFile = ::darwinResolveAlias(strFileName);
    870870#else
    871     const QString strTmpFile = strFileName;
     871    QString strTmpFile = strFileName;
    872872#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    }
    873886
    874887    /* Lock the action preventing cascade calls: */
     
    880893    /* Use the "safe way" to open stack of Mac OS X Sheets: */
    881894    QWidget *pWizardParent = windowManager().realParentWindow(this);
    882     UINativeWizardPointer pWizard = new UIWizardImportApp(pWizardParent, false /* OCI by default? */, strTmpFile);
     895    UINativeWizardPointer pWizard = new UIWizardImportApp(pWizardParent, fOCIByDefault, strTmpFile);
    883896    windowManager().registerNewParent(pWizard, pWizardParent);
    884897    pWizard->exec();
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportApp.cpp

    r91646 r91664  
    278278        {
    279279            if (m_fImportFromOCIByDefault || m_strFileName.isEmpty())
    280                 addPage(new UIWizardImportAppPageBasic1(m_fImportFromOCIByDefault));
     280                addPage(new UIWizardImportAppPageBasic1(m_fImportFromOCIByDefault, m_strFileName));
    281281            addPage(new UIWizardImportAppPageBasic2(m_strFileName));
    282282            break;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.cpp

    r91646 r91664  
    4848*********************************************************************************************************************************/
    4949
    50 void UIWizardImportAppPage1::populateSources(QIComboBox *pCombo, bool fImportFromOCIByDefault)
     50void UIWizardImportAppPage1::populateSources(QIComboBox *pCombo,
     51                                             bool fImportFromOCIByDefault,
     52                                             const QString &strSource)
    5153{
    5254    /* Sanity check: */
     
    6466        /* Otherwise "OCI" or "local" should be the default one: */
    6567        if (fImportFromOCIByDefault)
    66             strOldData = "OCI";
     68            strOldData = strSource.isEmpty() ? "OCI" : strSource;
    6769        else
    6870            strOldData = "local";
     
    157159void UIWizardImportAppPage1::refreshProfileCombo(QIComboBox *pCombo,
    158160                                                 const QString &strSource,
     161                                                 const QString &strProfileName,
    159162                                                 bool fIsSourceCloudOne)
    160163{
     
    176179        if (pCombo->currentIndex() != -1)
    177180            strOldData = pCombo->currentData(ProfileData_Name).toString();
     181        else if (!strProfileName.isEmpty())
     182            strOldData = strProfileName;
    178183
    179184        /* Block signals while updating: */
     
    190195                continue;
    191196            /* Acquire profile name: */
    192             QString strProfileName;
    193             if (!cloudProfileName(comProfile, strProfileName, pParent))
     197            QString strCurrentProfileName;
     198            if (!cloudProfileName(comProfile, strCurrentProfileName, pParent))
    194199                continue;
    195200
    196201            /* Compose item, fill it's data: */
    197             pCombo->addItem(strProfileName);
    198             pCombo->setItemData(pCombo->count() - 1, strProfileName, ProfileData_Name);
     202            pCombo->addItem(strCurrentProfileName);
     203            pCombo->setItemData(pCombo->count() - 1, strCurrentProfileName, ProfileData_Name);
    199204        }
    200205
     
    405410*********************************************************************************************************************************/
    406411
    407 UIWizardImportAppPageBasic1::UIWizardImportAppPageBasic1(bool fImportFromOCIByDefault)
     412UIWizardImportAppPageBasic1::UIWizardImportAppPageBasic1(bool fImportFromOCIByDefault, const QString &strFileName)
    408413    : m_fImportFromOCIByDefault(fImportFromOCIByDefault)
     414    , m_strFileName(strFileName)
    409415    , m_pLabelMain(0)
    410416    , m_pLabelDescription(0)
     
    593599    connect(m_pProfileInstanceList, &QListWidget::currentRowChanged,
    594600            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    }
    595614}
    596615
     
    691710{
    692711    /* Populate sources: */
    693     populateSources(m_pSourceComboBox, m_fImportFromOCIByDefault);
     712    populateSources(m_pSourceComboBox,
     713                    m_fImportFromOCIByDefault,
     714                    m_strSource);
    694715    /* Translate page: */
    695716    retranslateUi();
     
    764785    refreshProfileCombo(m_pProfileComboBox,
    765786                        source(m_pSourceComboBox),
     787                        m_strProfileName,
    766788                        wizard()->isSourceCloudOne());
    767789
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.h

    r91646 r91664  
    5757    /** Populates sources. */
    5858    void populateSources(QIComboBox *pCombo,
    59                          bool fImportFromOCIByDefault);
     59                         bool fImportFromOCIByDefault,
     60                         const QString &strSource);
    6061
    6162    /** Returns current source of @a pCombo specified. */
     
    7172    void refreshProfileCombo(QIComboBox *pCombo,
    7273                             const QString &strSource,
     74                             const QString &strProfileName,
    7375                             bool fIsSourceCloudOne);
    7476    /** Refresh profile instances. */
     
    107109
    108110    /** 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);
    111114
    112115protected:
     
    145148
    146149    /** 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;
    148158
    149159    /** Holds the main label instance. */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageExpert.cpp

    r91646 r91664  
    324324    connect(m_pCheckboxImportHDsAsVDI, &QCheckBox::stateChanged,
    325325            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    }
    326339}
    327340
     
    399412    m_pToolBox->setCurrentPage(0);
    400413    /* Populate sources: */
    401     populateSources(m_pSourceComboBox, m_fImportFromOCIByDefault);
     414    populateSources(m_pSourceComboBox,
     415                    m_fImportFromOCIByDefault,
     416                    m_strSource);
    402417    /* Translate page: */
    403418    retranslateUi();
     
    471486    /* If we have file name passed,
    472487     * check if specified file contains valid appliance: */
    473     if (   !m_strFileName.isEmpty()
     488    if (   !m_fImportFromOCIByDefault
     489        && !m_strFileName.isEmpty()
    474490        && !wizard()->setFile(m_strFileName))
    475491    {
     
    513529    refreshProfileCombo(m_pProfileComboBox,
    514530                        source(m_pSourceComboBox),
     531                        m_strProfileName,
    515532                        wizard()->isSourceCloudOne());
    516533    sltHandleProfileComboChange();
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageExpert.h

    r91646 r91664  
    101101    QString  m_strFileName;
    102102
     103    /** Holds the cached source. */
     104    QString  m_strSource;
     105    /** Holds the cached profile name. */
     106    QString  m_strProfileName;
     107
    103108    /** Holds the tool-box instance. */
    104109    UIToolBox *m_pToolBox;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette