1 | /* $Id: UIVMCloseDialog.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIVMCloseDialog class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-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_UIVMCloseDialog_h
|
---|
29 | #define FEQT_INCLUDED_SRC_runtime_UIVMCloseDialog_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | #include <QIcon>
|
---|
36 |
|
---|
37 | /* GUI includes: */
|
---|
38 | #include "QIDialog.h"
|
---|
39 | #include "UIExtraDataDefs.h"
|
---|
40 |
|
---|
41 | /* Forward declarations: */
|
---|
42 | class QCheckBox;
|
---|
43 | class QGridLayout;
|
---|
44 | class QHBoxLayout;
|
---|
45 | class QLabel;
|
---|
46 | class QRadioButton;
|
---|
47 | class QVBoxLayout;
|
---|
48 | class UIMachine;
|
---|
49 |
|
---|
50 | /** QIDialog extension to handle Runtime UI close-event. */
|
---|
51 | class UIVMCloseDialog : public QIDialog
|
---|
52 | {
|
---|
53 | Q_OBJECT;
|
---|
54 |
|
---|
55 | public:
|
---|
56 |
|
---|
57 | /** Constructs close dialog passing @a pParent to the base-class.
|
---|
58 | * @param pMachine Brings the machine UI dialog created for.
|
---|
59 | * @param fIsACPIEnabled Brings whether ACPI is enabled.
|
---|
60 | * @param restictedCloseActions Brings a set of restricted actions. */
|
---|
61 | UIVMCloseDialog(QWidget *pParent, UIMachine *pMachine,
|
---|
62 | bool fIsACPIEnabled, MachineCloseAction restictedCloseActions);
|
---|
63 |
|
---|
64 | /** Returns whether dialog is valid. */
|
---|
65 | bool isValid() const { return m_fValid; }
|
---|
66 |
|
---|
67 | /** Defines dialog @a icon. */
|
---|
68 | void setIcon(const QIcon &icon);
|
---|
69 |
|
---|
70 | protected:
|
---|
71 |
|
---|
72 | /** Preprocesses any Qt @a pEvent for passed @a pObject. */
|
---|
73 | virtual bool eventFilter(QObject *pObject, QEvent *pEvent) RT_OVERRIDE;
|
---|
74 |
|
---|
75 | /** Handles any Qt @a pEvent. */
|
---|
76 | virtual bool event(QEvent *pEvent) RT_OVERRIDE;
|
---|
77 |
|
---|
78 | /** Handles show @a pEvent. */
|
---|
79 | virtual void showEvent(QShowEvent *pEvent) RT_OVERRIDE;
|
---|
80 |
|
---|
81 | private slots:
|
---|
82 |
|
---|
83 | /** Handles translation event. */
|
---|
84 | void sltRetranslateUI();
|
---|
85 |
|
---|
86 | /** Updates widgets availability. */
|
---|
87 | void sltUpdateWidgetAvailability();
|
---|
88 |
|
---|
89 | /** Accepts the dialog. */
|
---|
90 | void accept() RT_OVERRIDE;
|
---|
91 |
|
---|
92 | private:
|
---|
93 |
|
---|
94 | /** Defines whether 'Detach' button is enabled. */
|
---|
95 | void setButtonEnabledDetach(bool fEnabled);
|
---|
96 | /** Defines whether 'Detach' button is visible. */
|
---|
97 | void setButtonVisibleDetach(bool fVisible);
|
---|
98 |
|
---|
99 | /** Defines whether 'Save' button is enabled. */
|
---|
100 | void setButtonEnabledSave(bool fEnabled);
|
---|
101 | /** Defines whether 'Save' button is visible. */
|
---|
102 | void setButtonVisibleSave(bool fVisible);
|
---|
103 |
|
---|
104 | /** Defines whether 'Shutdown' button is enabled. */
|
---|
105 | void setButtonEnabledShutdown(bool fEnabled);
|
---|
106 | /** Defines whether 'Shutdown' button is visible. */
|
---|
107 | void setButtonVisibleShutdown(bool fVisible);
|
---|
108 |
|
---|
109 | /** Defines whether 'PowerOff' button is enabled. */
|
---|
110 | void setButtonEnabledPowerOff(bool fEnabled);
|
---|
111 | /** Defines whether 'PowerOff' button is visible. */
|
---|
112 | void setButtonVisiblePowerOff(bool fVisible);
|
---|
113 |
|
---|
114 | /** Defines whether 'Discard' check-box is visible. */
|
---|
115 | void setCheckBoxVisibleDiscard(bool fVisible);
|
---|
116 |
|
---|
117 | /** Prepares all. */
|
---|
118 | void prepare();
|
---|
119 | /** Prepares main layout. */
|
---|
120 | void prepareMainLayout();
|
---|
121 | /** Prepares top layout. */
|
---|
122 | void prepareTopLayout();
|
---|
123 | /** Prepares top-left layout. */
|
---|
124 | void prepareTopLeftLayout();
|
---|
125 | /** Prepares top-right layout. */
|
---|
126 | void prepareTopRightLayout();
|
---|
127 | /** Prepares choice layout. */
|
---|
128 | void prepareChoiceLayout();
|
---|
129 | /** Prepares button-box. */
|
---|
130 | void prepareButtonBox();
|
---|
131 |
|
---|
132 | /** Configures dialog. */
|
---|
133 | void configure();
|
---|
134 |
|
---|
135 | /** Updates pixmaps. */
|
---|
136 | void updatePixmaps();
|
---|
137 |
|
---|
138 | /** Holds the machine UI reference. */
|
---|
139 | UIMachine *m_pMachine;
|
---|
140 | /** Holds whether ACPI is enabled. */
|
---|
141 | bool m_fIsACPIEnabled;
|
---|
142 | /** Holds a set of restricted actions. */
|
---|
143 | const MachineCloseAction m_restictedCloseActions;
|
---|
144 |
|
---|
145 | /** Holds whether dialog is valid. */
|
---|
146 | bool m_fValid;
|
---|
147 |
|
---|
148 | /** Holds the dialog icon. */
|
---|
149 | QIcon m_icon;
|
---|
150 |
|
---|
151 | /** Holds the main layout instance. */
|
---|
152 | QVBoxLayout *m_pMainLayout;
|
---|
153 | /** Holds the top layout instance. */
|
---|
154 | QHBoxLayout *m_pTopLayout;
|
---|
155 | /** Holds the top-left layout instance. */
|
---|
156 | QVBoxLayout *m_pTopLeftLayout;
|
---|
157 | /** Holds the top-right layout instance. */
|
---|
158 | QVBoxLayout *m_pTopRightLayout;
|
---|
159 | /** Holds the choice layout instance. */
|
---|
160 | QGridLayout *m_pChoiceLayout;
|
---|
161 |
|
---|
162 | /** Holds the icon label instance. */
|
---|
163 | QLabel *m_pLabelIcon;
|
---|
164 | /** Holds the text label instance. */
|
---|
165 | QLabel *m_pLabelText;
|
---|
166 |
|
---|
167 | /** Holds the 'Detach' icon label instance. */
|
---|
168 | QLabel *m_pLabelIconDetach;
|
---|
169 | /** Holds the 'Detach' radio-button instance. */
|
---|
170 | QRadioButton *m_pRadioButtonDetach;
|
---|
171 | /** Holds the 'Save' icon label instance. */
|
---|
172 | QLabel *m_pLabelIconSave;
|
---|
173 | /** Holds the 'Save' radio-button instance. */
|
---|
174 | QRadioButton *m_pRadioButtonSave;
|
---|
175 | /** Holds the 'Shutdown' icon label instance. */
|
---|
176 | QLabel *m_pLabelIconShutdown;
|
---|
177 | /** Holds the 'Shutdown' radio-button instance. */
|
---|
178 | QRadioButton *m_pRadioButtonShutdown;
|
---|
179 | /** Holds the 'PowerOff' icon label instance. */
|
---|
180 | QLabel *m_pLabelIconPowerOff;
|
---|
181 | /** Holds the 'PowerOff' radio-button instance. */
|
---|
182 | QRadioButton *m_pRadioButtonPowerOff;
|
---|
183 |
|
---|
184 | /** Holds the 'Discard' check-box instance. */
|
---|
185 | QCheckBox *m_pCheckBoxDiscard;
|
---|
186 | /** Holds the 'Discard' check-box text. */
|
---|
187 | QString m_strDiscardCheckBoxText;
|
---|
188 |
|
---|
189 | /** Holds the last close action. */
|
---|
190 | MachineCloseAction m_enmLastCloseAction;
|
---|
191 | };
|
---|
192 |
|
---|
193 | #endif /* !FEQT_INCLUDED_SRC_runtime_UIVMCloseDialog_h */
|
---|