UIMachineLogic.h revision 67d8048258ab7e245a0b2b6b759df0175ffab9a0
/** @file
*
* VBox frontends: Qt GUI ("VirtualBox"):
* UIMachineLogic class declaration
*/
/*
* Copyright (C) 2010-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef __UIMachineLogic_h__
#define __UIMachineLogic_h__
/* GUI includes: */
#include "UIDefs.h"
#include <QIWithRetranslateUI.h>
#ifdef VBOX_WITH_DEBUGGER_GUI
#endif /* VBOX_WITH_DEBUGGER_GUI */
/* COM includes: */
#include "COMEnums.h"
/* Forward declarations: */
#ifdef Q_WS_MAC
#endif /* Q_WS_MAC */
/* Machine logic interface: */
{
static UIMachineLogic* create(QObject *pParent, UISession *pSession, UIVisualStateType visualStateType);
/* Check if this logic is available: */
virtual bool checkAvailability() = 0;
UIMachineWindow* mainMachineWindow() const;
UIMachineWindow* activeMachineWindow() const;
bool isPreventAutoClose() const { return m_fIsPreventAutoClose; }
/* API: Guest screen size stuff: */
virtual void maybeAdjustGuestScreenSize();
/* Wrapper to open Machine settings / Network page: */
void openNetworkAdaptersDialog() { sltOpenNetworkAdaptersDialog(); }
#ifdef Q_WS_MAC
void updateDockIcon();
UIMachineView* dockPreviewView() const;
#endif /* Q_WS_MAC */
/* API: Close actions: */
void saveState();
void shutdown();
void powerOff(bool fDiscardingState);
/* API: 3D overlay visibility stuff: */
/* Console callback handlers: */
virtual void sltMachineStateChanged();
virtual void sltAdditionsStateChanged();
virtual void sltMouseCapabilityChanged();
virtual void sltKeyboardLedsChanged();
virtual void sltUSBDeviceStateChange(const CUSBDevice &device, bool fIsAttached, const CVirtualBoxErrorInfo &error);
#ifdef RT_OS_DARWIN
virtual void sltShowWindows();
#endif /* RT_OS_DARWIN */
virtual void sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
/* Qt callback handler: */
virtual void sltHostScreenCountChanged();
virtual void sltHostScreenGeometryChanged();
/* Constructor: */
bool isMachineWindowsCreated() const { return m_fIsWindowsCreated; }
void setMachineWindowsCreated(bool fIsWindowsCreated);
/* Protected members: */
void retranslateUi();
#ifdef Q_WS_MAC
bool isDockIconPreviewEnabled() const { return m_fIsDockIconEnabled; }
void setDockIconPreviewEnabled(bool fIsDockIconPreviewEnabled) { m_fIsDockIconEnabled = fIsDockIconPreviewEnabled; }
void updateDockOverlay();
#endif /* Q_WS_MAC */
/* Prepare helpers: */
virtual void prepareRequiredFeatures();
virtual void prepareSessionConnections();
virtual void prepareActionGroups();
virtual void prepareActionConnections();
virtual void prepareOtherConnections() {}
virtual void prepareHandlers();
virtual void prepareMachineWindows() = 0;
virtual void prepareMenu();
#ifdef Q_WS_MAC
virtual void prepareDock();
#endif /* Q_WS_MAC */
#ifdef VBOX_WITH_DEBUGGER_GUI
virtual void prepareDebugger();
#endif /* VBOX_WITH_DEBUGGER_GUI */
/* Cleanup helpers: */
#ifdef VBOX_WITH_DEBUGGER_GUI
virtual void cleanupDebugger();
#endif /* VBOX_WITH_DEBUGGER_GUI */
#ifdef Q_WS_MAC
virtual void cleanupDock();
#endif /* Q_WS_MAC */
virtual void cleanupMenu();
virtual void cleanupMachineWindows() = 0;
virtual void cleanupHandlers();
//virtual void cleanupOtherConnections() {}
//virtual void cleanupActionConnections() {}
virtual void cleanupActionGroups();
//virtual void cleanupSessionConnections() {}
//virtual void cleanupRequiredFeatures() {}
/* Handler: Event-filter stuff: */
/* Mode request watch dog: */
void sltCheckRequestedModes();
/* "Machine" menu functionality: */
void sltToggleGuestAutoresize(bool fEnabled);
void sltAdjustWindow();
void sltToggleMouseIntegration(bool fDisabled);
void sltTypeCAD();
#ifdef Q_WS_X11
void sltTypeCABS();
#endif /* Q_WS_X11 */
void sltTakeSnapshot();
void sltTakeScreenshot();
void sltShowInformationDialog();
void sltReset();
void sltSaveState();
void sltShutdown();
void sltPowerOff();
void sltClose();
/* "Device" menu functionality: */
void sltOpenVMSettingsDialog(const QString &strCategory = QString(), const QString &strControl = QString());
void sltOpenNetworkAdaptersDialog();
void sltOpenSharedFoldersDialog();
void sltPrepareStorageMenu();
void sltMountStorageMedium();
void sltMountRecentStorageMedium();
void sltPrepareUSBMenu();
void sltAttachUSBDevice();
void sltPrepareSharedClipboardMenu();
void sltPrepareDragAndDropMenu();
void sltToggleVRDE(bool fEnabled);
void sltToggleVideoCapture(bool fEnabled);
void sltOpenVideoCaptureOptions();
void sltInstallGuestAdditions();
#ifdef VBOX_WITH_DEBUGGER_GUI
/* "Debug" menu functionality: */
void sltPrepareDebugMenu();
void sltShowDebugStatistics();
void sltShowDebugCommandLine();
void sltLoggingToggled(bool);
void sltShowLogDialog();
#endif /* VBOX_WITH_DEBUGGER_GUI */
#ifdef RT_OS_DARWIN /* Something is *really* broken in regards of the moc here */
void sltChangeDockIconUpdate(bool fEnabled);
#endif /* RT_OS_DARWIN */
/* Handlers: Keyboard LEDs sync logic: */
void sltSwitchKeyboardLedsToGuestLeds();
/* Helpers: */
static int searchMaxSnapshotIndex(const CMachine &machine, const CSnapshot &snapshot, const QString &strNameTemplate);
/* Private variables: */
bool m_fIsWindowsCreated : 1;
bool m_fIsPreventAutoClose : 1;
#ifdef VBOX_WITH_DEBUGGER_GUI
/* Debugger functionality: */
bool dbgCreated();
void dbgDestroy();
void dbgAdjustRelativePos();
/* The handle to the debugger GUI: */
/* The virtual method table for the debugger GUI: */
#endif /* VBOX_WITH_DEBUGGER_GUI */
#ifdef Q_WS_MAC
bool m_fIsDockIconEnabled;
void *m_pHostLedsState;
#endif /* Q_WS_MAC */
/* Friend classes: */
};
#endif // __UIMachineLogic_h__