VirtualBox

Changeset 47612 in vbox


Ignore:
Timestamp:
Aug 8, 2013 12:35:01 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Modal-window Manager: Make sure progress-dialog which passed as parent to other modal-dialog is shown before that.

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

Legend:

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

    r45452 r47612  
    2323#include "UINetworkManager.h"
    2424#include "UISelectorWindow.h"
     25#include "UIProgressDialog.h"
    2526#include "VBoxGlobal.h"
    2627
     
    126127            {
    127128                /* Return the 'top' of the iterated-window-stack as the result: */
    128                 return iteratedWindowStack.last();
     129                QWidget *pTopWindow = iteratedWindowStack.last();
     130                preprocessRealParent(pTopWindow);
     131                return pTopWindow;
    129132            }
    130133        }
     
    133136    /* If we unable to found the possible-parent-window among all ours,
    134137     * we have to add it as the new-window-stack only element: */
    135     QList<QWidget*> newWindowStack(QList<QWidget*>() << pTopLevelWindow);
    136     m_windows << newWindowStack;
     138    registerNewParent(pTopLevelWindow);
    137139    /* And return as the result: */
    138140    return pTopLevelWindow;
     
    292294}
    293295
     296/* static */
     297void UIModalWindowManager::preprocessRealParent(QWidget *pParent)
     298{
     299    /* Progress dialog can be hidden while we are trying to use it as top-most modal parent,
     300     * We should show it in such cases because else on MacOS X there will be a problem. */
     301    if (UIProgressDialog *pProgressDialog = qobject_cast<UIProgressDialog*>(pParent))
     302        pProgressDialog->show();
     303}
     304
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIModalWindowManager.h

    r45452 r47612  
    6464    bool contains(QWidget *pParentWindow, bool fAsTheTopOfStack = false);
    6565
     66    /* Static helper: Access stuff: */
     67    static void preprocessRealParent(QWidget *pParent);
     68
    6669    /* Variables: */
    6770    QList<QList<QWidget*> > m_windows;
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.cpp

    r45432 r47612  
    5656{
    5757    /* Setup dialog: */
    58     setModal(true);
    5958    setWindowTitle(QString("%1: %2").arg(strTitle, m_progress.GetDescription()));
    6059    setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
     
    125124    /* The progress dialog will be shown automatically after
    126125     * the duration is over if progress is not finished yet. */
    127     QTimer::singleShot(cMinDuration, this, SLOT(sltShowDialog()));
     126    QTimer::singleShot(cMinDuration, this, SLOT(showDialog()));
    128127}
    129128
     
    178177    }
    179178    return Rejected;
     179}
     180
     181void UIProgressDialog::show()
     182{
     183    /* We should not show progress-dialog
     184     * if it was already finalized but not yet closed.
     185     * This could happens in case of some other
     186     * modal dialog prevents our event-loop from
     187     * being exit overlapping 'this'. */
     188    if (!m_fEnded)
     189        QIDialog::show();
    180190}
    181191
     
    307317}
    308318
    309 void UIProgressDialog::sltShowDialog()
    310 {
    311     /* We should not show progress-dialog
    312      * if it was already finalized but not yet closed.
    313      * This could happens in case of some other
    314      * modal dialog prevents our event-loop from
    315      * being exit overlapping 'this'. */
    316     if (!m_fEnded)
    317         show();
    318 }
    319 
    320319void UIProgressDialog::sltCancelOperation()
    321320{
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.h

    r45193 r47612  
    5757    int run(int aRefreshInterval);
    5858
     59public slots:
     60
     61    /* Handler: Show stuff: */
     62    void show();
     63
    5964protected:
    6065
     
    7176private slots:
    7277
    73     /* Handlers: */
    74     void sltShowDialog();
     78    /* Handler: Cancel stuff: */
    7579    void sltCancelOperation();
    7680
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