VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h@ 82781

Last change on this file since 82781 was 76581, checked in by vboxsync, 5 years ago

Fe/QT: scm header guard alignment.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1/* $Id: UIMachine.h 76581 2019-01-01 06:24:57Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIMachine class declaration.
4 */
5
6/*
7 * Copyright (C) 2010-2019 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef FEQT_INCLUDED_SRC_runtime_UIMachine_h
19#define FEQT_INCLUDED_SRC_runtime_UIMachine_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24/* Qt includes: */
25#include <QObject>
26
27/* GUI includes: */
28#include "UIExtraDataDefs.h"
29#include "UIMachineDefs.h"
30
31/* COM includes: */
32#include "COMEnums.h"
33
34/* Forward declarations: */
35class QWidget;
36class UISession;
37class UIMachineLogic;
38
39/** Singleton QObject extension
40 * used as virtual machine (VM) singleton instance. */
41class UIMachine : public QObject
42{
43 Q_OBJECT;
44
45signals:
46
47 /** Requests async visual-state change. */
48 void sigRequestAsyncVisualStateChange(UIVisualStateType visualStateType);
49
50public:
51
52 /** Static factory to start machine with passed @a uID.
53 * @return true if machine was started, false otherwise. */
54 static bool startMachine(const QUuid &uID);
55 /** Static constructor. */
56 static bool create();
57 /** Static destructor. */
58 static void destroy();
59 /** Static instance. */
60 static UIMachine* instance() { return m_spInstance; }
61
62 /** Returns session UI instance. */
63 UISession *uisession() const { return m_pSession; }
64 /** Returns machine-logic instance. */
65 UIMachineLogic* machineLogic() const { return m_pMachineLogic; }
66 /** Returns active machine-window reference (if possible). */
67 QWidget* activeWindow() const;
68
69 /** Returns whether requested visual @a state allowed. */
70 bool isVisualStateAllowed(UIVisualStateType state) const { return m_allowedVisualStates & state; }
71
72 /** Requests async visual-state change. */
73 void asyncChangeVisualState(UIVisualStateType visualStateType);
74
75 /** Close Runtime UI. */
76 void closeRuntimeUI();
77
78private slots:
79
80 /** Visual state-change handler. */
81 void sltChangeVisualState(UIVisualStateType visualStateType);
82
83private:
84
85 /** Constructor. */
86 UIMachine();
87 /** Destructor. */
88 ~UIMachine();
89
90 /** Prepare routine. */
91 bool prepare();
92 /** Prepare routine: Session stuff. */
93 bool prepareSession();
94 /** Prepare routine: Machine-logic stuff. */
95 void prepareMachineLogic();
96
97 /** Cleanup routine: Machine-logic stuff. */
98 void cleanupMachineLogic();
99 /** Cleanup routine: Session stuff. */
100 void cleanupSession();
101 /** Cleanup routine. */
102 void cleanup();
103
104 /** Moves VM to initial state. */
105 void enterInitialVisualState();
106
107 /** Static instance. */
108 static UIMachine* m_spInstance;
109
110 /** Holds the session UI instance. */
111 UISession *m_pSession;
112
113 /** Holds allowed visual states. */
114 UIVisualStateType m_allowedVisualStates;
115 /** Holds initial visual state. */
116 UIVisualStateType m_initialVisualState;
117 /** Holds current visual state. */
118 UIVisualStateType m_visualState;
119 /** Holds current machine-logic. */
120 UIMachineLogic *m_pMachineLogic;
121};
122
123#define gpMachine UIMachine::instance()
124
125#endif /* !FEQT_INCLUDED_SRC_runtime_UIMachine_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use