VirtualBox

Changeset 49505 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 15, 2013 2:01:16 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Runtime UI: UIVisualState framework cleanup: Moving most of unrelated stuff into corresponding places.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h

    r49465 r49505  
    11/** @file
    2  *
    3  * VBox frontends: Qt GUI ("VirtualBox"):
    4  * Global declarations and functions
     2 * VBox Qt GUI - UIDefs namespace and other global declarations.
    53 */
    64
    75/*
    8  * Copyright (C) 2006-2012 Oracle Corporation
     6 * Copyright (C) 2006-2013 Oracle Corporation
    97 *
    108 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1715 */
    1816
    19 #ifndef __UIDefs_h__
    20 #define __UIDefs_h__
     17#ifndef ___UIDefs_h___
     18#define ___UIDefs_h___
    2119
    2220/* Qt includes: */
     
    274272    UIVisualStateType_All        = 0xFF
    275273};
     274Q_DECLARE_METATYPE(UIVisualStateType);
    276275
    277276/* Details element type: */
     
    360359Q_DECLARE_METATYPE(MachineCloseAction);
    361360
    362 #endif // __UIDefs_h__
    363 
     361#endif /* !___UIDefs_h___ */
     362
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp

    r49498 r49505  
    3232    Q_OBJECT;
    3333
    34 signals:
    35 
    36     /* Signal to change-state: */
    37     void sigChangeVisualState(UIVisualStateType newVisualStateType);
    38 
    3934public:
    4035
    4136    /* Constructor: */
    42     UIVisualState(QObject *pParent, UISession *pSession)
     37    UIVisualState(QObject *pParent, UISession *pSession, UIVisualStateType type)
    4338        : QObject(pParent)
     39        , m_type(type)
    4440        , m_pSession(pSession)
    4541        , m_pMachineLogic(0)
     
    4844#endif /* Q_WS_MAC */
    4945    {
    50         /* Connect state-change handler: */
    51         connect(this, SIGNAL(sigChangeVisualState(UIVisualStateType)), parent(), SLOT(sltChangeVisualState(UIVisualStateType)));
    5246    }
    5347
     
    6660
    6761    /* Visual state type getter: */
    68     virtual UIVisualStateType visualStateType() const = 0;
     62    UIVisualStateType visualStateType() const { return m_type; }
    6963
    7064    /* Machine logic getter: */
     
    7266
    7367    /* Method to prepare change one visual state to another: */
    74     virtual bool prepareChange(UIVisualStateType previousVisualStateType)
     68    bool prepareChange(UIVisualStateType previousVisualStateType)
    7569    {
    7670        m_pMachineLogic = UIMachineLogic::create(this, m_pSession, visualStateType());
     
    9589
    9690    /* Method to change one visual state to another: */
    97     virtual void change()
     91    void change()
    9892    {
    9993        /* Prepare the logic object: */
     
    10296
    10397    /* Method to finish change one visual state to another: */
    104     virtual void finishChange()
     98    void finishChange()
    10599    {
    106100#ifdef Q_WS_MAC
     
    120114
    121115    /* Variables: */
     116    UIVisualStateType m_type;
    122117    UISession *m_pSession;
    123118    UIMachineLogic *m_pMachineLogic;
     
    125120    CGDisplayFadeReservationToken m_fadeToken;
    126121#endif /* Q_WS_MAC */
    127 };
    128 
    129 /* Normal visual state implementation: */
    130 class UIVisualStateNormal : public UIVisualState
    131 {
    132     Q_OBJECT;
    133 
    134 public:
    135 
    136     /* Constructor: */
    137     UIVisualStateNormal(QObject *pParent, UISession *pSession)
    138         : UIVisualState(pParent, pSession) {}
    139 
    140 private slots:
    141 
    142     /* State-change handlers: */
    143     void sltGoToFullscreenMode() { emit sigChangeVisualState(UIVisualStateType_Fullscreen); }
    144     void sltGoToSeamlessMode() { emit sigChangeVisualState(UIVisualStateType_Seamless); }
    145     void sltGoToScaleMode() { emit sigChangeVisualState(UIVisualStateType_Scale); }
    146 
    147 private:
    148 
    149     /* Visual state type getter: */
    150     UIVisualStateType visualStateType() const { return UIVisualStateType_Normal; }
    151 
    152     /* Method to change previous visual state to this one: */
    153     void change()
    154     {
    155         /* Call to base-class: */
    156         UIVisualState::change();
    157 
    158         /* Connect action handlers: */
    159         connect(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen), SIGNAL(triggered(bool)),
    160                 this, SLOT(sltGoToFullscreenMode()), Qt::QueuedConnection);
    161         connect(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SIGNAL(triggered(bool)),
    162                 this, SLOT(sltGoToSeamlessMode()), Qt::QueuedConnection);
    163         connect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
    164                 this, SLOT(sltGoToScaleMode()), Qt::QueuedConnection);
    165     }
    166 };
    167 
    168 /* Fullscreen visual state implementation: */
    169 class UIVisualStateFullscreen : public UIVisualState
    170 {
    171     Q_OBJECT;
    172 
    173 public:
    174 
    175     /* Constructor: */
    176     UIVisualStateFullscreen(QObject *pParent, UISession *pSession)
    177         : UIVisualState(pParent, pSession) {}
    178 
    179 private slots:
    180 
    181     /* State-change handlers: */
    182     void sltGoToNormalMode() { emit sigChangeVisualState(UIVisualStateType_Normal); }
    183     void sltGoToSeamlessMode() { emit sigChangeVisualState(UIVisualStateType_Seamless); }
    184     void sltGoToScaleMode() { emit sigChangeVisualState(UIVisualStateType_Scale); }
    185 
    186 private:
    187 
    188     /* Visual state type getter: */
    189     UIVisualStateType visualStateType() const { return UIVisualStateType_Fullscreen; }
    190 
    191     /* Method to change previous visual state to this one: */
    192     void change()
    193     {
    194         /* Call to base-class: */
    195         UIVisualState::change();
    196 
    197         /* Connect action handlers: */
    198         connect(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen), SIGNAL(triggered(bool)),
    199                 this, SLOT(sltGoToNormalMode()), Qt::QueuedConnection);
    200         connect(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SIGNAL(triggered(bool)),
    201                 this, SLOT(sltGoToSeamlessMode()), Qt::QueuedConnection);
    202         connect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
    203                 this, SLOT(sltGoToScaleMode()), Qt::QueuedConnection);
    204     }
    205 };
    206 
    207 /* Seamless visual state implementation: */
    208 class UIVisualStateSeamless : public UIVisualState
    209 {
    210     Q_OBJECT;
    211 
    212 public:
    213 
    214     /* Constructor: */
    215     UIVisualStateSeamless(QObject *pParent, UISession *pSession)
    216         : UIVisualState(pParent, pSession) {}
    217 
    218 private slots:
    219 
    220     /* State-change handlers: */
    221     void sltGoToNormalMode() { emit sigChangeVisualState(UIVisualStateType_Normal); }
    222     void sltGoToFullscreenMode() { emit sigChangeVisualState(UIVisualStateType_Fullscreen); }
    223     void sltGoToScaleMode() { emit sigChangeVisualState(UIVisualStateType_Scale); }
    224 
    225 private:
    226 
    227     /* Visual state type getter: */
    228     UIVisualStateType visualStateType() const { return UIVisualStateType_Seamless; }
    229 
    230     /* Method to change previous visual state to this one: */
    231     void change()
    232     {
    233         /* Call to base-class: */
    234         UIVisualState::change();
    235 
    236         /* Connect action handlers: */
    237         connect(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SIGNAL(triggered(bool)),
    238                 this, SLOT(sltGoToNormalMode()), Qt::QueuedConnection);
    239         connect(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen), SIGNAL(triggered(bool)),
    240                 this, SLOT(sltGoToFullscreenMode()), Qt::QueuedConnection);
    241         connect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
    242                 this, SLOT(sltGoToScaleMode()), Qt::QueuedConnection);
    243     }
    244 };
    245 
    246 /* Scale visual state implementation: */
    247 class UIVisualStateScale : public UIVisualState
    248 {
    249     Q_OBJECT;
    250 
    251 public:
    252 
    253     /* Constructor: */
    254     UIVisualStateScale(QObject *pParent, UISession *pSession)
    255         : UIVisualState(pParent, pSession) {}
    256 
    257 private slots:
    258 
    259     /* State-change handlers: */
    260     void sltGoToNormalMode() { emit sigChangeVisualState(UIVisualStateType_Normal); }
    261     void sltGoToFullscreenMode() { emit sigChangeVisualState(UIVisualStateType_Fullscreen); }
    262     void sltGoToSeamlessMode() { emit sigChangeVisualState(UIVisualStateType_Seamless); }
    263 
    264 private:
    265 
    266     /* Visual state type getter: */
    267     UIVisualStateType visualStateType() const { return UIVisualStateType_Scale; }
    268 
    269     /* Method to change previous visual state to this one: */
    270     void change()
    271     {
    272         /* Call to base-class: */
    273         UIVisualState::change();
    274 
    275         /* Connect action handlers: */
    276         connect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
    277                 this, SLOT(sltGoToNormalMode()), Qt::QueuedConnection);
    278         connect(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen), SIGNAL(triggered(bool)),
    279                 this, SLOT(sltGoToFullscreenMode()), Qt::QueuedConnection);
    280         connect(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SIGNAL(triggered(bool)),
    281                 this, SLOT(sltGoToSeamlessMode()), Qt::QueuedConnection);
    282     }
    283122};
    284123
     
    308147    loadMachineSettings();
    309148
     149    /* Prepare async visual-state change handler: */
     150    qRegisterMetaType<UIVisualStateType>();
     151    connect(this, SIGNAL(sigRequestAsyncVisualStateChange(UIVisualStateType)),
     152            this, SLOT(sltChangeVisualState(UIVisualStateType)),
     153            Qt::QueuedConnection);
     154
    310155    /* Enter default (normal) state */
    311156    enterInitialVisualState();
     
    345190}
    346191
     192void UIMachine::asyncChangeVisualState(UIVisualStateType visualStateType)
     193{
     194    emit sigRequestAsyncVisualStateChange(visualStateType);
     195}
     196
    347197void UIMachine::sltChangeVisualState(UIVisualStateType newVisualStateType)
    348198{
    349199    /* Create new state: */
    350     UIVisualState *pNewVisualState = 0;
    351     switch (newVisualStateType)
    352     {
    353         case UIVisualStateType_Normal:
    354         {
    355             /* Create normal visual state: */
    356             pNewVisualState = new UIVisualStateNormal(this, m_pSession);
    357             break;
    358         }
    359         case UIVisualStateType_Fullscreen:
    360         {
    361             /* Create fullscreen visual state: */
    362             pNewVisualState = new UIVisualStateFullscreen(this, m_pSession);
    363             break;
    364         }
    365         case UIVisualStateType_Seamless:
    366         {
    367             /* Create seamless visual state: */
    368             pNewVisualState = new UIVisualStateSeamless(this, m_pSession);
    369             break;
    370         }
    371         case UIVisualStateType_Scale:
    372         {
    373             /* Create scale visual state: */
    374             pNewVisualState = new UIVisualStateScale(this, m_pSession);
    375             break;
    376         }
    377         default:
    378             break;
    379     }
     200    UIVisualState *pNewVisualState = new UIVisualState(this, m_pSession, newVisualStateType);
    380201
    381202    /* Get previous visual state type: */
    382     UIVisualStateType previousVisualStateType = UIVisualStateType_Normal;
    383     if (m_pVisualState)
    384         previousVisualStateType = m_pVisualState->visualStateType();
     203    UIVisualStateType previousVisualStateType = m_pVisualState ? m_pVisualState->visualStateType() : UIVisualStateType_Normal;
    385204
    386205    /* First we have to check if the selected mode is available at all.
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r49498 r49505  
    1515 */
    1616
    17 #ifndef __UIMachine_h__
    18 #define __UIMachine_h__
     17#ifndef ___UIMachine_h___
     18#define ___UIMachine_h___
    1919
    2020/* Qt includes: */
     
    3939    Q_OBJECT;
    4040
     41signals:
     42
     43    /** Requests async visual-state change. */
     44    void sigRequestAsyncVisualStateChange(UIVisualStateType visualStateType);
     45
    4146public:
    4247
     
    5358    bool isVisualStateAllowedSeamless() const { return m_allowedVisualStateTypes & UIVisualStateType_Seamless; }
    5459    bool isVisualStateAllowedScale() const { return m_allowedVisualStateTypes & UIVisualStateType_Scale; }
     60
     61    /** Requests async visual-state change. */
     62    void asyncChangeVisualState(UIVisualStateType visualStateType);
    5563
    5664private slots:
     
    8593};
    8694
    87 #endif /* !__UIMachine_h__ */
     95#endif /* !___UIMachine_h___ */
    8896
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r49341 r49505  
    11/* $Id$ */
    22/** @file
    3  *
    4  * VBox frontends: Qt GUI ("VirtualBox"):
    5  * UIMachineLogic class implementation
     3 * VBox Qt GUI - UIMachineLogic class implementation.
    64 */
    75
     
    249247    cleanupHandlers();
    250248
     249    /* Cleanup action connections: */
     250    cleanupActionConnections();
    251251    /* Cleanup action groups: */
    252252    cleanupActionGroups();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r49333 r49505  
    11/** @file
    2  *
    3  * VBox frontends: Qt GUI ("VirtualBox"):
    4  * UIMachineLogic class declaration
     2 * VBox Qt GUI - UIMachineLogic class declaration.
    53 */
    64
     
    1715 */
    1816
    19 #ifndef __UIMachineLogic_h__
    20 #define __UIMachineLogic_h__
     17#ifndef ___UIMachineLogic_h___
     18#define ___UIMachineLogic_h___
    2119
    2220/* GUI includes: */
     
    165163    virtual void cleanupHandlers();
    166164    //virtual void cleanupOtherConnections() {}
    167     //virtual void cleanupActionConnections() {}
     165    virtual void cleanupActionConnections() {}
    168166    virtual void cleanupActionGroups();
    169167    //virtual void cleanupSessionConnections() {}
     
    281279};
    282280
    283 #endif // __UIMachineLogic_h__
    284 
     281#endif /* !___UIMachineLogic_h___ */
     282
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r49466 r49505  
    11/* $Id$ */
    22/** @file
    3  *
    4  * VBox frontends: Qt GUI ("VirtualBox"):
    5  * UISession stuff implementation
     3 * VBox Qt GUI - UISession class implementation.
    64 */
    75
    86/*
    9  * Copyright (C) 2006-2012 Oracle Corporation
     7 * Copyright (C) 2006-2013 Oracle Corporation
    108 *
    119 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    499497}
    500498
     499void UISession::changeVisualState(UIVisualStateType visualStateType)
     500{
     501    m_pMachine->asyncChangeVisualState(visualStateType);
     502}
     503
    501504bool UISession::setPause(bool fOn)
    502505{
     
    645648}
    646649
     650void UISession::sltChangeVisualStateToNormal()
     651{
     652    /* Reset requests: */
     653    setSeamlessModeRequested(false);
     654    /* Request change: */
     655    m_pMachine->asyncChangeVisualState(UIVisualStateType_Normal);
     656}
     657
     658void UISession::sltChangeVisualStateToFullscreen()
     659{
     660    /* Reset requests: */
     661    setSeamlessModeRequested(false);
     662    /* Request change: */
     663    m_pMachine->asyncChangeVisualState(UIVisualStateType_Fullscreen);
     664}
     665
     666void UISession::sltChangeVisualStateToSeamless()
     667{
     668    /* Reset requests: */
     669    setSeamlessModeRequested(false);
     670    /* Request change: */
     671    m_pMachine->asyncChangeVisualState(UIVisualStateType_Seamless);
     672}
     673
     674void UISession::sltChangeVisualStateToScale()
     675{
     676    /* Reset requests: */
     677    setSeamlessModeRequested(false);
     678    /* Request change: */
     679    m_pMachine->asyncChangeVisualState(UIVisualStateType_Scale);
     680}
     681
    647682void UISession::sltCloseRuntimeUI()
    648683{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r49466 r49505  
    11/** @file
    2  *
    3  * VBox frontends: Qt GUI ("VirtualBox"):
    4  * UISession class declaration
     2 * VBox Qt GUI - UISession class declaration.
    53 */
    64
    75/*
    8  * Copyright (C) 2010-2012 Oracle Corporation
     6 * Copyright (C) 2010-2013 Oracle Corporation
    97 *
    108 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1715 */
    1816
    19 #ifndef ___UIConsole_h___
    20 #define ___UIConsole_h___
     17#ifndef ___UISession_h___
     18#define ___UISession_h___
    2119
    2220/* Qt includes: */
     
    125123    bool isVisualStateAllowedSeamless() const;
    126124    bool isVisualStateAllowedScale() const;
     125    /** Requests visual-state change. */
     126    void changeVisualState(UIVisualStateType visualStateType);
    127127
    128128    bool isSaved() const { return machineState() == KMachineState_Saved; }
     
    237237private slots:
    238238
     239    /** Requests visual-state change to 'normal' (window). */
     240    void sltChangeVisualStateToNormal();
     241    /** Requests visual-state change to 'fullscreen'. */
     242    void sltChangeVisualStateToFullscreen();
     243    /** Requests visual-state change to 'seamless'. */
     244    void sltChangeVisualStateToSeamless();
     245    /** Requests visual-state change to 'scale'. */
     246    void sltChangeVisualStateToScale();
     247
    239248    /* Handler: Close Runtime UI stuff: */
    240249    void sltCloseRuntimeUI();
     
    379388};
    380389
    381 #endif // !___UIConsole_h___
     390#endif /* !___UISession_h___ */
     391
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp

    r49498 r49505  
    11/* $Id$ */
    22/** @file
    3  *
    4  * VBox frontends: Qt GUI ("VirtualBox"):
    5  * UIMachineLogicFullscreen class implementation
     3 * VBox Qt GUI - UIMachineLogicFullscreen class implementation.
    64 */
    75
     
    176174}
    177175
     176void UIMachineLogicFullscreen::prepareActionConnections()
     177{
     178    /* Call to base-class: */
     179    UIMachineLogic::prepareActionConnections();
     180
     181    /* "View" actions connections: */
     182    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen), SIGNAL(triggered(bool)),
     183            uisession(), SLOT(sltChangeVisualStateToNormal()));
     184    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SIGNAL(triggered(bool)),
     185            uisession(), SLOT(sltChangeVisualStateToSeamless()));
     186    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
     187            uisession(), SLOT(sltChangeVisualStateToScale()));
     188}
     189
    178190#ifdef Q_WS_MAC
    179191void UIMachineLogicFullscreen::prepareOtherConnections()
     
    249261}
    250262
     263void UIMachineLogicFullscreen::cleanupActionConnections()
     264{
     265    /* "View" actions disconnections: */
     266    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen), SIGNAL(triggered(bool)),
     267               uisession(), SLOT(sltChangeVisualStateToNormal()));
     268    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SIGNAL(triggered(bool)),
     269               uisession(), SLOT(sltChangeVisualStateToSeamless()));
     270    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
     271               uisession(), SLOT(sltChangeVisualStateToScale()));
     272
     273    /* Call to base-class: */
     274    UIMachineLogic::cleanupActionConnections();
     275}
     276
    251277void UIMachineLogicFullscreen::cleanupActionGroups()
    252278{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h

    r49309 r49505  
    11/** @file
    2  *
    3  * VBox frontends: Qt GUI ("VirtualBox"):
    4  * UIMachineLogicFullscreen class declaration
     2 * VBox Qt GUI - UIMachineLogicFullscreen class declaration.
    53 */
    64
     
    1715 */
    1816
    19 #ifndef __UIMachineLogicFullscreen_h__
    20 #define __UIMachineLogicFullscreen_h__
     17#ifndef ___UIMachineLogicFullscreen_h___
     18#define ___UIMachineLogicFullscreen_h___
    2119
    2220/* Local includes: */
     
    6159    /* Prepare helpers: */
    6260    void prepareActionGroups();
     61    void prepareActionConnections();
    6362#ifdef Q_WS_MAC
    6463    void prepareOtherConnections();
     
    7372    //void cleanupOtherConnections() {}
    7473#endif /* Q_WS_MAC */
     74    void cleanupActionConnections();
    7575    void cleanupActionGroups();
    7676
     
    8888};
    8989
    90 #endif // __UIMachineLogicFullscreen_h__
     90#endif /* !___UIMachineLogicFullscreen_h___ */
    9191
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp

    r46626 r49505  
    11/* $Id$ */
    22/** @file
    3  *
    4  * VBox frontends: Qt GUI ("VirtualBox"):
    5  * UIMachineLogicNormal class implementation
     3 * VBox Qt GUI - UIMachineLogicNormal class implementation.
    64 */
    75
    86/*
    9  * Copyright (C) 2010-2012 Oracle Corporation
     7 * Copyright (C) 2010-2013 Oracle Corporation
    108 *
    119 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    8179void UIMachineLogicNormal::prepareActionConnections()
    8280{
    83     /* Base class connections: */
     81    /* Call to base-class: */
    8482    UIMachineLogic::prepareActionConnections();
    8583
    86     /* This class connections: */
     84    /* "View" actions connections: */
     85    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen), SIGNAL(triggered(bool)),
     86            uisession(), SLOT(sltChangeVisualStateToFullscreen()));
     87    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SIGNAL(triggered(bool)),
     88            uisession(), SLOT(sltChangeVisualStateToSeamless()));
     89    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
     90            uisession(), SLOT(sltChangeVisualStateToScale()));
     91
     92    /* "Device" actions connections: */
    8793    connect(gActionPool->action(UIActionIndexRuntime_Menu_Network)->menu(), SIGNAL(aboutToShow()),
    8894            this, SLOT(sltPrepareNetworkAdaptersMenu()));
     
    134140}
    135141
     142void UIMachineLogicNormal::cleanupActionConnections()
     143{
     144    /* "View" actions disconnections: */
     145    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen), SIGNAL(triggered(bool)),
     146               uisession(), SLOT(sltChangeVisualStateToFullscreen()));
     147    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SIGNAL(triggered(bool)),
     148               uisession(), SLOT(sltChangeVisualStateToSeamless()));
     149    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
     150               uisession(), SLOT(sltChangeVisualStateToScale()));
     151
     152    /* Call to base-class: */
     153    UIMachineLogic::cleanupActionConnections();
     154}
     155
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.h

    r46582 r49505  
    11/** @file
    2  *
    3  * VBox frontends: Qt GUI ("VirtualBox"):
    4  * UIMachineLogicNormal class declaration
     2 * VBox Qt GUI - UIMachineLogicNormal class declaration.
    53 */
    64
    75/*
    8  * Copyright (C) 2010-2012 Oracle Corporation
     6 * Copyright (C) 2010-2013 Oracle Corporation
    97 *
    108 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1715 */
    1816
    19 #ifndef __UIMachineLogicNormal_h__
    20 #define __UIMachineLogicNormal_h__
     17#ifndef ___UIMachineLogicNormal_h___
     18#define ___UIMachineLogicNormal_h___
    2119
    2220/* Local includes: */
     
    5250    /* Cleanup helpers: */
    5351    void cleanupMachineWindows();
    54     //void cleanupActionConnections() {}
     52    void cleanupActionConnections();
    5553
    5654    /* Friend classes: */
     
    5856};
    5957
    60 #endif // __UIMachineLogicNormal_h__
     58#endif /* !___UIMachineLogicNormal_h___ */
    6159
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineLogicScale.cpp

    r49498 r49505  
    11/* $Id$ */
    22/** @file
    3  *
    4  * VBox frontends: Qt GUI ("VirtualBox"):
    5  * UIMachineLogicScale class implementation
     3 * VBox Qt GUI - UIMachineLogicScale class implementation.
    64 */
    75
    86/*
    9  * Copyright (C) 2010-2012 Oracle Corporation
     7 * Copyright (C) 2010-2013 Oracle Corporation
    108 *
    119 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    7371}
    7472
     73void UIMachineLogicScale::prepareActionConnections()
     74{
     75    /* Call to base-class: */
     76    UIMachineLogic::prepareActionConnections();
     77
     78    /* "View" actions connections: */
     79    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
     80            uisession(), SLOT(sltChangeVisualStateToNormal()));
     81    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen), SIGNAL(triggered(bool)),
     82            uisession(), SLOT(sltChangeVisualStateToFullscreen()));
     83    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SIGNAL(triggered(bool)),
     84            uisession(), SLOT(sltChangeVisualStateToSeamless()));
     85}
     86
    7587void UIMachineLogicScale::prepareMachineWindows()
    7688{
     
    112124}
    113125
     126void UIMachineLogicScale::cleanupActionConnections()
     127{
     128    /* "View" actions disconnections: */
     129    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
     130               uisession(), SLOT(sltChangeVisualStateToNormal()));
     131    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen), SIGNAL(triggered(bool)),
     132               uisession(), SLOT(sltChangeVisualStateToFullscreen()));
     133    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SIGNAL(triggered(bool)),
     134               uisession(), SLOT(sltChangeVisualStateToSeamless()));
     135
     136    /* Call to base-class: */
     137    UIMachineLogic::cleanupActionConnections();
     138
     139}
     140
    114141void UIMachineLogicScale::cleanupActionGroups()
    115142{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineLogicScale.h

    r41064 r49505  
    11/** @file
    2  *
    3  * VBox frontends: Qt GUI ("VirtualBox"):
    4  * UIMachineLogicScale class declaration
     2 * VBox Qt GUI - UIMachineLogicScale class declaration.
    53 */
    64
    75/*
    8  * Copyright (C) 2010-2012 Oracle Corporation
     6 * Copyright (C) 2010-2013 Oracle Corporation
    97 *
    108 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1715 */
    1816
    19 #ifndef __UIMachineLogicScale_h__
    20 #define __UIMachineLogicScale_h__
     17#ifndef ___UIMachineLogicScale_h___
     18#define ___UIMachineLogicScale_h___
    2119
    2220/* Local includes: */
     
    4038    /* Prepare helpers: */
    4139    void prepareActionGroups();
     40    void prepareActionConnections();
    4241    void prepareMachineWindows();
    4342
    4443    /* Cleanup helpers: */
    4544    void cleanupMachineWindows();
     45    void cleanupActionConnections();
    4646    void cleanupActionGroups();
    4747
     
    5050};
    5151
    52 #endif // __UIMachineLogicScale_h__
     52#endif /* !___UIMachineLogicScale_h___ */
    5353
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp

    r49498 r49505  
    11/* $Id$ */
    22/** @file
    3  *
    4  * VBox frontends: Qt GUI ("VirtualBox"):
    5  * UIMachineLogicSeamless class implementation
     3 * VBox Qt GUI - UIMachineLogicSeamless class implementation.
    64 */
    75
     
    180178}
    181179
     180void UIMachineLogicSeamless::prepareActionConnections()
     181{
     182    /* Call to base-class: */
     183    UIMachineLogic::prepareActionConnections();
     184
     185    /* "View" actions connections: */
     186    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SIGNAL(triggered(bool)),
     187            uisession(), SLOT(sltChangeVisualStateToNormal()));
     188    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen), SIGNAL(triggered(bool)),
     189            uisession(), SLOT(sltChangeVisualStateToFullscreen()));
     190    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
     191            uisession(), SLOT(sltChangeVisualStateToScale()));
     192}
     193
    182194void UIMachineLogicSeamless::prepareMachineWindows()
    183195{
     
    229241    foreach (UIMachineWindow *pMachineWindow, machineWindows())
    230242        UIMachineWindow::destroy(pMachineWindow);
     243}
     244
     245void UIMachineLogicSeamless::cleanupActionConnections()
     246{
     247    /* "View" actions connections: */
     248    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SIGNAL(triggered(bool)),
     249               uisession(), SLOT(sltChangeVisualStateToNormal()));
     250    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen), SIGNAL(triggered(bool)),
     251               uisession(), SLOT(sltChangeVisualStateToFullscreen()));
     252    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
     253               uisession(), SLOT(sltChangeVisualStateToScale()));
     254
     255    /* Call to base-class: */
     256    UIMachineLogic::cleanupActionConnections();
    231257}
    232258
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.h

    r49309 r49505  
    11/** @file
    2  *
    3  * VBox frontends: Qt GUI ("VirtualBox"):
    4  * UIMachineLogicSeamless class declaration
     2 * VBox Qt GUI - UIMachineLogicSeamless class declaration.
    53 */
    64
     
    1715 */
    1816
    19 #ifndef __UIMachineLogicSeamless_h__
    20 #define __UIMachineLogicSeamless_h__
     17#ifndef ___UIMachineLogicSeamless_h___
     18#define ___UIMachineLogicSeamless_h___
    2119
    2220/* Local includes: */
     
    6058    /* Prepare helpers: */
    6159    void prepareActionGroups();
     60    void prepareActionConnections();
    6261    void prepareMachineWindows();
    6362    void prepareMenu();
     
    6665    //void cleanupMenu() {}
    6766    void cleanupMachineWindows();
     67    void cleanupActionConnections();
    6868    void cleanupActionGroups();
    6969
     
    7777};
    7878
    79 #endif // __UIMachineLogicSeamless_h__
     79#endif /* !___UIMachineLogicSeamless_h___ */
    8080
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