Changeset 94341 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Mar 23, 2022 7:06:51 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.cpp
r94148 r94341 996 996 { 997 997 /* Prepare editor: */ 998 UIVideoMemoryEditor *pEditor = new UIVideoMemoryEditor(pPopup , true /* with label */);998 UIVideoMemoryEditor *pEditor = new UIVideoMemoryEditor(pPopup); 999 999 if (pEditor) 1000 1000 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIVideoMemoryEditor.cpp
r93115 r94341 32 32 33 33 34 UIVideoMemoryEditor::UIVideoMemoryEditor(QWidget *pParent /* = 0 */ , bool fWithLabel /* = false */)34 UIVideoMemoryEditor::UIVideoMemoryEditor(QWidget *pParent /* = 0 */) 35 35 : QIWithRetranslateUI<QWidget>(pParent) 36 , m_fWithLabel(fWithLabel)37 36 , m_comGuestOSType(CGuestOSType()) 38 37 , m_cGuestScreenCount(1) … … 46 45 , m_iMaxVRAMVisible(0) 47 46 , m_iInitialVRAM(0) 47 , m_pLayout(0) 48 48 , m_pLabelMemory(0) 49 49 , m_pSlider(0) … … 136 136 #endif /* VBOX_WITH_3D_ACCELERATION */ 137 137 138 int UIVideoMemoryEditor::minimumLabelHorizontalHint() const 139 { 140 return m_pLabelMemory->minimumSizeHint().width(); 141 } 142 143 void UIVideoMemoryEditor::setMinimumLayoutIndent(int iIndent) 144 { 145 if (m_pLayout) 146 m_pLayout->setColumnMinimumWidth(0, iIndent); 147 } 148 138 149 void UIVideoMemoryEditor::retranslateUi() 139 150 { 140 151 if (m_pLabelMemory) 141 152 m_pLabelMemory->setText(tr("Video &Memory:")); 153 154 if (m_pSlider) 155 m_pSlider->setToolTip(tr("Holds the amount of video memory provided to the virtual machine.")); 156 if (m_pSpinBox) 157 m_pSpinBox->setToolTip(tr("Holds the amount of video memory provided to the virtual machine.")); 158 142 159 if (m_pLabelMemoryMin) 160 { 143 161 m_pLabelMemoryMin->setText(tr("%1 MB").arg(m_iMinVRAM)); 162 m_pLabelMemoryMin->setToolTip(tr("Minimum possible video memory size.")); 163 } 144 164 if (m_pLabelMemoryMax) 165 { 145 166 m_pLabelMemoryMax->setText(tr("%1 MB").arg(m_iMaxVRAMVisible)); 167 m_pLabelMemoryMax->setToolTip(tr("Maximum possible video memory size.")); 168 } 169 146 170 if (m_pSpinBox) 147 171 m_pSpinBox->setSuffix(QString(" %1").arg(tr("MB"))); … … 185 209 186 210 /* Create main layout: */ 187 QGridLayout *pMainLayout = new QGridLayout(this); 188 if (pMainLayout) 189 { 190 pMainLayout->setContentsMargins(0, 0, 0, 0); 191 int iRow = 0; 211 m_pLayout = new QGridLayout(this); 212 if (m_pLayout) 213 { 214 m_pLayout->setContentsMargins(0, 0, 0, 0); 192 215 193 216 /* Create memory label: */ 194 if (m_fWithLabel) 195 m_pLabelMemory = new QLabel(this); 217 m_pLabelMemory = new QLabel(this); 196 218 if (m_pLabelMemory) 197 pMainLayout->addWidget(m_pLabelMemory, 0, iRow++, 1, 1); 219 { 220 m_pLabelMemory->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 221 m_pLayout->addWidget(m_pLabelMemory, 0, 0); 222 } 198 223 199 224 /* Create slider layout: */ … … 244 269 245 270 /* Add slider layout to main layout: */ 246 pMainLayout->addLayout(pSliderLayout, 0, iRow++, 2, 1);271 m_pLayout->addLayout(pSliderLayout, 0, 1, 2, 1); 247 272 } 248 273 … … 258 283 connect(m_pSpinBox, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), 259 284 this, &UIVideoMemoryEditor::sltHandleSpinBoxChange); 260 pMainLayout->addWidget(m_pSpinBox, 0, iRow++, 1, 1);285 m_pLayout->addWidget(m_pSpinBox, 0, 2); 261 286 } 262 287 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIVideoMemoryEditor.h
r93990 r94341 34 34 35 35 /* Forward declarations: */ 36 class QGridLayout; 36 37 class QLabel; 37 38 class QSpinBox; … … 50 51 public: 51 52 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); 53 /** Constructs video-memory editor passing @a pParent to the base-class. */ 54 UIVideoMemoryEditor(QWidget *pParent = 0); 55 55 56 56 /** Defines editor @a iValue. */ … … 74 74 void set3DAccelerationEnabled(bool fEnabled); 75 75 #endif 76 77 /** Returns minimum layout hint. */ 78 int minimumLabelHorizontalHint() const; 79 /** Defines minimum layout @a iIndent. */ 80 void setMinimumLayoutIndent(int iIndent); 76 81 77 82 protected: … … 101 106 static int calculatePageStep(int iMax); 102 107 103 /** Holds whether descriptive label should be created. */104 bool m_fWithLabel;105 106 108 /** Holds the guest OS type ID. */ 107 109 CGuestOSType m_comGuestOSType; … … 128 130 int m_iInitialVRAM; 129 131 132 /** Holds the main layout instance. */ 133 QGridLayout *m_pLayout; 130 134 /** Holds the memory label instance. */ 131 135 QLabel *m_pLabelMemory; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r94333 r94341 303 303 , m_pTabWidget(0) 304 304 , m_pTabScreen(0) 305 , m_pLa belVideoMemorySize(0)305 , m_pLayoutScreen(0) 306 306 , m_pEditorVideoMemorySize(0) 307 307 , m_pLabelMonitorCount(0) … … 778 778 void UIMachineSettingsDisplay::retranslateUi() 779 779 { 780 m_pLabelVideoMemorySize->setText(tr("Video &Memory:"));781 m_pEditorVideoMemorySize->setToolTip(tr("Controls the amount of video memory provided to the virtual machine."));782 780 m_pLabelMonitorCount->setText(tr("Mo&nitor Count:")); 783 781 m_pSliderMonitorCount->setToolTip(tr("Controls the amount of virtual monitors provided to the virtual machine.")); … … 865 863 m_pComboRecordingMode->setItemText(2, gpConverter->toString(UISettingsDefs::RecordingMode_AudioOnly)); 866 864 865 /* These editors have own labels, but we want them to be properly layouted according to each other: */ 866 int iMinimumLayoutHint = 0; 867 iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pEditorVideoMemorySize->minimumLabelHorizontalHint()); 868 iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pLabelMonitorCount->minimumSizeHint().width()); 869 iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pLabelScaleFactor->minimumSizeHint().width()); 870 iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pLabelGraphicsController->minimumSizeHint().width()); 871 iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pLabelAcceleration->minimumSizeHint().width()); 872 m_pEditorVideoMemorySize->setMinimumLayoutIndent(iMinimumLayoutHint); 873 m_pLayoutScreen->setColumnMinimumWidth(0, iMinimumLayoutHint); 874 867 875 updateRecordingFileSizeHint(); 868 876 } … … 874 882 875 883 /* Polish 'Screen' availability: */ 876 m_pLabelVideoMemorySize->setEnabled(isMachineOffline());877 884 m_pEditorVideoMemorySize->setEnabled(isMachineOffline()); 878 885 m_pLabelMonitorCount->setEnabled(isMachineOffline()); … … 1098 1105 { 1099 1106 /* Prepare 'Screen' tab layout: */ 1100 QGridLayout *pLayoutScreen = new QGridLayout(m_pTabScreen);1101 if ( pLayoutScreen)1107 m_pLayoutScreen = new QGridLayout(m_pTabScreen); 1108 if (m_pLayoutScreen) 1102 1109 { 1103 pLayoutScreen->setRowStretch(8, 1); 1104 1105 /* Prepare video memory label: */ 1106 m_pLabelVideoMemorySize = new QLabel(m_pTabScreen); 1107 if (m_pLabelVideoMemorySize) 1108 { 1109 m_pLabelVideoMemorySize->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 1110 pLayoutScreen->addWidget(m_pLabelVideoMemorySize, 0, 0); 1111 } 1110 m_pLayoutScreen->setRowStretch(8, 1); 1111 1112 1112 /* Prepare video memory editor: */ 1113 1113 m_pEditorVideoMemorySize = new UIVideoMemoryEditor(m_pTabScreen); 1114 1114 if (m_pEditorVideoMemorySize) 1115 { 1116 if (m_pLabelVideoMemorySize) 1117 m_pLabelVideoMemorySize->setBuddy(m_pEditorVideoMemorySize->focusProxy()); 1118 pLayoutScreen->addWidget(m_pEditorVideoMemorySize, 0, 1, 2, 2); 1119 } 1115 m_pLayoutScreen->addWidget(m_pEditorVideoMemorySize, 0, 0, 1, 3); 1120 1116 1121 1117 /* Prepare monitor count label: */ … … 1124 1120 { 1125 1121 m_pLabelMonitorCount->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 1126 pLayoutScreen->addWidget(m_pLabelMonitorCount, 2, 0);1122 m_pLayoutScreen->addWidget(m_pLabelMonitorCount, 1, 0); 1127 1123 } 1128 1124 /* Prepare monitor count layout: */ … … 1170 1166 } 1171 1167 1172 pLayoutScreen->addLayout(pLayoutMonitorCount, 2, 1, 2, 1);1168 m_pLayoutScreen->addLayout(pLayoutMonitorCount, 1, 1, 2, 1); 1173 1169 } 1174 1170 /* Prepare monitor count spinbox: */ … … 1181 1177 m_pSpinboxMonitorCount->setMaximum(comProperties.GetMaxGuestMonitors()); 1182 1178 1183 pLayoutScreen->addWidget(m_pSpinboxMonitorCount, 2, 2);1179 m_pLayoutScreen->addWidget(m_pSpinboxMonitorCount, 1, 2); 1184 1180 } 1185 1181 … … 1189 1185 { 1190 1186 m_pLabelScaleFactor->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 1191 pLayoutScreen->addWidget(m_pLabelScaleFactor, 4, 0);1187 m_pLayoutScreen->addWidget(m_pLabelScaleFactor, 3, 0); 1192 1188 } 1193 1189 /* Prepare scale factor editor: */ … … 1197 1193 if (m_pLabelScaleFactor) 1198 1194 m_pLabelScaleFactor->setBuddy(m_pEditorScaleFactor->focusProxy()); 1199 pLayoutScreen->addWidget(m_pEditorScaleFactor, 4, 1, 2, 2);1195 m_pLayoutScreen->addWidget(m_pEditorScaleFactor, 3, 1, 2, 2); 1200 1196 } 1201 1197 … … 1205 1201 { 1206 1202 m_pLabelGraphicsController->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 1207 pLayoutScreen->addWidget(m_pLabelGraphicsController, 6, 0);1203 m_pLayoutScreen->addWidget(m_pLabelGraphicsController, 5, 0); 1208 1204 } 1209 1205 /* Prepare graphics controller editor: */ … … 1213 1209 if (m_pLabelGraphicsController) 1214 1210 m_pLabelGraphicsController->setBuddy(m_pEditorGraphicsController); 1215 pLayoutScreen->addWidget(m_pEditorGraphicsController, 6, 1, 1, 2);1211 m_pLayoutScreen->addWidget(m_pEditorGraphicsController, 5, 1, 1, 2); 1216 1212 } 1217 1213 … … 1221 1217 { 1222 1218 m_pLabelAcceleration->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 1223 pLayoutScreen->addWidget(m_pLabelAcceleration, 7, 0);1219 m_pLayoutScreen->addWidget(m_pLabelAcceleration, 6, 0); 1224 1220 } 1225 1221 /* Prepare 3D checkbox: */ 1226 1222 m_pCheckbox3D = new QCheckBox(m_pTabScreen); 1227 1223 if (m_pCheckbox3D) 1228 pLayoutScreen->addWidget(m_pCheckbox3D, 7, 1);1224 m_pLayoutScreen->addWidget(m_pCheckbox3D, 6, 1); 1229 1225 } 1230 1226 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h
r94333 r94341 199 199 /** Holds the 'Screen' tab instance. */ 200 200 QWidget *m_pTabScreen; 201 /** Holds the video memory size labelinstance. */202 Q Label *m_pLabelVideoMemorySize;201 /** Holds the 'Screen' layout instance. */ 202 QGridLayout *m_pLayoutScreen; 203 203 /** Holds the video memory size editor instance. */ 204 204 UIVideoMemoryEditor *m_pEditorVideoMemorySize;
Note:
See TracChangeset
for help on using the changeset viewer.