VirtualBox

Changeset 50309 in vbox for trunk


Ignore:
Timestamp:
Feb 3, 2014 2:41:28 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: 6863: Runtime UI: SATA hot-plug support (step 5): Add hard-disk status-bar indicator's context menu.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
9 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/VirtualBox2.qrc

    r49333 r50309  
    7575        <file alias="hd_16px.png">images/hd_16px.png</file>
    7676        <file alias="hd_disabled_16px.png">images/hd_disabled_16px.png</file>
     77        <file alias="hd_settings_16px.png">images/hd_settings_16px.png</file>
     78        <file alias="hd_settings_disabled_16px.png">images/hd_settings_disabled_16px.png</file>
    7779        <file alias="hd_32px.png">images/hd_32px.png</file>
    7880        <file alias="hd_disabled_32px.png">images/hd_disabled_32px.png</file>
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp

    r50165 r50309  
    664664    {
    665665        setName(QApplication::translate("UIActionPool", "&Devices"));
     666    }
     667};
     668
     669class UIActionMenuHardDisks : public UIActionMenu
     670{
     671    Q_OBJECT;
     672
     673public:
     674
     675    UIActionMenuHardDisks(UIActionPool *pParent)
     676        : UIActionMenu(pParent, ":/hd_16px.png", ":/hd_disabled_16px.png")
     677    {
     678        qobject_cast<UIMenu*>(menu())->setShowToolTips(true);
     679        retranslateUi();
     680    }
     681
     682protected:
     683
     684    void retranslateUi() {}
     685};
     686
     687class UIActionSimpleShowStorageSettingsDialog : public UIActionSimple
     688{
     689    Q_OBJECT;
     690
     691public:
     692
     693    UIActionSimpleShowStorageSettingsDialog(UIActionPool *pParent)
     694        : UIActionSimple(pParent, ":/hd_settings_16px.png", ":/hd_settings_disabled_16px.png")
     695    {
     696        retranslateUi();
     697    }
     698
     699protected:
     700
     701    QString shortcutExtraDataID() const
     702    {
     703        return QString("StorageSettingsDialog");
     704    }
     705
     706    void retranslateUi()
     707    {
     708        setName(QApplication::translate("UIActionPool", "&Storage Settings..."));
     709        setStatusTip(QApplication::translate("UIActionPool", "Change the settings of storage devices"));
    666710    }
    667711};
     
    12391283
    12401284    /* 'Devices' actions: */
     1285    m_pool[UIActionIndexRuntime_Simple_StorageSettings] = new UIActionSimpleShowStorageSettingsDialog(this);
    12411286    m_pool[UIActionIndexRuntime_Simple_NetworkSettings] = new UIActionSimpleShowNetworkSettingsDialog(this);
    12421287    m_pool[UIActionIndexRuntime_Simple_SharedFoldersSettings] = new UIActionSimpleShowSharedFoldersSettingsDialog(this);
     
    12921337        delete m_pool[UIActionIndexRuntime_Menu_Devices];
    12931338    m_pool[UIActionIndexRuntime_Menu_Devices] = new UIActionMenuDevices(this);
     1339    if (m_pool[UIActionIndexRuntime_Menu_HardDisks])
     1340        delete m_pool[UIActionIndexRuntime_Menu_HardDisks];
     1341    m_pool[UIActionIndexRuntime_Menu_HardDisks] = new UIActionMenuHardDisks(this);
    12941342    if (m_pool[UIActionIndexRuntime_Menu_OpticalDevices])
    12951343        delete m_pool[UIActionIndexRuntime_Menu_OpticalDevices];
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h

    r49333 r50309  
    5555    /* 'Devices' menu actions: */
    5656    UIActionIndexRuntime_Menu_Devices,
     57    UIActionIndexRuntime_Menu_HardDisks,
     58    UIActionIndexRuntime_Simple_StorageSettings,
    5759    UIActionIndexRuntime_Menu_OpticalDevices,
    5860    UIActionIndexRuntime_Menu_FloppyDevices,
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r50301 r50309  
    827827    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_MouseIntegration));
    828828    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Pause));
     829    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Menu_HardDisks));
     830    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_StorageSettings));
    829831    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Menu_OpticalDevices));
    830832    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Menu_FloppyDevices));
     
    886888
    887889    /* "Devices" actions connections: */
     890    connect(gActionPool->action(UIActionIndexRuntime_Simple_StorageSettings), SIGNAL(triggered()),
     891            this, SLOT(sltOpenStorageSettingsDialog()));
    888892    connect(gActionPool->action(UIActionIndexRuntime_Menu_OpticalDevices)->menu(), SIGNAL(aboutToShow()),
    889893            this, SLOT(sltPrepareStorageMenu()));
     
    14531457    foreach (UIMachineWindow *pMachineWindow, machineWindows())
    14541458        pMachineWindow->updateAppearanceOf(UIVisualElement_HDStuff | UIVisualElement_CDStuff | UIVisualElement_FDStuff);
     1459}
     1460
     1461void UIMachineLogic::sltOpenStorageSettingsDialog()
     1462{
     1463    /* Machine settings: Storage page: */
     1464    sltOpenVMSettingsDialog("#storage");
    14551465}
    14561466
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r50302 r50309  
    199199    /* "Device" menu functionality: */
    200200    void sltOpenVMSettingsDialog(const QString &strCategory = QString(), const QString &strControl = QString());
     201    void sltOpenStorageSettingsDialog();
    201202    void sltOpenNetworkAdaptersDialog();
    202203    void sltOpenSharedFoldersDialog();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r50302 r50309  
    12601260    bool fAllowReconfiguration = m_machineState != KMachineState_Stuck && m_fReconfigurable;
    12611261    gActionPool->action(UIActionIndexRuntime_Simple_SettingsDialog)->setEnabled(fAllowReconfiguration);
     1262    gActionPool->action(UIActionIndexRuntime_Simple_StorageSettings)->setEnabled(fAllowReconfiguration);
    12621263    gActionPool->action(UIActionIndexRuntime_Simple_SharedFoldersSettings)->setEnabled(fAllowReconfiguration);
    12631264    gActionPool->action(UIActionIndexRuntime_Simple_VideoCaptureSettings)->setEnabled(fAllowReconfiguration);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp

    r50300 r50309  
    6767}
    6868
     69void UIMachineLogicNormal::sltPrepareHardDisksMenu()
     70{
     71    QMenu *pMenu = qobject_cast<QMenu*>(sender());
     72    AssertMsg(pMenu, ("This slot should be called only on Hard Disks menu show!\n"));
     73    pMenu->clear();
     74    pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_StorageSettings));
     75}
     76
    6977void UIMachineLogicNormal::sltPrepareSharedFoldersMenu()
    7078{
     
    106114
    107115    /* "Device" actions connections: */
     116    connect(gActionPool->action(UIActionIndexRuntime_Menu_HardDisks)->menu(), SIGNAL(aboutToShow()),
     117            this, SLOT(sltPrepareHardDisksMenu()));
    108118    connect(gActionPool->action(UIActionIndexRuntime_Menu_SharedFolders)->menu(), SIGNAL(aboutToShow()),
    109119            this, SLOT(sltPrepareSharedFoldersMenu()));
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.h

    r50165 r50309  
    4040
    4141    /* Windowed mode functionality: */
     42    void sltPrepareHardDisksMenu();
    4243    void sltPrepareSharedFoldersMenu();
    4344    void sltPrepareVideoCaptureMenu();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp

    r49177 r50309  
    133133void UIMachineWindowNormal::sltShowIndicatorsContextMenu(QIStateIndicator *pIndicator, QContextMenuEvent *pEvent)
    134134{
     135    /* Show hard-disks LED context menu: */
     136    if (pIndicator == indicatorsPool()->indicator(IndicatorType_HardDisks))
     137    {
     138        if (gActionPool->action(UIActionIndexRuntime_Menu_HardDisks)->isEnabled())
     139            gActionPool->action(UIActionIndexRuntime_Menu_HardDisks)->menu()->exec(pEvent->globalPos());
     140    }
    135141    /* Show optical-disks LED context menu: */
    136     if (pIndicator == indicatorsPool()->indicator(IndicatorType_OpticalDisks))
     142    else if (pIndicator == indicatorsPool()->indicator(IndicatorType_OpticalDisks))
    137143    {
    138144        if (gActionPool->action(UIActionIndexRuntime_Menu_OpticalDevices)->isEnabled())
     
    249255    {
    250256        pIndicatorBoxHLayout->addWidget(pLedHardDisks);
     257        connect(pLedHardDisks, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)),
     258                this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*)));
    251259        fAtLeastOneAddedToLeftSection = true;
    252260    }
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