VirtualBox

Changeset 98882 in vbox for trunk/src


Ignore:
Timestamp:
Mar 9, 2023 9:14:32 AM (22 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10322: A bit of cleanup around Runtime UI code.

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

Legend:

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

    r98103 r98882  
    209209/** Qt5 message handler, function that prints out
    210210  * debug, warning, critical, fatal and system error messages.
    211   * @param  type        Holds the type of the message.
     211  * @param  enmType     Holds the type of the message.
    212212  * @param  context     Holds the message context.
    213213  * @param  strMessage  Holds the message body. */
    214 static void QtMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &strMessage)
     214static void QtMessageOutput(QtMsgType enmType, const QMessageLogContext &context, const QString &strMessage)
    215215{
    216216    NOREF(context);
     
    218218    NOREF(strMessage);
    219219# endif
    220     switch (type)
     220    switch (enmType)
    221221    {
    222222        case QtDebugMsg:
     
    255255{
    256256#ifndef VBOX_RUNTIME_UI
    257     static const char s_szTitle[] = VBOX_PRODUCT " VM Selector";
     257    static const char s_szTitle[] = VBOX_PRODUCT " Manager";
    258258#else
    259     static const char s_szTitle[] = VBOX_PRODUCT " VM Runner";
    260 #endif
     259    static const char s_szTitle[] = VBOX_PRODUCT " Runner";
     260#endif
     261
    261262    static const char s_szUsage[] =
    262263#ifdef VBOX_RUNTIME_UI
     
    315316             s_szTitle, RTBldCfgVersion(), s_szUsage);
    316317
    317 #ifdef RT_OS_WINDOWS
     318#ifdef VBOX_WS_WIN
    318319    /* Show message box. Modify the option list a little
    319320     * to better make it fit in the upcoming dialog. */
     
    372373    MessageBoxExA(NULL /*hwndOwner*/, szMsg, szTitleWithVersion, MB_OK | MB_ICONINFORMATION,
    373374                  MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL));
    374 #endif
     375#endif /* VBOX_WS_WIN */
    375376}
    376377
    377378extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char ** /*envp*/)
    378379{
    379 #ifdef RT_OS_WINDOWS
     380#ifdef VBOX_WS_WIN
    380381    ATL::CComModule _Module; /* Required internally by ATL (constructor records instance in global variable). */
    381382#endif
     
    394395        if (!MakeSureMultiThreadingIsSafe())
    395396            break;
     397
    396398        /* Force using Qt platform module 'xcb', we have X11 specific code: */
    397399        RTEnvSet("QT_QPA_PLATFORM", "xcb");
     
    438440# ifdef VBOX_RUNTIME_UI
    439441        /* If we're a helper app inside Resources in the main application bundle,
    440            we need to amend the library path so the platform plugin can be found.
    441            Note! This builds on the initIprtForDarwinHelperApp() hack. */
     442         * we need to amend the library path so the platform plugin can be found.
     443         * Note! This builds on the initIprtForDarwinHelperApp() hack. */
    442444        {
    443445            char szExecDir[RTPATH_MAX];
     
    473475        /* Create application: */
    474476        QApplication a(argc, argv);
     477
     478#ifdef VBOX_WS_MAC
     479        /* Disable menu icons on MacOS X host: */
     480        ::darwinDisableIconsInMenus();
     481#endif /* VBOX_WS_MAC */
    475482
    476483#ifdef VBOX_WS_WIN
     
    482489         * thread to several seconds). */
    483490        PlaySound(NULL, NULL, 0);
    484 
    485491#endif /* VBOX_WS_WIN */
    486 
    487 #ifdef VBOX_WS_MAC
    488         /* Disable menu icons on MacOS X host: */
    489         ::darwinDisableIconsInMenus();
    490 
    491 #endif /* VBOX_WS_MAC */
    492492
    493493#ifdef VBOX_WS_X11
     
    546546            if (!uiCommon().isValid())
    547547                break;
    548 
    549             /* Init link between UI starter and global app instance: */
    550             gStarter->init();
    551 
    552548            /* Exit if UICommon pre-processed arguments: */
    553549            if (uiCommon().processArgs())
    554550                break;
     551
     552            /* Init link between UI starter and global app instance: */
     553            gStarter->init();
    555554
    556555            // WORKAROUND:
     
    563562            // by startup error message-box which is not treated as real window by some
    564563            // reason.  So we are making application exit manual everywhere.
    565             qApp->setQuitOnLastWindowClosed(false);
     564            a.setQuitOnLastWindowClosed(false);
    566565
    567566            /* Request to Start UI _after_ QApplication executed: */
     
    653652
    654653    /*
    655      * Determin the IPRT/SUPLib initialization flags if runtime UI process.
     654     * Determine the IPRT/SUPLib initialization flags if runtime UI process.
    656655     * Only initialize SUPLib if about to start a VM in this process.
    657656     *
     
    702701            fFlags |= SUPR3INIT_F_DRIVERLESS << RTR3INIT_FLAGS_SUPLIB_SHIFT;
    703702    }
    704 # endif
     703# endif /* VBOX_RUNTIME_UI */
    705704
    706705    /* Initialize VBox Runtime: */
     
    710709    int rc = RTR3InitExe(argc, &argv, fFlags);
    711710# endif
     711    /* Initialization failed: */
    712712    if (RT_FAILURE(rc))
    713713    {
    714         /* Initialization failed: */
    715 
    716714        /* We have to create QApplication anyway
    717715         * just to show the only one error-message: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp

    r98855 r98882  
    927927
    928928void UIMachine::generateMachineInformationSystem(const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions,
    929                                                   UITextTable &returnTable)
     929                                                 UITextTable &returnTable)
    930930{
    931931    uisession()->generateMachineInformationSystem(fOptions, returnTable);
     
    945945
    946946void UIMachine::generateMachineInformationAudio(const UIExtraDataMetaDefs::DetailsElementOptionTypeAudio &fOptions,
    947                                                   UITextTable &returnTable)
     947                                                UITextTable &returnTable)
    948948{
    949949    uisession()->generateMachineInformationAudio(fOptions, returnTable);
     
    957957
    958958void UIMachine::generateMachineInformationSerial(const UIExtraDataMetaDefs::DetailsElementOptionTypeSerial &fOptions,
    959                                                   UITextTable &returnTable)
     959                                                 UITextTable &returnTable)
    960960{
    961961    uisession()->generateMachineInformationSerial(fOptions, returnTable);
     
    963963
    964964void UIMachine::generateMachineInformationUSB(const UIExtraDataMetaDefs::DetailsElementOptionTypeUsb &fOptions,
    965                                                   UITextTable &returnTable)
     965                                              UITextTable &returnTable)
    966966{
    967967    uisession()->generateMachineInformationUSB(fOptions, returnTable);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r98855 r98882  
    7474
    7575    /** Requests async visual-state change. */
    76     void sigRequestAsyncVisualStateChange(UIVisualStateType visualStateType);
     76    void sigRequestAsyncVisualStateChange(UIVisualStateType enmVisualStateType);
    7777
    7878    /** @name COM events stuff.
     
    115115
    116116#ifdef VBOX_WS_MAC
    117         /** Notifies about VM window should be shown. */
     117        /** macOS X: Notifies about VM window should be shown. */
    118118        void sigShowWindows();
    119119#endif
     
    174174    UIFrameBuffer *frameBuffer(ulong uScreenId);
    175175    /** Returns active machine-window reference (if possible). */
    176     QWidget* activeWindow() const;
     176    QWidget *activeWindow() const;
    177177
    178178    /** Returns whether requested visual @a state allowed. */
     
    180180
    181181    /** Requests async visual-state change. */
    182     void asyncChangeVisualState(UIVisualStateType visualStateType);
     182    void asyncChangeVisualState(UIVisualStateType enmVisualStateType);
    183183
    184184    /** Requests visual-state to be entered when possible. */
    185     void setRequestedVisualState(UIVisualStateType visualStateType);
     185    void setRequestedVisualState(UIVisualStateType enmVisualStateType);
    186186    /** Returns requested visual-state to be entered when possible. */
    187187    UIVisualStateType requestedVisualState() const;
     
    685685        /** Return system info. of the machine(). */
    686686        void generateMachineInformationSystem(const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions,
    687                                                UITextTable &returnTable);
     687                                              UITextTable &returnTable);
    688688        /** Returns system info. of the machine(). */
    689689        void generateMachineInformationDisplay(const UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay &fOptions,
     
    694694        /** Returns audio info. of the machine(). */
    695695        void generateMachineInformationAudio(const UIExtraDataMetaDefs::DetailsElementOptionTypeAudio &fOptions,
    696                                                UITextTable &returnTable);
     696                                             UITextTable &returnTable);
    697697        /** Returns network info. of the machine(). */
    698698        void generateMachineInformationNetwork(const UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork &fOptions,
     
    700700        /** Returns serial info. of the machine(). */
    701701        void generateMachineInformationSerial(const UIExtraDataMetaDefs::DetailsElementOptionTypeSerial &fOptions,
    702                                                UITextTable &returnTable);
     702                                              UITextTable &returnTable);
    703703        /** Returns USB info. of the machine(). */
    704704        void generateMachineInformationUSB(const UIExtraDataMetaDefs::DetailsElementOptionTypeUsb &fOptions,
    705                                                UITextTable &returnTable);
     705                                           UITextTable &returnTable);
    706706        /** Returns shared folders info. of the machine(). */
    707707        void generateMachineInformationSharedFolders(const UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders &fOptions,
     
    742742
    743743    /** Visual state-change handler. */
    744     void sltChangeVisualState(UIVisualStateType visualStateType);
     744    void sltChangeVisualState(UIVisualStateType enmVisualStateType);
    745745
    746746    /** @name COM events stuff.
     
    761761     ** @{ */
    762762#ifdef VBOX_WS_MAC
    763         /** Mac OS X: Handles menu-bar configuration-change. */
     763        /** macOS X: Handles menu-bar configuration-change. */
    764764        void sltHandleMenuBarConfigurationChange(const QUuid &uMachineID);
    765765#endif
     
    776776
    777777#ifdef VBOX_WS_MAC
    778         /** MacOS X: Restarts display-reconfiguration watchdog timer from the beginning.
     778        /** macOS X: Restarts display-reconfiguration watchdog timer from the beginning.
    779779          * @note Watchdog is trying to determine display reconfiguration in
    780780          *       UISession::sltCheckIfHostDisplayChanged() slot every 500ms for 40 tries. */
     
    831831private:
    832832
    833     /** Constructor. */
     833    /** Constructs machine UI singleton. */
    834834    UIMachine();
    835     /** Destructor. */
    836     ~UIMachine();
     835    /** Destructs machine UI singleton. */
     836    virtual ~UIMachine() RT_OVERRIDE;
    837837
    838838    /** Prepare routine. */
     
    875875
    876876#ifdef VBOX_WS_MAC
    877         /** Mac OS X: Updates menu-bar content. */
     877        /** macOS X: Updates menu-bar content. */
    878878        void updateMenu();
    879879#endif
     
    911911
    912912#ifdef VBOX_WS_WIN
     913        /** Windows: Returns whether pointer of 1bpp depth. */
    913914        static bool isPointer1bpp(const uint8_t *pu8XorMask,
    914915                                  uint uWidth,
     
    960961
    961962#ifdef VBOX_WS_MAC
    962         /** Mac OS X: Holds the menu-bar instance. */
     963        /** macOS X: Holds the menu-bar instance. */
    963964        QMenuBar *m_pMenuBar;
    964965#endif
     
    971972
    972973#ifdef VBOX_WS_MAC
    973         /** Mac OS X: Watchdog timer looking for display reconfiguration. */
     974        /** macOS X: Watchdog timer looking for display reconfiguration. */
    974975        QTimer *m_pWatchdogDisplayChange;
    975976#endif
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r98841 r98882  
    26372637                        strInterfaceName = comNetworkAdapter.GetBridgedInterface();
    26382638                        break;
    2639 #ifndef VBOX_WITH_VMNET
     2639# ifndef VBOX_WITH_VMNET
    26402640                    case KNetworkAttachmentType_HostOnly:
    26412641                        strInterfaceName = comNetworkAdapter.GetHostOnlyInterface();
    26422642                        break;
    2643 #endif /* !VBOX_WITH_VMNET */
     2643# endif /* !VBOX_WITH_VMNET */
    26442644                    default:
    26452645                        break;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r98849 r98882  
    576576        /** Returns system info. of the machine(). */
    577577        void generateMachineInformationSystem(const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions,
    578                                                UITextTable &returnTable);
     578                                              UITextTable &returnTable);
    579579        /** Returns display info. of the machine(). */
    580580        void generateMachineInformationDisplay(const UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay &fOptions,
     
    585585        /** Returns audio info. of the machine(). */
    586586        void generateMachineInformationAudio(const UIExtraDataMetaDefs::DetailsElementOptionTypeAudio &fOptions,
    587                                                UITextTable &returnTable);
     587                                             UITextTable &returnTable);
    588588        /** Returns network info. of the machine(). */
    589589        void generateMachineInformationNetwork(const UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork &fOptions,
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