Changeset 93935 in vbox
- Timestamp:
- Feb 24, 2022 4:40:30 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIDefaultMachineFolderEditor.cpp
r93115 r93935 26 26 27 27 28 UIDefaultMachineFolderEditor::UIDefaultMachineFolderEditor(QWidget *pParent /* = 0 */ , bool fWithLabel /* = false */)28 UIDefaultMachineFolderEditor::UIDefaultMachineFolderEditor(QWidget *pParent /* = 0 */) 29 29 : QIWithRetranslateUI<QWidget>(pParent) 30 , m_fWithLabel(fWithLabel)31 30 , m_strValue(QString()) 31 , m_pLayout(0) 32 32 , m_pLabel(0) 33 33 , m_pSelector(0) … … 55 55 } 56 56 57 int UIDefaultMachineFolderEditor::minimumLabelHorizontalHint() const 58 { 59 return m_pLabel->minimumSizeHint().width(); 60 } 61 62 void UIDefaultMachineFolderEditor::setMinimumLayoutIndent(int iIndent) 63 { 64 if (m_pLayout) 65 m_pLayout->setColumnMinimumWidth(0, iIndent); 66 } 67 57 68 void UIDefaultMachineFolderEditor::retranslateUi() 58 69 { … … 60 71 m_pLabel->setText(tr("Default &Machine Folder:")); 61 72 if (m_pSelector) 62 m_pSelector->set WhatsThis(tr("Holds the path to the default virtual machine folder. This folder is used, "63 73 m_pSelector->setToolTip(tr("Holds the path to the default virtual machine folder. This folder is used, " 74 "if not explicitly specified otherwise, when creating new virtual machines.")); 64 75 } 65 76 … … 73 84 { 74 85 /* Create main layout: */ 75 QGridLayout *pMainLayout = new QGridLayout(this);76 if ( pMainLayout)86 m_pLayout = new QGridLayout(this); 87 if (m_pLayout) 77 88 { 78 pMainLayout->setContentsMargins(0, 0, 0, 0);79 int iRow = 0;89 m_pLayout->setContentsMargins(0, 0, 0, 0); 90 m_pLayout->setColumnStretch(1, 1); 80 91 81 92 /* Create label: */ 82 if (m_fWithLabel) 93 m_pLabel = new QLabel(this); 94 if (m_pLabel) 83 95 { 84 m_pLabel = new QLabel(this); 85 if (m_pLabel) 86 pMainLayout->addWidget(m_pLabel, 0, iRow++, 1, 1); 96 m_pLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 97 m_pLayout->addWidget(m_pLabel, 0, 0); 87 98 } 88 99 … … 97 108 this, &UIDefaultMachineFolderEditor::sltHandleSelectorPathChanged); 98 109 99 pMainLayout->addWidget(m_pSelector, 0, iRow++, 1, 1);110 m_pLayout->addWidget(m_pSelector, 0, 1); 100 111 } 101 112 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIDefaultMachineFolderEditor.h
r93115 r93935 30 30 31 31 /* Forward declarations: */ 32 class QGridLayout; 32 33 class QLabel; 33 34 class UIFilePathSelector; … … 45 46 public: 46 47 47 /** Constructs editor passing @a pParent to the base-class. 48 * @param fWithLabel Brings whether we should add label ourselves. */ 49 UIDefaultMachineFolderEditor(QWidget *pParent = 0, bool fWithLabel = false); 48 /** Constructs editor passing @a pParent to the base-class. */ 49 UIDefaultMachineFolderEditor(QWidget *pParent = 0); 50 50 51 51 /** Defines editor @a strValue. */ … … 53 53 /** Returns editor value. */ 54 54 QString value() const; 55 56 /** Returns minimum layout hint. */ 57 int minimumLabelHorizontalHint() const; 58 /** Defines minimum layout @a iIndent. */ 59 void setMinimumLayoutIndent(int iIndent); 55 60 56 61 protected: … … 69 74 void prepare(); 70 75 71 /** Holds whether descriptive label should be created. */72 bool m_fWithLabel;73 74 76 /** Holds the value to be set. */ 75 77 QString m_strValue; 76 78 79 /** Holds the main layout instance. */ 80 QGridLayout *m_pLayout; 77 81 /** Holds the label instance. */ 78 82 QLabel *m_pLabel; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIVRDEAuthLibraryEditor.cpp
r93115 r93935 26 26 27 27 28 UIVRDEAuthLibraryEditor::UIVRDEAuthLibraryEditor(QWidget *pParent /* = 0 */ , bool fWithLabel /* = false */)28 UIVRDEAuthLibraryEditor::UIVRDEAuthLibraryEditor(QWidget *pParent /* = 0 */) 29 29 : QIWithRetranslateUI<QWidget>(pParent) 30 , m_fWithLabel(fWithLabel)31 30 , m_strValue(QString()) 32 31 , m_pLabel(0) … … 55 54 } 56 55 56 int UIVRDEAuthLibraryEditor::minimumLabelHorizontalHint() const 57 { 58 return m_pLabel->minimumSizeHint().width(); 59 } 60 61 void UIVRDEAuthLibraryEditor::setMinimumLayoutIndent(int iIndent) 62 { 63 if (m_pLayout) 64 m_pLayout->setColumnMinimumWidth(0, iIndent); 65 } 66 57 67 void UIVRDEAuthLibraryEditor::retranslateUi() 58 68 { … … 60 70 m_pLabel->setText(tr("V&RDP Authentication Library:")); 61 71 if (m_pSelector) 62 m_pSelector->set WhatsThis(tr("Holds the path to the library that provides "63 72 m_pSelector->setToolTip(tr("Holds the path to the library that provides " 73 "authentication for Remote Display (VRDP) clients.")); 64 74 } 65 75 … … 73 83 { 74 84 /* Create main layout: */ 75 QGridLayout *pMainLayout = new QGridLayout(this);76 if ( pMainLayout)85 m_pLayout = new QGridLayout(this); 86 if (m_pLayout) 77 87 { 78 pMainLayout->setContentsMargins(0, 0, 0, 0);79 int iRow = 0;88 m_pLayout->setContentsMargins(0, 0, 0, 0); 89 m_pLayout->setColumnStretch(1, 1); 80 90 81 91 /* Create label: */ 82 if (m_fWithLabel) 92 m_pLabel = new QLabel(this); 93 if (m_pLabel) 83 94 { 84 m_pLabel = new QLabel(this); 85 if (m_pLabel) 86 pMainLayout->addWidget(m_pLabel, 0, iRow++, 1, 1); 95 m_pLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 96 m_pLayout->addWidget(m_pLabel, 0, 0); 87 97 } 88 98 … … 98 108 this, &UIVRDEAuthLibraryEditor::sltHandleSelectorPathChanged); 99 109 100 pMainLayout->addWidget(m_pSelector, 0, iRow++, 1, 1);110 m_pLayout->addWidget(m_pSelector, 0, 1); 101 111 } 102 112 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIVRDEAuthLibraryEditor.h
r93115 r93935 30 30 31 31 /* Forward declarations: */ 32 class QGridLayout; 32 33 class QLabel; 33 34 class UIFilePathSelector; … … 45 46 public: 46 47 47 /** Constructs editor passing @a pParent to the base-class. 48 * @param fWithLabel Brings whether we should add label ourselves. */ 49 UIVRDEAuthLibraryEditor(QWidget *pParent = 0, bool fWithLabel = false); 48 /** Constructs editor passing @a pParent to the base-class. */ 49 UIVRDEAuthLibraryEditor(QWidget *pParent = 0); 50 50 51 51 /** Defines editor @a strValue. */ … … 53 53 /** Returns editor value. */ 54 54 QString value() const; 55 56 /** Returns minimum layout hint. */ 57 int minimumLabelHorizontalHint() const; 58 /** Defines minimum layout @a iIndent. */ 59 void setMinimumLayoutIndent(int iIndent); 55 60 56 61 protected: … … 69 74 void prepare(); 70 75 71 /** Holds whether descriptive label should be created. */72 bool m_fWithLabel;73 74 76 /** Holds the value to be set. */ 75 77 QString m_strValue; 76 78 79 /** Holds the main layout instance. */ 80 QGridLayout *m_pLayout; 77 81 /** Holds the label instance. */ 78 82 QLabel *m_pLabel; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.cpp
r93115 r93935 17 17 18 18 /* Qt includes: */ 19 #include <QGridLayout> 20 #include <QLabel> 19 #include <QVBoxLayout> 21 20 22 21 /* GUI includes: */ … … 64 63 UIGlobalSettingsGeneral::UIGlobalSettingsGeneral() 65 64 : m_pCache(0) 66 , m_pLabelDefaultMachineFolder(0)67 65 , m_pEditorDefaultMachineFolder(0) 68 , m_pLabelVRDEAuthLibrary(0)69 66 , m_pEditorVRDEAuthLibrary(0) 70 67 { … … 128 125 void UIGlobalSettingsGeneral::retranslateUi() 129 126 { 130 m_pLabelDefaultMachineFolder->setText(UIDefaultMachineFolderEditor::tr("Default &Machine Folder:")); 131 m_pLabelVRDEAuthLibrary->setText(UIVRDEAuthLibraryEditor::tr("V&RDP Authentication Library:")); 127 /* These editors have own labels, but we want them to be properly layouted according to each other: */ 128 int iMinimumLayoutHint = 0; 129 iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pEditorDefaultMachineFolder->minimumLabelHorizontalHint()); 130 iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pEditorVRDEAuthLibrary->minimumLabelHorizontalHint()); 131 m_pEditorDefaultMachineFolder->setMinimumLayoutIndent(iMinimumLayoutHint); 132 m_pEditorVRDEAuthLibrary->setMinimumLayoutIndent(iMinimumLayoutHint); 132 133 } 133 134 … … 148 149 { 149 150 /* Prepare main layout: */ 150 Q GridLayout *pLayoutMain = new QGridLayout(this);151 QVBoxLayout *pLayoutMain = new QVBoxLayout(this); 151 152 if (pLayoutMain) 152 153 { 153 pLayoutMain->setColumnStretch(1, 1);154 pLayoutMain->setRowStretch(3, 1);155 156 /* Prepare 'default machine folder' label: */157 m_pLabelDefaultMachineFolder = new QLabel(this);158 if (m_pLabelDefaultMachineFolder)159 {160 m_pLabelDefaultMachineFolder->setAlignment(Qt::AlignRight | Qt::AlignVCenter);161 pLayoutMain->addWidget(m_pLabelDefaultMachineFolder, 0, 0);162 }163 154 /* Prepare 'default machine folder' editor: */ 164 155 m_pEditorDefaultMachineFolder = new UIDefaultMachineFolderEditor(this); 165 156 if (m_pEditorDefaultMachineFolder) 166 { 167 if (m_pLabelDefaultMachineFolder) 168 m_pLabelDefaultMachineFolder->setBuddy(m_pEditorDefaultMachineFolder); 169 pLayoutMain->addWidget(m_pEditorDefaultMachineFolder, 0, 1, 1, 2); 170 } 171 172 /* Prepare 'VRDE auth library' label: */ 173 m_pLabelVRDEAuthLibrary = new QLabel(this); 174 if (m_pLabelVRDEAuthLibrary) 175 { 176 m_pLabelVRDEAuthLibrary->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 177 pLayoutMain->addWidget(m_pLabelVRDEAuthLibrary, 1, 0); 178 } 157 pLayoutMain->addWidget(m_pEditorDefaultMachineFolder); 158 179 159 /* Prepare 'VRDE auth library' editor: */ 180 160 m_pEditorVRDEAuthLibrary = new UIVRDEAuthLibraryEditor(this); 181 161 if (m_pEditorVRDEAuthLibrary) 182 { 183 if (m_pLabelVRDEAuthLibrary) 184 m_pLabelVRDEAuthLibrary->setBuddy(m_pEditorVRDEAuthLibrary); 185 pLayoutMain->addWidget(m_pEditorVRDEAuthLibrary, 1, 1, 1, 2); 186 } 162 pLayoutMain->addWidget(m_pEditorVRDEAuthLibrary); 163 164 /* Add stretch to the end: */ 165 pLayoutMain->addStretch(); 187 166 } 188 167 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.h
r93115 r93935 26 26 27 27 /* Forward declarations: */ 28 class QLabel;29 28 class UIDefaultMachineFolderEditor; 30 29 class UIVRDEAuthLibraryEditor; … … 80 79 /** @name Widgets 81 80 * @{ */ 82 /** Holds 'default machine folder' label instance. */83 QLabel *m_pLabelDefaultMachineFolder;84 81 /** Holds 'default machine folder' editor instance. */ 85 82 UIDefaultMachineFolderEditor *m_pEditorDefaultMachineFolder; 86 /** Holds 'VRDE auth library' label instance. */87 QLabel *m_pLabelVRDEAuthLibrary;88 83 /** Holds 'VRDE auth library' editor instance. */ 89 84 UIVRDEAuthLibraryEditor *m_pEditorVRDEAuthLibrary;
Note:
See TracChangeset
for help on using the changeset viewer.