VirtualBox

Changeset 52236 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jul 30, 2014 2:11:22 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: 7462: Runtime UI: Menu-bar, menu cleanup/rework (part 13).

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp

    r52220 r52236  
    2020#include "UIExtraDataManager.h"
    2121#include "UIShortcutPool.h"
     22#include "UIFrameBuffer.h"
     23#include "UISession.h"
    2224#include "VBoxGlobal.h"
    2325
     
    12591261UIActionPoolRuntime::UIActionPoolRuntime(bool fTemporary /* = false */)
    12601262    : UIActionPool(UIActionPoolType_Runtime, fTemporary)
    1261 {
     1263    , m_pSession(0)
     1264{
     1265}
     1266
     1267void UIActionPoolRuntime::setSession(UISession *pSession)
     1268{
     1269    m_pSession = pSession;
     1270    m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup;
     1271}
     1272
     1273UISession* UIActionPoolRuntime::session() const
     1274{
     1275    return m_pSession;
    12621276}
    12631277
     
    13341348#endif /* VBOX_WITH_DEBUGGER_GUI */
    13351349
    1336 void UIActionPoolRuntime::setCurrentFrameBufferSizes(const QList<QSize> &sizes, bool fUpdateMenu /* = false */)
    1337 {
    1338     m_sizes = sizes;
    1339     if (fUpdateMenu)
    1340         m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup;
    1341 }
    1342 
    13431350void UIActionPoolRuntime::sltPrepareMenuViewResize()
    13441351{
     
    13601367    const QSize size = pAction->property("Requested Size").toSize();
    13611368    emit sigNotifyAboutTriggeringViewResize(iScreenIndex, size);
     1369}
     1370
     1371void UIActionPoolRuntime::sltHandleFrameBufferResize()
     1372{
     1373    /* Make sure session was set: */
     1374    AssertPtrReturnVoid(m_pSession);
     1375
     1376    /* Update the list of frame-buffer sizes: */
     1377    m_frameBufferSizes.clear();
     1378    foreach (const UIFrameBuffer *pFrameBuffer, session()->frameBuffers())
     1379        m_frameBufferSizes << QSize(pFrameBuffer->width(), pFrameBuffer->height());
     1380    /* Invalidate View and ViewPopup menus: */
     1381    m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup;
    13621382}
    13631383
     
    19151935    const bool fAllowToShowActionResize = isAllowedInMenuView(RuntimeMenuViewActionType_Resize);
    19161936    if (fAllowToShowActionResize)
    1917         for (int iScreenIndex = 0; iScreenIndex < m_sizes.size(); ++iScreenIndex)
     1937        for (int iScreenIndex = 0; iScreenIndex < m_frameBufferSizes.size(); ++iScreenIndex)
    19181938        {
    19191939            /* Add 'Virtual Screen %1' menu: */
     
    19671987    const bool fAllowToShowActionResize = isAllowedInMenuView(RuntimeMenuViewActionType_Resize);
    19681988    if (fAllowToShowActionResize)
    1969         for (int iScreenIndex = 0; iScreenIndex < m_sizes.size(); ++iScreenIndex)
     1989        for (int iScreenIndex = 0; iScreenIndex < m_frameBufferSizes.size(); ++iScreenIndex)
    19701990        {
    19711991            /* Add 'Virtual Screen %1' menu: */
     
    20262046    /* Get corresponding screen index and size: */
    20272047    const int iScreenIndex = pMenu->property("Screen Index").toInt();
    2028     const QSize screenSize = m_sizes.at(iScreenIndex);
     2048    const QSize screenSize = m_frameBufferSizes.at(iScreenIndex);
    20292049
    20302050    /* Create exclusive action-group: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h

    r52220 r52236  
    2525#include "UIActionPool.h"
    2626#include "UIExtraDataDefs.h"
     27
     28/* Forward declarations: */
     29class UISession;
    2730
    2831/** Runtime action-pool index enum.
     
    122125public:
    123126
     127    /** Defines UI session object reference.
     128      * @note For menus which uses it to build contents. */
     129    void setSession(UISession *pSession);
     130    /** Returns UI session object reference. */
     131    UISession* session() const;
     132
    124133    /** Returns whether the menu with passed @a type is allowed in menu-bar. */
    125134    bool isAllowedInMenuBar(RuntimeMenuType type) const;
     
    149158#endif /* VBOX_WITH_DEBUGGER_GUI */
    150159
    151     /** Defines current frame-buffer sizes
    152       * for menus which uses such arguments to build content. */
    153     void setCurrentFrameBufferSizes(const QList<QSize> &sizes, bool fUpdateMenu = false);
    154 
    155160protected slots:
    156161
     
    159164    /** Handles 'View' : 'Resize' menu @a pAction trigger. */
    160165    void sltHandleActionTriggerViewResize(QAction *pAction);
     166
     167    /** Handles frame-buffer resize. */
     168    void sltHandleFrameBufferResize();
    161169
    162170protected:
     
    221229private:
    222230
     231    /** Holds the UI session object reference. */
     232    UISession *m_pSession;
     233
    223234    /** Holds the list of main-menus. */
    224235    QList<QMenu*> m_mainMenus;
     
    237248#endif /* VBOX_WITH_DEBUGGER_GUI */
    238249
    239     /** Defines current frame-buffer sizes
    240       * for menus which uses such arguments to build content. */
    241     QList<QSize> m_sizes;
     250    /** Holds current frame-buffer sizes. */
     251    QList<QSize> m_frameBufferSizes;
    242252
    243253    /* Enable factory in base-class: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r52220 r52236  
    805805
    806806    /* Host-screen-change updaters: */
    807     connect(uisession(), SIGNAL(sigHostScreenCountChanged()),
    808             this, SLOT(sltHostScreenCountChanged()));
    809     connect(uisession(), SIGNAL(sigHostScreenGeometryChanged()),
    810             this, SLOT(sltHostScreenGeometryChanged()));
     807    connect(uisession(), SIGNAL(sigHostScreenCountChanged()), this, SLOT(sltHostScreenCountChanged()));
     808    connect(uisession(), SIGNAL(sigHostScreenGeometryChanged()), this, SLOT(sltHostScreenGeometryChanged()));
     809
     810    /* Frame-buffer connections: */
     811    connect(this, SIGNAL(sigFrameBufferResize()), uisession(), SIGNAL(sigFrameBufferResize()));
    811812}
    812813
     
    957958}
    958959
    959 void UIMachineLogic::prepareOtherConnections()
    960 {
    961     connect(this, SIGNAL(sigFrameBufferResize()), this, SLOT(sltHandleFrameBufferResize()));
    962 }
    963 
    964960void UIMachineLogic::prepareHandlers()
    965961{
     
    14871483}
    14881484
    1489 void UIMachineLogic::sltHandleFrameBufferResize()
    1490 {
    1491     /* Prepare the list of frame-buffer sizes: */
    1492     QList<QSize> frameBufferSizes;
    1493     foreach (UIMachineWindow *pMachineWindow, machineWindows())
    1494     {
    1495         const UIFrameBuffer *pFB = uisession()->frameBuffer(pMachineWindow->screenId());
    1496         frameBufferSizes << QSize(pFB->width(), pFB->height());
    1497     }
    1498     /* Pass that list to the action-pool to update 'View' menu accordingly: */
    1499     actionPool()->toRuntime()->setCurrentFrameBufferSizes(frameBufferSizes);
    1500 }
    1501 
    15021485void UIMachineLogic::sltOpenVMSettingsDialog(const QString &strCategory /* = QString() */,
    15031486                                             const QString &strControl /* = QString()*/)
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r52220 r52236  
    166166    virtual void prepareActionGroups();
    167167    virtual void prepareActionConnections();
    168     virtual void prepareOtherConnections();
     168    virtual void prepareOtherConnections() {}
    169169    virtual void prepareHandlers();
    170170    virtual void prepareMachineWindows() = 0;
     
    222222    void sltClose();
    223223
    224     /** Handles frame-buffer resize. */
    225     void sltHandleFrameBufferResize();
    226 
    227224    /* "Device" menu functionality: */
    228225    void sltOpenVMSettingsDialog(const QString &strCategory = QString(), const QString &strControl = QString());
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r52203 r52236  
    985985    /* Create action-pool: */
    986986    m_pActionPool = UIActionPool::create(UIActionPoolType_Runtime);
     987    m_pActionPool->toRuntime()->setSession(this);
     988    connect(this, SIGNAL(sigFrameBufferResize()), m_pActionPool, SLOT(sltHandleFrameBufferResize()));
    987989
    988990    /* Get host/machine: */
     
    11281130{
    11291131    /* Each framebuffer will be really prepared on first UIMachineView creation: */
    1130     const ULONG uMonitorCount = m_session.GetMachine().GetMonitorCount();
    1131     m_frameBufferVector.resize(uMonitorCount);
    1132     QVector<QSize> sizes(uMonitorCount);
    1133     actionPool()->toRuntime()->setCurrentFrameBufferSizes(sizes.toList(), true);
     1132    m_frameBufferVector.resize(m_session.GetMachine().GetMonitorCount());
    11341133}
    11351134
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r52202 r52236  
    206206     * Ignores (asserts) if screen-number attribute is out of bounds: */
    207207    void setFrameBuffer(ulong uScreenId, UIFrameBuffer* pFrameBuffer);
     208    /** Returns existing frame-buffer vector. */
     209    const QVector<ComObjPtr<UIFrameBuffer> >& frameBuffers() const { return m_frameBufferVector; }
    208210
    209211    /* Temporary API: */
     
    215217    /* Notifier: Close Runtime UI stuff: */
    216218    void sigCloseRuntimeUI();
     219
     220    /** Notifies about frame-buffer resize. */
     221    void sigFrameBufferResize();
    217222
    218223    /* Console callback signals: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp

    r52203 r52236  
    477477void UIMachineLogicFullscreen::prepareOtherConnections()
    478478{
    479     /* Call to base-class: */
    480     UIMachineLogic::prepareOtherConnections();
    481 
    482479    /* Make sure 'presentation mode' preference handling
    483480     * is updated at runtime for Lion and previous: */
     
    517514        connect(pMachineWindow, SIGNAL(sigFrameBufferResize()),
    518515                this, SIGNAL(sigFrameBufferResize()));
     516    emit sigFrameBufferResize();
    519517
    520518    /* Connect multi-screen layout change handler: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp

    r52203 r52236  
    177177        connect(pMachineWindow, SIGNAL(sigFrameBufferResize()),
    178178                this, SIGNAL(sigFrameBufferResize()));
     179    emit sigFrameBufferResize();
    179180
    180181    /* Mark machine-window(s) created: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineLogicScale.cpp

    r52203 r52236  
    130130        connect(pMachineWindow, SIGNAL(sigFrameBufferResize()),
    131131                this, SIGNAL(sigFrameBufferResize()));
     132    emit sigFrameBufferResize();
    132133
    133134    /* Mark machine-window(s) created: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp

    r52203 r52236  
    262262        connect(pMachineWindow, SIGNAL(sigFrameBufferResize()),
    263263                this, SIGNAL(sigFrameBufferResize()));
     264    emit sigFrameBufferResize();
    264265
    265266    /* Connect multi-screen layout change handler: */
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