VirtualBox

Changeset 20594 in vbox


Ignore:
Timestamp:
Jun 15, 2009 2:46:15 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: 4008: GUI modal lock up on starting VM on Solaris with a warning - Should be fixed.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxProgressDialog.h

    r20265 r20594  
    5353
    5454public:
     55
    5556    VBoxProgressDialog (CProgress &aProgress, const QString &aTitle,
    56                         int aMinDuration = 2000, QWidget *aParent = NULL);
     57                        int aMinDuration = 2000, QWidget *aParent = 0);
    5758
    5859    int run (int aRefreshInterval);
     
    6061
    6162protected:
     63
    6264    virtual void retranslateUi();
    6365
    6466    virtual void reject();
     67
    6568    virtual void timerEvent (QTimerEvent *aEvent);
    6669    virtual void closeEvent (QCloseEvent *aEvent);
    6770
    6871private slots:
     72
     73    void showDialog();
    6974    void cancelOperation();
    7075
    7176private:
     77
    7278    /* Private member vars */
    7379    CProgress &mProgress;
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp

    r20123 r20594  
    249249    int aMinDuration)
    250250{
    251     QApplication::setOverrideCursor (QCursor (Qt::WaitCursor));
    252 
    253     VBoxProgressDialog progressDlg (aProgress, aTitle, aMinDuration,
    254                                     aParent);
     251    VBoxProgressDialog progressDlg (aProgress, aTitle, aMinDuration, aParent);
    255252
    256253    /* run the dialog with the 100 ms refresh interval */
    257254    progressDlg.run (100);
    258 
    259     QApplication::restoreOverrideCursor();
    260255
    261256    return true;
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxProgressDialog.cpp

    r20469 r20594  
    2222
    2323/* VBox includes */
     24#include "COMDefs.h"
     25#include "QIDialogButtonBox.h"
     26#include "QILabel.h"
     27#include "VBoxGlobal.h"
    2428#include "VBoxProgressDialog.h"
    25 #include "COMDefs.h"
    26 #include "QILabel.h"
    27 #include "QIDialogButtonBox.h"
    28 #include "VBoxGlobal.h"
    2929
    3030#ifdef Q_WS_MAC
     
    3333
    3434/* Qt includes */
    35 #include <QVBoxLayout>
     35#include <QCloseEvent>
     36#include <QEventLoop>
    3637#include <QProgressBar>
    3738#include <QTime>
    38 #include <QEventLoop>
    39 #include <QCloseEvent>
    4039#include <QTimer>
     40#include <QVBoxLayout>
    4141
    4242const char *VBoxProgressDialog::sOpDescTpl = "%1... (%2/%3)";
    4343
    44 VBoxProgressDialog::VBoxProgressDialog (CProgress &aProgress, const QString &aTitle,
    45                                         int aMinDuration /* = 2000 */, QWidget *aParent /* = NULL */)
     44VBoxProgressDialog::VBoxProgressDialog (CProgress &aProgress,
     45                                        const QString &aTitle,
     46                                        int aMinDuration /* = 2000 */,
     47                                        QWidget *aParent /* = 0 */)
    4648  : QIDialog (aParent, Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint)
    4749  , mProgress (aProgress)
     
    8385                         .arg (mProgress.GetOperationDescription()));
    8486    mProgressBar->setMaximum (100);
    85     setWindowTitle (QString ("%1: %2")
    86                     .arg (aTitle, mProgress.GetDescription()));
    87     QTimer::singleShot (aMinDuration, this, SLOT (show()));
     87    setWindowTitle (QString ("%1: %2").arg (aTitle, mProgress.GetDescription()));
    8888    mProgressBar->setValue (0);
    8989    mCancelEnabled = aProgress.GetCancelable();
    9090    if (mCancelEnabled)
    9191    {
    92         QDialogButtonBox *pBtnBox = new QDialogButtonBox (QDialogButtonBox::Cancel, Qt::Horizontal, this);
     92        QDialogButtonBox *pBtnBox = new QDialogButtonBox (QDialogButtonBox::Cancel,
     93                                                          Qt::Horizontal, this);
    9394        pLayout1->addWidget (pBtnBox);
    94         connect (pBtnBox, SIGNAL (rejected()),
    95                  this, SLOT (cancelOperation()));
     95        connect (pBtnBox, SIGNAL (rejected()), this, SLOT (cancelOperation()));
    9696    }
    9797
    9898    retranslateUi();
     99
     100    /* The progress dialog will be shown automatically after
     101     * the duration is over if progress is not finished yet. */
     102    QTimer::singleShot (aMinDuration, this, SLOT (showDialog()));
    99103}
    100104
     
    111115        int id = startTimer (aRefreshInterval);
    112116
    113         /* The progress dialog is automatically shown after the duration is over */
     117        /* Set busy cursor */
     118        QApplication::setOverrideCursor (QCursor (Qt::WaitCursor));
    114119
    115120        /* Enter the modal loop */
     
    124129}
    125130
     131void VBoxProgressDialog::showDialog()
     132{
     133    /* We should not show progress-dialog
     134     * if it was already finalized but not yet closed.
     135     * This could happens in case of some other
     136     * modal dialog prevents our event-loop from
     137     * being exit overlapping 'this'. */
     138    if (!mEnded)
     139        show();
     140}
     141
    126142void VBoxProgressDialog::cancelOperation()
    127143{
     
    131147void VBoxProgressDialog::timerEvent (QTimerEvent * /* aEvent */)
    132148{
     149    /* We should hide progress-dialog
     150     * if it was already finalized but not yet closed.
     151     * This could happens in case of some other
     152     * modal dialog prevents our event-loop from
     153     * being exit overlapping 'this'. */
     154    if (mEnded && !isHidden())
     155        hide();
     156
    133157    if (!mEnded && (!mProgress.isOk() || mProgress.GetCompleted()))
    134158    {
     
    153177    if (mEnded)
    154178    {
    155         /* Exit loop if it is running */
    156179        if (mEventLoop->isRunning())
     180        {
     181            /* Exit loop if it is running */
    157182            mEventLoop->quit();
     183
     184            /* Restore normal cursor */
     185            QApplication::restoreOverrideCursor();
     186        }
    158187        return;
    159188    }
     
    166195        if (newTime >= 0)
    167196        {
    168             QTime time(0, 0);
     197            QTime time (0, 0);
    169198            time = time.addSecs (newTime);
    170199            mETA->setText (mETAText.arg (time.toString()));
    171         }else
     200        }
     201        else
    172202            mETA->clear();
    173203        /* Then operation text if changed */
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