VirtualBox

Changeset 90727 in vbox


Ignore:
Timestamp:
Aug 18, 2021 4:09:34 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9996: Extend UINativeWizard with interface to show/hide/advance own progress-bar via corresponding signals.

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

Legend:

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

    r90712 r90727  
    2020#include <QLabel>
    2121#include <QPainter>
     22#include <QProgressBar>
    2223#include <QPushButton>
    2324#include <QStackedWidget>
     
    100101    , m_pLabelPageTitle(0)
    101102    , m_pWidgetStack(0)
     103    , m_pProgressStack(0)
     104    , m_pProgressBar(0)
    102105{
    103106    prepare();
     
    153156    connect(pPage, &UINativeWizardPage::completeChanged,
    154157            this, &UINativeWizard::sltCompleteChanged);
     158    connect(pPage, &UINativeWizardPage::sigProgressStarted,
     159            this, &UINativeWizard::sltHandleProgressStarted);
     160    connect(pPage, &UINativeWizardPage::sigProgressChange,
     161            this, &UINativeWizard::sltHandleProgressChange);
     162    connect(pPage, &UINativeWizardPage::sigProgressFinished,
     163            this, &UINativeWizard::sltHandleProgressFinished);
    155164
    156165    /* Returns added page index: */
     
    272281    AssertMsgReturnVoid(pButtonNext, ("No Next wizard button found!\n"));
    273282    pButtonNext->setEnabled(pPage->isComplete());
     283}
     284
     285void UINativeWizard::sltHandleProgressStarted()
     286{
     287    m_pProgressStack->setCurrentIndex(1);
     288}
     289
     290void UINativeWizard::sltHandleProgressChange(ulong uPercent)
     291{
     292    m_pProgressBar->setMinimum(0);
     293    m_pProgressBar->setValue(uPercent);
     294    m_pProgressBar->setMaximum(100);
     295}
     296
     297void UINativeWizard::sltHandleProgressFinished()
     298{
     299    m_pProgressStack->setCurrentIndex(0);
    274300}
    275301
     
    467493                        pLayoutBottom->addWidget(pButton);
    468494                    if (enmType == WizardButtonType_Help)
    469                         pLayoutBottom->addStretch(1);
     495                    {
     496                        /* Prepare progress-stack: */
     497                        m_pProgressStack = new QStackedWidget(pWidgetBottom);
     498                        if (m_pProgressStack)
     499                        {
     500                            /* Prepare stretch: */
     501                            QWidget *pStretch = new QWidget(m_pProgressStack);
     502                            if (pStretch)
     503                                m_pProgressStack->addWidget(pStretch);
     504
     505                            /* Prepare progress-bar: */
     506                            m_pProgressBar = new QProgressBar(m_pProgressStack);
     507                            if (m_pProgressBar)
     508                            {
     509                                m_pProgressBar->setMaximum(0);
     510                                m_pProgressStack->addWidget(m_pProgressBar);
     511                            }
     512
     513                            /* Add to layout: */
     514                            pLayoutBottom->addWidget(m_pProgressStack);
     515                        }
     516                    }
    470517                    if (   pButton
    471518                        && enmType == WizardButtonType_Next)
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/UINativeWizard.h

    r90069 r90727  
    3333/* Forward declarations: */
    3434class QLabel;
     35class QProgressBar;
    3536class QPushButton;
    3637class QStackedWidget;
     
    128129    void sltCompleteChanged();
    129130
     131    /** Handles signal about progress has started. */
     132    void sltHandleProgressStarted();
     133    /** Handles signal about progress changed.
     134      * @param  uPercent  Brings the progress percentage. */
     135    void sltHandleProgressChange(ulong uPercent);
     136    /** Handles signal about progress has finished. */
     137    void sltHandleProgressFinished();
     138
    130139    /** Toggles between basic and expert modes. */
    131140    void sltExpert();
     
    178187    /** Holds the widget-stack instance. */
    179188    QStackedWidget                       *m_pWidgetStack;
     189    /** Holds the progress-stack instance. */
     190    QStackedWidget                       *m_pProgressStack;
     191    /** Holds the progress-bar instance. */
     192    QProgressBar                         *m_pProgressBar;
    180193    /** Holds button instance map. */
    181194    QMap<WizardButtonType, QPushButton*>  m_buttons;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/UINativeWizardPage.h

    r89960 r90727  
    3939    void completeChanged();
    4040
     41    /** Notifies listeners about progress has started. */
     42    void sigProgressStarted();
     43    /** Notifies listeners about progress has changed.
     44      * @param  uPercent  Brings the progress percentage. */
     45    void sigProgressChange(ulong uPercent);
     46    /** Notifies listeners about progress has finished. */
     47    void sigProgressFinished();
     48
    4149public:
    4250
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