VirtualBox

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

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

FE/Qt: Runtime UI: General machine-window refactoring/cleanup.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 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
67 /* Slot to close machine-window: */
68 void sltTryClose();
69
70protected:
71
72 /* Constructor/destructor: */
73 UIMachineWindow(UIMachineLogic *pMachineLogic, ulong uScreenId);
74 ~UIMachineWindow();
75
76 /* Show stuff: */
77 virtual void showInNecessaryMode() = 0;
78
79 /* Translate stuff: */
80 void retranslateUi();
81
82 /* Event handlers: */
83#ifdef Q_WS_X11
84 bool x11Event(XEvent *pEvent);
85#endif /* Q_WS_X11 */
86 void closeEvent(QCloseEvent *pEvent);
87
88 /* Prepare helpers: */
89 virtual void prepareSessionConnections();
90 virtual void prepareMainLayout();
91 virtual void prepareMenu() {}
92 virtual void prepareStatusBar() {}
93 virtual void prepareMachineView();
94 virtual void prepareVisualState() {}
95 virtual void prepareHandlers();
96 virtual void loadSettings() {}
97
98 /* Cleanup helpers: */
99 virtual void saveSettings() {}
100 virtual void cleanupHandlers();
101 virtual void cleanupVisualState() {}
102 virtual void cleanupMachineView();
103 virtual void cleanupStatusBar() {}
104 virtual void cleanupMenu() {}
105 virtual void cleanupMainLayout() {}
106 virtual void cleanupSessionConnections() {}
107
108 /* Update stuff: */
109 virtual void updateAppearanceOf(int iElement);
110#ifdef VBOX_WITH_DEBUGGER_GUI
111 void updateDbgWindows();
112#endif /* VBOX_WITH_DEBUGGER_GUI */
113
114 /* Helpers: */
115 const QString& defaultWindowTitle() const { return m_strWindowTitlePrefix; }
116 static Qt::WindowFlags windowFlags(UIVisualStateType visualStateType);
117 static Qt::Alignment viewAlignment(UIVisualStateType visualStateType);
118
119 /* Variables: */
120 UIMachineLogic *m_pMachineLogic;
121 UIMachineView *m_pMachineView;
122 QString m_strWindowTitlePrefix;
123 ulong m_uScreenId;
124 QGridLayout *m_pMainLayout;
125 QSpacerItem *m_pTopSpacer;
126 QSpacerItem *m_pBottomSpacer;
127 QSpacerItem *m_pLeftSpacer;
128 QSpacerItem *m_pRightSpacer;
129
130 /* Friend classes: */
131 friend class UIMachineLogic;
132};
133
134#endif // __UIMachineWindow_h__
135
Note: See TracBrowser for help on using the repository browser.

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