19
19
#ifndef __UIMachineWindow_h__
20
20
#define __UIMachineWindow_h__
23
#include <QMainWindow>
26
#include "QIWithRetranslateUI.h"
23
27
#include "UIMachineDefs.h"
33
/* Forward declarations: */
34
39
class UIMachineLogic;
35
40
class UIMachineView;
42
/* Machine-window interface: */
43
class UIMachineWindow : public QIWithRetranslateUI2<QMainWindow>
41
/* Factory function to create required machine window child: */
42
static UIMachineWindow* create(UIMachineLogic *pMachineLogic, UIVisualStateType visualStateType, ulong uScreenId = 0);
49
/* Factory functions to create/destroy machine-window: */
50
static UIMachineWindow* create(UIMachineLogic *pMachineLogic, ulong uScreenId = 0);
43
51
static void destroy(UIMachineWindow *pWhichWindow);
45
/* Abstract slot to close machine window: */
46
virtual void sltTryClose();
53
/* Prepare/cleanup machine-window: */
48
57
/* Public getters: */
49
virtual UIMachineLogic* machineLogic() const { return m_pMachineLogic; }
50
virtual QWidget* machineWindow() const { return m_pMachineWindow; }
51
virtual UIMachineView* machineView() const { return m_pMachineView; }
58
UIMachineView* machineView() const { return m_pMachineView; }
59
UIMachineLogic* machineLogic() const { return m_pMachineLogic; }
52
60
UISession* uisession() const;
53
61
CSession& session() const;
56
virtual void reshow() {}
57
virtual void setMask(const QRegion ®ion);
62
CMachine machine() const;
66
/* Session event-handlers: */
67
virtual void sltMachineStateChanged();
68
virtual void sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
61
/* Machine window constructor/destructor: */
62
73
UIMachineWindow(UIMachineLogic *pMachineLogic, ulong uScreenId);
63
virtual ~UIMachineWindow();
65
/* Protected getters: */
66
const QString& defaultWindowTitle() const { return m_strWindowTitlePrefix; }
68
/* Translate routine: */
69
virtual void retranslateUi();
71
/* Common machine window event handlers: */
76
virtual void showInNecessaryMode() = 0;
78
/* Translate stuff: */
73
83
bool x11Event(XEvent *pEvent);
75
85
void closeEvent(QCloseEvent *pEvent);
77
87
/* Prepare helpers: */
78
virtual void prepareWindowIcon();
79
virtual void prepareConsoleConnections();
80
virtual void prepareMachineViewContainer();
81
//virtual void loadWindowSettings() {}
88
virtual void prepareSessionConnections();
89
virtual void prepareMainLayout();
90
virtual void prepareMenu() {}
91
virtual void prepareStatusBar() {}
92
virtual void prepareMachineView();
93
virtual void prepareVisualState() {}
82
94
virtual void prepareHandlers();
95
virtual void loadSettings() {}
84
97
/* Cleanup helpers: */
98
virtual void saveSettings() {}
85
99
virtual void cleanupHandlers();
86
//virtual void saveWindowSettings() {}
87
//virtual void cleanupMachineViewContainer() {}
88
//virtual void cleanupConsoleConnections() {}
89
//virtual void cleanupWindowIcon() {}
100
virtual void cleanupVisualState() {}
101
virtual void cleanupMachineView();
102
virtual void cleanupStatusBar() {}
103
virtual void cleanupMenu() {}
104
virtual void cleanupMainLayout() {}
105
virtual void cleanupSessionConnections() {}
91
/* Update routines: */
92
108
virtual void updateAppearanceOf(int iElement);
93
109
#ifdef VBOX_WITH_DEBUGGER_GUI
94
virtual void updateDbgWindows();
110
void updateDbgWindows();
95
111
#endif /* VBOX_WITH_DEBUGGER_GUI */
97
/* Protected slots: */
98
virtual void sltMachineStateChanged();
114
const QString& defaultWindowTitle() const { return m_strWindowTitlePrefix; }
115
static Qt::WindowFlags windowFlags(UIVisualStateType visualStateType);
116
static Qt::Alignment viewAlignment(UIVisualStateType visualStateType);
100
/* Protected variables: */
101
119
UIMachineLogic *m_pMachineLogic;
102
QWidget *m_pMachineWindow;
104
/* Virtual screen number: */
120
UIMachineView *m_pMachineView;
121
QString m_strWindowTitlePrefix;
105
122
ulong m_uScreenId;
107
QGridLayout *m_pMachineViewContainer;
123
QGridLayout *m_pMainLayout;
108
124
QSpacerItem *m_pTopSpacer;
109
125
QSpacerItem *m_pBottomSpacer;
110
126
QSpacerItem *m_pLeftSpacer;
111
127
QSpacerItem *m_pRightSpacer;
113
UIMachineView *m_pMachineView;
114
QString m_strWindowTitlePrefix;
129
/* Friend classes: */
116
130
friend class UIMachineLogic;