VirtualBox

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

Last change on this file since 100347 was 98103, checked in by vboxsync, 22 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: 6.2 KB
Line 
1/* $Id: UIStatusBarEditorWindow.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIStatusBarEditorWindow 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_UIStatusBarEditorWindow_h
29#define FEQT_INCLUDED_SRC_widgets_UIStatusBarEditorWindow_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35#include <QList>
36#include <QMap>
37#include <QUuid>
38
39/* GUI includes: */
40#include "QIWithRetranslateUI.h"
41#include "UIExtraDataDefs.h"
42#include "UILibraryDefs.h"
43#include "UISlidingToolBar.h"
44
45/* Forward declarations: */
46class QCheckBox;
47class QDragEnterEvent;
48class QDragLeaveEvent;
49class QDragMoveEvent;
50class QDropEvent;
51class QHBoxLayout;
52class QPaintEvent;
53class QString;
54class QWidget;
55class QIToolButton;
56class UIMachineWindow;
57class UIStatusBarEditorButton;
58
59
60/** UISlidingToolBar subclass
61 * providing user with possibility to edit status-bar layout. */
62class SHARED_LIBRARY_STUFF UIStatusBarEditorWindow : public UISlidingToolBar
63{
64 Q_OBJECT;
65
66public:
67
68 /** Constructs sliding toolbar passing @a pParent to the base-class. */
69 UIStatusBarEditorWindow(UIMachineWindow *pParent);
70};
71
72
73/** QWidget subclass
74 * used as status-bar editor widget. */
75class SHARED_LIBRARY_STUFF UIStatusBarEditorWidget : public QIWithRetranslateUI2<QWidget>
76{
77 Q_OBJECT;
78
79signals:
80
81 /** Notifies about Cancel button click. */
82 void sigCancelClicked();
83
84public:
85
86 /** Constructs status-bar editor widget passing @a pParent to the base-class.
87 * @param fStartedFromVMSettings Brings whether 'this' is a part of VM settings.
88 * @param uMachineID Brings the machine ID to be used by the editor. */
89 UIStatusBarEditorWidget(QWidget *pParent,
90 bool fStartedFromVMSettings = true,
91 const QUuid &uMachineID = QUuid());
92
93 /** Returns the machine ID instance. */
94 const QUuid &machineID() const { return m_uMachineID; }
95 /** Defines the @a uMachineID instance. */
96 void setMachineID(const QUuid &uMachineID);
97
98 /** Returns whether the status-bar enabled. */
99 bool isStatusBarEnabled() const;
100 /** Defines whether the status-bar @a fEnabled. */
101 void setStatusBarEnabled(bool fEnabled);
102
103 /** Returns status-bar indicator restrictions. */
104 const QList<IndicatorType> &statusBarIndicatorRestrictions() const { return m_restrictions; }
105 /** Returns status-bar indicator order. */
106 const QList<IndicatorType> &statusBarIndicatorOrder() const { return m_order; }
107 /** Defines status-bar indicator @a restrictions and @a order. */
108 void setStatusBarConfiguration(const QList<IndicatorType> &restrictions, const QList<IndicatorType> &order);
109
110protected:
111
112 /** Handles translation event. */
113 virtual void retranslateUi() RT_OVERRIDE;
114
115 /** Handles paint @a pEvent. */
116 virtual void paintEvent(QPaintEvent *pEvent) RT_OVERRIDE;
117
118 /** Handles drag-enter @a pEvent. */
119 virtual void dragEnterEvent(QDragEnterEvent *pEvent) RT_OVERRIDE;
120 /** Handles drag-move @a pEvent. */
121 virtual void dragMoveEvent(QDragMoveEvent *pEvent) RT_OVERRIDE;
122 /** Handles drag-leave @a pEvent. */
123 virtual void dragLeaveEvent(QDragLeaveEvent *pEvent) RT_OVERRIDE;
124 /** Handles drop @a pEvent. */
125 virtual void dropEvent(QDropEvent *pEvent) RT_OVERRIDE;
126
127private slots:
128
129 /** Handles configuration change. */
130 void sltHandleConfigurationChange(const QUuid &uMachineID);
131
132 /** Handles button click. */
133 void sltHandleButtonClick();
134
135 /** Handles drag object destroy. */
136 void sltHandleDragObjectDestroy();
137
138private:
139
140 /** Prepares all. */
141 void prepare();
142 /** Prepares status-buttons. */
143 void prepareStatusButtons();
144 /** Prepares status-button of certain @a enmType. */
145 void prepareStatusButton(IndicatorType enmType);
146
147 /** Returns position for passed @a enmType. */
148 int position(IndicatorType enmType) const;
149
150 /** @name General
151 * @{ */
152 /** Holds whether 'this' is prepared. */
153 bool m_fPrepared;
154 /** Holds whether 'this' is a part of VM settings. */
155 bool m_fStartedFromVMSettings;
156 /** Holds the machine ID instance. */
157 QUuid m_uMachineID;
158 /** @} */
159
160 /** @name Contents
161 * @{ */
162 /** Holds the main-layout instance. */
163 QHBoxLayout *m_pMainLayout;
164 /** Holds the button-layout instance. */
165 QHBoxLayout *m_pButtonLayout;
166 /** Holds the close-button instance. */
167 QIToolButton *m_pButtonClose;
168 /** Holds the enable-checkbox instance. */
169 QCheckBox *m_pCheckBoxEnable;
170 /** Holds status-bar buttons. */
171 QMap<IndicatorType, UIStatusBarEditorButton*> m_buttons;
172 /** @} */
173
174 /** @name Contents: Restrictions
175 * @{ */
176 /** Holds the cached status-bar button restrictions. */
177 QList<IndicatorType> m_restrictions;
178 /** @} */
179
180 /** @name Contents: Order
181 * @{ */
182 /** Holds the cached status-bar button order. */
183 QList<IndicatorType> m_order;
184 /** Holds the token-button to drop dragged-button nearby. */
185 UIStatusBarEditorButton *m_pButtonDropToken;
186 /** Holds whether dragged-button should be dropped <b>after</b> the token-button. */
187 bool m_fDropAfterTokenButton;
188 /** @} */
189};
190
191
192#endif /* !FEQT_INCLUDED_SRC_widgets_UIStatusBarEditorWindow_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