VirtualBox

Changeset 98335 in vbox


Ignore:
Timestamp:
Jan 27, 2023 2:28:05 PM (2 years ago)
Author:
vboxsync
Message:

FE/Qt: Moving UICommon::LaunchMode to UIDefs to make it possible to translate enum values using UIConverter stuff.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h

    r98103 r98335  
    118118template<> SHARED_LIBRARY_STUFF bool canConvert<UIExtraDataMetaDefs::DetailsElementOptionTypeDescription>();
    119119template<> SHARED_LIBRARY_STUFF bool canConvert<UIColorThemeType>();
     120template<> SHARED_LIBRARY_STUFF bool canConvert<UILaunchMode>();
    120121template<> SHARED_LIBRARY_STUFF bool canConvert<UIToolType>();
    121122template<> SHARED_LIBRARY_STUFF bool canConvert<UIVisualStateType>();
     
    242243template<> SHARED_LIBRARY_STUFF QString toInternalString(const UIColorThemeType &colorThemeType);
    243244template<> SHARED_LIBRARY_STUFF UIColorThemeType fromInternalString<UIColorThemeType>(const QString &strColorThemeType);
     245template<> SHARED_LIBRARY_STUFF UILaunchMode fromInternalString<UILaunchMode>(const QString &strDefaultFrontendType);
    244246template<> SHARED_LIBRARY_STUFF QString toInternalString(const UIToolType &enmToolType);
    245247template<> SHARED_LIBRARY_STUFF UIToolType fromInternalString<UIToolType>(const QString &strToolType);
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp

    r98103 r98335  
    7373template<> bool canConvert<UIExtraDataMetaDefs::DetailsElementOptionTypeDescription>() { return true; }
    7474template<> bool canConvert<UIColorThemeType>() { return true; }
     75template<> bool canConvert<UILaunchMode>() { return true; }
    7576template<> bool canConvert<UIToolType>() { return true; }
    7677template<> bool canConvert<UIVisualStateType>() { return true; }
     
    16571658}
    16581659
     1660/* UILaunchMode <= QString: */
     1661template<> UILaunchMode fromInternalString<UILaunchMode>(const QString &strDefaultFrontendType)
     1662{
     1663    if (strDefaultFrontendType.compare("Default", Qt::CaseInsensitive) == 0)
     1664        return UILaunchMode_Default;
     1665    if (strDefaultFrontendType.compare("Headless", Qt::CaseInsensitive) == 0)
     1666        return UILaunchMode_Headless;
     1667    if (strDefaultFrontendType.compare("Separate", Qt::CaseInsensitive) == 0)
     1668        return UILaunchMode_Separate;
     1669    return UILaunchMode_Invalid;
     1670}
     1671
    16591672/* QString <= UIToolType: */
    16601673template<> QString toInternalString(const UIToolType &enmToolType)
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp

    r98103 r98335  
    12651265
    12661266/* static */
    1267 bool UICommon::launchMachine(CMachine &comMachine, LaunchMode enmLaunchMode /* = LaunchMode_Default */)
     1267bool UICommon::launchMachine(CMachine &comMachine, UILaunchMode enmLaunchMode /* = UILaunchMode_Default */)
    12681268{
    12691269    /* Switch to machine window(s) if possible: */
     
    12911291
    12921292    /* Not for separate UI (which can connect to machine in any state): */
    1293     if (enmLaunchMode != LaunchMode_Separate)
     1293    if (enmLaunchMode != UILaunchMode_Separate)
    12941294    {
    12951295        /* Make sure machine-state is one of required: */
     
    13311331    switch (enmLaunchMode)
    13321332    {
    1333         case LaunchMode_Default:  strType = ""; break;
    1334         case LaunchMode_Separate: strType = uiCommon().isSeparateProcess() ? "headless" : "separate"; break;
    1335         case LaunchMode_Headless: strType = "headless"; break;
     1333        case UILaunchMode_Default:  strType = ""; break;
     1334        case UILaunchMode_Separate: strType = uiCommon().isSeparateProcess() ? "headless" : "separate"; break;
     1335        case UILaunchMode_Headless: strType = "headless"; break;
    13361336        default: AssertFailedReturn(false);
    13371337    }
     
    13421342    {
    13431343        /* If the VM is started separately and the VM process is already running, then it is OK. */
    1344         if (enmLaunchMode == LaunchMode_Separate)
     1344        if (enmLaunchMode == UILaunchMode_Separate)
    13451345        {
    13461346            const KMachineState enmState = comMachine.GetState();
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h

    r98103 r98335  
    144144    };
    145145
    146     /** VM launch modes. */
    147     enum LaunchMode
    148     {
    149         LaunchMode_Invalid,
    150         LaunchMode_Default,
    151         LaunchMode_Headless,
    152         LaunchMode_Separate
    153     };
    154 
    155146    /** VM launch running options. */
    156147    enum LaunchRunning
     
    349340        static bool switchToMachine(CMachine &comMachine);
    350341        /** Launches certain @a comMachine in specified @a enmLaunchMode. */
    351         static bool launchMachine(CMachine &comMachine, LaunchMode enmLaunchMode = LaunchMode_Default);
     342        static bool launchMachine(CMachine &comMachine, UILaunchMode enmLaunchMode = UILaunchMode_Default);
    352343
    353344        /** Opens session of certain @a enmLockType for VM with certain @a uId. */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h

    r98103 r98335  
    127127
    128128
     129/** VM launch modes. */
     130enum UILaunchMode
     131{
     132    UILaunchMode_Invalid,
     133    UILaunchMode_Default,
     134    UILaunchMode_Headless,
     135    UILaunchMode_Separate
     136};
     137
     138
    129139/** Storage-slot struct. */
    130140struct StorageSlot
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r98103 r98335  
    12331233    QList<UIVirtualMachineItem*> items = currentItems();
    12341234    AssertMsgReturnVoid(!items.isEmpty(), ("At least one item should be selected!\n"));
    1235     performStartOrShowVirtualMachines(items, UICommon::LaunchMode_Invalid);
     1235    performStartOrShowVirtualMachines(items, UILaunchMode_Invalid);
    12361236}
    12371237
     
    12411241    QList<UIVirtualMachineItem*> items = currentItems();
    12421242    AssertMsgReturnVoid(!items.isEmpty(), ("At least one item should be selected!\n"));
    1243     performStartOrShowVirtualMachines(items, UICommon::LaunchMode_Default);
     1243    performStartOrShowVirtualMachines(items, UILaunchMode_Default);
    12441244}
    12451245
     
    12491249    QList<UIVirtualMachineItem*> items = currentItems();
    12501250    AssertMsgReturnVoid(!items.isEmpty(), ("At least one item should be selected!\n"));
    1251     performStartOrShowVirtualMachines(items, UICommon::LaunchMode_Headless);
     1251    performStartOrShowVirtualMachines(items, UILaunchMode_Headless);
    12521252}
    12531253
     
    12571257    QList<UIVirtualMachineItem*> items = currentItems();
    12581258    AssertMsgReturnVoid(!items.isEmpty(), ("At least one item should be selected!\n"));
    1259     performStartOrShowVirtualMachines(items, UICommon::LaunchMode_Separate);
     1259    performStartOrShowVirtualMachines(items, UILaunchMode_Separate);
    12601260}
    12611261
     
    26572657/* static */
    26582658void UIVirtualBoxManager::launchMachine(CMachine &comMachine,
    2659                                         UICommon::LaunchMode enmLaunchMode /* = UICommon::LaunchMode_Default */)
     2659                                        UILaunchMode enmLaunchMode /* = UILaunchMode_Default */)
    26602660{
    26612661    /* Switch to machine window(s) if possible: */
     
    26682668
    26692669    /* Not for separate UI (which can connect to machine in any state): */
    2670     if (enmLaunchMode != UICommon::LaunchMode_Separate)
     2670    if (enmLaunchMode != UILaunchMode_Separate)
    26712671    {
    26722672        /* Make sure machine-state is one of required: */
     
    27102710    AssertReturnVoid(checkUnattendedInstallError(comUnattendedInstaller));
    27112711
    2712     launchMachine(comMachine, fStartHeadless ? UICommon::LaunchMode_Headless : UICommon::LaunchMode_Default);
    2713 }
    2714 
    2715 void UIVirtualBoxManager::performStartOrShowVirtualMachines(const QList<UIVirtualMachineItem*> &items, UICommon::LaunchMode enmLaunchMode)
     2712    launchMachine(comMachine, fStartHeadless ? UILaunchMode_Headless : UILaunchMode_Default);
     2713}
     2714
     2715void UIVirtualBoxManager::performStartOrShowVirtualMachines(const QList<UIVirtualMachineItem*> &items, UILaunchMode enmLaunchMode)
    27162716{
    27172717    /* Do nothing while group saving is in progress: */
     
    27492749            {
    27502750                /* Fetch item launch mode: */
    2751                 UICommon::LaunchMode enmItemLaunchMode = enmLaunchMode;
    2752                 if (enmItemLaunchMode == UICommon::LaunchMode_Invalid)
     2751                UILaunchMode enmItemLaunchMode = enmLaunchMode;
     2752                if (enmItemLaunchMode == UILaunchMode_Invalid)
    27532753                    enmItemLaunchMode = pItem->isItemRunningHeadless()
    2754                                       ? UICommon::LaunchMode_Separate
     2754                                      ? UILaunchMode_Separate
    27552755                                      : qApp->keyboardModifiers() == Qt::ShiftModifier
    2756                                       ? UICommon::LaunchMode_Headless
    2757                                       : UICommon::LaunchMode_Default;
     2756                                      ? UILaunchMode_Headless
     2757                                      : UILaunchMode_Default;
    27582758                /* Acquire local machine: */
    27592759                CMachine machine = pItem->toLocal()->machine();
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h

    r98103 r98335  
    398398        void openNewMachineWizard(const QString &strISOFilePath = QString());
    399399        /** Launches certain @a comMachine in specified @a enmLaunchMode. */
    400         static void launchMachine(CMachine &comMachine, UICommon::LaunchMode enmLaunchMode = UICommon::LaunchMode_Default);
     400        static void launchMachine(CMachine &comMachine, UILaunchMode enmLaunchMode = UILaunchMode_Default);
    401401        /** Launches certain @a comMachine. */
    402402        static void launchMachine(CCloudMachine &comMachine);
     
    406406
    407407        /** Launches or shows virtual machines represented by passed @a items in corresponding @a enmLaunchMode (for launch). */
    408         void performStartOrShowVirtualMachines(const QList<UIVirtualMachineItem*> &items, UICommon::LaunchMode enmLaunchMode);
     408        void performStartOrShowVirtualMachines(const QList<UIVirtualMachineItem*> &items, UILaunchMode enmLaunchMode);
    409409
    410410#ifndef VBOX_WS_WIN
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

    r98103 r98335  
    19641964*********************************************************************************************************************************/
    19651965
    1966 UINotificationProgressMachinePowerUp::UINotificationProgressMachinePowerUp(const CMachine &comMachine, UICommon::LaunchMode enmLaunchMode)
     1966UINotificationProgressMachinePowerUp::UINotificationProgressMachinePowerUp(const CMachine &comMachine, UILaunchMode enmLaunchMode)
    19671967    : m_comMachine(comMachine)
    19681968    , m_enmLaunchMode(enmLaunchMode)
     
    20192019    switch (m_enmLaunchMode)
    20202020    {
    2021         case UICommon::LaunchMode_Default:  strType = ""; break;
    2022         case UICommon::LaunchMode_Separate: strType = "separate"; break;
    2023         case UICommon::LaunchMode_Headless: strType = "headless"; break;
     2021        case UILaunchMode_Default:  strType = ""; break;
     2022        case UILaunchMode_Separate: strType = "separate"; break;
     2023        case UILaunchMode_Headless: strType = "headless"; break;
    20242024        default: AssertFailedReturn(CProgress());
    20252025    }
     
    20282028    CProgress comProgress = m_comMachine.LaunchVMProcess(m_comSession, strType, astrEnv);
    20292029//    /* If the VM is started separately and the VM process is already running, then it is OK. */
    2030 //    if (m_enmLaunchMode == UICommon::LaunchMode_Separate)
     2030//    if (m_enmLaunchMode == UILaunchMode_Separate)
    20312031//    {
    20322032//        const KMachineState enmState = comMachine.GetState();
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r98103 r98335  
    983983    /** Constructs machine power-up notification-progress.
    984984      * @param  comMachine  Brings the machine being powered-up. */
    985     UINotificationProgressMachinePowerUp(const CMachine &comMachine, UICommon::LaunchMode enmLaunchMode);
     985    UINotificationProgressMachinePowerUp(const CMachine &comMachine, UILaunchMode enmLaunchMode);
    986986
    987987protected:
     
    10021002
    10031003    /** Holds the machine being powered-up. */
    1004     CMachine              m_comMachine;
     1004    CMachine      m_comMachine;
    10051005    /** Holds the launch mode. */
    1006     UICommon::LaunchMode  m_enmLaunchMode;
     1006    UILaunchMode  m_enmLaunchMode;
    10071007    /** Holds the session being opened. */
    1008     CSession              m_comSession;
     1008    CSession      m_comSession;
    10091009    /** Holds the machine name. */
    1010     QString               m_strName;
     1010    QString       m_strName;
    10111011};
    10121012
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp

    r98103 r98335  
    9191
    9292        /* Try to launch corresponding machine: */
    93         if (!UICommon::launchMachine(machine, UICommon::LaunchMode_Separate))
     93        if (!UICommon::launchMachine(machine, UILaunchMode_Separate))
    9494            return false;
    9595    }
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