VBoxConsoleWnd.h revision 40f816668d362e859601b6e450ffea01a6f0e5e5
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync/** @file
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync *
2291faee92ebb5cc9722cd3f22e499900a5a411fvboxsync * VBox frontends: Qt GUI ("VirtualBox"):
546cd3313d635980a2cc168a79a58b4f0858d784vboxsync * VBoxConsoleWnd class declaration
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync */
2291faee92ebb5cc9722cd3f22e499900a5a411fvboxsync
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync/*
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync * Copyright (C) 2006-2007 innotek GmbH
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync *
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync * available from http://www.virtualbox.org. This file is free software;
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync * you can redistribute it and/or modify it under the terms of the GNU
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync * General Public License as published by the Free Software Foundation,
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync * distribution. VirtualBox OSE is distributed in the hope that it will
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync * be useful, but WITHOUT ANY WARRANTY of any kind.
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync *
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync * If you received this file as part of a commercial VirtualBox
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync * distribution, then only the terms of your commercial VirtualBox
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync * license agreement apply instead of the previous paragraph.
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync */
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync#ifndef __VBoxConsoleWnd_h__
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync#define __VBoxConsoleWnd_h__
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync#include "COMDefs.h"
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync#include <qmainwindow.h>
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync#include <qmap.h>
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync#include <qobjectlist.h>
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync#include <qcolor.h>
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync#include <qdialog.h>
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync#ifdef VBOX_WITH_DEBUGGER_GUI
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync# include <VBox/dbggui.h>
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync#endif
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync#ifdef Q_WS_MAC
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync# undef PAGE_SIZE
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync# undef PAGE_SHIFT
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync# include <Carbon/Carbon.h>
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync#endif
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsyncclass QAction;
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsyncclass QActionGroup;
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsyncclass QHBox;
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsyncclass QLabel;
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsyncclass VBoxConsoleView;
cdd0348e21eb564698908d33dcd883dd4f54f669vboxsyncclass QIStateIndicator;
cdd0348e21eb564698908d33dcd883dd4f54f669vboxsync
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsyncclass VBoxUSBMenu;
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsyncclass VBoxSwitchMenu;
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsyncclass VBoxUSBLedTip;
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsyncclass VBoxNetworkLedTip;
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsyncclass VBoxConsoleWnd : public QMainWindow
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync{
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync Q_OBJECT
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync
cdd0348e21eb564698908d33dcd883dd4f54f669vboxsyncpublic:
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync VBoxConsoleWnd (VBoxConsoleWnd **aSelf,
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync QWidget* aParent = 0, const char* aName = 0,
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync WFlags aFlags = WType_TopLevel);
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync virtual ~VBoxConsoleWnd();
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync bool openView (const CSession &session);
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync void closeView();
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync void refreshView();
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync bool isTrueFullscreen() const { return mIsFullscreen; }
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync
aa6929adf39d3b1c4479a63d9537888fa83bcf65vboxsync bool isTrueSeamless() const { return mIsSeamless; }
void setMouseIntegrationLocked (bool aDisabled);
void popupMainMenu (bool aCenter);
public slots:
protected:
// events
bool event (QEvent *e);
void closeEvent (QCloseEvent *e);
#if defined(Q_WS_X11)
bool x11Event (XEvent *event);
#endif
#ifdef VBOX_WITH_DEBUGGER_GUI
bool dbgCreated();
void dbgDestroy();
void dbgAdjustRelativePos();
#endif
protected slots:
private:
enum /* Stuff */
{
FloppyStuff = 0x01,
DVDStuff = 0x02,
HardDiskStuff = 0x04,
PauseAction = 0x08,
NetworkStuff = 0x10,
DisableMouseIntegrAction = 0x20,
Caption = 0x40,
USBStuff = 0x80,
VRDPStuff = 0x100,
AllStuff = 0xFF,
};
void languageChange();
void updateAppearanceOf (int element);
void toggleFullscreenMode (bool, bool);
private slots:
void finalizeOpenView();
void activateUICustomizations();
void vmFullscreen (bool on);
void vmSeamless (bool on);
void vmAutoresizeGuest (bool on);
void vmAdjustWindow();
void vmTypeCAD();
void vmTypeCABS();
void vmReset();
void vmPause(bool);
void vmACPIShutdown();
void vmClose();
void vmTakeSnapshot();
void vmDisableMouseIntegr (bool);
void devicesMountFloppyImage();
void devicesUnmountFloppy();
void devicesMountDVDImage();
void devicesUnmountDVD();
void devicesSwitchVrdp (bool);
void devicesOpenSFDialog();
void devicesInstallGuestAdditions();
void prepareFloppyMenu();
void prepareDVDMenu();
void prepareNetworkMenu();
void setDynamicMenuItemStatusTip (int aId);
void captureFloppy (int aId);
void captureDVD (int aId);
void activateNetworkMenu (int aId);
void switchUSB (int aId);
void statusTipChanged (const QString &);
void clearStatusBar();
void showIndicatorContextMenu (QIStateIndicator *ind, QContextMenuEvent *e);
void updateDeviceLights();
void updateMachineState (CEnums::MachineState state);
void updateMouseState (int state);
void updateAdditionsState (const QString&, bool, bool);
void tryClose();
void processGlobalSettingChange (const char *publicName, const char *name);
void dbgShowStatistics();
void dbgShowCommandLine();
private:
/** Popup version of the main menu */
QPopupMenu *mMainMenu;
QActionGroup *runningActions;
// Machine actions
QAction *vmFullscreenAction;
QAction *vmSeamlessAction;
QAction *vmAutoresizeGuestAction;
QAction *vmAdjustWindowAction;
QAction *vmTypeCADAction;
#if defined(Q_WS_X11)
QAction *vmTypeCABSAction;
#endif
QAction *vmResetAction;
QAction *vmPauseAction;
QAction *vmACPIShutdownAction;
QAction *vmCloseAction;
QAction *vmTakeSnapshotAction;
QAction *vmDisableMouseIntegrAction;
// Devices actions
QAction *devicesMountFloppyImageAction;
QAction *devicesUnmountFloppyAction;
QAction *devicesMountDVDImageAction;
QAction *devicesUnmountDVDAction;
QAction *devicesSwitchVrdpAction;
QAction *devicesSFDialogAction;
QAction *devicesInstallGuestToolsAction;
#ifdef VBOX_WITH_DEBUGGER_GUI
// Debugger actions
QAction *dbgStatisticsAction;
QAction *dbgCommandLineAction;
#endif
// Help actions
QAction *helpWebAction;
QAction *helpAboutAction;
QAction *helpResetMessagesAction;
// Machine popup menus
VBoxSwitchMenu *vmAutoresizeMenu;
VBoxSwitchMenu *vmDisMouseIntegrMenu;
// Devices popup menus
QPopupMenu *devicesMenu;
QPopupMenu *devicesMountFloppyMenu;
QPopupMenu *devicesMountDVDMenu;
QPopupMenu *devicesSharedFolders;
QPopupMenu *devicesNetworkMenu;
VBoxUSBMenu *devicesUSBMenu;
VBoxSwitchMenu *devicesVRDPMenu;
int devicesUSBMenuSeparatorId;
int devicesVRDPMenuSeparatorId;
int devicesSFMenuSeparatorId;
bool waitForStatusBarChange;
bool statusBarChangedInside;
#ifdef VBOX_WITH_DEBUGGER_GUI
// Debugger popup menu
QPopupMenu *dbgMenu;
#endif
// Menu identifiers
enum {
vmMenuId = 1,
devicesMenuId,
devicesMountFloppyMenuId,
devicesMountDVDMenuId,
devicesUSBMenuId,
devicesNetworkMenuId,
#ifdef VBOX_WITH_DEBUGGER_GUI
dbgMenuId,
#endif
helpMenuId,
};
CSession csession;
// widgets
VBoxConsoleView *console;
QIStateIndicator *hd_light, *cd_light, *fd_light, *net_light, *usb_light;
QIStateIndicator *mouse_state, *hostkey_state;
QIStateIndicator *autoresize_state;
QIStateIndicator *vrdp_state;
QIStateIndicator *sf_state;
QHBox *hostkey_hbox;
QLabel *hostkey_name;
VBoxUSBLedTip *mUsbLedTip;
VBoxNetworkLedTip *mNetworkLedTip;
QTimer *idle_timer;
CEnums::MachineState machine_state;
QString caption_prefix;
bool no_auto_close : 1;
QMap <int, CHostDVDDrive> hostDVDMap;
QMap <int, CHostFloppyDrive> hostFloppyMap;
QPoint normal_pos;
QSize normal_size;
QSize prev_min_size;
// variables for dealing with true fullscreen
bool mIsFullscreen : 1;
bool mIsSeamless : 1;
bool mIsSeamlessSupported : 1;
int normal_wflags;
bool was_max : 1;
QObjectList hidden_children;
int console_style;
QColor erase_color;
bool mIsFirstTimeStarted : 1;
bool mIsAutoSaveMedia : 1;
#ifdef VBOX_WITH_DEBUGGER_GUI
// Debugger GUI
PDBGGUI dbg_gui;
#endif
#ifdef Q_WS_MAC
// Dock images.
CGImageRef dockImgStateRunning;
CGImageRef dockImgStatePaused;
CGImageRef dockImgStateSaving;
CGImageRef dockImgStateRestoring;
CGImageRef dockImgBack75x75;
CGImageRef dockImgBack100x75;
CGImageRef dockImgOS;
#endif
};
class VBoxSharedFoldersSettings;
class VBoxSFDialog : public QDialog
{
Q_OBJECT
public:
VBoxSFDialog (QWidget*, CSession&);
protected slots:
virtual void accept();
protected:
void showEvent (QShowEvent*);
private:
VBoxSharedFoldersSettings *mSettings;
CSession &mSession;
};
#endif // __VBoxConsoleWnd_h__