UISession.h revision 0de1998ac52682bb5322df476e45f237265ea9b7
1N/A/** @file
1N/A *
1N/A * VBox frontends: Qt GUI ("VirtualBox"):
1N/A * UISession class declaration
1N/A */
1N/A
1N/A/*
1N/A * Copyright (C) 2010 Sun Microsystems, Inc.
1N/A *
1N/A * This file is part of VirtualBox Open Source Edition (OSE), as
1N/A * available from http://www.virtualbox.org. This file is free software;
1N/A * you can redistribute it and/or modify it under the terms of the GNU
1N/A * General Public License (GPL) as published by the Free Software
1N/A * Foundation, in version 2 as it comes in the "COPYING" file of the
1N/A * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
1N/A * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
1N/A *
1N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
1N/A * Clara, CA 95054 USA or visit http://www.sun.com if you need
1N/A * additional information or have any questions.
1N/A */
1N/A
1N/A#ifndef ___UIConsole_h___
1N/A#define ___UIConsole_h___
1N/A
1N/A/* Global includes */
1N/A#include <QObject>
1N/A#include <QCursor>
1N/A
1N/A/* Local includes */
1N/A#include "COMDefs.h"
1N/A
1N/A/* Local forwards */
1N/Aclass UIMachine;
1N/Aclass UIConsoleCallback;
1N/A
1N/A/* CConsole callback event types: */
1N/Aenum UIConsoleEventType
1N/A{
1N/A UIConsoleEventType_MousePointerShapeChange = QEvent::User + 1,
1N/A UIConsoleEventType_MouseCapabilityChange,
1N/A UIConsoleEventType_KeyboardLedsChange,
1N/A UIConsoleEventType_StateChange,
1N/A UIConsoleEventType_AdditionsStateChange,
1N/A UIConsoleEventType_NetworkAdapterChange,
1N/A UIConsoleEventType_SerialPortChange,
1N/A UIConsoleEventType_ParallelPortChange,
1N/A UIConsoleEventType_StorageControllerChange,
1N/A UIConsoleEventType_MediumChange,
1N/A UIConsoleEventType_CPUChange,
1N/A UIConsoleEventType_VRDPServerChange,
1N/A UIConsoleEventType_RemoteDisplayInfoChange,
1N/A UIConsoleEventType_USBControllerChange,
1N/A UIConsoleEventType_USBDeviceStateChange,
1N/A UIConsoleEventType_SharedFolderChange,
1N/A UIConsoleEventType_RuntimeError,
1N/A UIConsoleEventType_CanShowWindow,
1N/A UIConsoleEventType_ShowWindow,
1N/A UIConsoleEventType_MAX
1N/A};
1N/A
1N/Aclass UISession : public QObject
1N/A{
1N/A Q_OBJECT;
1N/A
1N/Apublic:
1N/A
1N/A /* Machine session constructor/destructor: */
1N/A UISession(UIMachine *pMachine, const CSession &session);
1N/A virtual ~UISession();
1N/A
1N/A /* Common getters: */
1N/A CSession& session() { return m_session; }
1N/A KMachineState machineState() const { return m_machineState; }
1N/A bool isSaved() const { return machineState() == KMachineState_Saved; }
1N/A bool isTurnedOff() const { return machineState() == KMachineState_PoweredOff ||
1N/A machineState() == KMachineState_Saved ||
1N/A machineState() == KMachineState_Teleported ||
1N/A machineState() == KMachineState_Aborted; }
1N/A bool isPaused() const { return machineState() == KMachineState_Paused ||
1N/A machineState() == KMachineState_TeleportingPausedVM; }
1N/A bool isRunning() const { return machineState() == KMachineState_Running ||
1N/A machineState() == KMachineState_Teleporting ||
1N/A machineState() == KMachineState_LiveSnapshotting; }
1N/A bool isFirstTimeStarted() const { return m_fIsFirstTimeStarted; }
1N/A bool isIgnoreRuntimeMediumsChanging() const { return m_fIsIgnoreRutimeMediumsChanging; }
1N/A bool isGuestResizeIgnored() const { return m_fIsGuestResizeIgnored; }
1N/A QCursor cursor() const { return m_cursor; }
1N/A
1N/A /* Guest additions state getters: */
1N/A bool isGuestAdditionsActive() const { return m_fIsGuestAdditionsActive; }
1N/A bool isGuestSupportsGraphics() const { return m_fIsGuestSupportsGraphics; }
1N/A bool isGuestSupportsSeamless() const { return m_fIsGuestSupportsSeamless; }
1N/A
1N/A /* Keyboard getters: */
1N/A bool isNumLock() const { return m_fNumLock; }
1N/A bool isCapsLock() const { return m_fCapsLock; }
1N/A bool isScrollLock() const { return m_fScrollLock; }
1N/A uint numLockAdaptionCnt() const { return m_uNumLockAdaptionCnt; }
1N/A uint capsLockAdaptionCnt() const { return m_uCapsLockAdaptionCnt; }
1N/A
1N/A /* Mouse getters: */
1N/A bool isMouseSupportsAbsolute() const { return m_fIsMouseSupportsAbsolute; }
1N/A bool isMouseSupportsRelative() const { return m_fIsMouseSupportsRelative; }
1N/A bool isMouseHostCursorNeeded() const { return m_fIsMouseHostCursorNeeded; }
1N/A bool isMouseCaptured() const { return m_fIsMouseCaptured; }
1N/A bool isMouseIntegrated() const { return m_fIsMouseIntegrated; }
1N/A bool isHidingHostPointer() const { return m_fIsMouseCaptured || (m_fIsMouseSupportsAbsolute && m_fIsHideHostPointer); }
1N/A
1N/A /* Common setters: */
1N/A bool pause() { return setPause(true); }
1N/A bool unpause() { return setPause(false); }
1N/A bool setPause(bool fOn);
1N/A void setGuestResizeIgnored(bool fIsGuestResizeIgnored) { m_fIsGuestResizeIgnored = fIsGuestResizeIgnored; }
1N/A
1N/A /* Keyboard setters: */
1N/A void setNumLockAdaptionCnt(uint uNumLockAdaptionCnt) { m_uNumLockAdaptionCnt = uNumLockAdaptionCnt; }
1N/A void setCapsLockAdaptionCnt(uint uCapsLockAdaptionCnt) { m_uCapsLockAdaptionCnt = uCapsLockAdaptionCnt; }
1N/A
1N/A /* Mouse setters: */
1N/A void setMouseCaptured(bool fIsMouseCaptured) { m_fIsMouseCaptured = fIsMouseCaptured; }
1N/A void setMouseIntegrated(bool fIsMouseIntegrated) { m_fIsMouseIntegrated = fIsMouseIntegrated; }
1N/A
1N/Asignals:
1N/A
1N/A /* Console callback signals: */
1N/A void sigMousePointerShapeChange();
1N/A void sigMouseCapabilityChange();
1N/A void sigKeyboardLedsChange();
1N/A void sigMachineStateChange();
1N/A void sigAdditionsStateChange();
1N/A void sigNetworkAdapterChange(const CNetworkAdapter &networkAdapter);
1N/A void sigSerialPortChange(const CSerialPort &serialPort);
1N/A void sigParallelPortChange(const CParallelPort &parallelPort);
1N/A void sigStorageControllerChange();
1N/A void sigMediumChange(const CMediumAttachment &mediumAttachment);
1N/A void sigCPUChange(ulong uCPU, bool bRemove);
1N/A void sigVRDPServerChange();
1N/A void sigRemoteDisplayInfoChange();
1N/A void sigUSBControllerChange();
1N/A void sigUSBDeviceStateChange(const CUSBDevice &device, bool bIsAttached, const CVirtualBoxErrorInfo &error);
1N/A void sigSharedFolderChange();
1N/A void sigRuntimeError(bool bIsFatal, const QString &strErrorId, const QString &strMessage);
1N/A
1N/Aprivate:
1N/A
1N/A /* Private getters: */
1N/A UIMachine* uimachine() const { return m_pMachine; }
1N/A
1N/A /* Event handlers: */
bool event(QEvent *pEvent);
/* Prepare helpers: */
void loadSessionSettings();
/* Cleanup helpers: */
void saveSessionSettings();
/* Common helpers: */
qulonglong winId() const;
void setPointerShape(const uchar *pShapeData, bool fHasAlpha, uint uXHot, uint uYHot, uint uWidth, uint uHeight);
/* Private variables: */
UIMachine *m_pMachine;
CSession m_session;
UIConsoleCallback *m_pCallback;
const CConsoleCallback &m_callback;
/* Common variables: */
KMachineState m_machineState;
QCursor m_cursor;
#if defined(Q_WS_WIN)
HCURSOR m_alphaCursor;
#endif
/* Common flags: */
bool m_fIsFirstTimeStarted : 1;
bool m_fIsIgnoreRutimeMediumsChanging : 1;
bool m_fIsGuestResizeIgnored : 1;
/* Guest additions flags: */
bool m_fIsGuestAdditionsActive : 1;
bool m_fIsGuestSupportsGraphics : 1;
bool m_fIsGuestSupportsSeamless : 1;
/* Keyboard flags: */
bool m_fNumLock : 1;
bool m_fCapsLock : 1;
bool m_fScrollLock : 1;
uint m_uNumLockAdaptionCnt;
uint m_uCapsLockAdaptionCnt;
/* Mouse flags: */
bool m_fIsMouseSupportsAbsolute : 1;
bool m_fIsMouseSupportsRelative : 1;
bool m_fIsMouseHostCursorNeeded : 1;
bool m_fIsMouseCaptured : 1;
bool m_fIsMouseIntegrated : 1;
bool m_fIsHideHostPointer : 1;
/* Friend classes: */
friend class UIConsoleCallback;
};
#endif // !___UIConsole_h___