Changeset 94148 in vbox
- Timestamp:
- Mar 9, 2022 12:33:50 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
r94039 r94148 1242 1242 { 1243 1243 /* Prepare editor: */ 1244 UIVisualStateEditor *pEditor = new UIVisualStateEditor(pPopup , true /* with label */);1244 UIVisualStateEditor *pEditor = new UIVisualStateEditor(pPopup); 1245 1245 if (pEditor) 1246 1246 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIVisualStateEditor.cpp
r94062 r94148 29 29 30 30 31 UIVisualStateEditor::UIVisualStateEditor(QWidget *pParent /* = 0 */ , bool fWithLabel /* = false */)31 UIVisualStateEditor::UIVisualStateEditor(QWidget *pParent /* = 0 */) 32 32 : QIWithRetranslateUI<QWidget>(pParent) 33 , m_fWithLabel(fWithLabel)34 33 , m_enmValue(UIVisualStateType_Invalid) 34 , m_pLayout(0) 35 35 , m_pLabel(0) 36 36 , m_pCombo(0) … … 68 68 } 69 69 70 int UIVisualStateEditor::minimumLabelHorizontalHint() const 71 { 72 return m_pLabel->minimumSizeHint().width(); 73 } 74 75 void UIVisualStateEditor::setMinimumLayoutIndent(int iIndent) 76 { 77 if (m_pLayout) 78 m_pLayout->setColumnMinimumWidth(0, iIndent); 79 } 80 70 81 void UIVisualStateEditor::retranslateUi() 71 82 { … … 93 104 { 94 105 /* Create main layout: */ 95 QGridLayout *pMainLayout = new QGridLayout(this);96 if ( pMainLayout)106 m_pLayout = new QGridLayout(this); 107 if (m_pLayout) 97 108 { 98 pMainLayout->setContentsMargins(0, 0, 0, 0); 99 int iRow = 0; 109 m_pLayout->setContentsMargins(0, 0, 0, 0); 100 110 101 111 /* Create label: */ 102 if (m_fWithLabel) 103 m_pLabel = new QLabel(this); 112 m_pLabel = new QLabel(this); 104 113 if (m_pLabel) 105 pMainLayout->addWidget(m_pLabel, 0, iRow++, 1, 1); 114 { 115 m_pLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 116 m_pLayout->addWidget(m_pLabel, 0, 0); 117 } 106 118 107 119 /* Create combo layout: */ … … 126 138 127 139 /* Add combo-layout into main-layout: */ 128 pMainLayout->addLayout(pComboLayout, 0, iRow++, 1, 1);140 m_pLayout->addLayout(pComboLayout, 0, 1); 129 141 } 130 142 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIVisualStateEditor.h
r94062 r94148 33 33 /* Forward declarations: */ 34 34 class QComboBox; 35 class QGridLayout; 35 36 class QLabel; 36 37 … … 47 48 public: 48 49 49 /** Constructs visual state editor passing @a pParent to the base-class. 50 * @param fWithLabel Brings whether we should add label ourselves. */ 51 UIVisualStateEditor(QWidget *pParent = 0, bool fWithLabel = false); 50 /** Constructs visual state editor passing @a pParent to the base-class. */ 51 UIVisualStateEditor(QWidget *pParent = 0); 52 52 53 53 /** Defines editor @a uMachineId. */ … … 61 61 /** Returns the vector of supported values. */ 62 62 QVector<UIVisualStateType> supportedValues() const { return m_supportedValues; } 63 64 /** Returns minimum layout hint. */ 65 int minimumLabelHorizontalHint() const; 66 /** Defines minimum layout @a iIndent. */ 67 void setMinimumLayoutIndent(int iIndent); 63 68 64 69 protected: … … 82 87 QUuid m_uMachineId; 83 88 84 /** Holds whether descriptive label should be created. */85 bool m_fWithLabel;86 87 89 /** Holds the value to be selected. */ 88 90 UIVisualStateType m_enmValue; … … 91 93 QVector<UIVisualStateType> m_supportedValues; 92 94 95 /** Holds the main layout instance. */ 96 QGridLayout *m_pLayout; 93 97 /** Holds the label instance. */ 94 QLabel *m_pLabel;98 QLabel *m_pLabel; 95 99 /** Holds the combo instance. */ 96 QComboBox *m_pCombo;100 QComboBox *m_pCombo; 97 101 }; 98 102 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.cpp
r94062 r94148 144 144 , m_pActionPool(0) 145 145 , m_pCache(0) 146 , m_pLayout(0) 146 147 , m_pEditorMenuBar(0) 147 , m_pLabelVisualState(0)148 148 , m_pEditorVisualState(0) 149 149 , m_pLabelMiniToolBar(0) … … 152 152 , m_pEditorStatusBar(0) 153 153 { 154 /* Prepare: */155 154 prepare(); 156 155 } … … 158 157 UIMachineSettingsInterface::~UIMachineSettingsInterface() 159 158 { 160 /* Cleanup: */161 159 cleanup(); 162 160 } … … 300 298 { 301 299 m_pEditorMenuBar->setToolTip(tr("Allows to modify VM menu-bar contents.")); 302 m_pLabelVisualState->setText(tr("&Visual State:"));303 300 m_pLabelMiniToolBar->setText(tr("Mini ToolBar:")); 301 m_pCheckBoxShowMiniToolBar->setText(tr("Show in &Full-screen/Seamless")); 304 302 m_pCheckBoxShowMiniToolBar->setToolTip(tr("When checked, show the Mini ToolBar in full-screen and seamless modes.")); 305 m_pCheckBox ShowMiniToolBar->setText(tr("Show in &Full-screen/Seamless"));303 m_pCheckBoxMiniToolBarAlignment->setText(tr("Show at &Top of Screen")); 306 304 m_pCheckBoxMiniToolBarAlignment->setToolTip(tr("When checked, show the Mini ToolBar at the top of the screen, rather than in " 307 305 "its default position at the bottom of the screen.")); 308 m_pCheckBoxMiniToolBarAlignment->setText(tr("Show at &Top of Screen"));309 306 m_pEditorStatusBar->setToolTip(tr("Allows to modify VM status-bar contents.")); 307 308 /* These editors have own labels, but we want them to be properly layouted according to each other: */ 309 int iMinimumLayoutHint = 0; 310 iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pEditorVisualState->minimumLabelHorizontalHint()); 311 iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pLabelMiniToolBar->minimumSizeHint().width()); 312 m_pEditorVisualState->setMinimumLayoutIndent(iMinimumLayoutHint); 313 m_pLayout->setColumnMinimumWidth(0, iMinimumLayoutHint); 310 314 } 311 315 … … 346 350 { 347 351 /* Prepare main layout: */ 348 QGridLayout *pLayoutMain= new QGridLayout(this);349 if ( pLayoutMain)350 { 351 pLayoutMain->setColumnStretch(1, 1);352 pLayoutMain->setRowStretch(4, 1);352 m_pLayout = new QGridLayout(this); 353 if (m_pLayout) 354 { 355 m_pLayout->setColumnStretch(1, 1); 356 m_pLayout->setRowStretch(4, 1); 353 357 354 358 /* Prepare menu-bar editor: */ … … 359 363 m_pEditorMenuBar->setMachineID(m_uMachineId); 360 364 361 pLayoutMain->addWidget(m_pEditorMenuBar, 0, 0, 1, 3);365 m_pLayout->addWidget(m_pEditorMenuBar, 0, 0, 1, 3); 362 366 } 363 367 364 /* Prepare visual-state label: */365 m_pLabelVisualState = new QLabel(this);366 if (m_pLabelVisualState)367 {368 m_pLabelVisualState->setAlignment(Qt::AlignRight | Qt::AlignVCenter);369 pLayoutMain->addWidget(m_pLabelVisualState, 1, 0);370 }371 368 /* Prepare visual-state editor: */ 372 369 m_pEditorVisualState = new UIVisualStateEditor(this); 373 370 if (m_pEditorVisualState) 374 { 375 if (m_pLabelVisualState) 376 m_pLabelVisualState->setBuddy(m_pEditorVisualState); 377 pLayoutMain->addWidget(m_pEditorVisualState, 1, 1); 378 } 371 m_pLayout->addWidget(m_pEditorVisualState, 1, 0, 1, 3); 379 372 380 373 /* Prepare mini-toolbar label: */ … … 383 376 { 384 377 m_pLabelMiniToolBar->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 385 pLayoutMain->addWidget(m_pLabelMiniToolBar, 2, 0);378 m_pLayout->addWidget(m_pLabelMiniToolBar, 2, 0); 386 379 } 387 380 /* Prepare 'show mini-toolbar' check-box: */ 388 381 m_pCheckBoxShowMiniToolBar = new QCheckBox(this); 389 382 if (m_pCheckBoxShowMiniToolBar) 390 pLayoutMain->addWidget(m_pCheckBoxShowMiniToolBar, 2, 1);383 m_pLayout->addWidget(m_pCheckBoxShowMiniToolBar, 2, 1); 391 384 /* Prepare 'mini-toolbar alignment' check-box: */ 392 385 m_pCheckBoxMiniToolBarAlignment = new QCheckBox(this); 393 386 if (m_pCheckBoxMiniToolBarAlignment) 394 pLayoutMain->addWidget(m_pCheckBoxMiniToolBarAlignment, 3, 1);387 m_pLayout->addWidget(m_pCheckBoxMiniToolBarAlignment, 3, 1); 395 388 396 389 /* Prepare status-bar editor: */ … … 399 392 { 400 393 m_pEditorStatusBar->setMachineID(m_uMachineId); 401 pLayoutMain->addWidget(m_pEditorStatusBar, 5, 0, 1, 3);394 m_pLayout->addWidget(m_pEditorStatusBar, 5, 0, 1, 3); 402 395 } 403 396 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.h
r93990 r94148 27 27 /* Forward declarations: */ 28 28 class QCheckBox; 29 class QGridLayout; 29 30 class QLabel; 30 31 class UIActionPool; … … 104 105 /** @name Widgets 105 106 * @{ */ 107 /** Holds the main layout instance. */ 108 QGridLayout *m_pLayout; 106 109 /** Holds the menu-bar editor instance. */ 107 110 UIMenuBarEditorWidget *m_pEditorMenuBar; 108 /** Holds the visual state label instance. */ 109 QLabel *m_pLabelVisualState; 110 /** Holds the visual state label instance. */ 111 /** Holds the visual state editor instance. */ 111 112 UIVisualStateEditor *m_pEditorVisualState; 112 113 /** Holds the mini-toolbar label instance. */
Note:
See TracChangeset
for help on using the changeset viewer.