VirtualBox

Ignore:
Timestamp:
Mar 15, 2018 5:14:12 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9049: Detach VBoxGlobal dependencies from Selector and Runtime UIs.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r71348 r71360  
    353353        src/globals/UIPopupCenter.h \
    354354        src/globals/UIShortcutPool.h \
     355        src/globals/UIStarter.h \
    355356        src/globals/UIThreadPool.h \
    356357        src/globals/VBoxGlobal.h \
     
    695696        src/globals/UIPopupCenter.cpp \
    696697        src/globals/UIShortcutPool.cpp \
     698        src/globals/UIStarter.cpp \
    697699        src/globals/UIThreadPool.cpp \
    698700        src/globals/VBoxGlobal.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r71355 r71360  
    5353/* GUI includes: */
    5454# include "VBoxGlobal.h"
    55 # include "UISelectorWindow.h"
    5655# include "UIMessageCenter.h"
    5756# include "UIPopupCenter.h"
     
    36343633    if (!list.isEmpty())
    36353634    {
     3635        /* Store the URLs: */
    36363636        m_ArgUrlList = list;
    3637         UISelectorWindow::create();
    3638         QTimer::singleShot(0, gpSelectorWindow, SLOT(sltOpenUrls()));
     3637        /* Ask UIStarter to open them: */
     3638        emit sigAskToOpenURLs();
    36393639    }
    36403640    return fResult;
     
    40614061#endif /* VBOX_GUI_WITH_PIDFILE */
    40624062
    4063     /* Destroy the GUI root windows _BEFORE_
    4064      * the media related code which could race us: */
    4065     if (gpSelectorWindow)
    4066         UISelectorWindow::destroy();
    4067     if (gpMachine)
    4068         UIMachine::destroy();
    4069 
    40704063    /* Starting medium-enumerator cleanup: */
    40714064    m_mediumEnumeratorDtorRwLock.lockForWrite();
     
    42204213                UIExtraDataManager::instance();
    42214214                UIVirtualBoxEventHandler::instance();
    4222                 /* Recreate/show selector-window: */
    4223                 UISelectorWindow::destroy();
    4224                 UISelectorWindow::create();
     4215                /* Ask UIStarter to restart UI: */
     4216                emit sigAskToRestartUI();
    42254217            }
    42264218        }
     
    43814373
    43824374#endif /* VBOX_WITH_DEBUGGER_GUI */
    4383 
    4384 void VBoxGlobal::showUI()
    4385 {
    4386     /* Show Selector UI: */
    4387     if (!isVMConsoleProcess())
    4388     {
    4389         /* Make sure Selector UI is permitted, quit if not: */
    4390         if (gEDataManager->guiFeatureEnabled(GUIFeatureType_NoSelector))
    4391         {
    4392             msgCenter().cannotStartSelector();
    4393             return QApplication::quit();
    4394         }
    4395 
    4396         /* Create/show selector-window: */
    4397         UISelectorWindow::create();
    4398 
    4399 #ifdef VBOX_BLEEDING_EDGE
    4400         /* Show EXPERIMENTAL BUILD warning: */
    4401         msgCenter().showExperimentalBuildWarning();
    4402 #else /* !VBOX_BLEEDING_EDGE */
    4403 # ifndef DEBUG
    4404         /* Show BETA warning if necessary: */
    4405         const QString vboxVersion(vboxGlobal().virtualBox().GetVersion());
    4406         if (   vboxVersion.contains("BETA")
    4407             && gEDataManager->preventBetaBuildWarningForVersion() != vboxVersion)
    4408             msgCenter().showBetaBuildWarning();
    4409 # endif /* !DEBUG */
    4410 #endif /* !VBOX_BLEEDING_EDGE */
    4411     }
    4412     /* Show Runtime UI: */
    4413     else
    4414     {
    4415         /* Make sure machine is started, quit if not: */
    4416         if (!UIMachine::startMachine(vboxGlobal().managedVMUuid()))
    4417             return QApplication::quit();
    4418     }
    4419 }
    44204375
    44214376bool VBoxGlobal::switchToMachine(CMachine &machine)
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r71355 r71360  
    448448signals:
    449449
     450    /** Asks listener to recreate UI. */
     451    void sigAskToRestartUI();
     452    /** Ask listener to open URLs. */
     453    void sigAskToOpenURLs();
     454
    450455    /** Notifies listeners about the VBoxSVC availability change. */
    451456    void sigVBoxSVCAvailabilityChange();
     
    474479    /** Handles @a manager request for emergency session shutdown. */
    475480    void sltHandleCommitDataRequest(QSessionManager &manager);
    476 
    477     /** Shows UI. */
    478     void showUI();
    479481
    480482    /** Handles the VBoxSVC availability change. */
  • trunk/src/VBox/Frontends/VirtualBox/src/main.cpp

    r71355 r71360  
    2626/* GUI includes: */
    2727# include "VBoxGlobal.h"
    28 # include "UIMachine.h"
    29 # include "UISelectorWindow.h"
     28# include "UIStarter.h"
    3029# include "UIModalWindowManager.h"
    3130# ifdef VBOX_WS_MAC
     
    462461        UIModalWindowManager::create();
    463462
    464         /* Create global UI instance: */
     463        /* Create UI starter: */
     464        UIStarter::create();
     465        /* Create global app instance: */
    465466        VBoxGlobal::create();
    466467
     
    471472            if (!vboxGlobal().isValid())
    472473                break;
     474
     475            /* Init link between UI starter and global app instance: */
     476            gStarter->init();
    473477
    474478            /* Exit if VBoxGlobal pre-processed arguments: */
     
    483487            }
    484488
    485             /* Request to Show UI _after_ QApplication started: */
    486             QMetaObject::invokeMethod(&vboxGlobal(), "showUI", Qt::QueuedConnection);
     489            /* Request to Show UI _after_ QApplication executed: */
     490            QMetaObject::invokeMethod(gStarter, "sltShowUI", Qt::QueuedConnection);
    487491
    488492            /* Start application: */
    489493            iResultCode = a.exec();
     494
     495            /* Break link between UI starter and global app instance: */
     496            gStarter->deinit();
    490497        }
    491498        while (0);
    492499
    493         /* Destroy global UI instance: */
     500        /* Destroy global app instance: */
    494501        VBoxGlobal::destroy();
     502        /* Destroy UI starter: */
     503        UIStarter::destroy();
    495504
    496505        /* Destroy modal-window manager: */
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