VirtualBox

Changeset 72389 in vbox for trunk


Ignore:
Timestamp:
May 30, 2018 9:18:18 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
122849
Message:

FE/Qt: bugref:9049: Allow VBoxGlobal library distinguish whether it is used from VM or VBox Manager UI; this also allows to ignore --startvm argument passed to VirtualBox executable.

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

Legend:

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

    r72174 r72389  
    188188
    189189/* static */
     190#ifndef VBOX_GUI_WITH_SHARED_LIBRARY
    190191void VBoxGlobal::create()
     192#else
     193void VBoxGlobal::create(UIType enmType)
     194#endif
    191195{
    192196    /* Make sure instance is NOT created yet: */
     
    197201    }
    198202
     203#ifndef VBOX_GUI_WITH_SHARED_LIBRARY
    199204    /* Create instance: */
    200205    new VBoxGlobal;
     206#else
     207    /* Create instance: */
     208    new VBoxGlobal(enmType);
     209#endif
    201210    /* Prepare instance: */
    202211    s_pInstance->prepare();
     
    223232}
    224233
     234#ifndef VBOX_GUI_WITH_SHARED_LIBRARY
    225235VBoxGlobal::VBoxGlobal()
    226     : mValid (false)
     236    : mValid(false)
     237#else
     238VBoxGlobal::VBoxGlobal(UIType enmType)
     239    : m_enmType(enmType)
     240    , mValid(false)
     241#endif
    227242#ifdef VBOX_WS_MAC
    228243    , m_osRelease(MacOSXRelease_Old)
     
    40174032    }
    40184033
     4034#ifndef VBOX_GUI_WITH_SHARED_LIBRARY
    40194035    if (startVM)
     4036#else
     4037    if (m_enmType == UIType_RuntimeUI && startVM)
     4038#endif
    40204039    {
    40214040        /* m_fSeparateProcess makes sense only if a VM is started. */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r71784 r72389  
    6565public:
    6666
     67#ifdef VBOX_GUI_WITH_SHARED_LIBRARY
     68    /** UI types. */
     69    enum UIType
     70    {
     71        UIType_SelectorUI,
     72        UIType_RuntimeUI
     73    };
     74#endif
     75
    6776    /** VM launch modes. */
    6877    enum LaunchMode
     
    8493    /* Static API: Create/destroy stuff: */
    8594    static VBoxGlobal *instance() { return s_pInstance; }
     95#ifndef VBOX_GUI_WITH_SHARED_LIBRARY
    8696    static void create();
     97#else
     98    static void create(UIType enmType);
     99#endif
    87100    static void destroy();
    88101
     
    501514private:
    502515
    503     /* Constructor/destructor: */
     516#ifndef VBOX_GUI_WITH_SHARED_LIBRARY
     517    /** Construcs global VirtualBox object. */
    504518    VBoxGlobal();
    505     ~VBoxGlobal();
     519#else
     520    /** Construcs global VirtualBox object of passed @a enmType. */
     521    VBoxGlobal(UIType enmType);
     522#endif
     523
     524    /** Destrucs global VirtualBox object. */
     525    virtual ~VBoxGlobal() /* override */;
    506526
    507527    /** Re-initializes COM wrappers and containers. */
     
    517537    void setDebuggerVar(int *piDbgCfgVar, bool fState);
    518538    bool isDebuggerWorker(int *piDbgCfgVar, const char *pszExtraDataName) const;
     539#endif
     540
     541#ifdef VBOX_GUI_WITH_SHARED_LIBRARY
     542    /** Holds the UI type. */
     543    UIType m_enmType;
    519544#endif
    520545
  • trunk/src/VBox/Frontends/VirtualBox/src/main.cpp

    r72363 r72389  
    464464        /* Create UI starter: */
    465465        UIStarter::create();
     466#ifndef VBOX_GUI_WITH_SHARED_LIBRARY
    466467        /* Create global app instance: */
    467468        VBoxGlobal::create();
     469#else
     470# ifndef VBOX_RUNTIME_UI
     471        /* Create global app instance for Selecotr UI: */
     472        VBoxGlobal::create(VBoxGlobal::UIType_SelectorUI);
     473# else
     474        /* Create global app instance for Runtime UI: */
     475        VBoxGlobal::create(VBoxGlobal::UIType_RuntimeUI);
     476# endif
     477#endif
    468478
    469479        /* Simulate try-catch block: */
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