VirtualBox

Changeset 91341 in vbox for trunk/src


Ignore:
Timestamp:
Sep 23, 2021 7:18:29 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
147008
Message:

FE/Qt: bugref:9340. Make sure newly created VISO is selected even if UICommon::sigMediumCreated is not emitted.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp

    r91216 r91341  
    17131713
    17141714
    1715 void UICommon::openMediumCreatorDialog(QWidget *pParent, UIMediumDeviceType enmMediumType,
     1715QUuid UICommon::openMediumCreatorDialog(QWidget *pParent, UIMediumDeviceType enmMediumType,
    17161716                                       const QString &strDefaultFolder /* = QString() */,
    17171717                                       const QString &strMachineName /* = QString() */,
     
    17231723    {
    17241724        case UIMediumDeviceType_HardDisk:
    1725             createVDWithWizard(pParent, strDefaultFolder, strMachineName, strMachineGuestOSTypeId);
     1725            uMediumId = createVDWithWizard(pParent, strDefaultFolder, strMachineName, strMachineGuestOSTypeId);
    17261726            break;
    17271727        case UIMediumDeviceType_DVD:
     
    17351735    }
    17361736    if (uMediumId.isNull())
    1737         return;
     1737        return QUuid();
    17381738
    17391739    /* Update the recent medium list only if the medium type is DVD or floppy: */
    17401740    if (enmMediumType == UIMediumDeviceType_DVD || enmMediumType == UIMediumDeviceType_Floppy)
    17411741        updateRecentlyUsedMediumListAndFolder(enmMediumType, medium(uMediumId).location());
     1742    return uMediumId;
    17421743}
    17431744
     
    18891890}
    18901891
    1891 void UICommon::createVDWithWizard(QWidget *pParent,
    1892                                   const QString &strMachineFolder /* = QString() */,
    1893                                   const QString &strMachineName /* = QString() */,
    1894                                   const QString &strMachineGuestOSTypeId  /* = QString() */)
     1892QUuid UICommon::createVDWithWizard(QWidget *pParent,
     1893                                   const QString &strMachineFolder /* = QString() */,
     1894                                   const QString &strMachineName /* = QString() */,
     1895                                   const QString &strMachineGuestOSTypeId  /* = QString() */)
    18951896{
    18961897    /* Initialize variables: */
     
    19131914                                                         comGuestOSType.GetRecommendedHDD());
    19141915    if (!pWizard)
    1915         return;
     1916        return QUuid();
    19161917    QWidget *pDialogParent = windowManager().realParentWindow(pParent);
    19171918    windowManager().registerNewParent(pWizard, pDialogParent);
     1919    QUuid mediumId = pWizard->mediumId();
    19181920    pWizard->exec();
    19191921    delete pWizard;
     1922    return mediumId;
    19201923}
    19211924
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h

    r91125 r91341  
    424424          * @param  strMachineFolder         Passes the machine folder,
    425425          * @param  strMachineGuestOSTypeId  Passes the type ID of machine's guest os,
    426           * @param  fEnableCreate            Passes whether to show/enable create action in the medium selector dialog. */
    427         void openMediumCreatorDialog(QWidget *pParent, UIMediumDeviceType  enmMediumType,
    428                                      const QString &strMachineFolder = QString(),
    429                                      const QString &strMachineName = QString(),
    430                                      const QString &strMachineGuestOSTypeId = QString());
     426          * @param  fEnableCreate            Passes whether to show/enable create action in the medium selector dialog,
     427          * returns QUuid of the new medium */
     428        QUuid openMediumCreatorDialog(QWidget *pParent, UIMediumDeviceType  enmMediumType,
     429                                      const QString &strMachineFolder = QString(),
     430                                      const QString &strMachineName = QString(),
     431                                      const QString &strMachineGuestOSTypeId = QString());
    431432
    432433        /** Prepares storage menu according passed parameters.
     
    622623          * @param  strMachineFolder          Passes the machine folder,
    623624          * @param  strMachineName            Passes the name of the machine,
    624           * @param  strMachineGuestOSTypeId   Passes the string of machine's guest OS type ID. */
    625         void createVDWithWizard(QWidget *pParent,
    626                                 const QString &strMachineFolder = QString(),
    627                                 const QString &strMachineName = QString(),
    628                                 const QString &strMachineGuestOSTypeId = QString());
     625          * @param  strMachineGuestOSTypeId   Passes the string of machine's guest OS type ID,
     626          * returns QUuid of the created medium. */
     627        QUuid createVDWithWizard(QWidget *pParent,
     628                                 const QString &strMachineFolder = QString(),
     629                                 const QString &strMachineName = QString(),
     630                                 const QString &strMachineGuestOSTypeId = QString());
    629631    /** @} */
    630632
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp

    r91109 r91341  
    449449void UIMediumSelector::sltCreateMedium()
    450450{
    451     uiCommon().openMediumCreatorDialog(this, m_enmMediumType, m_strMachineFolder,
    452                                        m_strMachineName, m_strMachineGuestOSTypeId);
     451    QUuid uMediumId = uiCommon().openMediumCreatorDialog(this, m_enmMediumType, m_strMachineFolder,
     452                                                         m_strMachineName, m_strMachineGuestOSTypeId);
     453    /* Make sure that the data structure is updated and newly created medium is selected and visible: */
     454    sltHandleMediumCreated(uMediumId);
    453455}
    454456
     
    468470void UIMediumSelector::sltHandleMediumCreated(const QUuid &uMediumId)
    469471{
     472    if (uMediumId.isNull())
     473        return;
    470474    /* Update the tree widget making sure we show the new item: */
    471475    repopulateTreeWidget();
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp

    r91061 r91341  
    8888}
    8989
     90QUuid UIWizardNewVD::mediumId() const
     91{
     92    return m_uMediumId;
     93}
     94
    9095void UIWizardNewVD::populatePages()
    9196{
     
    143148    connect(pNotification, &UINotificationProgressMediumCreate::sigMediumCreated,
    144149            &uiCommon(), &UICommon::sltHandleMediumCreated);
     150
     151    m_uMediumId = comVirtualDisk.GetId();
     152
    145153    gpNotificationCenter->append(pNotification);
    146154
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.h

    r91061 r91341  
    5656       qulonglong mediumSize() const;
    5757       void setMediumSize(qulonglong mediumSize);
     58
     59       QUuid mediumId() const;
    5860    /** @} */
    5961
     
    7577    qulonglong  m_uDefaultSize;
    7678    int m_iMediumVariantPageIndex;
     79    QUuid m_uMediumId;
    7780};
    7881
Note: See TracChangeset for help on using the changeset viewer.

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