VirtualBox

Changeset 27012 in vbox


Ignore:
Timestamp:
Mar 4, 2010 11:47:23 AM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: New running VM core: initial seamless mode feature commit.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
1 added
9 edited
6 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r26920 r27012  
    226226    ./src/runtime \
    227227        ./src/runtime/normal \
    228         ./src/runtime/fullscreen
     228        ./src/runtime/fullscreen \
     229        ./src/runtime/seamless
    229230endif
    230231
     
    376377        src/runtime/fullscreen/UIMachineLogicFullscreen.h \
    377378        src/runtime/fullscreen/UIMachineWindowFullscreen.h \
    378         src/runtime/fullscreen/UIMachineViewFullscreen.h
     379        src/runtime/fullscreen/UIMachineViewFullscreen.h \
     380        src/runtime/seamless/UIMachineLogicSeamless.h \
     381        src/runtime/seamless/UIMachineWindowSeamless.h \
     382        src/runtime/seamless/UIMachineViewSeamless.h
    379383endif
    380384
     
    509513        src/runtime/fullscreen/UIMachineLogicFullscreen.cpp \
    510514        src/runtime/fullscreen/UIMachineWindowFullscreen.cpp \
    511         src/runtime/fullscreen/UIMachineViewFullscreen.cpp
     515        src/runtime/fullscreen/UIMachineViewFullscreen.cpp \
     516        src/runtime/seamless/UIMachineLogicSeamless.cpp \
     517        src/runtime/seamless/UIMachineWindowSeamless.cpp \
     518        src/runtime/seamless/UIMachineViewSeamless.cpp
    512519endif
    513520
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r26938 r27012  
    4949#include "UIMachineLogicNormal.h"
    5050#include "UIMachineLogicFullscreen.h"
    51 //#include "UIMachineLogicSeamless.h"
     51#include "UIMachineLogicSeamless.h"
    5252#include "UIMachineWindow.h"
    5353#include "UIMachineView.h"
     
    358358            break;
    359359        case UIVisualStateType_Seamless:
    360             // logic = new UIMachineLogicSeamless(pParent, pSession, pActionsPool);
    361             logic = new UIMachineLogicNormal(pParent, pSession, pActionsPool);
     360            logic = new UIMachineLogicSeamless(pParent, pSession, pActionsPool);
    362361            break;
    363362    }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r26998 r27012  
    4444#include "UIMachineViewNormal.h"
    4545#include "UIMachineViewFullscreen.h"
     46#include "UIMachineViewSeamless.h"
    4647
    4748#ifdef Q_WS_PM
     
    139140            break;
    140141        case UIVisualStateType_Seamless:
    141             view = new UIMachineViewNormal(  pMachineWindow
    142                                            , renderMode
     142            view = new UIMachineViewSeamless(  pMachineWindow
     143                                             , renderMode
    143144#ifdef VBOX_WITH_VIDEOHWACCEL
    144                                            , bAccelerate2DVideo
    145 #endif
    146                                            , uScreenId);
     145                                             , bAccelerate2DVideo
     146#endif
     147                                             , uScreenId);
    147148            break;
    148149        default:
     
    197198//    : QAbstractScrollArea(((QMainWindow*)pMachineWindow->machineWindow())->centralWidget())
    198199    : QAbstractScrollArea(pMachineWindow->machineWindow())
    199     , m_desktopGeometryType(DesktopGeo_Invalid)
    200200    , m_pMachineWindow(pMachineWindow)
    201201    , m_mode(renderMode)
     
    204204    , m_pFrameBuffer(0)
    205205    , m_previousState(KMachineState_Null)
     206    , m_desktopGeometryType(DesktopGeo_Invalid)
    206207    , m_iLastMouseWheelDelta(0)
    207208    , m_bIsAutoCaptureDisabled(false)
     
    718719        {
    719720            m_pFrameBuffer->doProcessVHWACommand(pEvent);
    720             return true;
    721         }
    722 #endif
    723 
    724 #if 0 // TODO: Move that to seamless mode event hadler!
    725         case VBoxDefs::SetRegionEventType:
    726         {
    727             VBoxSetRegionEvent *sre = (VBoxSetRegionEvent*) pEvent;
    728             if (machineWindowWrapper()->isTrueSeamless() && sre->region() != mLastVisibleRegion)
    729             {
    730                 mLastVisibleRegion = sre->region();
    731                 machineWindowWrapper()->setMask (sre->region());
    732             }
    733             else if (!mLastVisibleRegion.isEmpty() && !machineWindowWrapper()->isTrueSeamless())
    734                 mLastVisibleRegion = QRegion();
    735721            return true;
    736722        }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h

    r26998 r27012  
    7070
    7171    /* Public setters: */
    72     virtual void setGuestAutoresizeEnabled(bool bEnabled) = 0;
    73     virtual void setMouseIntegrationEnabled(bool bEnabled);
     72    virtual void setGuestAutoresizeEnabled(bool /* fEnabled */) {}
     73    virtual void setMouseIntegrationEnabled(bool fEnabled);
    7474
    7575    /* Public members: */
    76     virtual void normalizeGeometry(bool bAdjustPosition = false) = 0;
     76    virtual void normalizeGeometry(bool /* bAdjustPosition = false */) {}
    7777
    7878#if defined(Q_WS_MAC)
     
    8888    void keyboardStateChanged(int iState);
    8989    void mouseStateChanged(int iState);
     90
     91    /* Utility signals: */
     92    void resizeHintDone();
    9093
    9194protected:
     
    118121    bool isFrameBufferResizeIgnored() const { return m_bIsFrameBufferResizeIgnored; }
    119122    const QPixmap& pauseShot() const { return m_pauseShot; }
     123    QSize storedConsoleSize() const { return m_storedConsoleSize; }
    120124    virtual QSize desktopGeometry() const;
    121125
     
    169173# endif
    170174#endif
    171 protected:
    172 
    173     DesktopGeo m_desktopGeometryType;
    174     QSize m_desktopGeometry;
    175     QSize m_storedConsoleSize;
    176175
    177176private:
     
    233232    KMachineState m_previousState;
    234233
     234    DesktopGeo m_desktopGeometryType;
     235    QSize m_desktopGeometry;
     236    QSize m_storedConsoleSize;
     237
    235238    QPoint m_lastMousePos;
    236239    QPoint m_capturedMousePos;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp

    r27008 r27012  
    3939#include "UIMachineWindowNormal.h"
    4040#include "UIMachineWindowFullscreen.h"
    41 //#include "UIMachineWindowSeamless.h"
     41#include "UIMachineWindowSeamless.h"
    4242
    4343UIMachineWindow* UIMachineWindow::create(UIMachineLogic *pMachineLogic, UIVisualStateType visualStateType, ulong uScreenId)
     
    5353            break;
    5454        case UIVisualStateType_Seamless:
    55             // window = new UIMachineWindowSeamless(pMachineLogic, uScreenId);
    56             window = new UIMachineWindowNormal(pMachineLogic, uScreenId);
     55            window = new UIMachineWindowSeamless(pMachineLogic, uScreenId);
    5756            break;
    5857    }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp

    r26931 r27012  
    110110
    111111        /* Do not send the same hints as we already have: */
    112         if ((newSize.width() == m_storedConsoleSize.width()) && (newSize.height() == m_storedConsoleSize.height()))
     112        if ((newSize.width() == storedConsoleSize().width()) && (newSize.height() == storedConsoleSize().height()))
    113113            return;
    114114
     
    123123        {
    124124            /* Remember the new size. */
    125             m_storedConsoleSize = newSize;
     125            storeConsoleSize(newSize.width(), newSize.height());
    126126
    127127            /* Send new size-hint to the guest: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.h

    r26921 r27012  
    3030{
    3131    Q_OBJECT;
    32 
    33 signals:
    34 
    35     /* Utility signals: */
    36     void resizeHintDone();
    3732
    3833protected:
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp

    r26921 r27012  
    110110
    111111        /* Do not send the same hints as we already have: */
    112         if ((newSize.width() == m_storedConsoleSize.width()) && (newSize.height() == m_storedConsoleSize.height()))
     112        if ((newSize.width() == storedConsoleSize().width()) && (newSize.height() == storedConsoleSize().height()))
    113113            return;
    114114
     
    123123        {
    124124            /* Remember the new size. */
    125             m_storedConsoleSize = newSize;
     125            storeConsoleSize(newSize.width(), newSize.height());
    126126
    127127            /* Send new size-hint to the guest: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.h

    r26921 r27012  
    3030{
    3131    Q_OBJECT;
    32 
    33 signals:
    34 
    35     /* Utility signals: */
    36     void resizeHintDone();
    3732
    3833protected:
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp

    r27006 r27012  
    33 *
    44 * VBox frontends: Qt GUI ("VirtualBox"):
    5  * UIMachineLogicNormal class implementation
     5 * UIMachineLogicSeamless class implementation
    66 */
    77
     
    2222 */
    2323
    24 /* Global includes */
    25 #include <QMenu>
    26 
    2724/* Local includes */
    2825#include "COMDefs.h"
     
    3128
    3229#include "UISession.h"
    33 #include "UIActionsPool.h"
    34 #include "UIMachineLogicNormal.h"
     30#include "UIMachineLogicSeamless.h"
    3531#include "UIMachineWindow.h"
    36 #include "UIMachineView.h"
    3732
    3833#include "VBoxUtils.h"
    3934
    40 UIMachineLogicNormal::UIMachineLogicNormal(QObject *pParent, UISession *pSession, UIActionsPool *pActionsPool)
    41     : UIMachineLogic(pParent, pSession, pActionsPool, UIVisualStateType_Normal)
    42 {
    43 }
    44 
    45 UIMachineLogicNormal::~UIMachineLogicNormal()
     35UIMachineLogicSeamless::UIMachineLogicSeamless(QObject *pParent, UISession *pSession, UIActionsPool *pActionsPool)
     36    : UIMachineLogic(pParent, pSession, pActionsPool, UIVisualStateType_Seamless)
     37{
     38}
     39
     40UIMachineLogicSeamless::~UIMachineLogicSeamless()
    4641{
    4742    /* Cleanup normal machine window: */
    48     cleanupMachineWindow();
    49 }
    50 
    51 void UIMachineLogicNormal::initialize()
     43    cleanupMachineWindows();
     44}
     45
     46void UIMachineLogicSeamless::initialize()
    5247{
    5348    /* Check the status of required features: */
     
    7671}
    7772
    78 void UIMachineLogicNormal::sltPrepareNetworkAdaptersMenu()
    79 {
    80     QMenu *menu = qobject_cast<QMenu*>(sender());
    81     AssertMsg(menu, ("This slot should be called only on Network Adapters menu show!\n"));
    82     menu->clear();
    83     menu->addAction(actionsPool()->action(UIActionIndex_Simple_NetworkAdaptersDialog));
    84 }
    85 
    86 void UIMachineLogicNormal::sltPrepareSharedFoldersMenu()
    87 {
    88     QMenu *menu = qobject_cast<QMenu*>(sender());
    89     AssertMsg(menu, ("This slot should be called only on Shared Folders menu show!\n"));
    90     menu->clear();
    91     menu->addAction(actionsPool()->action(UIActionIndex_Simple_SharedFoldersDialog));
    92 }
    93 
    94 void UIMachineLogicNormal::sltPrepareMouseIntegrationMenu()
    95 {
    96     QMenu *menu = qobject_cast<QMenu*>(sender());
    97     AssertMsg(menu, ("This slot should be called only on Mouse Integration Menu show!\n"));
    98     menu->clear();
    99     menu->addAction(actionsPool()->action(UIActionIndex_Toggle_MouseIntegration));
    100 }
    101 
    102 void UIMachineLogicNormal::prepareActionConnections()
    103 {
    104     /* Base class connections: */
    105     UIMachineLogic::prepareActionConnections();
    106 
    107     /* This class connections: */
    108     connect(actionsPool()->action(UIActionIndex_Menu_NetworkAdapters)->menu(), SIGNAL(aboutToShow()),
    109             this, SLOT(sltPrepareNetworkAdaptersMenu()));
    110     connect(actionsPool()->action(UIActionIndex_Menu_SharedFolders)->menu(), SIGNAL(aboutToShow()),
    111             this, SLOT(sltPrepareSharedFoldersMenu()));
    112     connect(actionsPool()->action(UIActionIndex_Menu_MouseIntegration)->menu(), SIGNAL(aboutToShow()),
    113             this, SLOT(sltPrepareMouseIntegrationMenu()));
    114 }
    115 
    116 void UIMachineLogicNormal::prepareMachineWindows()
     73void UIMachineLogicSeamless::prepareMachineWindows()
    11774{
    11875    /* Get monitor count: */
     
    13289#endif /* Q_WS_MAC */
    13390
     91#if 0 // TODO: Add seamless multi-monitor support!
    13492    /* Create machine window(s): */
    13593    for (ulong uScreenId = 0; uScreenId < uMonitorCount; ++ uScreenId)
     
    13896    for (ulong uScreenId = uMonitorCount; uScreenId > 0; -- uScreenId)
    13997        machineWindows()[uScreenId - 1]->machineWindow()->raise();
     98#else
     99    /* Create primary machine window: */
     100    addMachineWindow(UIMachineWindow::create(this, visualStateType(), 0 /* primary only */));
     101#endif
    140102
    141103    /* Notify others about machine window(s) created: */
     
    145107    if (!uisession()->isRunning() && !uisession()->isPaused())
    146108    {
     109        /* Prepare console powerup: */
    147110        prepareConsolePowerUp();
    148111
     
    224187}
    225188
    226 void UIMachineLogicNormal::cleanupMachineWindow()
     189void UIMachineLogicSeamless::cleanupMachineWindows()
    227190{
    228191    /* Do not cleanup machine window if it is not present: */
     
    230193        return;
    231194
     195#if 0 // TODO: Add seamless multi-monitor support!
    232196    /* Cleanup normal machine window: */
    233197    foreach (UIMachineWindow *pMachineWindow, machineWindows())
    234198        UIMachineWindow::destroy(pMachineWindow);
    235 }
    236 
     199#else
     200    /* Create machine window(s): */
     201    UIMachineWindow::destroy(machineWindows()[0] /* primary only */);
     202#endif
     203}
     204
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.h

    r27006 r27012  
    22 *
    33 * VBox frontends: Qt GUI ("VirtualBox"):
    4  * UIMachineLogicNormal class declaration
     4 * UIMachineLogicSeamless class declaration
    55 */
    66
     
    2121 */
    2222
    23 #ifndef __UIMachineLogicNormal_h__
    24 #define __UIMachineLogicNormal_h__
     23#ifndef __UIMachineLogicSeamless_h__
     24#define __UIMachineLogicSeamless_h__
    2525
    2626/* Local includes */
     
    3030class UIActionsPool;
    3131
    32 class UIMachineLogicNormal : public UIMachineLogic
     32class UIMachineLogicSeamless : public UIMachineLogic
    3333{
    3434    Q_OBJECT;
     
    3636protected:
    3737
    38     /* Normal machine logic constructor/destructor: */
    39     UIMachineLogicNormal(QObject *pParent,
    40                          UISession *pSession,
    41                          UIActionsPool *pActionsPool);
    42     virtual ~UIMachineLogicNormal();
     38    /* Seamless machine logic constructor/destructor: */
     39    UIMachineLogicSeamless(QObject *pParent,
     40                           UISession *pSession,
     41                           UIActionsPool *pActionsPool);
     42    virtual ~UIMachineLogicSeamless();
    4343
    4444    void initialize();
    45 
    46 private slots:
    47 
    48     /* Windowed mode funtionality: */
    49     void sltPrepareNetworkAdaptersMenu();
    50     void sltPrepareSharedFoldersMenu();
    51     void sltPrepareMouseIntegrationMenu();
    5245
    5346private:
    5447
    5548    /* Prepare helpers: */
    56     void prepareActionConnections();
    5749    void prepareMachineWindows();
    5850
    5951    /* Cleanup helpers: */
    60     void cleanupMachineWindow();
    61     void cleanupActionConnections() {}
     52    void cleanupMachineWindows();
    6253
    6354    /* Friend classes: */
     
    6556};
    6657
    67 #endif // __UIMachineLogicNormal_h__
     58#endif // __UIMachineLogicSeamless_h__
    6859
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp

    r27006 r27012  
    33 *
    44 * VBox frontends: Qt GUI ("VirtualBox"):
    5  * UIMachineViewNormal class implementation
     5 * UIMachineViewSeamless class implementation
    66 */
    77
     
    2525#include <QApplication>
    2626#include <QDesktopWidget>
     27#ifdef Q_WS_MAC
    2728#include <QMenuBar>
    28 #include <QTimer>
     29#endif
     30#ifdef Q_WS_X11
     31#include <limits.h>
     32#endif
    2933
    3034/* Local includes */
    31 #include "VBoxGlobal.h"
    3235#include "UISession.h"
    33 #include "UIActionsPool.h"
    34 #include "UIMachineLogic.h"
    3536#include "UIMachineWindow.h"
    3637#include "UIFrameBuffer.h"
    37 #include "UIMachineViewNormal.h"
     38#include "UIMachineViewSeamless.h"
    3839#include "QIMainDialog.h"
    3940
    40 UIMachineViewNormal::UIMachineViewNormal(  UIMachineWindow *pMachineWindow
    41                                          , VBoxDefs::RenderMode renderMode
     41UIMachineViewSeamless::UIMachineViewSeamless(  UIMachineWindow *pMachineWindow
     42                                             , VBoxDefs::RenderMode renderMode
    4243#ifdef VBOX_WITH_VIDEOHWACCEL
    43                                          , bool bAccelerate2DVideo
    44 #endif
    45                                          , ulong uMonitor)
     44                                             , bool bAccelerate2DVideo
     45#endif
     46                                             , ulong uMonitor)
    4647    : UIMachineView(  pMachineWindow
    4748                    , renderMode
     
    5051#endif
    5152                    , uMonitor)
    52     , m_bIsGuestAutoresizeEnabled(pMachineWindow->machineLogic()->actionsPool()->action(UIActionIndex_Toggle_GuestAutoresize)->isChecked())
    53     , m_fShouldWeDoResize(false)
    5453{
    5554    /* Prepare frame buffer: */
    5655    prepareFrameBuffer();
    5756
     57    /* Prepare backup inforrmation: */
     58    prepareBackup();
     59
    5860    /* Prepare common things: */
    5961    prepareCommon();
     
    6264    prepareFilters();
    6365
     66    /* Prepare connections: */
     67    prepareConnections();
     68
    6469    /* Prepare console connections: */
    6570    prepareConsoleConnections();
     
    6772    /* Load machine view settings: */
    6873    loadMachineViewSettings();
     74
     75    /* Prepare seamless mode: */
     76    prepareSeamless();
    6977
    7078    /* Initialization: */
     
    7583}
    7684
    77 UIMachineViewNormal::~UIMachineViewNormal()
    78 {
     85UIMachineViewSeamless::~UIMachineViewSeamless()
     86{
     87    /* Cleanup seamless mode: */
     88    cleanupSeamless();
     89
    7990    /* Cleanup common things: */
    8091    cleanupCommon();
     
    8495}
    8596
    86 void UIMachineViewNormal::sltAdditionsStateChanged()
    87 {
    88     /* Check if we should restrict minimum size: */
    89     maybeRestrictMinimumSize();
    90 }
    91 
    92 void UIMachineViewNormal::sltPerformGuestResize(const QSize &toSize)
    93 {
    94     if (m_bIsGuestAutoresizeEnabled && uisession()->isGuestSupportsGraphics())
    95     {
    96         /* Taking Main Dialog: */
    97         QIMainDialog *pMainDialog = machineWindowWrapper() && machineWindowWrapper()->machineWindow() ?
    98                                     qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow()) : 0;
    99 
    100         /* If this slot is invoked directly then use the passed size
    101          * otherwise get the available size for the guest display.
    102          * We assume here that the centralWidget() contains this view only
    103          * and gives it all available space. */
    104         QSize newSize(toSize.isValid() ? toSize : pMainDialog ? pMainDialog->centralWidget()->size() : QSize());
    105         AssertMsg(newSize.isValid(), ("This size should be valid!\n"));
    106 
    107         /* Subtracting frame in case we basing on machine view size: */
    108         if (!toSize.isValid())
    109             newSize -= QSize(frameWidth() * 2, frameWidth() * 2);
    110 
    111         /* Do not send the same hints as we already have: */
    112         if ((newSize.width() == m_storedConsoleSize.width()) && (newSize.height() == m_storedConsoleSize.height()))
    113             return;
    114 
    115         /* We only actually send the hint if
    116          * 1) the autoresize property is set to true and
    117          * 2) either an explicit new size was given (e.g. if the request
    118          *    was triggered directly by a console resize event) or if no
    119          *    explicit size was specified but a resize is flagged as being
    120          *    needed (e.g. the autoresize was just enabled and the console
    121          *    was resized while it was disabled). */
    122         if (toSize.isValid() || m_fShouldWeDoResize)
    123         {
    124             /* Remember the new size. */
    125             m_storedConsoleSize = newSize;
    126 
    127             /* Send new size-hint to the guest: */
    128             session().GetConsole().GetDisplay().SetVideoModeHint(newSize.width(), newSize.height(), 0, screenId());
    129         }
    130         /* We had requested resize now, rejecting accident requests: */
    131         m_fShouldWeDoResize = false;
    132     }
     97void UIMachineViewSeamless::sltAdditionsStateChanged()
     98{
     99    // TODO: Exit seamless if additions doesn't support it!
    133100}
    134101
    135102/* If the desktop geometry is set automatically, this will update it: */
    136 void UIMachineViewNormal::sltDesktopResized()
    137 {
    138     calculateDesktopGeometry();
    139 }
    140 
    141 void UIMachineViewNormal::prepareFilters()
    142 {
    143     /* Base class filters: */
    144     UIMachineView::prepareFilters();
    145 
    146     /* Menu bar filters: */
    147     qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow())->menuBar()->installEventFilter(this);
    148 }
    149 
    150 void UIMachineViewNormal::prepareConsoleConnections()
    151 {
    152     /* Base class connections: */
    153     UIMachineView::prepareConsoleConnections();
    154 
    155     /* Guest additions state-change updater: */
    156     connect(uisession(), SIGNAL(sigAdditionsStateChange()), this, SLOT(sltAdditionsStateChanged()));
    157 }
    158 
    159 void UIMachineViewNormal::loadMachineViewSettings()
    160 {
    161     /* Base class settings: */
    162     UIMachineView::loadMachineViewSettings();
    163 
    164     /* Global settings: */
    165     {
    166         connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(sltDesktopResized()));
    167     }
    168 }
    169 
    170 void UIMachineViewNormal::setGuestAutoresizeEnabled(bool fEnabled)
    171 {
    172     if (m_bIsGuestAutoresizeEnabled != fEnabled)
    173     {
    174         m_bIsGuestAutoresizeEnabled = fEnabled;
    175 
    176         maybeRestrictMinimumSize();
    177 
    178         if (m_bIsGuestAutoresizeEnabled && uisession()->isGuestSupportsGraphics())
    179             sltPerformGuestResize();
    180     }
    181 }
    182 
    183 void UIMachineViewNormal::normalizeGeometry(bool bAdjustPosition)
    184 {
    185     QWidget *pTopLevelWidget = window();
    186 
    187     /* Make no normalizeGeometry in case we are in manual resize mode or main window is maximized: */
    188     if (pTopLevelWidget->isMaximized())
    189         return;
    190 
    191     /* Calculate client window offsets: */
    192     QRect frameGeo = pTopLevelWidget->frameGeometry();
    193     QRect geo = pTopLevelWidget->geometry();
    194     int dl = geo.left() - frameGeo.left();
    195     int dt = geo.top() - frameGeo.top();
    196     int dr = frameGeo.right() - geo.right();
    197     int db = frameGeo.bottom() - geo.bottom();
    198 
    199     /* Get the best size w/o scroll bars: */
    200     QSize s = pTopLevelWidget->sizeHint();
    201 
    202     /* Resize the frame to fit the contents: */
    203     s -= pTopLevelWidget->size();
    204     frameGeo.setRight(frameGeo.right() + s.width());
    205     frameGeo.setBottom(frameGeo.bottom() + s.height());
    206 
    207     if (bAdjustPosition)
    208     {
    209         QRegion availableGeo;
    210         QDesktopWidget *dwt = QApplication::desktop();
    211         if (dwt->isVirtualDesktop())
    212             /* Compose complex available region */
    213             for (int i = 0; i < dwt->numScreens(); ++ i)
    214                 availableGeo += dwt->availableGeometry(i);
    215         else
    216             /* Get just a simple available rectangle */
    217             availableGeo = dwt->availableGeometry(pTopLevelWidget->pos());
    218 
    219         frameGeo = VBoxGlobal::normalizeGeometry(frameGeo, availableGeo, mode() != VBoxDefs::SDLMode /* can resize? */);
    220     }
    221 
    222 #if 0
    223     /* Center the frame on the desktop: */
    224     frameGeo.moveCenter(availableGeo.center());
    225 #endif
    226 
    227     /* Finally, set the frame geometry */
    228     pTopLevelWidget->setGeometry(frameGeo.left() + dl, frameGeo.top() + dt, frameGeo.width() - dl - dr, frameGeo.height() - dt - db);
    229 }
    230 
    231 QRect UIMachineViewNormal::availableGeometry()
    232 {
    233     return QApplication::desktop()->availableGeometry(this);
    234 }
    235 
    236 void UIMachineViewNormal::maybeRestrictMinimumSize()
    237 {
    238     /* Sets the minimum size restriction depending on the auto-resize feature state and the current rendering mode.
    239      * Currently, the restriction is set only in SDL mode and only when the auto-resize feature is inactive.
    240      * We need to do that because we cannot correctly draw in a scrolled window in SDL mode.
    241      * In all other modes, or when auto-resize is in force, this function does nothing. */
    242     if (mode() == VBoxDefs::SDLMode)
    243     {
    244         if (!uisession()->isGuestSupportsGraphics() || !m_bIsGuestAutoresizeEnabled)
    245             setMinimumSize(sizeHint());
    246         else
    247             setMinimumSize(0, 0);
    248     }
    249 }
    250 
    251 bool UIMachineViewNormal::event(QEvent *pEvent)
     103void UIMachineViewSeamless::sltDesktopResized()
     104{
     105    // TODO: Try to resize framebuffer according new desktop size, exit seamless if resize is failed!
     106}
     107
     108bool UIMachineViewSeamless::event(QEvent *pEvent)
    252109{
    253110    switch (pEvent->type())
     
    255112        case VBoxDefs::ResizeEventType:
    256113        {
    257             /* Some situations require initial VGA Resize Request
    258              * to be ignored at all, leaving previous framebuffer,
    259              * machine view and machine window sizes preserved: */
     114            /* Some situations require framebuffer resize events to be ignored,
     115             * leaving machine window & machine view & framebuffer sizes preserved: */
    260116            if (uisession()->isGuestResizeIgnored())
    261117                return true;
    262118
    263             bool oldIgnoreMainwndResize = isMachineWindowResizeIgnored();
    264             setMachineWindowResizeIgnored(true);
    265 
     119            /* Get guest resize-event: */
    266120            UIResizeEvent *pResizeEvent = static_cast<UIResizeEvent*>(pEvent);
    267121
    268             /* Store the new size to prevent unwanted resize hints being sent back. */
    269             storeConsoleSize(pResizeEvent->width(), pResizeEvent->height());
    270 
    271             /* Unfortunately restoreOverrideCursor() is broken in Qt 4.4.0 if WA_PaintOnScreen widgets are present.
    272              * This is the case on linux with SDL. As workaround we save/restore the arrow cursor manually.
    273              * See http://trolltech.com/developer/task-tracker/index_html?id=206165&method=entry for details.
    274              * Moreover the current cursor, which could be set by the guest, should be restored after resize: */
    275             QCursor cursor;
    276             if (uisession()->isHidingHostPointer())
    277                 cursor = QCursor(Qt::BlankCursor);
    278             else
    279                 cursor = viewport()->cursor();
     122            /* Perform framebuffer resize: */
    280123            frameBuffer()->resizeEvent(pResizeEvent);
    281             viewport()->setCursor(cursor);
    282 
    283 #ifdef Q_WS_MAC
    284             // TODO_NEW_CORE
    285 //            mDockIconPreview->setOriginalSize(pResizeEvent->width(), pResizeEvent->height());
    286 #endif /* Q_WS_MAC */
    287 
    288             /* This event appears in case of guest video was changed for somehow even without video resolution change.
    289              * In this last case the host VM window will not be resized according this event and the host mouse cursor
    290              * which was unset to default here will not be hidden in capture state. So it is necessary to perform
    291              * updateMouseClipping() for the guest resize event if the mouse cursor was captured: */
    292             if (uisession()->isMouseCaptured())
    293                 updateMouseClipping();
    294 
    295             /* Apply maximum size restriction: */
     124
     125            /* Reapply maximum size restriction for machine view: */
    296126            setMaximumSize(sizeHint());
    297127
    298             /* May be we have to restrict minimum size? */
    299             maybeRestrictMinimumSize();
    300 
    301             /* Resize the guest canvas: */
    302             if (!isFrameBufferResizeIgnored())
    303                 resize(pResizeEvent->width(), pResizeEvent->height());
    304             updateSliders();
     128            /* Perform machine view resize: */
     129            resize(pResizeEvent->width(), pResizeEvent->height());
    305130
    306131            /* Let our toplevel widget calculate its sizeHint properly. */
     
    314139#endif /* Q_WS_X11 */
    315140
    316             if (!isFrameBufferResizeIgnored())
    317                 normalizeGeometry(true /* adjustPosition */);
    318 
    319             /* Report to the VM thread that we finished resizing */
     141#ifdef Q_WS_MAC
     142            // TODO_NEW_CORE
     143            //mDockIconPreview->setOriginalSize(pResizeEvent->width(), pResizeEvent->height());
     144#endif /* Q_WS_MAC */
     145
     146            /* Update machine view sliders: */
     147            updateSliders();
     148
     149            /* Unfortunately restoreOverrideCursor() is broken in Qt 4.4.0 if WA_PaintOnScreen widgets are present.
     150             * This is the case on linux with SDL. As workaround we save/restore the arrow cursor manually.
     151             * See http://trolltech.com/developer/task-tracker/index_html?id=206165&method=entry for details.
     152             * Moreover the current cursor, which could be set by the guest, should be restored after resize: */
     153            if (uisession()->isValidPointerShapePresent())
     154                viewport()->setCursor(uisession()->cursor());
     155            else if (uisession()->isHidingHostPointer())
     156                viewport()->setCursor(Qt::BlankCursor);
     157            /* This event appears in case of guest video was changed for somehow even without video resolution change.
     158             * In this last case the host VM window will not be resized according this event and the host mouse cursor
     159             * which was unset to default here will not be hidden in capture state. So it is necessary to perform
     160             * updateMouseClipping() for the guest resize event if the mouse cursor was captured: */
     161            if (uisession()->isMouseCaptured())
     162                updateMouseClipping();
     163
     164            /* Report to the VM thread that we finished resizing: */
    320165            session().GetConsole().GetDisplay().ResizeCompleted(screenId());
    321 
    322             setMachineWindowResizeIgnored(oldIgnoreMainwndResize);
    323166
    324167            /* Make sure that all posted signals are processed: */
     
    328171            emit resizeHintDone();
    329172
    330             /* We also recalculate the desktop geometry if this is determined
    331              * automatically.  In fact, we only need this on the first resize,
    332              * but it is done every time to keep the code simpler. */
    333             calculateDesktopGeometry();
    334 
    335             /* Enable frame-buffer resize watching: */
    336             if (isFrameBufferResizeIgnored())
    337                 setFrameBufferResizeIgnored(false);
    338 
     173            return true;
     174        }
     175
     176        case VBoxDefs::SetRegionEventType:
     177        {
     178            UISetRegionEvent *pSetRegionEvent = static_cast<UISetRegionEvent*>(pEvent);
     179            if (pSetRegionEvent->region() != m_lastVisibleRegion)
     180            {
     181                m_lastVisibleRegion = pSetRegionEvent->region();
     182                machineWindowWrapper()->machineWindow()->setMask(m_lastVisibleRegion);
     183            }
    339184            return true;
    340185        }
     
    349194                if (pKeyEvent->key() == Qt::Key_Home)
    350195                {
    351                     /* In Qt4 it is not enough to just set the focus to menu-bar.
    352                      * So to get the menu-bar we have to send Qt::Key_Alt press/release events directly: */
    353                     QKeyEvent e1(QEvent::KeyPress, Qt::Key_Alt, Qt::NoModifier);
    354                     QKeyEvent e2(QEvent::KeyRelease, Qt::Key_Alt, Qt::NoModifier);
    355                     QMenuBar *pMenuBar = machineWindowWrapper() && machineWindowWrapper()->machineWindow() ?
    356                                          qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow())->menuBar() : 0;
    357                     QApplication::sendEvent(pMenuBar, &e1);
    358                     QApplication::sendEvent(pMenuBar, &e2);
     196#if 0 // TODO: Activate Main Menu!
     197                    // should we create it first?
     198#endif
    359199                }
    360200                else
     
    368208}
    369209
    370 bool UIMachineViewNormal::eventFilter(QObject *pWatched, QEvent *pEvent)
    371 {
    372     /* Who are we watchin? */
    373     QIMainDialog *pMainDialog = machineWindowWrapper() && machineWindowWrapper()->machineWindow() ?
    374         qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow()) : 0;
    375     QMenuBar *pMenuBar = pMainDialog ? qobject_cast<QIMainDialog*>(pMainDialog)->menuBar() : 0;
    376 
    377     if (pWatched != 0 && pWatched == pMainDialog)
    378     {
    379         switch (pEvent->type())
    380         {
    381             case QEvent::Resize:
    382             {
    383                 /* Set the "guest needs to resize" hint.
    384                  * This hint is acted upon when (and only when) the autoresize property is "true": */
    385                 m_fShouldWeDoResize = uisession()->isGuestSupportsGraphics();
    386                 if (!isMachineWindowResizeIgnored() && m_bIsGuestAutoresizeEnabled && uisession()->isGuestSupportsGraphics())
    387                     QTimer::singleShot(300, this, SLOT(sltPerformGuestResize()));
    388                 break;
    389             }
    390 #if defined (Q_WS_WIN32)
    391 # if defined (VBOX_GUI_USE_DDRAW)
    392             case QEvent::Move:
    393             {
    394                 /* Notification from our parent that it has moved. We need this in order
    395                  * to possibly adjust the direct screen blitting: */
    396                 if (frameBuffer())
    397                     frameBuffer()->moveEvent(static_cast<QMoveEvent*>(pEvent));
    398                 break;
    399             }
    400 # endif
    401 #endif /* defined (Q_WS_WIN32) */
    402             default:
    403                 break;
    404         }
    405     }
    406     else if (pWatched != 0 && pWatched == pMenuBar)
     210bool UIMachineViewSeamless::eventFilter(QObject *pWatched, QEvent *pEvent)
     211{
     212#ifdef Q_WS_MAC // TODO: Is it really needed?
     213    QMenuBar *pMenuBar = machineWindowWrapper() && machineWindowWrapper()->machineWindow() ?
     214                         qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow())->menuBar() : 0;
     215    if (pWatched != 0 && pWatched == pMenuBar)
    407216    {
    408217        /* Sometimes when we press ESC in the menu it brings the focus away (Qt bug?)
     
    429238        }
    430239    }
     240#endif /* Q_WS_MAC */
    431241    return UIMachineView::eventFilter(pWatched, pEvent);
    432242}
    433243
     244void UIMachineViewSeamless::prepareBackup()
     245{
     246    /* Store old machine view size before bramebuffer resized: */
     247    m_normalSize = QSize(frameBuffer()->width(), frameBuffer()->height());
     248}
     249
     250void UIMachineViewSeamless::prepareFilters()
     251{
     252    /* Base class filters: */
     253    UIMachineView::prepareFilters();
     254
     255#ifdef Q_WS_MAC // TODO: Is it really needed? See UIMachineViewSeamless::eventFilter(...);
     256    /* Menu bar filters: */
     257    qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow())->menuBar()->installEventFilter(this);
     258#endif
     259}
     260
     261void UIMachineViewSeamless::prepareConnections()
     262{
     263    connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(sltDesktopResized()));
     264}
     265
     266void UIMachineViewSeamless::prepareConsoleConnections()
     267{
     268    /* Base class connections: */
     269    UIMachineView::prepareConsoleConnections();
     270
     271    /* Guest additions state-change updater: */
     272    connect(uisession(), SIGNAL(sigAdditionsStateChange()), this, SLOT(sltAdditionsStateChanged()));
     273}
     274
     275void UIMachineViewSeamless::prepareSeamless()
     276{
     277    session().GetConsole().GetDisplay().SetSeamlessMode(true);
     278    session().GetConsole().GetDisplay().SetVideoModeHint(machineWindowWrapper()->machineWindow()->width(),
     279                                                         machineWindowWrapper()->machineWindow()->height(), 0, screenId());
     280}
     281
     282void UIMachineViewSeamless::cleanupSeamless()
     283{
     284    /* Send normal size-hint to the guest: */
     285    session().GetConsole().GetDisplay().SetSeamlessMode(false);
     286    session().GetConsole().GetDisplay().SetVideoModeHint(m_normalSize.width(), m_normalSize.height(), 0, screenId());
     287}
     288
     289QRect UIMachineViewSeamless::availableGeometry()
     290{
     291    return QApplication::desktop()->availableGeometry(this);
     292}
     293
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.h

    r27006 r27012  
    22 *
    33 * VBox frontends: Qt GUI ("VirtualBox"):
    4  * UIMachineViewNormal class declaration
     4 * UIMachineViewSeamless class declaration
    55 */
    66
     
    2121 */
    2222
    23 #ifndef ___UIMachineViewNormal_h___
    24 #define ___UIMachineViewNormal_h___
     23#ifndef ___UIMachineViewSeamless_h___
     24#define ___UIMachineViewSeamless_h___
    2525
    2626/* Local includes */
    2727#include "UIMachineView.h"
    2828
    29 class UIMachineViewNormal : public UIMachineView
     29class UIMachineViewSeamless : public UIMachineView
    3030{
    3131    Q_OBJECT;
    32 
    33 signals:
    34 
    35     /* Utility signals: */
    36     void resizeHintDone();
    3732
    3833protected:
    3934
    4035    /* Normal machine view constructor/destructor: */
    41     UIMachineViewNormal(  UIMachineWindow *pMachineWindow
    42                         , VBoxDefs::RenderMode renderMode
     36    UIMachineViewSeamless(  UIMachineWindow *pMachineWindow
     37                          , VBoxDefs::RenderMode renderMode
    4338#ifdef VBOX_WITH_VIDEOHWACCEL
    44                         , bool bAccelerate2DVideo
     39                          , bool bAccelerate2DVideo
    4540#endif
    46                         , ulong uMonitor);
    47     virtual ~UIMachineViewNormal();
     41                          , ulong uMonitor);
     42    virtual ~UIMachineViewSeamless();
    4843
    4944private slots:
     
    5247    void sltAdditionsStateChanged();
    5348
    54     /* Slot to perform guest resize: */
    55     void sltPerformGuestResize(const QSize &size = QSize());
    56 
    5749    /* Watch dog for desktop resizes: */
    5850    void sltDesktopResized();
     
    6052private:
    6153
    62     /* Prepare helpers: */
    63     void prepareFilters();
    64     void prepareConsoleConnections();
    65     void loadMachineViewSettings();
    66 
    67     /* Cleanup helpers: */
    68     //void saveMachineViewSettings() {}
    69     //void cleanupConsoleConnections() {}
    70     //cleanupFilters() {}
    71 
    72     /* Hidden setters: */
    73     void setGuestAutoresizeEnabled(bool bEnabled);
    74 
    75     /* Private helpers: */
    76     void normalizeGeometry(bool fAdjustPosition);
    77     QRect availableGeometry();
    78     void maybeRestrictMinimumSize();
    79 
    8054    /* Event handlers: */
    8155    bool event(QEvent *pEvent);
    8256    bool eventFilter(QObject *pWatched, QEvent *pEvent);
    8357
    84     /* Private members: */
    85     bool m_bIsGuestAutoresizeEnabled : 1;
    86     bool m_fShouldWeDoResize : 1;
     58    /* Prepare helpers: */
     59    void prepareBackup();
     60    void prepareFilters();
     61    void prepareConnections();
     62    void prepareConsoleConnections();
     63    void prepareSeamless();
     64
     65    /* Cleanup helpers: */
     66    void cleanupSeamless();
     67    //void cleanupConsoleConnections() {}
     68    //void prepareConnections() {}
     69    //void cleanupFilters() {}
     70    //void prepareBackup() {}
     71
     72    /* Private helpers: */
     73    QRect availableGeometry();
     74
     75    /* Private variables: */
     76    QRegion m_lastVisibleRegion;
     77    QSize m_normalSize;
    8778
    8879    /* Friend classes: */
     
    9081};
    9182
    92 #endif // !___UIMachineViewNormal_h___
     83#endif // !___UIMachineViewSeamless_h___
    9384
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp

    r27006 r27012  
    33 *
    44 * VBox frontends: Qt GUI ("VirtualBox"):
    5  * UIMachineWindowNormal class implementation
     5 * UIMachineWindowSeamless class implementation
    66 */
    77
     
    2424/* Global includes */
    2525#include <QDesktopWidget>
    26 #include <QMenuBar>
    27 #include <QTimer>
    28 #include <QContextMenuEvent>
     26#ifdef Q_WS_MAC
     27# include <QMenuBar>
     28#endif /* Q_WS_MAC */
    2929
    3030/* Local includes */
    3131#include "VBoxGlobal.h"
    3232
    33 #include "UISession.h"
    34 #include "UIActionsPool.h"
    35 #include "UIIndicatorsPool.h"
     33#ifdef Q_WS_MAC
     34# include "UISession.h"
     35#endif /* Q_WS_MAC */
    3636#include "UIMachineLogic.h"
    3737#include "UIMachineView.h"
    38 #include "UIMachineWindowNormal.h"
    39 
    40 #include "QIStatusBar.h"
    41 #include "QIStateIndicator.h"
    42 #include "QIHotKeyEdit.h"
    43 
    44 UIMachineWindowNormal::UIMachineWindowNormal(UIMachineLogic *pMachineLogic, ulong uScreenId)
    45     : QIWithRetranslateUI<QIMainDialog>(0)
     38#include "UIMachineWindowSeamless.h"
     39
     40UIMachineWindowSeamless::UIMachineWindowSeamless(UIMachineLogic *pMachineLogic, ulong uScreenId)
     41    : QIWithRetranslateUI2<QIMainDialog>(0, Qt::FramelessWindowHint)
    4642    , UIMachineWindow(pMachineLogic, uScreenId)
    47     , m_pIndicatorsPool(new UIIndicatorsPool(pMachineLogic->uisession()->session(), this))
    48     , m_pIdleTimer(0)
    4943{
    5044    /* "This" is machine window: */
     
    5751    prepareConsoleConnections();
    5852
     53    /* Prepare seamless window: */
     54    prepareSeamless();
     55
     56#ifdef Q_WS_MAC
    5957    /* Prepare menu: */
    6058    prepareMenu();
    61 
    62     /* Prepare status bar: */
    63     prepareStatusBar();
    64 
    65     /* Prepare connections: */
    66     prepareConnections();
    67 
    68     /* Retranslate normal window finally: */
     59#endif /* Q_WS_MAC */
     60
     61    /* Retranslate seamless window finally: */
    6962    retranslateUi();
    7063
     
    7568    prepareMachineView();
    7669
     70#ifdef Q_WS_MAC
    7771    /* Load normal window settings: */
    7872    loadWindowSettings();
     73#endif /* Q_WS_MAC */
    7974
    8075    /* Update all the elements: */
     
    8580}
    8681
    87 UIMachineWindowNormal::~UIMachineWindowNormal()
    88 {
    89     /* Save normal window settings: */
    90     saveWindowSettings();
    91 
     82UIMachineWindowSeamless::~UIMachineWindowSeamless()
     83{
    9284    /* Cleanup normal machine view: */
    9385    cleanupMachineView();
    94 
    95     /* Cleanup status-bar: */
    96     cleanupStatusBar();
    97 }
    98 
    99 void UIMachineWindowNormal::sltMachineStateChanged()
     86}
     87
     88void UIMachineWindowSeamless::sltMachineStateChanged()
    10089{
    10190    UIMachineWindow::sltMachineStateChanged();
    10291}
    10392
    104 void UIMachineWindowNormal::sltMediumChange(const CMediumAttachment &attachment)
    105 {
    106     KDeviceType type = attachment.GetType();
    107     if (type == KDeviceType_HardDisk)
    108         updateAppearanceOf(UIVisualElement_HDStuff);
    109     if (type == KDeviceType_DVD)
    110         updateAppearanceOf(UIVisualElement_CDStuff);
    111     if (type == KDeviceType_Floppy)
    112         updateAppearanceOf(UIVisualElement_FDStuff);
    113 }
    114 
    115 void UIMachineWindowNormal::sltUSBControllerChange()
    116 {
    117     updateAppearanceOf(UIVisualElement_USBStuff);
    118 }
    119 
    120 void UIMachineWindowNormal::sltUSBDeviceStateChange()
    121 {
    122     updateAppearanceOf(UIVisualElement_USBStuff);
    123 }
    124 
    125 void UIMachineWindowNormal::sltNetworkAdapterChange()
    126 {
    127     updateAppearanceOf(UIVisualElement_NetworkStuff);
    128 }
    129 
    130 void UIMachineWindowNormal::sltSharedFolderChange()
    131 {
    132     updateAppearanceOf(UIVisualElement_SharedFolderStuff);
    133 }
    134 
    135 void UIMachineWindowNormal::sltTryClose()
     93void UIMachineWindowSeamless::sltTryClose()
    13694{
    13795    UIMachineWindow::sltTryClose();
    13896}
    13997
    140 void UIMachineWindowNormal::sltUpdateIndicators()
    141 {
    142     CConsole console = session().GetConsole();
    143     QIStateIndicator *pStateIndicator = 0;
    144 
    145     pStateIndicator = indicatorsPool()->indicator(UIIndicatorIndex_HardDisks);
    146     if (pStateIndicator->state() != KDeviceActivity_Null)
    147     {
    148         int state = console.GetDeviceActivity(KDeviceType_HardDisk);
    149         if (pStateIndicator->state() != state)
    150             pStateIndicator->setState(state);
    151     }
    152     pStateIndicator = indicatorsPool()->indicator(UIIndicatorIndex_OpticalDisks);
    153     if (pStateIndicator->state() != KDeviceActivity_Null)
    154     {
    155         int state = console.GetDeviceActivity(KDeviceType_DVD);
    156         if (pStateIndicator->state() != state)
    157             pStateIndicator->setState(state);
    158     }
    159     pStateIndicator = indicatorsPool()->indicator(UIIndicatorIndex_USBDevices);
    160     if (pStateIndicator->state() != KDeviceActivity_Null)
    161     {
    162         int state = console.GetDeviceActivity(KDeviceType_USB);
    163         if (pStateIndicator->state() != state)
    164             pStateIndicator->setState(state);
    165     }
    166     pStateIndicator = indicatorsPool()->indicator(UIIndicatorIndex_NetworkAdapters);
    167     if (pStateIndicator->state() != KDeviceActivity_Null)
    168     {
    169         int state = console.GetDeviceActivity(KDeviceType_Network);
    170         if (pStateIndicator->state() != state)
    171             pStateIndicator->setState(state);
    172     }
    173     pStateIndicator = indicatorsPool()->indicator(UIIndicatorIndex_SharedFolders);
    174     if (pStateIndicator->state() != KDeviceActivity_Null)
    175     {
    176         int state = console.GetDeviceActivity(KDeviceType_SharedFolder);
    177         if (pStateIndicator->state() != state)
    178             pStateIndicator->setState(state);
    179     }
    180 }
    181 
    182 void UIMachineWindowNormal::sltShowIndicatorsContextMenu(QIStateIndicator *pIndicator, QContextMenuEvent *pEvent)
    183 {
    184     if (pIndicator == indicatorsPool()->indicator(UIIndicatorIndex_OpticalDisks))
    185     {
    186         if (machineLogic()->actionsPool()->action(UIActionIndex_Menu_OpticalDevices)->isEnabled())
    187             machineLogic()->actionsPool()->action(UIActionIndex_Menu_OpticalDevices)->menu()->exec(pEvent->globalPos());
    188     }
    189     else if (pIndicator == indicatorsPool()->indicator(UIIndicatorIndex_USBDevices))
    190     {
    191         if (machineLogic()->actionsPool()->action(UIActionIndex_Menu_USBDevices)->isEnabled())
    192             machineLogic()->actionsPool()->action(UIActionIndex_Menu_USBDevices)->menu()->exec(pEvent->globalPos());
    193     }
    194     else if (pIndicator == indicatorsPool()->indicator(UIIndicatorIndex_NetworkAdapters))
    195     {
    196         if (machineLogic()->actionsPool()->action(UIActionIndex_Menu_NetworkAdapters)->isEnabled())
    197             machineLogic()->actionsPool()->action(UIActionIndex_Menu_NetworkAdapters)->menu()->exec(pEvent->globalPos());
    198     }
    199     else if (pIndicator == indicatorsPool()->indicator(UIIndicatorIndex_SharedFolders))
    200     {
    201         if (machineLogic()->actionsPool()->action(UIActionIndex_Menu_SharedFolders)->isEnabled())
    202             machineLogic()->actionsPool()->action(UIActionIndex_Menu_SharedFolders)->menu()->exec(pEvent->globalPos());
    203     }
    204     else if (pIndicator == indicatorsPool()->indicator(UIIndicatorIndex_Mouse))
    205     {
    206         if (machineLogic()->actionsPool()->action(UIActionIndex_Menu_MouseIntegration)->isEnabled())
    207             machineLogic()->actionsPool()->action(UIActionIndex_Menu_MouseIntegration)->menu()->exec(pEvent->globalPos());
    208     }
    209 }
    210 
    211 void UIMachineWindowNormal::sltProcessGlobalSettingChange(const char * /* aPublicName */, const char * /* aName */)
    212 {
    213     m_pNameHostkey->setText(QIHotKeyEdit::keyName(vboxGlobal().settings().hostKey()));
    214 }
    215 
    216 void UIMachineWindowNormal::retranslateUi()
     98void UIMachineWindowSeamless::retranslateUi()
    21799{
    218100    /* Translate parent class: */
     
    225107//    m_pDockEnablePreviewMonitor->setText(tr("Show Monitor Preview"));
    226108#endif /* Q_WS_MAC */
    227 
    228     m_pNameHostkey->setToolTip(
    229         tr("Shows the currently assigned Host key.<br>"
    230            "This key, when pressed alone, toggles the keyboard and mouse "
    231            "capture state. It can also be used in combination with other keys "
    232            "to quickly perform actions from the main menu."));
    233     m_pNameHostkey->setText(QIHotKeyEdit::keyName(vboxGlobal().settings().hostKey()));
    234 }
    235 
    236 void UIMachineWindowNormal::updateAppearanceOf(int iElement)
    237 {
    238     /* Update parent-class window: */
    239     UIMachineWindow::updateAppearanceOf(iElement);
    240 
    241     /* Update that machine window: */
    242     if (iElement & UIVisualElement_HDStuff)
    243         indicatorsPool()->indicator(UIIndicatorIndex_HardDisks)->updateAppearance();
    244     if (iElement & UIVisualElement_CDStuff)
    245         indicatorsPool()->indicator(UIIndicatorIndex_OpticalDisks)->updateAppearance();
    246     if (iElement & UIVisualElement_USBStuff &&
    247         !indicatorsPool()->indicator(UIIndicatorIndex_USBDevices)->isHidden())
    248         indicatorsPool()->indicator(UIIndicatorIndex_USBDevices)->updateAppearance();
    249     if (iElement & UIVisualElement_NetworkStuff)
    250         indicatorsPool()->indicator(UIIndicatorIndex_NetworkAdapters)->updateAppearance();
    251     if (iElement & UIVisualElement_SharedFolderStuff)
    252         indicatorsPool()->indicator(UIIndicatorIndex_SharedFolders)->updateAppearance();
    253     if (iElement & UIVisualElement_VirtualizationStuff)
    254         indicatorsPool()->indicator(UIIndicatorIndex_Virtualization)->updateAppearance();
    255 }
    256 
    257 bool UIMachineWindowNormal::event(QEvent *pEvent)
    258 {
    259     switch (pEvent->type())
    260     {
    261         case QEvent::Resize:
    262         {
    263             QResizeEvent *pResizeEvent = static_cast<QResizeEvent*>(pEvent);
    264             if (!isMaximized())
    265             {
    266                 m_normalGeometry.setSize(pResizeEvent->size());
    267 #ifdef VBOX_WITH_DEBUGGER_GUI
    268                 // TODO: Update debugger window size!
    269                 //dbgAdjustRelativePos();
    270 #endif
    271             }
    272             break;
    273         }
    274         case QEvent::Move:
    275         {
    276             if (!isMaximized())
    277             {
    278                 m_normalGeometry.moveTo(geometry().x(), geometry().y());
    279 #ifdef VBOX_WITH_DEBUGGER_GUI
    280                 // TODO: Update debugger window position!
    281                 //dbgAdjustRelativePos();
    282 #endif
    283             }
    284             break;
    285         }
    286         default:
    287             break;
    288     }
    289     return QIWithRetranslateUI<QIMainDialog>::event(pEvent);
    290109}
    291110
    292111#ifdef Q_WS_X11
    293 bool UIMachineWindowNormal::x11Event(XEvent *pEvent)
     112bool UIMachineWindowSeamless::x11Event(XEvent *pEvent)
    294113{
    295114    /* Qt bug: when the console view grabs the keyboard, FocusIn, FocusOut,
     
    312131#endif
    313132
    314 void UIMachineWindowNormal::closeEvent(QCloseEvent *pEvent)
     133void UIMachineWindowSeamless::closeEvent(QCloseEvent *pEvent)
    315134{
    316135    return UIMachineWindow::closeEvent(pEvent);
    317136}
    318137
    319 void UIMachineWindowNormal::prepareConsoleConnections()
    320 {
    321     /* Base-class connections: */
    322     UIMachineWindow::prepareConsoleConnections();
    323 
    324     /* Medium change updater: */
    325     connect(machineLogic()->uisession(), SIGNAL(sigMediumChange(const CMediumAttachment &)),
    326             this, SLOT(sltMediumChange(const CMediumAttachment &)));
    327 
    328     /* USB controller change updater: */
    329     connect(machineLogic()->uisession(), SIGNAL(sigUSBControllerChange()),
    330             this, SLOT(sltUSBControllerChange()));
    331 
    332     /* USB device state-change updater: */
    333     connect(machineLogic()->uisession(), SIGNAL(sigUSBDeviceStateChange(const CUSBDevice &, bool, const CVirtualBoxErrorInfo &)),
    334             this, SLOT(sltUSBDeviceStateChange()));
    335 
    336     /* Network adapter change updater: */
    337     connect(machineLogic()->uisession(), SIGNAL(sigNetworkAdapterChange(const CNetworkAdapter &)),
    338             this, SLOT(sltNetworkAdapterChange()));
    339 
    340     /* Shared folder change updater: */
    341     connect(machineLogic()->uisession(), SIGNAL(sigSharedFolderChange()),
    342             this, SLOT(sltSharedFolderChange()));
    343 }
    344 
    345 void UIMachineWindowNormal::prepareMenu()
     138void UIMachineWindowSeamless::prepareSeamless()
     139{
     140    /* Move & resize seamless frameless window: */
     141    QRect geometry = QApplication::desktop()->availableGeometry();
     142#ifdef Q_WS_WIN
     143    m_prevRegion = geometry;
     144#endif
     145    move(geometry.topLeft());
     146    resize(geometry.size());
     147    /* Perform these events: */
     148    qApp->processEvents();
     149}
     150
     151#ifdef Q_WS_MAC
     152void UIMachineWindowSeamless::prepareMenu()
    346153{
    347154    setMenuBar(uisession()->newMenuBar());
    348155}
    349 
    350 void UIMachineWindowNormal::prepareStatusBar()
    351 {
    352     /* Common setup: */
    353     setStatusBar(new QIStatusBar(this));
    354     QWidget *pIndicatorBox = new QWidget;
    355     QHBoxLayout *pIndicatorBoxHLayout = new QHBoxLayout(pIndicatorBox);
    356     VBoxGlobal::setLayoutMargin(pIndicatorBoxHLayout, 0);
    357     pIndicatorBoxHLayout->setSpacing(5);
    358 
    359     /* Hard Disks: */
    360     pIndicatorBoxHLayout->addWidget(indicatorsPool()->indicator(UIIndicatorIndex_HardDisks));
    361 
    362     /* Optical Disks: */
    363     QIStateIndicator *pLedOpticalDisks = indicatorsPool()->indicator(UIIndicatorIndex_OpticalDisks);
    364     pIndicatorBoxHLayout->addWidget(pLedOpticalDisks);
    365     connect(pLedOpticalDisks, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)),
    366             this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*)));
    367 
    368     /* USB Devices: */
    369     QIStateIndicator *pLedUSBDevices = indicatorsPool()->indicator(UIIndicatorIndex_USBDevices);
    370     pIndicatorBoxHLayout->addWidget(pLedUSBDevices);
    371     connect(pLedUSBDevices, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)),
    372             this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*)));
    373 
    374     /* Network Adapters: */
    375     QIStateIndicator *pLedNetworkAdapters = indicatorsPool()->indicator(UIIndicatorIndex_NetworkAdapters);
    376     pIndicatorBoxHLayout->addWidget(pLedNetworkAdapters);
    377     connect(pLedNetworkAdapters, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)),
    378             this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*)));
    379 
    380     /* Shared Folders: */
    381     QIStateIndicator *pLedSharedFolders = indicatorsPool()->indicator(UIIndicatorIndex_SharedFolders);
    382     pIndicatorBoxHLayout->addWidget(pLedSharedFolders);
    383     connect(pLedSharedFolders, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)),
    384             this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*)));
    385 
    386     /* Virtualization: */
    387     pIndicatorBoxHLayout->addWidget(indicatorsPool()->indicator(UIIndicatorIndex_Virtualization));
    388 
    389     /* Separator: */
    390     QFrame *pSeparator = new QFrame;
    391     pSeparator->setFrameStyle(QFrame::VLine | QFrame::Sunken);
    392     pIndicatorBoxHLayout->addWidget(pSeparator);
    393 
    394     /* Mouse: */
    395     QIStateIndicator *pLedMouse = indicatorsPool()->indicator(UIIndicatorIndex_Mouse);
    396     pIndicatorBoxHLayout->addWidget(pLedMouse);
    397     connect(pLedMouse, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)),
    398             this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*)));
    399 
    400     /* Host Key: */
    401     m_pCntHostkey = new QWidget;
    402     QHBoxLayout *pHostkeyLedContainerLayout = new QHBoxLayout(m_pCntHostkey);
    403     VBoxGlobal::setLayoutMargin(pHostkeyLedContainerLayout, 0);
    404     pHostkeyLedContainerLayout->setSpacing(3);
    405     pIndicatorBoxHLayout->addWidget(m_pCntHostkey);
    406     pHostkeyLedContainerLayout->addWidget(indicatorsPool()->indicator(UIIndicatorIndex_Hostkey));
    407     m_pNameHostkey = new QLabel(QIHotKeyEdit::keyName(vboxGlobal().settings().hostKey()));
    408     pHostkeyLedContainerLayout->addWidget(m_pNameHostkey);
    409 
    410     /* Add to statusbar: */
    411     statusBar()->addPermanentWidget(pIndicatorBox, 0);
    412 
    413     /* Create & start timer to update LEDs: */
    414     m_pIdleTimer = new QTimer(this);
    415     connect(m_pIdleTimer, SIGNAL(timeout()), this, SLOT(sltUpdateIndicators()));
    416     m_pIdleTimer->start(50);
    417 
    418 #ifdef Q_WS_MAC
    419     /* For the status bar on Cocoa: */
    420     setUnifiedTitleAndToolBarOnMac(true);
    421 #endif
    422 }
    423 
    424 void UIMachineWindowNormal::prepareConnections()
    425 {
    426     /* Setup global settings change updater: */
    427     connect(&vboxGlobal().settings(), SIGNAL(propertyChanged(const char *, const char *)),
    428             this, SLOT(sltProcessGlobalSettingChange(const char *, const char *)));
    429 }
    430 
    431 void UIMachineWindowNormal::prepareMachineView()
     156#endif
     157
     158void UIMachineWindowSeamless::prepareMachineView()
    432159{
    433160#ifdef VBOX_WITH_VIDEOHWACCEL
     
    452179    /* Add machine view into layout: */
    453180    m_pMachineViewContainer->addWidget(m_pMachineView, 1, 1);
    454 
    455     /* Setup machine view connections: */
    456     if (machineView())
    457     {
    458         /* Keyboard state-change updater: */
    459         connect(machineView(), SIGNAL(keyboardStateChanged(int)), indicatorsPool()->indicator(UIIndicatorIndex_Hostkey), SLOT(setState(int)));
    460 
    461         /* Mouse state-change updater: */
    462         connect(machineView(), SIGNAL(mouseStateChanged(int)), indicatorsPool()->indicator(UIIndicatorIndex_Mouse), SLOT(setState(int)));
    463 
    464         /* Early initialize required connections: */
    465         indicatorsPool()->indicator(UIIndicatorIndex_Hostkey)->setState(machineView()->keyboardState());
    466         indicatorsPool()->indicator(UIIndicatorIndex_Mouse)->setState(machineView()->mouseState());
    467     }
    468 }
    469 
    470 void UIMachineWindowNormal::loadWindowSettings()
    471 {
    472     /* Load normal window settings: */
    473     CMachine machine = session().GetMachine();
    474 
    475     /* Load extra-data settings: */
    476     {
    477         QString strPositionSettings = machine.GetExtraData(VBoxDefs::GUI_LastWindowPosition);
    478 
    479         bool ok = false, max = false;
    480         int x = 0, y = 0, w = 0, h = 0;
    481         x = strPositionSettings.section(',', 0, 0).toInt(&ok);
    482         if (ok)
    483             y = strPositionSettings.section(',', 1, 1).toInt(&ok);
    484         if (ok)
    485             w = strPositionSettings.section(',', 2, 2).toInt(&ok);
    486         if (ok)
    487             h = strPositionSettings.section(',', 3, 3).toInt(&ok);
    488         if (ok)
    489             max = strPositionSettings.section(',', 4, 4) == VBoxDefs::GUI_LastWindowPosition_Max;
    490 
    491         QRect ar = ok ? QApplication::desktop()->availableGeometry(QPoint(x, y)) :
    492                         QApplication::desktop()->availableGeometry(machineWindow());
    493 
    494         if (ok /* if previous parameters were read correctly */)
    495         {
    496             m_normalGeometry = QRect(x, y, w, h);
    497             setGeometry(m_normalGeometry);
    498 
    499             /* Normalize view to the optimal size */
    500             if (machineView())
    501                 machineView()->normalizeGeometry(true /* adjust position? */);
    502 
    503             /* Maximize if needed: */
    504             if (max)
    505                 setWindowState(windowState() | Qt::WindowMaximized);
    506         }
    507         else
    508         {
    509             /* Normalize to the optimal size */
    510             if (machineView())
    511                 machineView()->normalizeGeometry(true /* adjust position? */);
    512 
    513             /* Move newly created window to the screen center: */
    514             m_normalGeometry = geometry();
    515             m_normalGeometry.moveCenter(ar.center());
    516             setGeometry(m_normalGeometry);
    517         }
    518     }
    519 
    520     /* Load availability settings: */
    521     {
    522         /* USB Stuff: */
    523         CUSBController usbController = machine.GetUSBController();
    524         if (usbController.isNull())
    525         {
    526             /* Hide USB Menu: */
    527             indicatorsPool()->indicator(UIIndicatorIndex_USBDevices)->setHidden(true);
    528         }
    529         else
    530         {
    531             /* Toggle USB LED: */
    532             indicatorsPool()->indicator(UIIndicatorIndex_USBDevices)->setState(
    533                 usbController.GetEnabled() ? KDeviceActivity_Idle : KDeviceActivity_Null);
    534         }
    535     }
    536 
     181}
     182
     183#ifdef Q_WS_MAC
     184void UIMachineWindowSeamless::loadWindowSettings()
     185{
    537186    /* Load global settings: */
    538187    {
    539188        VBoxGlobalSettings settings = vboxGlobal().settings();
    540189        menuBar()->setHidden(settings.isFeatureActive("noMenuBar"));
    541         statusBar()->setHidden(settings.isFeatureActive("noStatusBar"));
    542     }
    543 }
    544 
    545 void UIMachineWindowNormal::saveWindowSettings()
    546 {
    547     CMachine machine = session().GetMachine();
    548 
    549     /* Save extra-data settings: */
    550     {
    551         QString strWindowPosition = QString("%1,%2,%3,%4")
    552                                     .arg(m_normalGeometry.x()).arg(m_normalGeometry.y())
    553                                     .arg(m_normalGeometry.width()).arg(m_normalGeometry.height());
    554         if (isMaximized())
    555             strWindowPosition += QString(",%1").arg(VBoxDefs::GUI_LastWindowPosition_Max);
    556         machine.SetExtraData(VBoxDefs::GUI_LastWindowPosition, strWindowPosition);
    557     }
    558 }
    559 
    560 void UIMachineWindowNormal::cleanupMachineView()
     190    }
     191}
     192#endif
     193
     194void UIMachineWindowSeamless::cleanupMachineView()
    561195{
    562196    /* Do not cleanup machine view if it is not present: */
     
    568202}
    569203
    570 void UIMachineWindowNormal::cleanupStatusBar()
    571 {
    572     /* Stop LED-update timer: */
    573     m_pIdleTimer->stop();
    574     m_pIdleTimer->disconnect(SIGNAL(timeout()), this, SLOT(sltUpdateIndicators()));
    575 }
    576 
     204void UIMachineWindowSeamless::setMask(const QRegion &constRegion)
     205{
     206    QRegion region = constRegion;
     207
     208#if 0 // TODO: Is it really needed now?
     209    /* The global mask shift cause of toolbars and such things. */
     210    region.translate(mMaskShift.width(), mMaskShift.height());
     211#endif
     212
     213#if 0 // TODO: Add mini-toolbar support!
     214    /* Including mini toolbar area */
     215    QRegion toolBarRegion(mMiniToolBar->mask());
     216    toolBarRegion.translate(mMiniToolBar->mapToGlobal (toolBarRegion.boundingRect().topLeft()) - QPoint (1, 0));
     217    region += toolBarRegion;
     218#endif
     219
     220#if 0 // TODO: Is it really needed now?
     221    /* Restrict the drawing to the available space on the screen.
     222     * (The &operator is better than the previous used -operator,
     223     * because this excludes space around the real screen also.
     224     * This is necessary for the mac.) */
     225    region &= mStrictedRegion;
     226#endif
     227
     228#ifdef Q_WS_WIN
     229    QRegion difference = m_prevRegion.subtract(region);
     230
     231    /* Region offset calculation */
     232    int fleft = 0, ftop = 0;
     233
     234    /* Visible region calculation */
     235    HRGN newReg = CreateRectRgn(0, 0, 0, 0);
     236    CombineRgn(newReg, region.handle(), 0, RGN_COPY);
     237    OffsetRgn(newReg, fleft, ftop);
     238
     239    /* Invisible region calculation */
     240    HRGN diffReg = CreateRectRgn(0, 0, 0, 0);
     241    CombineRgn(diffReg, difference.handle(), 0, RGN_COPY);
     242    OffsetRgn(diffReg, fleft, ftop);
     243
     244    /* Set the current visible region and clean the previous */
     245    SetWindowRgn(winId(), newReg, FALSE);
     246    RedrawWindow(0, 0, diffReg, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN);
     247    RedrawWindow(mConsole->viewport()->winId(), 0, 0, RDW_INVALIDATE);
     248
     249    m_prevRegion = region;
     250#elif defined (Q_WS_MAC)
     251# if defined (VBOX_GUI_USE_QUARTZ2D)
     252    if (vboxGlobal().vmRenderMode() == VBoxDefs::Quartz2DMode)
     253    {
     254        /* If we are using the Quartz2D backend we have to trigger
     255         * an repaint only. All the magic clipping stuff is done
     256         * in the paint engine. */
     257        ::darwinWindowInvalidateShape (mConsole->viewport());
     258    }
     259    else
     260# endif
     261    {
     262        /* This is necessary to avoid the flicker by an mask update.
     263         * See http://lists.apple.com/archives/Carbon-development/2001/Apr/msg01651.html
     264         * for the hint.
     265         * There *must* be a better solution. */
     266        if (!region.isEmpty())
     267            region |= QRect (0, 0, 1, 1);
     268        // /* Save the current region for later processing in the darwin event handler. */
     269        // mCurrRegion = region;
     270        // /* We repaint the screen before the ReshapeCustomWindow command. Unfortunately
     271        //  * this command flushes a copy of the backbuffer to the screen after the new
     272        //  * mask is set. This leads into a missplaced drawing of the content. Currently
     273        //  * no alternative to this and also this is not 100% perfect. */
     274        // repaint();
     275        // qApp->processEvents();
     276        // /* Now force the reshaping of the window. This is definitly necessary. */
     277        // ReshapeCustomWindow (reinterpret_cast <WindowPtr> (winId()));
     278        QMainWindow::setMask (region);
     279        // HIWindowInvalidateShadow (::darwinToWindowRef (mConsole->viewport()));
     280    }
     281#else
     282    QMainWindow::setMask(region);
     283#endif
     284}
     285
     286void UIMachineWindowSeamless::clearMask()
     287{
     288#ifdef Q_WS_WIN
     289    SetWindowRgn(winId(), 0, TRUE);
     290#else
     291    QMainWindow::clearMask();
     292#endif
     293}
     294
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.h

    r27006 r27012  
    22 *
    33 * VBox frontends: Qt GUI ("VirtualBox"):
    4  * UIMachineWindowNormal class declaration
     4 * UIMachineWindowSeamless class declaration
    55 */
    66
     
    2121 */
    2222
    23 #ifndef __UIMachineWindowNormal_h__
    24 #define __UIMachineWindowNormal_h__
    25 
    26 /* Global includes */
    27 #include <QLabel>
     23#ifndef __UIMachineWindowSeamless_h__
     24#define __UIMachineWindowSeamless_h__
    2825
    2926/* Local includes */
    30 #include "VBoxDefs.h"
    3127#include "QIWithRetranslateUI.h"
    3228#include "QIMainDialog.h"
     
    3632#endif
    3733
    38 /* Local forwards */
    39 class CMediumAttachment;
    40 class UIIndicatorsPool;
    41 class QIStateIndicator;
    42 
    43 class UIMachineWindowNormal : public QIWithRetranslateUI<QIMainDialog>, public UIMachineWindow
     34class UIMachineWindowSeamless : public QIWithRetranslateUI2<QIMainDialog>, public UIMachineWindow
    4435{
    4536    Q_OBJECT;
     
    4738protected:
    4839
    49     /* Normal machine window constructor/destructor: */
    50     UIMachineWindowNormal(UIMachineLogic *pMachineLogic, ulong uScreenId);
    51     virtual ~UIMachineWindowNormal();
     40    /* Seamless machine window constructor/destructor: */
     41    UIMachineWindowSeamless(UIMachineLogic *pMachineLogic, ulong uScreenId);
     42    virtual ~UIMachineWindowSeamless();
    5243
    5344private slots:
     
    5546    /* Console callback handlers: */
    5647    void sltMachineStateChanged();
    57     void sltMediumChange(const CMediumAttachment &attachment);
    58     void sltUSBControllerChange();
    59     void sltUSBDeviceStateChange();
    60     void sltNetworkAdapterChange();
    61     void sltSharedFolderChange();
    62 
    63     /* LED connections: */
    64     void sltUpdateIndicators();
    65     void sltShowIndicatorsContextMenu(QIStateIndicator *pIndicator, QContextMenuEvent *pEvent);
    66     void sltProcessGlobalSettingChange(const char *aPublicName, const char *aName);
    6748
    6849    /* Close window reimplementation: */
     
    7455    void retranslateUi();
    7556
    76     /* Update routines: */
    77     void updateAppearanceOf(int aElement);
    78 
    7957    /* Event handlers: */
    80     bool event(QEvent *pEvent);
    8158#ifdef Q_WS_X11
    8259    bool x11Event(XEvent *pEvent);
     
    8461    void closeEvent(QCloseEvent *pEvent);
    8562
    86     /* Private getters: */
    87     UIIndicatorsPool* indicatorsPool() { return m_pIndicatorsPool; }
    88 
    8963    /* Prepare helpers: */
    90     void prepareConsoleConnections();
     64    void prepareSeamless();
     65#ifdef Q_WS_MAC
    9166    void prepareMenu();
    92     void prepareStatusBar();
    93     void prepareConnections();
     67#endif
    9468    void prepareMachineView();
     69#ifdef Q_WS_MAC
    9570    void loadWindowSettings();
     71#endif
    9672
    9773    /* Cleanup helpers: */
    98     void saveWindowSettings();
     74#ifdef Q_WS_MAC
     75    //void saveWindowSettings() {}
     76#endif
    9977    void cleanupMachineView();
    100     //void cleanupConnections() {}
    101     void cleanupStatusBar();
     78#ifdef Q_WS_MAC
    10279    //void cleanupMenu() {}
    103     //void cleanupConsoleConnections() {}
     80#endif
     81    //void cleanupSeamless() {}
    10482
    105     /* Indicators pool: */
    106     UIIndicatorsPool *m_pIndicatorsPool;
    107     /* Other QWidgets: */
    108     QWidget *m_pCntHostkey;
    109     QLabel *m_pNameHostkey;
    110     /* Other QObjects: */
    111     QTimer *m_pIdleTimer;
    11283    /* Other members: */
    113     QRect m_normalGeometry;
     84    void setMask(const QRegion &region);
     85    void clearMask();
     86
     87    /* Private variables: */
     88#ifdef Q_WS_WIN
     89    QRegion m_prevRegion;
     90#endif
    11491
    11592    /* Factory support: */
     
    11794};
    11895
    119 #endif // __UIMachineWindowNormal_h__
     96#endif // __UIMachineWindowSeamless_h__
    12097
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