1 | /* $Id: UIVideoMemoryEditor.h 80394 2019-08-23 13:02:30Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIVideoMemoryEditor class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 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 FEQT_INCLUDED_SRC_widgets_UIVideoMemoryEditor_h
|
---|
19 | #define FEQT_INCLUDED_SRC_widgets_UIVideoMemoryEditor_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /* Qt includes: */
|
---|
25 | #include <QWidget>
|
---|
26 |
|
---|
27 | /* GUI includes: */
|
---|
28 | #include "QIWithRetranslateUI.h"
|
---|
29 | #include "UILibraryDefs.h"
|
---|
30 |
|
---|
31 | /* COM includes: */
|
---|
32 | #include "COMEnums.h"
|
---|
33 | #include "CGuestOSType.h"
|
---|
34 |
|
---|
35 | /* Forward declarations: */
|
---|
36 | class QLabel;
|
---|
37 | class QSpinBox;
|
---|
38 | class QIAdvancedSlider;
|
---|
39 |
|
---|
40 | /** QWidget subclass used as a video memory editor. */
|
---|
41 | class SHARED_LIBRARY_STUFF UIVideoMemoryEditor : public QIWithRetranslateUI<QWidget>
|
---|
42 | {
|
---|
43 | Q_OBJECT;
|
---|
44 |
|
---|
45 | signals:
|
---|
46 |
|
---|
47 | /** Notifies listeners about value has became @a fValid. */
|
---|
48 | void sigValidChanged(bool fValid);
|
---|
49 |
|
---|
50 | public:
|
---|
51 |
|
---|
52 | /** Constructs video-memory editor passing @a pParent to the base-class.
|
---|
53 | * @param fWithLabel Brings whether we should add label ourselves. */
|
---|
54 | UIVideoMemoryEditor(QWidget *pParent = 0, bool fWithLabel = false);
|
---|
55 |
|
---|
56 | /** Defines editor @a iValue. */
|
---|
57 | void setValue(int iValue);
|
---|
58 | /** Returns editor value. */
|
---|
59 | int value() const;
|
---|
60 |
|
---|
61 | /** Defines @a comGuestOSType. */
|
---|
62 | void setGuestOSType(const CGuestOSType &comGuestOSType);
|
---|
63 |
|
---|
64 | /** Defines @a cGuestScreenCount. */
|
---|
65 | void setGuestScreenCount(int cGuestScreenCount);
|
---|
66 |
|
---|
67 | /** Defines @a enmGraphicsControllerType. */
|
---|
68 | void setGraphicsControllerType(const KGraphicsControllerType &enmGraphicsControllerType);
|
---|
69 |
|
---|
70 | #ifdef VBOX_WITH_3D_ACCELERATION
|
---|
71 | /** Defines whether 3D acceleration is @a fSupported. */
|
---|
72 | void set3DAccelerationSupported(bool fSupported);
|
---|
73 | /** Defines whether 3D acceleration is @a fEnabled. */
|
---|
74 | void set3DAccelerationEnabled(bool fEnabled);
|
---|
75 | #endif
|
---|
76 |
|
---|
77 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
78 | /** Defines whether 2D video acceleration is @a fSupported. */
|
---|
79 | void set2DVideoAccelerationSupported(bool fSupported);
|
---|
80 | /** Defines whether 2D video acceleration is @a fEnabled. */
|
---|
81 | void set2DVideoAccelerationEnabled(bool fEnabled);
|
---|
82 | #endif
|
---|
83 |
|
---|
84 | protected:
|
---|
85 |
|
---|
86 | /** Handles translation event. */
|
---|
87 | virtual void retranslateUi() /* override */;
|
---|
88 |
|
---|
89 | private slots:
|
---|
90 |
|
---|
91 | /** Handles slider value changes. */
|
---|
92 | void sltHandleSliderChange();
|
---|
93 | /** Handles spin-box value changes. */
|
---|
94 | void sltHandleSpinBoxChange();
|
---|
95 |
|
---|
96 | private:
|
---|
97 |
|
---|
98 | /** Prepares all. */
|
---|
99 | void prepare();
|
---|
100 |
|
---|
101 | /** Update requirements. */
|
---|
102 | void updateRequirements();
|
---|
103 |
|
---|
104 | /** Revalidates and emits validity change signal. */
|
---|
105 | void revalidate();
|
---|
106 |
|
---|
107 | /** Calculates the reasonably sane slider page step. */
|
---|
108 | static int calculatePageStep(int iMax);
|
---|
109 |
|
---|
110 | /** Holds whether descriptive label should be created. */
|
---|
111 | bool m_fWithLabel;
|
---|
112 |
|
---|
113 | /** Holds the guest OS type ID. */
|
---|
114 | CGuestOSType m_comGuestOSType;
|
---|
115 | /** Holds the guest screen count. */
|
---|
116 | int m_cGuestScreenCount;
|
---|
117 | /** Holds the graphics controller type. */
|
---|
118 | KGraphicsControllerType m_enmGraphicsControllerType;
|
---|
119 | #ifdef VBOX_WITH_3D_ACCELERATION
|
---|
120 | /** Holds whether 3D acceleration is supported. */
|
---|
121 | bool m_f3DAccelerationSupported;
|
---|
122 | /** Holds whether 3D acceleration is enabled. */
|
---|
123 | bool m_f3DAccelerationEnabled;
|
---|
124 | #endif
|
---|
125 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
126 | /** Holds whether 2D video acceleration is supported. */
|
---|
127 | bool m_f2DVideoAccelerationSupported;
|
---|
128 | /** Holds whether 2D video acceleration is enabled. */
|
---|
129 | bool m_f2DVideoAccelerationEnabled;
|
---|
130 | #endif
|
---|
131 |
|
---|
132 | /** Holds the minimum lower limit of VRAM (MiB). */
|
---|
133 | int m_iMinVRAM;
|
---|
134 | /** Holds the maximum upper limit of VRAM (MiB). */
|
---|
135 | int m_iMaxVRAM;
|
---|
136 | /** Holds the upper limit of VRAM (MiB) for this dialog.
|
---|
137 | * @note This value is lower than m_iMaxVRAM to save
|
---|
138 | * careless users from setting useless big values. */
|
---|
139 | int m_iMaxVRAMVisible;
|
---|
140 | /** Holds the initial VRAM value when the dialog is opened. */
|
---|
141 | int m_iInitialVRAM;
|
---|
142 |
|
---|
143 | /** Holds the memory label instance. */
|
---|
144 | QLabel *m_pLabelMemory;
|
---|
145 | /** Holds the memory slider instance. */
|
---|
146 | QIAdvancedSlider *m_pSlider;
|
---|
147 | /** Holds minimum memory label instance. */
|
---|
148 | QLabel *m_pLabelMemoryMin;
|
---|
149 | /** Holds maximum memory label instance. */
|
---|
150 | QLabel *m_pLabelMemoryMax;
|
---|
151 | /** Holds the memory spin-box instance. */
|
---|
152 | QSpinBox *m_pSpinBox;
|
---|
153 | };
|
---|
154 |
|
---|
155 | #endif /* !FEQT_INCLUDED_SRC_widgets_UIVideoMemoryEditor_h */
|
---|