VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.h@ 103977

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

Apply RT_OVERRIDE/NS_OVERRIDE where required to shut up clang.

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

© 2023 Oracle
ContactPrivacy policyTerms of Use