VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMenuBarEditorWindow.h@ 100347

Last change on this file since 100347 was 98103, checked in by vboxsync, 23 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: 10.7 KB
Line 
1/* $Id: UIMenuBarEditorWindow.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIMenuBarEditorWindow class declaration.
4 */
5
6/*
7 * Copyright (C) 2014-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_widgets_UIMenuBarEditorWindow_h
29#define FEQT_INCLUDED_SRC_widgets_UIMenuBarEditorWindow_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35#include <QMap>
36#include <QUuid>
37
38/* GUI includes: */
39#include "QIWithRetranslateUI.h"
40#include "UIExtraDataDefs.h"
41#include "UILibraryDefs.h"
42#include "UISlidingToolBar.h"
43
44/* Forward declarations: */
45class QAction;
46class QHBoxLayout;
47class QMenu;
48#ifndef VBOX_WS_MAC
49class QCheckBox;
50#endif
51class QString;
52class QWidget;
53class QIToolButton;
54class UIAction;
55class UIActionPool;
56class QIToolBar;
57class UIMachineWindow;
58
59
60/** UISlidingToolBar subclass
61 * providing user with possibility to edit menu-bar layout. */
62class SHARED_LIBRARY_STUFF UIMenuBarEditorWindow : public UISlidingToolBar
63{
64 Q_OBJECT;
65
66public:
67
68 /** Constructs sliding toolbar passing @a pParent to the base-class.
69 * @param pActionPool Brings the action-pool reference for internal use. */
70 UIMenuBarEditorWindow(UIMachineWindow *pParent, UIActionPool *pActionPool);
71};
72
73
74/** QWidget subclass
75 * used as menu-bar editor widget. */
76class SHARED_LIBRARY_STUFF UIMenuBarEditorWidget : public QIWithRetranslateUI2<QWidget>
77{
78 Q_OBJECT;
79
80signals:
81
82 /** Notifies about Cancel button click. */
83 void sigCancelClicked();
84
85public:
86
87 /** Constructs menu-bar editor widget passing @a pParent to the base-class.
88 * @param fStartedFromVMSettings Brings whether 'this' is a part of VM settings.
89 * @param uMachineID Brings the machine ID to be used by the editor.
90 * @param pActionPool Brings the action-pool to be used by the editor. */
91 UIMenuBarEditorWidget(QWidget *pParent,
92 bool fStartedFromVMSettings = true,
93 const QUuid &uMachineID = QUuid(),
94 UIActionPool *pActionPool = 0);
95
96 /** Returns the machine ID instance. */
97 const QUuid &machineID() const { return m_uMachineID; }
98 /** Defines the @a uMachineID instance. */
99 void setMachineID(const QUuid &uMachineID);
100
101 /** Returns the action-pool reference. */
102 const UIActionPool *actionPool() const { return m_pActionPool; }
103 /** Defines the @a pActionPool reference. */
104 void setActionPool(UIActionPool *pActionPool);
105
106#ifndef VBOX_WS_MAC
107 /** Returns whether the menu-bar enabled. */
108 bool isMenuBarEnabled() const;
109 /** Defines whether the menu-bar @a fEnabled. */
110 void setMenuBarEnabled(bool fEnabled);
111#endif
112
113 /** Returns the cached restrictions of menu-bar. */
114 UIExtraDataMetaDefs::MenuType restrictionsOfMenuBar() const { return m_restrictionsOfMenuBar; }
115 /** Returns the cached restrictions of menu 'Application'. */
116 UIExtraDataMetaDefs::MenuApplicationActionType restrictionsOfMenuApplication() const { return m_restrictionsOfMenuApplication; }
117 /** Returns the cached restrictions of menu 'Machine'. */
118 UIExtraDataMetaDefs::RuntimeMenuMachineActionType restrictionsOfMenuMachine() const { return m_restrictionsOfMenuMachine; }
119 /** Returns the cached restrictions of menu 'View'. */
120 UIExtraDataMetaDefs::RuntimeMenuViewActionType restrictionsOfMenuView() const { return m_restrictionsOfMenuView; }
121 /** Returns the cached restrictions of menu 'Input'. */
122 UIExtraDataMetaDefs::RuntimeMenuInputActionType restrictionsOfMenuInput() const { return m_restrictionsOfMenuInput; }
123 /** Returns the cached restrictions of menu 'Devices'. */
124 UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restrictionsOfMenuDevices() const { return m_restrictionsOfMenuDevices; }
125#ifdef VBOX_WITH_DEBUGGER_GUI
126 /** Returns the cached restrictions of menu 'Debug'. */
127 UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType restrictionsOfMenuDebug() const { return m_restrictionsOfMenuDebug; }
128#endif
129#ifdef VBOX_WS_MAC
130 /** Returns the cached restrictions of menu 'Window'. */
131 UIExtraDataMetaDefs::MenuWindowActionType restrictionsOfMenuWindow() const { return m_restrictionsOfMenuWindow; }
132#endif
133 /** Returns the cached restrictions of menu 'Help'. */
134 UIExtraDataMetaDefs::MenuHelpActionType restrictionsOfMenuHelp() const { return m_restrictionsOfMenuHelp; }
135
136 /** Defines the cached @a restrictions of menu-bar. */
137 void setRestrictionsOfMenuBar(UIExtraDataMetaDefs::MenuType restrictions);
138 /** Defines the cached @a restrictions of menu 'Application'. */
139 void setRestrictionsOfMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType restrictions);
140 /** Defines the cached @a restrictions of menu 'Machine'. */
141 void setRestrictionsOfMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType restrictions);
142 /** Defines the cached @a restrictions of menu 'View'. */
143 void setRestrictionsOfMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType restrictions);
144 /** Defines the cached @a restrictions of menu 'Input'. */
145 void setRestrictionsOfMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType restrictions);
146 /** Defines the cached @a restrictions of menu 'Devices'. */
147 void setRestrictionsOfMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restrictions);
148#ifdef VBOX_WITH_DEBUGGER_GUI
149 /** Defines the cached @a restrictions of menu 'Debug'. */
150 void setRestrictionsOfMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType restrictions);
151#endif
152#ifdef VBOX_WS_MAC
153 /** Defines the cached @a restrictions of menu 'Window'. */
154 void setRestrictionsOfMenuWindow(UIExtraDataMetaDefs::MenuWindowActionType restrictions);
155#endif
156 /** Defines the cached @a restrictions of menu 'Help'. */
157 void setRestrictionsOfMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType restrictions);
158
159protected:
160
161 /** Handles translation event. */
162 virtual void retranslateUi() RT_OVERRIDE;
163
164 /** Handles paint @a pEvent. */
165 virtual void paintEvent(QPaintEvent *pEvent) RT_OVERRIDE;
166
167private slots:
168
169 /** Handles configuration change. */
170 void sltHandleConfigurationChange(const QUuid &uMachineID);
171
172 /** Handles menu-bar menu click. */
173 void sltHandleMenuBarMenuClick();
174
175private:
176
177 /** Prepare routine. */
178 void prepare();
179
180#ifdef VBOX_WS_MAC
181 /** Prepare named menu routine. */
182 QMenu *prepareNamedMenu(const QString &strName);
183#endif
184 /** Prepare copied menu routine. */
185 QMenu *prepareCopiedMenu(const UIAction *pAction);
186#if 0
187 /** Prepare copied sub-menu routine. */
188 QMenu *prepareCopiedSubMenu(QMenu *pMenu, const UIAction *pAction);
189#endif
190 /** Prepare named action routine. */
191 QAction *prepareNamedAction(QMenu *pMenu, const QString &strName,
192 int iExtraDataID, const QString &strExtraDataID);
193 /** Prepare copied action routine. */
194 QAction *prepareCopiedAction(QMenu *pMenu, const UIAction *pAction);
195
196 /** Prepare menus routine. */
197 void prepareMenus();
198 /** Prepare 'Application' menu routine. */
199 void prepareMenuApplication();
200 /** Prepare 'Machine' menu routine. */
201 void prepareMenuMachine();
202 /** Prepare 'View' menu routine. */
203 void prepareMenuView();
204 /** Prepare 'Input' menu routine. */
205 void prepareMenuInput();
206 /** Prepare 'Devices' menu routine. */
207 void prepareMenuDevices();
208#ifdef VBOX_WITH_DEBUGGER_GUI
209 /** Prepare 'Debug' menu routine. */
210 void prepareMenuDebug();
211#endif
212#ifdef VBOX_WS_MAC
213 /** Prepare 'Window' menu routine. */
214 void prepareMenuWindow();
215#endif
216 /** Prepare 'Help' menu routine. */
217 void prepareMenuHelp();
218
219 /** @name General
220 * @{ */
221 /** Holds whether 'this' is prepared. */
222 bool m_fPrepared;
223 /** Holds whether 'this' is a part of VM settings. */
224 bool m_fStartedFromVMSettings;
225 /** Holds the machine ID instance. */
226 QUuid m_uMachineID;
227 /** Holds the action-pool reference. */
228 const UIActionPool *m_pActionPool;
229 /** @} */
230
231 /** @name Contents
232 * @{ */
233 /** Holds the main-layout instance. */
234 QHBoxLayout *m_pMainLayout;
235 /** Holds the tool-bar instance. */
236 QIToolBar *m_pToolBar;
237 /** Holds the close-button instance. */
238 QIToolButton *m_pButtonClose;
239#ifndef VBOX_WS_MAC
240 /** Holds the enable-checkbox instance. */
241 QCheckBox *m_pCheckBoxEnable;
242#endif
243 /** Holds tool-bar action references. */
244 QMap<QString, QAction*> m_actions;
245 /** @} */
246
247 /** @name Contents: Restrictions
248 * @{ */
249 /** Holds the cached restrictions of menu-bar. */
250 UIExtraDataMetaDefs::MenuType m_restrictionsOfMenuBar;
251 /** Holds the cached restrictions of menu 'Application'. */
252 UIExtraDataMetaDefs::MenuApplicationActionType m_restrictionsOfMenuApplication;
253 /** Holds the cached restrictions of menu 'Machine'. */
254 UIExtraDataMetaDefs::RuntimeMenuMachineActionType m_restrictionsOfMenuMachine;
255 /** Holds the cached restrictions of menu 'View'. */
256 UIExtraDataMetaDefs::RuntimeMenuViewActionType m_restrictionsOfMenuView;
257 /** Holds the cached restrictions of menu 'Input'. */
258 UIExtraDataMetaDefs::RuntimeMenuInputActionType m_restrictionsOfMenuInput;
259 /** Holds the cached restrictions of menu 'Devices'. */
260 UIExtraDataMetaDefs::RuntimeMenuDevicesActionType m_restrictionsOfMenuDevices;
261#ifdef VBOX_WITH_DEBUGGER_GUI
262 /** Holds the cached restrictions of menu 'Debug'. */
263 UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType m_restrictionsOfMenuDebug;
264#endif
265#ifdef VBOX_WS_MAC
266 /** Holds the cached restrictions of menu 'Window'. */
267 UIExtraDataMetaDefs::MenuWindowActionType m_restrictionsOfMenuWindow;
268#endif
269 /** Holds the cached restrictions of menu 'Help'. */
270 UIExtraDataMetaDefs::MenuHelpActionType m_restrictionsOfMenuHelp;
271 /** @} */
272};
273
274
275#endif /* !FEQT_INCLUDED_SRC_widgets_UIMenuBarEditorWindow_h */
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