VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.h

Last change on this file was 106061, checked in by vboxsync, 3 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1/* $Id: UIMultiScreenLayout.h 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIMultiScreenLayout class declaration.
4 */
5
6/*
7 * Copyright (C) 2010-2024 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_UIMultiScreenLayout_h
29#define FEQT_INCLUDED_SRC_runtime_UIMultiScreenLayout_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35#include <QMap>
36#include <QObject>
37
38/* Forward declarations: */
39class UIActionPool;
40class UIMachine;
41class UIMachineLogic;
42
43/** QObject subclass containing a part of
44 * machine-logic related to multi-screen layout handling.
45 * Used in such modes as Full-screen and Seamless. */
46class UIMultiScreenLayout : public QObject
47{
48 Q_OBJECT;
49
50signals:
51
52 /** Notifies about layout change. */
53 void sigScreenLayoutChange();
54
55public:
56
57 /** Constructs multi-screen layout passing @a pMachineLogic to the base-class.
58 * @param pMachineLogic Brings the parent machine-logic reference. */
59 UIMultiScreenLayout(UIMachineLogic *pMachineLogic);
60
61 /** Returns whether there is host-monitor suitable for guest-screen with @a iScreenId specified. */
62 bool hasHostScreenForGuestScreen(int iScreenId) const;
63 /** Returns a host-monitor suitable for guest-screen with @a iScreenId specified. */
64 int hostScreenForGuestScreen(int iScreenId) const;
65
66 /** Returns video memory requirements for currently cached multi-screen layout. */
67 quint64 memoryRequirements() const;
68
69 /** Updates multi-screen layout on the basis
70 * of known host/guest screen count. */
71 void update();
72 /** Updates everything.
73 * Recalculates host/guest screen count
74 * and calls for update wrapper above. */
75 void rebuild();
76
77private slots:
78
79 /** Handles screen layout change request.
80 * @param iRequestedGuestScreen Brings the index of guest-screen which needs to be mapped to certain host-monitor.
81 * @param iRequestedHostMonitor Brings the index of host-monitor which needs to be mapped to certain guest-screen.*/
82 void sltHandleScreenLayoutChange(int iRequestedGuestScreen, int iRequestedHostMonitor);
83
84private:
85
86 /** Prepares everything. */
87 void prepare();
88 /** Prepares connections. */
89 void prepareConnections();
90
91 /** Returns parent machine-logic reference. */
92 UIMachineLogic *machineLogic() const { return m_pMachineLogic; }
93 /** Returns machine UI reference. */
94 UIMachine *uimachine() const;
95 /** Returns action-pool reference. */
96 UIActionPool *actionPool() const;
97
98 /** Recalculates host-monitor count. */
99 void calculateHostMonitorCount();
100 /** Recalculates guest-screen count. */
101 void calculateGuestScreenCount();
102
103 /** Calculates memory requirements for passed @a screenLayout. */
104 quint64 memoryRequirements(const QMap<int, int> &screenLayout) const;
105
106 /** Holds the machine-logic reference. */
107 UIMachineLogic *m_pMachineLogic;
108
109 /** Holds the number of guest-screens. */
110 ulong m_cGuestScreens;
111 /** Holds the number of host-monitors. */
112 int m_cHostMonitors;
113
114 /** Holds currently cached enabled guest-screens. */
115 QList<int> m_guestScreens;
116 /** Holds currently cached disabled guest-screens. */
117 QList<int> m_disabledGuestScreens;
118
119 /** Holds the cached screens map.
120 * The keys used for guest-screens.
121 * The values used for host-monitors. */
122 QMap<int, int> m_screenMap;
123};
124
125#endif /* !FEQT_INCLUDED_SRC_runtime_UIMultiScreenLayout_h */
126
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