1 | /* $Id: UIMachineLogicSeamless.h 98375 2023-02-01 12:15:57Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIMachineLogicSeamless class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef FEQT_INCLUDED_SRC_runtime_seamless_UIMachineLogicSeamless_h
|
---|
29 | #define FEQT_INCLUDED_SRC_runtime_seamless_UIMachineLogicSeamless_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* GUI includes: */
|
---|
35 | #include "UIMachineLogic.h"
|
---|
36 |
|
---|
37 | /* Forward declarations: */
|
---|
38 | class UIMultiScreenLayout;
|
---|
39 |
|
---|
40 | /** UIMachineLogic subclass used as seamless machine logic implementation. */
|
---|
41 | class UIMachineLogicSeamless : public UIMachineLogic
|
---|
42 | {
|
---|
43 | Q_OBJECT;
|
---|
44 |
|
---|
45 | public:
|
---|
46 |
|
---|
47 | /** Constructs a logic passing @a pMachine and @a pSession to the base-class.
|
---|
48 | * @param pMachine Brings the machine this logic belongs to.
|
---|
49 | * @param pSession Brings the session this logic is created for. */
|
---|
50 | UIMachineLogicSeamless(UIMachine *pMachine, UISession *pSession);
|
---|
51 | /** Destructs the logic. */
|
---|
52 | virtual ~UIMachineLogicSeamless() RT_OVERRIDE;
|
---|
53 |
|
---|
54 | /** Returns visual state type. */
|
---|
55 | virtual UIVisualStateType visualStateType() const { return UIVisualStateType_Seamless; }
|
---|
56 |
|
---|
57 | /** Returns an index of host-screen for guest-screen with @a iScreenId specified. */
|
---|
58 | int hostScreenForGuestScreen(int iScreenId) const;
|
---|
59 | /** Returns whether there is a host-screen for guest-screen with @a iScreenId specified. */
|
---|
60 | bool hasHostScreenForGuestScreen(int iScreenId) const;
|
---|
61 |
|
---|
62 | protected:
|
---|
63 |
|
---|
64 | /* Check if this logic is available: */
|
---|
65 | bool checkAvailability();
|
---|
66 |
|
---|
67 | /** Returns machine-window flags for 'Seamless' machine-logic and passed @a uScreenId. */
|
---|
68 | virtual Qt::WindowFlags windowFlags(ulong uScreenId) const { Q_UNUSED(uScreenId); return Qt::FramelessWindowHint; }
|
---|
69 |
|
---|
70 | /** Adjusts machine-window geometry if necessary for 'Seamless'. */
|
---|
71 | virtual void adjustMachineWindowsGeometry();
|
---|
72 |
|
---|
73 | private slots:
|
---|
74 |
|
---|
75 | /** Checks if some visual-state type was requested. */
|
---|
76 | void sltCheckForRequestedVisualStateType();
|
---|
77 |
|
---|
78 | /* Handler: Console callback stuff: */
|
---|
79 | void sltMachineStateChanged();
|
---|
80 |
|
---|
81 | /** Updates machine-window(s) location/size on screen-layout changes. */
|
---|
82 | void sltScreenLayoutChanged();
|
---|
83 |
|
---|
84 | /** Handles guest-screen count change. */
|
---|
85 | virtual void sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
|
---|
86 | /** Handles host-screen count change. */
|
---|
87 | virtual void sltHostScreenCountChange();
|
---|
88 | /** Handles additions-state change. */
|
---|
89 | virtual void sltAdditionsStateChanged();
|
---|
90 |
|
---|
91 | #ifndef RT_OS_DARWIN
|
---|
92 | /** Invokes popup-menu. */
|
---|
93 | void sltInvokePopupMenu();
|
---|
94 | #endif /* !RT_OS_DARWIN */
|
---|
95 |
|
---|
96 | private:
|
---|
97 |
|
---|
98 | /* Prepare helpers: */
|
---|
99 | void prepareActionGroups();
|
---|
100 | void prepareActionConnections();
|
---|
101 | void prepareMachineWindows();
|
---|
102 | #ifndef VBOX_WS_MAC
|
---|
103 | void prepareMenu();
|
---|
104 | #endif /* !VBOX_WS_MAC */
|
---|
105 |
|
---|
106 | /* Cleanup helpers: */
|
---|
107 | #ifndef VBOX_WS_MAC
|
---|
108 | void cleanupMenu();
|
---|
109 | #endif /* !VBOX_WS_MAC */
|
---|
110 | void cleanupMachineWindows();
|
---|
111 | void cleanupActionConnections();
|
---|
112 | void cleanupActionGroups();
|
---|
113 |
|
---|
114 | /* Variables: */
|
---|
115 | UIMultiScreenLayout *m_pScreenLayout;
|
---|
116 |
|
---|
117 | #ifndef RT_OS_DARWIN
|
---|
118 | /** Holds the popup-menu instance. */
|
---|
119 | QMenu *m_pPopupMenu;
|
---|
120 | #endif /* !RT_OS_DARWIN */
|
---|
121 | };
|
---|
122 |
|
---|
123 | #endif /* !FEQT_INCLUDED_SRC_runtime_seamless_UIMachineLogicSeamless_h */
|
---|