VirtualBox

Changeset 93659 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 8, 2022 2:53:08 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10193. Some fixes in clone vm wizard. Plus some changes in UINativeWizard so that we can dynamically update label of 'Next' button to 'Finish' and vice versa.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/UINativeWizard.cpp

    r93235 r93659  
    143143    else
    144144        m_invisiblePages.insert(iIndex);
     145    /* Update the button labels since the last visible page might have changed. Thus 'Next' <-> 'Finish' might be needed: */
     146    retranslateUi();
    145147}
    146148
     
    210212    QPushButton *pButtonNext = wizardButton(WizardButtonType_Next);
    211213    AssertMsgReturnVoid(pButtonNext, ("No Next wizard button found!\n"));
    212     if (m_pWidgetStack && m_pWidgetStack->currentIndex() < m_pWidgetStack->count() - 1)
     214    if (!isLastVisiblePage(m_pWidgetStack->currentIndex()))
    213215    {
    214216        pButtonNext->setText(tr("&Next"));
     
    720722    m_pLabelPixmap->setPixmap(pixmapNew);
    721723}
     724
     725bool UINativeWizard::isLastVisiblePage(int iPageIndex) const
     726{
     727    if (!m_pWidgetStack)
     728        return false;
     729    if (iPageIndex == -1)
     730        return false;
     731    /* The page itself is not visible: */
     732    if (m_invisiblePages.contains(iPageIndex))
     733        return false;
     734    bool fLastVisible = true;
     735    /* Look at the page coming after the page with @p iPageIndex and check if they are visible: */
     736    for (int i = iPageIndex + 1; i < m_pWidgetStack->count(); ++i)
     737    {
     738        if (!m_invisiblePages.contains(i))
     739        {
     740            fLastVisible = false;
     741            break;
     742        }
     743    }
     744    return fLastVisible;
     745}
     746
    722747#endif /* !VBOX_WS_MAC */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/UINativeWizard.h

    r93115 r93659  
    173173    void assignWatermark();
    174174#endif
     175    /** Checks if the pages coming after the page with iPageIndex is visible or not. Returns true if
     176      * page with iPageIndex is the last visible page of the wizard. Returns false otherwise. */
     177    bool isLastVisiblePage(int iPageIndex) const;
    175178
    176179    /** Holds the wizard type. */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVM.cpp

    r93115 r93659  
    134134}
    135135
     136bool UIWizardCloneVM::machineHasSnapshot() const
     137{
     138    AssertReturn(!m_machine.isNull(), false);
     139    return m_machine.GetSnapshotCount() > 0;
     140}
     141
    136142bool UIWizardCloneVM::cloneVM()
    137143{
     
    235241            addPage(new UIWizardCloneVMNamePathPage(m_strCloneName, strDefaultMachineFolder, m_strGroup));
    236242            addPage(new UIWizardCloneVMTypePage(m_snapshot.isNull()));
    237             if (m_machine.GetSnapshotCount() > 0)
     243            if (machineHasSnapshot())
    238244                m_iCloneModePageIndex = addPage(new UIWizardCloneVMModePage(m_snapshot.isNull() ? false : m_snapshot.GetChildrenCount() > 0));
    239245            break;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVM.h

    r93115 r93659  
    4343    /** Clone VM stuff. */
    4444    bool cloneVM();
     45    bool machineHasSnapshot() const;
    4546
    4647    /** @name Parameter setter/getters
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMExpertPage.cpp

    r93115 r93659  
    8080                this, &UIWizardCloneVMExpertPage::sltKeepHardwareUUIDsToggled);
    8181    }
    82 
    8382    retranslateUi();
    8483}
     
    118117    if (m_pCloneModeGroupBox)
    119118        pWizard->setCloneMode(m_pCloneModeGroupBox->cloneMode());
     119
     120    if (m_pCloneModeGroupBox)
     121        m_pCloneModeGroupBox->setEnabled(pWizard->machineHasSnapshot());
    120122
    121123    retranslateUi();
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