VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h@ 41122

Last change on this file since 41122 was 41122, checked in by vboxsync, 13 years ago

FE/Qt: Runtime UI: More predicted close VM handling.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * UIMachineWindow class declaration
5 */
6
7/*
8 * Copyright (C) 2010-2012 Oracle Corporation
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19#ifndef __UIMachineWindow_h__
20#define __UIMachineWindow_h__
21
22/* Global includes: */
23#include <QMainWindow>
24
25/* Local includes: */
26#include "QIWithRetranslateUI.h"
27#include "UIMachineDefs.h"
28#include "COMDefs.h"
29
30/* Forward declarations: */
31class QGridLayout;
32class QSpacerItem;
33class QCloseEvent;
34class CSession;
35class UISession;
36class UIMachineLogic;
37class UIMachineView;
38
39/* Machine-window interface: */
40class UIMachineWindow : public QIWithRetranslateUI2<QMainWindow>
41{
42 Q_OBJECT;
43
44public:
45
46 /* Factory functions to create/destroy machine-window: */
47 static UIMachineWindow* create(UIMachineLogic *pMachineLogic, ulong uScreenId = 0);
48 static void destroy(UIMachineWindow *pWhichWindow);
49
50 /* Prepare/cleanup machine-window: */
51 void prepare();
52 void cleanup();
53
54 /* Public getters: */
55 UIMachineView* machineView() const { return m_pMachineView; }
56 UIMachineLogic* machineLogic() const { return m_pMachineLogic; }
57 UISession* uisession() const;
58 CSession& session() const;
59 CMachine machine() const;
60
61protected slots:
62
63 /* Session event-handlers: */
64 virtual void sltMachineStateChanged();
65 virtual void sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
66
67protected:
68
69 /* Constructor: */
70 UIMachineWindow(UIMachineLogic *pMachineLogic, ulong uScreenId);
71
72 /* Show stuff: */
73 virtual void showInNecessaryMode() = 0;
74
75 /* Translate stuff: */
76 void retranslateUi();
77
78 /* Event handlers: */
79#ifdef Q_WS_X11
80 bool x11Event(XEvent *pEvent);
81#endif /* Q_WS_X11 */
82 void closeEvent(QCloseEvent *pEvent);
83
84 /* Prepare helpers: */
85 virtual void prepareSessionConnections();
86 virtual void prepareMainLayout();
87 virtual void prepareMenu() {}
88 virtual void prepareStatusBar() {}
89 virtual void prepareMachineView();
90 virtual void prepareVisualState() {}
91 virtual void prepareHandlers();
92 virtual void loadSettings() {}
93
94 /* Cleanup helpers: */
95 virtual void saveSettings() {}
96 virtual void cleanupHandlers();
97 virtual void cleanupVisualState() {}
98 virtual void cleanupMachineView();
99 virtual void cleanupStatusBar() {}
100 virtual void cleanupMenu() {}
101 virtual void cleanupMainLayout() {}
102 virtual void cleanupSessionConnections() {}
103
104 /* Update stuff: */
105 virtual void updateAppearanceOf(int iElement);
106#ifdef VBOX_WITH_DEBUGGER_GUI
107 void updateDbgWindows();
108#endif /* VBOX_WITH_DEBUGGER_GUI */
109
110 /* Helpers: */
111 const QString& defaultWindowTitle() const { return m_strWindowTitlePrefix; }
112 static Qt::WindowFlags windowFlags(UIVisualStateType visualStateType);
113 static Qt::Alignment viewAlignment(UIVisualStateType visualStateType);
114
115 /* Variables: */
116 UIMachineLogic *m_pMachineLogic;
117 UIMachineView *m_pMachineView;
118 QString m_strWindowTitlePrefix;
119 ulong m_uScreenId;
120 QGridLayout *m_pMainLayout;
121 QSpacerItem *m_pTopSpacer;
122 QSpacerItem *m_pBottomSpacer;
123 QSpacerItem *m_pLeftSpacer;
124 QSpacerItem *m_pRightSpacer;
125
126 /* Friend classes: */
127 friend class UIMachineLogic;
128};
129
130#endif // __UIMachineWindow_h__
131
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette