VirtualBox

Ignore:
Timestamp:
May 6, 2015 4:38:21 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
100100
Message:

FE/Qt: Progress-dialog: Make sure wrapped CProgress is completed upon the progress-dialog destruction.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/widgets
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.cpp

    r55305 r55696  
    133133}
    134134
     135UIProgressDialog::~UIProgressDialog()
     136{
     137    /* Wait for CProgress to complete: */
     138    m_progress.WaitForCompletion(-1);
     139    /* Call the timer event handling delegate: */
     140    handleTimerEvent();
     141}
     142
    135143void UIProgressDialog::retranslateUi()
    136144{
     
    202210}
    203211
    204 void UIProgressDialog::timerEvent(QTimerEvent* /* pEvent */)
     212void UIProgressDialog::timerEvent(QTimerEvent*)
     213{
     214    /* Call the timer event handling delegate: */
     215    handleTimerEvent();
     216}
     217
     218void UIProgressDialog::closeEvent(QCloseEvent *pEvent)
     219{
     220    if (m_fCancelEnabled)
     221        sltCancelOperation();
     222    else
     223        pEvent->ignore();
     224}
     225
     226void UIProgressDialog::sltCancelOperation()
     227{
     228    m_pCancelBtn->setEnabled(false);
     229    m_progress.Cancel();
     230}
     231
     232void UIProgressDialog::handleTimerEvent()
    205233{
    206234    /* We should hide progress-dialog
     
    315343}
    316344
    317 void UIProgressDialog::closeEvent(QCloseEvent *pEvent)
    318 {
    319     if (m_fCancelEnabled)
    320         sltCancelOperation();
    321     else
    322         pEvent->ignore();
    323 }
    324 
    325 void UIProgressDialog::sltCancelOperation()
    326 {
    327     m_pCancelBtn->setEnabled(false);
    328     m_progress.Cancel();
    329 }
    330 
    331345
    332346UIProgress::UIProgress(CProgress &progress, QObject *pParent /* = 0 */)
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.h

    r55401 r55696  
    4949public:
    5050
    51     /* Constructor/destructor: */
     51    /** Constructor. */
    5252    UIProgressDialog(CProgress &progress, const QString &strTitle,
    5353                     QPixmap *pImage = 0, int cMinDuration = 2000, QWidget *pParent = 0);
     54    /** Destructor. */
     55    ~UIProgressDialog();
    5456
    5557    /* API: Run stuff: */
     
    7981
    8082private:
     83
     84    /** Timer event handling delegate. */
     85    void handleTimerEvent();
    8186
    8287    /* Variables: */
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