VirtualBox

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

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

scm --update-copyright-year

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

© 2023 Oracle
ContactPrivacy policyTerms of Use