VirtualBox

Ignore:
Timestamp:
Oct 1, 2018 3:30:56 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9241: VirtualBox Manager: A bit of refactoring for tool types.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r74464 r74556  
    653653
    654654
     655#ifndef VBOX_GUI_WITH_NEW_MANAGER
     656
    655657/** Selector UI: Machine tool types. */
    656658enum ToolTypeMachine
     
    674676};
    675677Q_DECLARE_METATYPE(ToolTypeGlobal);
     678
     679#else /* VBOX_GUI_WITH_NEW_MANAGER */
     680
     681/** Tool item classes. */
     682enum UIToolsClass
     683{
     684    UIToolsClass_Invalid,
     685    UIToolsClass_Global,
     686    UIToolsClass_Machine
     687};
     688
     689
     690/** Tool item types. */
     691enum UIToolsType
     692{
     693    UIToolsType_Invalid,
     694    /* Global types: */
     695    UIToolsType_Welcome,
     696    UIToolsType_Media,
     697    UIToolsType_Network,
     698    /* Machine types: */
     699    UIToolsType_Details,
     700    UIToolsType_Snapshots,
     701    UIToolsType_Logs,
     702};
     703
     704
     705/** Selector UI: Global tool types. */
     706enum ToolTypeGlobal
     707{
     708    ToolTypeGlobal_Invalid,
     709    ToolTypeGlobal_Welcome,
     710    ToolTypeGlobal_Media,
     711    ToolTypeGlobal_Network,
     712};
     713Q_DECLARE_METATYPE(ToolTypeGlobal);
     714
     715
     716/** Selector UI: Machine tool types. */
     717enum ToolTypeMachine
     718{
     719    ToolTypeMachine_Invalid,
     720    ToolTypeMachine_Error,
     721    ToolTypeMachine_Details,
     722    ToolTypeMachine_Snapshots,
     723    ToolTypeMachine_Logs
     724};
     725Q_DECLARE_METATYPE(ToolTypeMachine);
     726
     727#endif /* VBOX_GUI_WITH_NEW_MANAGER */
    676728
    677729
     
    831883
    832884
    833 #ifdef VBOX_GUI_WITH_NEW_MANAGER
    834 /** Tool item classes. */
    835 enum UIToolsClass
    836 {
    837     UIToolsClass_Invalid,
    838     UIToolsClass_Global,
    839     UIToolsClass_Machine
    840 };
    841 
    842 
    843 /** Tool item types. */
    844 enum UIToolsType
    845 {
    846     UIToolsType_Invalid,
    847     /* Global types: */
    848     UIToolsType_Media,
    849     UIToolsType_Network,
    850     /* Machine types: */
    851     UIToolsType_Details,
    852     UIToolsType_Snapshots,
    853     UIToolsType_Logs,
    854 };
    855 #endif /* VBOX_GUI_WITH_NEW_MANAGER */
    856 
    857 
    858885#endif /* !___UIExtraDataDefs_h___ */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneGlobal.cpp

    r74505 r74556  
    9393        switch (enmType)
    9494        {
    95             case ToolTypeGlobal_Desktop:
     95            case ToolTypeGlobal_Welcome:
    9696            {
    9797                /* Create Desktop pane: */
     
    100100                {
    101101                    /* Configure pane: */
    102                     m_pPaneDesktop->setProperty("ToolType", QVariant::fromValue(ToolTypeGlobal_Desktop));
     102                    m_pPaneDesktop->setProperty("ToolType", QVariant::fromValue(ToolTypeGlobal_Welcome));
    103103
    104104                    /* Add into layout: */
     
    111111                break;
    112112            }
    113             case ToolTypeGlobal_VirtualMedia:
     113            case ToolTypeGlobal_Media:
    114114            {
    115115                /* Create Virtual Media Manager: */
     
    123123
    124124                    /* Configure pane: */
    125                     m_pPaneMedia->setProperty("ToolType", QVariant::fromValue(ToolTypeGlobal_VirtualMedia));
     125                    m_pPaneMedia->setProperty("ToolType", QVariant::fromValue(ToolTypeGlobal_Media));
    126126
    127127                    /* Add into layout: */
     
    131131                break;
    132132            }
    133             case ToolTypeGlobal_HostNetwork:
     133            case ToolTypeGlobal_Network:
    134134            {
    135135                /* Create Host Network Manager: */
     
    143143
    144144                    /* Configure pane: */
    145                     m_pPaneNetwork->setProperty("ToolType", QVariant::fromValue(ToolTypeGlobal_HostNetwork));
     145                    m_pPaneNetwork->setProperty("ToolType", QVariant::fromValue(ToolTypeGlobal_Network));
    146146
    147147                    /* Add into layout: */
     
    171171        switch (enmType)
    172172        {
    173             case ToolTypeGlobal_Desktop:      m_pPaneDesktop = 0; break;
    174             case ToolTypeGlobal_VirtualMedia: m_pPaneMedia = 0; break;
    175             case ToolTypeGlobal_HostNetwork: m_pPaneNetwork = 0; break;
     173            case ToolTypeGlobal_Welcome: m_pPaneDesktop = 0; break;
     174            case ToolTypeGlobal_Media:  m_pPaneMedia = 0; break;
     175            case ToolTypeGlobal_Network: m_pPaneNetwork = 0; break;
    176176            default: break;
    177177        }
     
    201201
    202202    /* Create desktop pane: */
    203     openTool(ToolTypeGlobal_VirtualMedia);
     203    openTool(ToolTypeGlobal_Media);
    204204
    205205    /* Apply language settings: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneMachine.cpp

    r74505 r74556  
    9797        switch (enmType)
    9898        {
    99             case ToolTypeMachine_Desktop:
     99            case ToolTypeMachine_Error:
    100100            {
    101101                /* Create Desktop pane: */
     
    104104                {
    105105                    /* Configure pane: */
    106                     m_pPaneDesktop->setProperty("ToolType", QVariant::fromValue(ToolTypeMachine_Desktop));
     106                    m_pPaneDesktop->setProperty("ToolType", QVariant::fromValue(ToolTypeMachine_Error));
    107107
    108108                    /* Add into layout: */
     
    154154                break;
    155155            }
    156             case ToolTypeMachine_LogViewer:
     156            case ToolTypeMachine_Logs:
    157157            {
    158158                /* Create the Logviewer pane: */
     
    166166
    167167                    /* Configure pane: */
    168                     m_pPaneLogViewer->setProperty("ToolType", QVariant::fromValue(ToolTypeMachine_LogViewer));
     168                    m_pPaneLogViewer->setProperty("ToolType", QVariant::fromValue(ToolTypeMachine_Logs));
    169169
    170170                    /* Add into layout: */
     
    194194        switch (enmType)
    195195        {
    196             case ToolTypeMachine_Desktop:   m_pPaneDesktop = 0; break;
     196            case ToolTypeMachine_Error:     m_pPaneDesktop = 0; break;
    197197            case ToolTypeMachine_Details:   m_pPaneDetails = 0; break;
    198198            case ToolTypeMachine_Snapshots: m_pPaneSnapshots = 0; break;
    199             case ToolTypeMachine_LogViewer: m_pPaneLogViewer = 0; break;
     199            case ToolTypeMachine_Logs:      m_pPaneLogViewer = 0; break;
    200200            default: break;
    201201        }
     
    249249    }
    250250    /* Update logviewer pane is it is open: */
    251     if (isToolOpened(ToolTypeMachine_LogViewer))
     251    if (isToolOpened(ToolTypeMachine_Logs))
    252252    {
    253253        AssertPtrReturnVoid(m_pPaneLogViewer);
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolbarTools.cpp

    r73881 r74556  
    210210void UIToolbarTools::prepareMenu()
    211211{
     212    /* Configure 'Global' menu: */
     213    UIMenu *pMenuGlobal = m_pActionPool->action(UIActionIndexST_M_Tools_M_Global)->menu();
     214    if (pMenuGlobal)
     215    {
     216        /* Add 'Virtual Media Manager' action: */
     217        pMenuGlobal->addAction(m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_S_VirtualMediaManager));
     218        connect(m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_S_VirtualMediaManager), &UIAction::triggered,
     219                this, &UIToolbarTools::sltHandleOpenToolGlobal);
     220        m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_S_VirtualMediaManager)
     221            ->setProperty("ToolTypeGlobal", QVariant::fromValue(ToolTypeGlobal_Media));
     222
     223        /* Add 'Host Network Manager' action: */
     224        pMenuGlobal->addAction(m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_S_HostNetworkManager));
     225        connect(m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_S_HostNetworkManager), &UIAction::triggered,
     226                this, &UIToolbarTools::sltHandleOpenToolGlobal);
     227        m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_S_HostNetworkManager)
     228            ->setProperty("ToolTypeGlobal", QVariant::fromValue(ToolTypeGlobal_Network));
     229    }
     230
     231    /* Configure 'Global' toggle action: */
     232    m_pActionPool->action(UIActionIndexST_M_Tools_T_Global)->setMenu(pMenuGlobal);
     233
    212234    /* Configure 'Machine' menu: */
    213235    UIMenu *pMenuMachine = m_pActionPool->action(UIActionIndexST_M_Tools_M_Machine)->menu();
     
    233255                this, &UIToolbarTools::sltHandleOpenToolMachine);
    234256        m_pActionPool->action(UIActionIndexST_M_Tools_M_Machine_S_LogViewer)
    235             ->setProperty("ToolTypeMachine", QVariant::fromValue(ToolTypeMachine_LogViewer));
     257            ->setProperty("ToolTypeMachine", QVariant::fromValue(ToolTypeMachine_Logs));
    236258    }
    237259
    238260    /* Configure 'Machine' toggle action: */
    239261    m_pActionPool->action(UIActionIndexST_M_Tools_T_Machine)->setMenu(pMenuMachine);
    240 
    241     /* Configure 'Global' menu: */
    242     UIMenu *pMenuGlobal = m_pActionPool->action(UIActionIndexST_M_Tools_M_Global)->menu();
    243     if (pMenuGlobal)
    244     {
    245         /* Add 'Virtual Media Manager' action: */
    246         pMenuGlobal->addAction(m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_S_VirtualMediaManager));
    247         connect(m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_S_VirtualMediaManager), &UIAction::triggered,
    248                 this, &UIToolbarTools::sltHandleOpenToolGlobal);
    249         m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_S_VirtualMediaManager)
    250             ->setProperty("ToolTypeGlobal", QVariant::fromValue(ToolTypeGlobal_VirtualMedia));
    251 
    252         /* Add 'Host Network Manager' action: */
    253         pMenuGlobal->addAction(m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_S_HostNetworkManager));
    254         connect(m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_S_HostNetworkManager), &UIAction::triggered,
    255                 this, &UIToolbarTools::sltHandleOpenToolGlobal);
    256         m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_S_HostNetworkManager)
    257             ->setProperty("ToolTypeGlobal", QVariant::fromValue(ToolTypeGlobal_HostNetwork));
    258     }
    259 
    260     /* Configure 'Global' toggle action: */
    261     m_pActionPool->action(UIActionIndexST_M_Tools_T_Global)->setMenu(pMenuGlobal);
    262262}
    263263
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r74504 r74556  
    286286     * otherwise user sees everything himself: */
    287287    if (   m_pManagerVirtualMedia
    288         || m_pWidget->isToolOpened(ToolTypeGlobal_VirtualMedia))
     288        || m_pWidget->isToolOpened(ToolTypeGlobal_Media))
    289289        return;
    290290
     
    386386{
    387387    /* First check if instance of widget opened the embedded way: */
    388     if (m_pWidget->isToolOpened(ToolTypeGlobal_VirtualMedia))
    389     {
    390         m_pWidget->switchToTool(ToolTypeGlobal_VirtualMedia);
     388    if (m_pWidget->isToolOpened(ToolTypeGlobal_Media))
     389    {
     390        m_pWidget->switchToTool(ToolTypeGlobal_Media);
    391391        return;
    392392    }
     
    416416{
    417417    /* First check if instance of widget opened the embedded way: */
    418     if (m_pWidget->isToolOpened(ToolTypeGlobal_HostNetwork))
    419     {
    420         m_pWidget->switchToTool(ToolTypeGlobal_HostNetwork);
     418    if (m_pWidget->isToolOpened(ToolTypeGlobal_Network))
     419    {
     420        m_pWidget->switchToTool(ToolTypeGlobal_Network);
    421421        return;
    422422    }
     
    10171017
    10181018    /* First check if a logviewer is already opened in embedded mode: */
    1019     if (m_pWidget->isToolOpened(ToolTypeMachine_LogViewer))
    1020     {
    1021         m_pWidget->switchToTool(ToolTypeMachine_LogViewer);
     1019    if (m_pWidget->isToolOpened(ToolTypeMachine_Logs))
     1020    {
     1021        m_pWidget->switchToTool(ToolTypeMachine_Logs);
    10221022        return;
    10231023    }
     
    19931993    m_pGroupMenuAction->setVisible(fMachineOrGroupMenuShown && !fMachineMenuShown);
    19941994
    1995     /* Determine whether Snapshot actions should be visible: */
     1995    /* Determine whether Media actions should be visible: */
     1996    const bool fMediumMenuShown = fGlobalMenuShown && m_pWidget->currentGlobalTool() == ToolTypeGlobal_Media;
     1997    const bool fMediumActionsShown = fMediumMenuShown || !m_pWidget->isToolOpened(ToolTypeGlobal_Media);
     1998    m_pVirtualMediaManagerMenuAction->setVisible(fMediumMenuShown);
     1999
     2000    /* Determine whether Network actions should be visible: */
     2001    const bool fNetworkMenuShown = fGlobalMenuShown && m_pWidget->currentGlobalTool() == ToolTypeGlobal_Network;
     2002    const bool fNetworkActionsShown = fNetworkMenuShown || !m_pWidget->isToolOpened(ToolTypeGlobal_Network);
     2003    m_pHostNetworkManagerMenuAction->setVisible(fNetworkMenuShown);
     2004
     2005    /* Determine whether Snapshots actions should be visible: */
    19962006    const bool fSnapshotMenuShown = fMachineOrGroupMenuShown && m_pWidget->currentMachineTool() == ToolTypeMachine_Snapshots;
    19972007    m_pSnapshotMenuAction->setVisible(fSnapshotMenuShown);
    19982008
    1999     /* Determine whether LogViewer actions should be visible: */
    2000     const bool fLogViewerMenuShown = fMachineOrGroupMenuShown && m_pWidget->currentMachineTool() == ToolTypeMachine_LogViewer;
    2001     const bool fLogViewerActionsShown = fLogViewerMenuShown || !m_pWidget->isToolOpened(ToolTypeMachine_LogViewer);
     2009    /* Determine whether Logs actions should be visible: */
     2010    const bool fLogViewerMenuShown = fMachineOrGroupMenuShown && m_pWidget->currentMachineTool() == ToolTypeMachine_Logs;
     2011    const bool fLogViewerActionsShown = fLogViewerMenuShown || !m_pWidget->isToolOpened(ToolTypeMachine_Logs);
    20022012    m_pLogViewerMenuAction->setVisible(fLogViewerMenuShown);
    2003 
    2004     /* Determine whether VirtualMediaManager actions should be visible: */
    2005     const bool fMediumMenuShown = fGlobalMenuShown && m_pWidget->currentGlobalTool() == ToolTypeGlobal_VirtualMedia;
    2006     const bool fMediumActionsShown = fMediumMenuShown || !m_pWidget->isToolOpened(ToolTypeGlobal_VirtualMedia);
    2007     m_pVirtualMediaManagerMenuAction->setVisible(fMediumMenuShown);
    2008 
    2009     /* Determine whether HostNetworkManager actions should be visible: */
    2010     const bool fNetworkMenuShown = fGlobalMenuShown && m_pWidget->currentGlobalTool() == ToolTypeGlobal_HostNetwork;
    2011     const bool fNetworkActionsShown = fNetworkMenuShown || !m_pWidget->isToolOpened(ToolTypeGlobal_HostNetwork);
    2012     m_pHostNetworkManagerMenuAction->setVisible(fNetworkMenuShown);
    20132013
    20142014    /* Hide action shortcuts: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp

    r74502 r74556  
    134134        m_pPaneToolsMachine->setItems(currentItems());
    135135    /* If that was 'Snapshot' or 'LogViewer' => pass there current or null machine: */
    136     if (enmType == ToolTypeMachine_Snapshots || enmType == ToolTypeMachine_LogViewer)
     136    if (enmType == ToolTypeMachine_Snapshots || enmType == ToolTypeMachine_Logs)
    137137    {
    138138        UIVirtualMachineItem *pItem = currentItem();
     
    254254        if (pItem && pItem->accessible())
    255255        {
    256             /* If Desktop pane is chosen currently => open tool currently chosen in Tools-pane: */
    257             if (m_pPaneToolsMachine->currentTool() == ToolTypeMachine_Desktop)
     256            /* If Error pane is chosen currently => open tool currently chosen in Tools-pane: */
     257            if (m_pPaneToolsMachine->currentTool() == ToolTypeMachine_Error)
    258258                sltHandleToolsPaneIndexChange();
    259259
     
    268268        else
    269269        {
    270             /* Make sure Desktop-pane raised: */
    271             m_pPaneToolsMachine->openTool(ToolTypeMachine_Desktop);
     270            /* Make sure Error pane raised: */
     271            m_pPaneToolsMachine->openTool(ToolTypeMachine_Error);
    272272
    273273            /* Note that the machine becomes inaccessible (or if the last VM gets
     
    332332            ToolTypeGlobal enmType = ToolTypeGlobal_Invalid;
    333333            if (!m_pPaneTools->areToolsEnabled(UIToolsClass_Global))
    334                 enmType = ToolTypeGlobal_Desktop;
     334                enmType = ToolTypeGlobal_Media;
    335335            else
    336336            {
    337337                switch (m_pPaneTools->toolsType())
    338338                {
    339                     case UIToolsType_Media:   enmType = ToolTypeGlobal_VirtualMedia; break;
    340                     case UIToolsType_Network: enmType = ToolTypeGlobal_HostNetwork; break;
     339                    case UIToolsType_Media:   enmType = ToolTypeGlobal_Media; break;
     340                    case UIToolsType_Network: enmType = ToolTypeGlobal_Network; break;
    341341                    default: break;
    342342                }
     
    350350            ToolTypeMachine enmType = ToolTypeMachine_Invalid;
    351351            if (!m_pPaneTools->areToolsEnabled(UIToolsClass_Machine))
    352                 enmType = ToolTypeMachine_Desktop;
     352                enmType = ToolTypeMachine_Details;
    353353            else
    354354            {
     
    357357                    case UIToolsType_Details:   enmType = ToolTypeMachine_Details; break;
    358358                    case UIToolsType_Snapshots: enmType = ToolTypeMachine_Snapshots; break;
    359                     case UIToolsType_Logs:      enmType = ToolTypeMachine_LogViewer; break;
     359                    case UIToolsType_Logs:      enmType = ToolTypeMachine_Logs; break;
    360360                    default: break;
    361361                }
     
    603603    /* Separator: */
    604604    if (   isToolOpened(ToolTypeMachine_Snapshots)
    605         || isToolOpened(ToolTypeMachine_LogViewer)
    606         || isToolOpened(ToolTypeGlobal_VirtualMedia)
    607         || isToolOpened(ToolTypeGlobal_HostNetwork))
     605        || isToolOpened(ToolTypeMachine_Logs)
     606        || isToolOpened(ToolTypeGlobal_Media)
     607        || isToolOpened(ToolTypeGlobal_Network))
    608608        m_pToolBar->addSeparator();
    609609
    610     /* Add 'Snapshot' actions block: */
     610    /* Add 'Snapshots' actions block: */
    611611    if (isToolOpened(ToolTypeMachine_Snapshots))
    612612    {
     
    618618    }
    619619
    620     /* Add 'Log Viewer' actions block: */
    621     if (isToolOpened(ToolTypeMachine_LogViewer))
     620    /* Add 'Logs' actions block: */
     621    if (isToolOpened(ToolTypeMachine_Logs))
    622622    {
    623623        m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_S_Save));
     
    629629    }
    630630
    631     /* Add 'Medium' actions block: */
    632     if (isToolOpened(ToolTypeGlobal_VirtualMedia))
     631    /* Add 'Media' actions block: */
     632    if (isToolOpened(ToolTypeGlobal_Media))
    633633    {
    634634        m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Medium_S_Add));
     
    642642
    643643    /* Add 'Network' actions block: */
    644     if (isToolOpened(ToolTypeGlobal_HostNetwork))
     644    if (isToolOpened(ToolTypeGlobal_Network))
    645645    {
    646646        m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Network_S_Create));
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