VirtualBox

Ignore:
Timestamp:
May 26, 2017 11:49:48 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
115781
Message:

FE/Qt: Selector UI: Tools pane: Initial integration.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/selector
Files:
2 edited

Legend:

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

    r67046 r67114  
    55
    66/*
    7  * Copyright (C) 2006-2016 Oracle Corporation
     7 * Copyright (C) 2006-2017 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    5656# include "UISelectorWindow.h"
    5757# include "UISettingsDialogSpecific.h"
    58 # include "UISnapshotPane.h"
    5958# include "UISpacerWidgets.h"
    6059# include "UISpecialControls.h"
     
    130129    , m_pPaneDetails(0)
    131130    , m_pPaneDesktop(0)
    132     , m_pPaneSnapshots(0)
     131    , m_pPaneTools(0)
    133132    , m_pGroupMenuAction(0)
    134133    , m_pMachineMenuAction(0)
     
    306305
    307306    /* Make sure MM window is not opened: */
    308     if (m_pManagerVirtualMedia)
     307    if (   m_pManagerVirtualMedia
     308        || m_pPaneTools->isToolOpened(ToolType_VirtualMediaManager))
    309309        return;
    310310
     
    425425void UISelectorWindow::sltOpenVirtualMediumManagerWindow()
    426426{
     427    /* First check if instance of widget opened embedded: */
     428    if (m_pPaneTools->isToolOpened(ToolType_VirtualMediaManager))
     429    {
     430        sltPerformSegmentedButtonSwitch(SegmentType_Tools);
     431        m_pPaneTools->setCurrentTool(ToolType_VirtualMediaManager);
     432        return;
     433    }
     434
    427435    /* Create instance if not yet created: */
    428436    if (!m_pManagerVirtualMedia)
     
    451459void UISelectorWindow::sltOpenHostNetworkManagerWindow()
    452460{
     461    /* First check if instance of widget opened embedded: */
     462    if (m_pPaneTools->isToolOpened(ToolType_HostNetworkManager))
     463    {
     464        sltPerformSegmentedButtonSwitch(SegmentType_Tools);
     465        m_pPaneTools->setCurrentTool(ToolType_HostNetworkManager);
     466        return;
     467    }
     468
    453469    /* Create instance if not yet created: */
    454470    if (!m_pManagerHostNetwork)
     
    10621078        {
    10631079            case SegmentType_Details: m_pContainerDetails->setCurrentWidget(m_pPaneDetails); break;
    1064             case SegmentType_Snapshots: m_pContainerDetails->setCurrentWidget(m_pPaneSnapshots); break;
    1065             default: break;
     1080            case SegmentType_Tools:   m_pContainerDetails->setCurrentWidget(m_pPaneTools); break;
     1081            default:                  break;
    10661082        }
    10671083    }
     
    10921108}
    10931109
     1110void UISelectorWindow::sltHandleToolsPaneToolOpened(ToolType enmType)
     1111{
     1112    switch (enmType)
     1113    {
     1114        case ToolType_VirtualMediaManager: sltCloseVirtualMediumManagerWindow(); break;
     1115        case ToolType_HostNetworkManager:  sltCloseHostNetworkManagerWindow(); break;
     1116        default:                           break;
     1117    }
     1118}
     1119
    10941120UIVMItem* UISelectorWindow::currentItem() const
    10951121{
     
    11021128}
    11031129
    1104 void UISelectorWindow::updateSnapshots(UIVMItem *pItem, const CMachine &comMachine)
    1105 {
    1106     /* Update segmented-button text: */
    1107     // TODO: Bring that NLS to "&Snapshots" / "&Snapshots (%1)" form
    1108     //       as translator should be able to translate whole sentence.
    1109     //       And move it from UIDesktopPane to UISelectorWindow context.
    1110     QString strName = QApplication::translate("UIDesktopPane", "&Snapshots");
    1111     if (pItem)
    1112     {
    1113         /* Append the snapshot count (if any): */
    1114         const ULONG count = pItem->snapshotCount();
    1115         if (count)
    1116             strName += QString(" (%1)").arg(count);
    1117     }
    1118     m_pSegmentedButton->setTitle(SegmentType_Snapshots, strName);
    1119 
     1130void UISelectorWindow::updateSnapshots(UIVMItem * /* pItem */, const CMachine &comMachine)
     1131{
    11201132    /* Update snapshot pane availability: */
    11211133    if (comMachine.isNotNull())
    1122         m_pSegmentedButton->setEnabled(SegmentType_Snapshots, true);
     1134        m_pSegmentedButton->setEnabled(SegmentType_Tools, true);
    11231135    else
    11241136        lockSnapshots();
    11251137
    1126     /* Update snapshot pane finally: */
    1127     m_pPaneSnapshots->setMachine(comMachine);
     1138    /* Update tools pane finally: */
     1139    m_pPaneTools->setMachine(comMachine);
    11281140}
    11291141
     
    11331145    sltPerformSegmentedButtonSwitchToDetails();
    11341146    /* Then lock the snapshot pane: */
    1135     m_pSegmentedButton->setEnabled(SegmentType_Snapshots, false);
     1147    m_pSegmentedButton->setEnabled(SegmentType_Tools, false);
    11361148}
    11371149
     
    11531165    // TODO: Move that NLS from UIDesktopPane to UISelectorWindow context.
    11541166    m_pSegmentedButton->setTitle(SegmentType_Details, QApplication::translate("UIDesktopPane", "&Details"));
     1167    m_pSegmentedButton->setTitle(SegmentType_Tools, QApplication::translate("UIDesktopPane", "&Tools"));
    11551168
    11561169    /* Make sure details and snapshot panes are updated: */
     
    17831796    /* Create/add segmented-button: */
    17841797    m_pSegmentedButton = new UITexturedSegmentedButton(this, 2);
    1785     m_pSegmentedButton->setIcon(SegmentType_Details, UIIconPool::iconSet(":/vm_settings_16px.png",
    1786                                                                          ":/vm_settings_disabled_16px.png"));
    1787     m_pSegmentedButton->setIcon(SegmentType_Snapshots, UIIconPool::iconSet(":/snapshot_take_16px.png",
    1788                                                                            ":/snapshot_take_disabled_16px.png"));
     1798    m_pSegmentedButton->setIcon(SegmentType_Details, UIIconPool::iconSet(":/edataman_16px.png",
     1799                                                                         ":/edataman_16px.png"));
     1800    m_pSegmentedButton->setIcon(SegmentType_Tools, UIIconPool::iconSet(":/guesttools_16px.png",
     1801                                                                       ":/guesttools_disabled_16px.png"));
    17891802    m_pToolBar->addWidget(m_pSegmentedButton);
    17901803
     
    18151828    m_pPaneDesktop = new UIDesktopPane(actionPool()->action(UIActionIndexST_M_Group_S_Refresh), this);
    18161829
    1817     /* Prepare snapshot pane: */
    1818     m_pPaneSnapshots = new UISnapshotPane(this);
    1819 
    1820     /* Crate container: */
     1830    /* Prepare tools pane: */
     1831    m_pPaneTools = new UIToolsPane(this);
     1832
     1833    /* Create container: */
    18211834    m_pContainerDetails = new QStackedWidget(this);
    18221835    m_pContainerDetails->addWidget(m_pPaneDetails);
    18231836    m_pContainerDetails->addWidget(m_pPaneDesktop);
    1824     m_pContainerDetails->addWidget(m_pPaneSnapshots);
     1837    m_pContainerDetails->addWidget(m_pPaneTools);
    18251838
    18261839    /* Layout all the widgets: */
     
    19471960    connect(m_pPaneDetails, SIGNAL(sigLinkClicked(const QString&, const QString&, const QString&)),
    19481961            this, SLOT(sltOpenMachineSettingsDialog(const QString&, const QString&, const QString&)));
     1962    connect(m_pPaneTools, &UIToolsPane::sigToolOpened, this, &UISelectorWindow::sltHandleToolsPaneToolOpened);
    19491963
    19501964    /* Global event handlers: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h

    r67046 r67114  
    55
    66/*
    7  * Copyright (C) 2006-2016 Oracle Corporation
     7 * Copyright (C) 2006-2017 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2525#include "QIMainWindow.h"
    2626#include "QIWithRetranslateUI.h"
     27#include "UIToolsPane.h"
    2728#include "VBoxGlobal.h"
    2829
     
    4041class UIGDetails;
    4142class UIMainBar;
    42 class UISnapshotPane;
    4343class UITexturedSegmentedButton;
    4444class UIToolBar;
     
    5454    enum SegmentType
    5555    {
    56         SegmentType_Details   = 0,
    57         SegmentType_Snapshots
     56        SegmentType_Details,
     57        SegmentType_Tools,
    5858    };
    5959
     
    204204    /** @} */
    205205
     206    /** @name Tools-pane stuff.
     207      * @{ */
     208        void sltHandleToolsPaneToolOpened(ToolType enmType);
     209    /** @} */
     210
    206211private:
    207212
     
    348353    /** Holds the Desktop-pane instance. */
    349354    UIDesktopPane *m_pPaneDesktop;
    350     /** Holds the Snapshot-pane instance. */
    351     UISnapshotPane *m_pPaneSnapshots;
     355    /** Holds the Tools-pane instance. */
     356    UIToolsPane *m_pPaneTools;
    352357
    353358    /** Holds the list of Group menu actions. */
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