VirtualBox

Changeset 52097 in vbox


Ignore:
Timestamp:
Jul 18, 2014 11:03:57 AM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: 3646: Status-bar Editor: Integrate status-bar menu into Runtime UI.

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

Legend:

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

    r52012 r52097  
    507507        case RuntimeMenuViewActionType_GuestAutoresize: strResult = "GuestAutoresize"; break;
    508508        case RuntimeMenuViewActionType_AdjustWindow:    strResult = "AdjustWindow"; break;
     509        case RuntimeMenuViewActionType_StatusBar:       strResult = "StatusBar"; break;
    509510        case RuntimeMenuViewActionType_Multiscreen:     strResult = "Multiscreen"; break;
    510511        case RuntimeMenuViewActionType_All:             strResult = "All"; break;
     
    529530    keys << "GuestAutoresize"; values << RuntimeMenuViewActionType_GuestAutoresize;
    530531    keys << "AdjustWindow";    values << RuntimeMenuViewActionType_AdjustWindow;
     532    keys << "StatusBar";       values << RuntimeMenuViewActionType_StatusBar;
    531533    keys << "Multiscreen";     values << RuntimeMenuViewActionType_Multiscreen;
    532534    keys << "All";             values << RuntimeMenuViewActionType_All;
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r52035 r52097  
    413413    RuntimeMenuViewActionType_GuestAutoresize = RT_BIT(3),
    414414    RuntimeMenuViewActionType_AdjustWindow    = RT_BIT(4),
    415     RuntimeMenuViewActionType_Multiscreen     = RT_BIT(5),
     415    RuntimeMenuViewActionType_StatusBar       = RT_BIT(5),
     416    RuntimeMenuViewActionType_Multiscreen     = RT_BIT(6),
    416417    RuntimeMenuViewActionType_All             = 0xFFFF
    417418};
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp

    r51993 r52097  
    692692        setName(QApplication::translate("UIActionPool", "&Adjust Window Size"));
    693693        setStatusTip(QApplication::translate("UIActionPool", "Adjust window size and position to best fit the guest display"));
     694    }
     695};
     696
     697class UIActionMenuStatusBar : public UIActionMenu
     698{
     699    Q_OBJECT;
     700
     701public:
     702
     703    UIActionMenuStatusBar(UIActionPool *pParent)
     704        : UIActionMenu(pParent)
     705    {
     706        retranslateUi();
     707    }
     708
     709protected:
     710
     711    void retranslateUi()
     712    {
     713        setName(QApplication::translate("UIActionPool", "&Status Bar"));
     714    }
     715};
     716
     717class UIActionSimpleShowStatusBarSettingsWindow : public UIActionSimple
     718{
     719    Q_OBJECT;
     720
     721public:
     722
     723    UIActionSimpleShowStatusBarSettingsWindow(UIActionPool *pParent)
     724        : UIActionSimple(pParent)
     725    {
     726        retranslateUi();
     727    }
     728
     729protected:
     730
     731    QString shortcutExtraDataID() const
     732    {
     733        return QString("StatusBarSettings");
     734    }
     735
     736    void retranslateUi()
     737    {
     738        setName(QApplication::translate("UIActionPool", "&Status Bar Settings..."));
     739        setStatusTip(QApplication::translate("UIActionPool", "Opens window to configure status-bar"));
    694740    }
    695741};
     
    13411387    m_pool[UIActionIndexRuntime_Toggle_GuestAutoresize] = new UIActionToggleGuestAutoresize(this);
    13421388    m_pool[UIActionIndexRuntime_Simple_AdjustWindow] = new UIActionSimplePerformWindowAdjust(this);
     1389    m_pool[UIActionIndexRuntime_Simple_StatusBarSettings] = new UIActionSimpleShowStatusBarSettingsWindow(this);
    13431390
    13441391    /* 'Devices' actions: */
     
    13951442        delete m_pool[UIActionIndexRuntime_Menu_View];
    13961443    m_pool[UIActionIndexRuntime_Menu_View] = new UIActionMenuView(this);
     1444    if (m_pool[UIActionIndexRuntime_Menu_StatusBar])
     1445        delete m_pool[UIActionIndexRuntime_Menu_StatusBar];
     1446    m_pool[UIActionIndexRuntime_Menu_StatusBar] = new UIActionMenuStatusBar(this);
    13971447
    13981448    /* 'Devices' menu: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h

    r51398 r52097  
    5454    UIActionIndexRuntime_Toggle_GuestAutoresize,
    5555    UIActionIndexRuntime_Simple_AdjustWindow,
     56    UIActionIndexRuntime_Menu_StatusBar,
     57    UIActionIndexRuntime_Simple_StatusBarSettings,
    5658
    5759    /* 'Devices' menu actions: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r52055 r52097  
    857857    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_MouseIntegration));
    858858    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Pause));
     859    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Menu_StatusBar));
     860    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_StatusBarSettings));
    859861    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Menu_HardDisks));
    860862    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_StorageSettings));
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp

    r51666 r52097  
    382382
    383383
     384    /* Separator #2? */
     385    bool fSeparator2 = false;
     386
    384387    /* Guest Autoresize action: */
    385388    if (m_pSession->allowedActionsMenuView() & RuntimeMenuViewActionType_GuestAutoresize)
     389    {
    386390        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize));
     391        fSeparator2 = true;
     392    }
    387393    else
    388394        gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize)->setEnabled(false);
     
    390396    /* Adjust Window action: */
    391397    if (m_pSession->allowedActionsMenuView() & RuntimeMenuViewActionType_AdjustWindow)
     398    {
    392399        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_AdjustWindow));
     400        fSeparator2 = true;
     401    }
    393402    else
    394403        gActionPool->action(UIActionIndexRuntime_Simple_AdjustWindow)->setEnabled(false);
     404
     405    /* Separator #2: */
     406    if (fSeparator2)
     407        pMenu->addSeparator();
     408
     409
     410    /* Status-bar submenu: */
     411    if (m_pSession->allowedActionsMenuView() & RuntimeMenuViewActionType_StatusBar)
     412    {
     413        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_StatusBar));
     414        gActionPool->action(UIActionIndexRuntime_Menu_StatusBar)->menu()->addAction(gActionPool->action(UIActionIndexRuntime_Simple_StatusBarSettings));
     415    }
     416    else
     417    {
     418        gActionPool->action(UIActionIndexRuntime_Menu_StatusBar)->setEnabled(false);
     419        gActionPool->action(UIActionIndexRuntime_Simple_StatusBarSettings)->setEnabled(false);
     420    }
    395421}
    396422
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.cpp

    r52076 r52097  
    2323#include <QPaintEvent>
    2424#include <QMouseEvent>
     25#include <QStatusBar>
    2526#include <QMdiArea>
    2627#include <QPainter>
     
    3536#include "UIExtraDataManager.h"
    3637#include "UIExtraDataDefs.h"
     38#include "UIMachineWindow.h"
    3739#include "UIConverter.h"
    3840#include "UIIconPool.h"
     
    699701
    700702
    701 UIStatusBarEditorWindow::UIStatusBarEditorWindow(QWidget *pParent, const QRect &rect, const QRect &statusBarRect)
     703UIStatusBarEditorWindow::UIStatusBarEditorWindow(UIMachineWindow *pParent)
    702704    : QWidget(pParent, Qt::Tool | Qt::FramelessWindowHint)
    703     , m_rect(rect), m_statusBarRect(statusBarRect)
     705    , m_rect(pParent->geometry())
     706    , m_statusBarRect(pParent->statusBar()->geometry())
    704707    , m_pAnimation(0), m_fExpanded(false)
    705708    , m_pMainLayout(0), m_pMdiArea(0)
     
    809812#endif /* Q_WS_WIN */
    810813
    811     /* Request to activate window after it was shown: */
    812     connect(this, SIGNAL(sigShown()), this, SLOT(sltActivateWindow()), Qt::QueuedConnection);
     814    /* Activate window after it was shown: */
     815    connect(this, SIGNAL(sigShown()), this,
     816            SLOT(sltActivateWindow()), Qt::QueuedConnection);
     817    /* Update window geometry after parent geometry changed: */
     818    connect(parent(), SIGNAL(sigGeometryChange(const QRect&)),
     819            this, SLOT(sltParentGeometryChanged(const QRect&)));
    813820}
    814821
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.h

    r52074 r52097  
    2424class QMdiArea;
    2525class QMdiSubWindow;
     26class QHBoxLayout;
    2627class UIAnimation;
    27 class QHBoxLayout;
     28class UIMachineWindow;
    2829class UIStatusBarEditorWidget;
    2930
     
    4849public:
    4950
    50     /** Constructor, passes @a pParent to the QWidget constructor.
    51       * @param rect is used to define initial cached parent geometry.
    52       * @param statusBarRect is used to define initial cached status-bar geometry. */
    53     UIStatusBarEditorWindow(QWidget *pParent, const QRect &rect, const QRect &statusBarRect);
     51    /** Constructor, passes @a pParent to the QWidget constructor. */
     52    UIStatusBarEditorWindow(UIMachineWindow *pParent);
    5453
    5554private slots:
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp

    r51671 r52097  
    434434    /* Adjust-window action isn't allowed in fullscreen: */
    435435    gActionPool->action(UIActionIndexRuntime_Simple_AdjustWindow)->setVisible(false);
     436    /* Status-bar menu isn't allowed in fullscreen: */
     437    gActionPool->action(UIActionIndexRuntime_Menu_StatusBar)->setVisible(false);
    436438
    437439    /* Take care of view-action toggle state: */
     
    606608    }
    607609
     610    /* Reenable status-bar menu: */
     611    gActionPool->action(UIActionIndexRuntime_Menu_StatusBar)->setVisible(true);
    608612    /* Reenable adjust-window action: */
    609613    gActionPool->action(UIActionIndexRuntime_Simple_AdjustWindow)->setVisible(true);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp

    r51398 r52097  
    2626#include "UIMachineLogicNormal.h"
    2727#include "UIMachineWindow.h"
     28#include "UIStatusBarEditorWindow.h"
     29#include "UIExtraDataManager.h"
    2830#ifdef Q_WS_MAC
    2931#include "VBoxUtils.h"
     
    6870}
    6971
     72void UIMachineLogicNormal::sltOpenStatusBarSettings()
     73{
     74    /* Do not process if window(s) missed! */
     75    AssertReturnVoid(isMachineWindowsCreated());
     76
     77    /* Prevent user from opening another one editor: */
     78    gActionPool->action(UIActionIndexRuntime_Simple_StatusBarSettings)->setEnabled(false);
     79    /* Create status-bar editor: */
     80    UIStatusBarEditorWindow *pStatusBarEditor = new UIStatusBarEditorWindow(activeMachineWindow());
     81    AssertPtrReturnVoid(pStatusBarEditor);
     82    {
     83        /* Configure status-bar editor: */
     84        connect(pStatusBarEditor, SIGNAL(destroyed(QObject*)),
     85                this, SLOT(sltStatusBarSettingsClosed()));
     86#ifdef Q_WS_MAC
     87        connect(this, SIGNAL(sigNotifyAbout3DOverlayVisibilityChange(bool)),
     88                pStatusBarEditor, SLOT(sltActivateWindow()));
     89#endif /* Q_WS_MAC */
     90        /* Show window: */
     91        pStatusBarEditor->show();
     92    }
     93}
     94
     95void UIMachineLogicNormal::sltStatusBarSettingsClosed()
     96{
     97    /* Allow user to open editor again: */
     98    gActionPool->action(UIActionIndexRuntime_Simple_StatusBarSettings)->setEnabled(true);
     99}
     100
    70101void UIMachineLogicNormal::sltPrepareHardDisksMenu()
    71102{
     
    121152    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
    122153            this, SLOT(sltChangeVisualStateToScale()));
     154    connect(gActionPool->action(UIActionIndexRuntime_Simple_StatusBarSettings), SIGNAL(triggered(bool)),
     155            this, SLOT(sltOpenStatusBarSettings()));
    123156
    124157    /* "Device" actions connections: */
     
    183216    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
    184217               this, SLOT(sltChangeVisualStateToScale()));
     218    disconnect(gActionPool->action(UIActionIndexRuntime_Simple_StatusBarSettings), SIGNAL(triggered(bool)),
     219               this, SLOT(sltOpenStatusBarSettings()));
    185220
    186221    /* Call to base-class: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.h

    r51398 r52097  
    3939    void sltCheckForRequestedVisualStateType();
    4040
    41     /* Windowed mode functionality: */
     41    /* View menu functionality: */
     42    void sltOpenStatusBarSettings();
     43    void sltStatusBarSettingsClosed();
     44
     45    /* Devices menu functionality: */
    4246    void sltPrepareHardDisksMenu();
    4347    void sltPrepareSharedFoldersMenu();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp

    r52070 r52097  
    2828#include "VBoxGlobal.h"
    2929#include "UIMachineWindowNormal.h"
    30 #include "UIStatusBarEditorWindow.h"
    3130#include "UIActionPoolRuntime.h"
    3231#include "UIExtraDataManager.h"
     
    114113}
    115114
    116 void UIMachineWindowNormal::sltShowStatusBarContextMenu(const QPoint &position)
    117 {
    118     /* Prepare context-menu: */
    119     QMenu menu;
    120     /* Having just one action to configure status-bar: */
    121     QAction *pAction = menu.addAction(UIIconPool::iconSet(":/vm_settings_16px.png"),
    122                                       tr("Configure status-bar..."),
    123                                       this, SLOT(sltOpenStatusBarEditorWindow()));
    124     pAction->setEnabled(!uisession()->property("StatusBarEditorOpened").toBool());
    125     /* Execute context-menu: */
    126     menu.exec(statusBar()->mapToGlobal(position));
    127 }
    128 
    129 void UIMachineWindowNormal::sltOpenStatusBarEditorWindow()
    130 {
    131     /* Prevent user from opening another one editor: */
    132     uisession()->setProperty("StatusBarEditorOpened", true);
    133     /* Create status-bar editor: */
    134     UIStatusBarEditorWindow *pStatusBarEditor =
    135         new UIStatusBarEditorWindow(this, m_normalGeometry, statusBar()->geometry());
    136     AssertPtrReturnVoid(pStatusBarEditor);
    137     {
    138         /* Configure status-bar editor: */
    139         connect(this, SIGNAL(sigGeometryChange(const QRect&)),
    140                 pStatusBarEditor, SLOT(sltParentGeometryChanged(const QRect&)));
    141         connect(pStatusBarEditor, SIGNAL(destroyed(QObject*)),
    142                 this, SLOT(sltStatusBarEditorWindowClosed()));
    143 #ifdef Q_WS_MAC
    144         connect(machineLogic(), SIGNAL(sigNotifyAbout3DOverlayVisibilityChange(bool)),
    145                 pStatusBarEditor, SLOT(sltActivateWindow()));
    146 #endif /* Q_WS_MAC */
    147         /* Show window: */
    148         pStatusBarEditor->show();
    149     }
    150 }
    151 
    152 void UIMachineWindowNormal::sltStatusBarEditorWindowClosed()
    153 {
    154     /* Allow user to open editor again: */
    155     uisession()->setProperty("StatusBarEditorOpened", QVariant());
     115void UIMachineWindowNormal::sltHandleStatusBarContextMenuRequest(const QPoint &position)
     116{
     117    /* Raise action's context-menu: */
     118    gActionPool->action(UIActionIndexRuntime_Menu_StatusBar)->menu()->exec(statusBar()->mapToGlobal(position));
    156119}
    157120
     
    237200        statusBar()->setContextMenuPolicy(Qt::CustomContextMenu);
    238201        connect(statusBar(), SIGNAL(customContextMenuRequested(const QPoint&)),
    239                 this, SLOT(sltShowStatusBarContextMenu(const QPoint&)));
     202                this, SLOT(sltHandleStatusBarContextMenuRequest(const QPoint&)));
    240203        /* Create indicator-pool: */
    241204        m_pIndicatorsPool = new UIIndicatorsPool(machineLogic()->uisession());
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h

    r52053 r52097  
    6060
    6161    /** Handles status-bar context-menu-request: */
    62     void sltShowStatusBarContextMenu(const QPoint &position);
    63     /** Handles status-bar editor opening. */
    64     void sltOpenStatusBarEditorWindow();
    65     /** Handles status-bar editor closing. */
    66     void sltStatusBarEditorWindowClosed();
    67 
    68     /** Handles indicator context-menu-request: */
     62    void sltHandleStatusBarContextMenuRequest(const QPoint &position);
     63    /** Handles status-bar indicator context-menu-request: */
    6964    void sltHandleIndicatorContextMenuRequest(IndicatorType indicatorType, const QPoint &position);
    7065
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineLogicScale.cpp

    r50490 r52097  
    5757    /* Adjust-window isn't allowed in scale-mode: */
    5858    gActionPool->action(UIActionIndexRuntime_Simple_AdjustWindow)->setVisible(false);
     59    /* Status-bar menu isn't allowed in scale-mode: */
     60    gActionPool->action(UIActionIndexRuntime_Menu_StatusBar)->setVisible(false);
    5961
    6062    /* Take care of view-action toggle state: */
     
    149151    }
    150152
     153    /* Reenable status-bar menu: */
     154    gActionPool->action(UIActionIndexRuntime_Menu_StatusBar)->setVisible(true);
    151155    /* Reenable guest-autoresize action: */
    152156    gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize)->setVisible(true);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp

    r51249 r52097  
    189189    /* Disable mouse-integration isn't allowed in seamless: */
    190190    gActionPool->action(UIActionIndexRuntime_Toggle_MouseIntegration)->setVisible(false);
     191    /* Status-bar menu isn't allowed in seamless: */
     192    gActionPool->action(UIActionIndexRuntime_Menu_StatusBar)->setVisible(false);
    191193
    192194    /* Take care of view-action toggle state: */
     
    292294    }
    293295
     296    /* Reenable status-bar menu: */
     297    gActionPool->action(UIActionIndexRuntime_Menu_StatusBar)->setVisible(true);
    294298    /* Reenable guest-autoresize action: */
    295299    gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize)->setVisible(true);
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