Changeset 72279 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 22, 2018 9:22:09 AM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFilePathSelector.cpp
r71901 r72279 176 176 } 177 177 178 void UIFilePathSelector::setDefaultPath(const QString &strDefaultPath) 179 { 180 if (m_strDefaultPath == strDefaultPath) 181 return; 182 m_strDefaultPath = strDefaultPath; 183 if (currentIndex() == ResetId) 184 setPath(m_strDefaultPath); 185 } 186 187 const QString& UIFilePathSelector::defaultPath() const 188 { 189 return m_strDefaultPath; 190 } 191 178 192 void UIFilePathSelector::setPath(const QString &strPath, bool fRefreshText /* = true */) 179 193 { … … 321 335 case ResetId: 322 336 { 323 changePath(QString::null); 337 if (m_strDefaultPath.isEmpty()) 338 changePath(QString::null); 339 else 340 changePath(m_strDefaultPath); 324 341 break; 325 342 } -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFilePathSelector.h
r71901 r72279 112 112 void setToolTip(const QString &strToolTip); 113 113 114 void setDefaultPath(const QString &strDefaultPath); 115 const QString& defaultPath() const; 116 114 117 public slots: 115 118 … … 204 207 /** Holds the copy action instance. */ 205 208 QAction *m_pCopyAction; 209 210 /** Path is set to m_strDefaultPath when it is reset. */ 211 QString m_strDefaultPath; 206 212 }; 207 213 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.cpp
r72226 r72279 24 24 # include <QGridLayout> 25 25 # include <QLabel> 26 # include <QLineEdit>27 26 # include <QVBoxLayout> 28 27 29 28 /* GUI includes: */ 29 # include "QILineEdit.h" 30 30 # include "VBoxGlobal.h" 31 31 # include "UIFilePathSelector.h" 32 32 # include "UINameAndSystemEditor.h" 33 # include "UIVMNamePathSelector.h"34 33 35 34 /* COM includes: */ … … 54 53 , m_pLabelType(0) 55 54 , m_pIconType(0) 56 , m_pNamePathLabel(0) 57 , m_pNamePathSelector(0) 55 , m_pNameLabel(0) 56 , m_pPathLabel(0) 57 , m_pNameLineEdit(0) 58 , m_pPathSelector(0) 58 59 , m_pComboFamily(0) 59 60 , m_pComboType(0) … … 65 66 QString UINameAndSystemEditor::name() const 66 67 { 67 if (!m_pName PathSelector)68 if (!m_pNameLineEdit) 68 69 return QString(); 69 return m_pName PathSelector->name();70 return m_pNameLineEdit->text(); 70 71 } 71 72 72 73 QString UINameAndSystemEditor::path() const 73 74 { 74 if (!m_p NamePathSelector)75 if (!m_pPathSelector) 75 76 return vboxGlobal().virtualBox().GetSystemProperties().GetDefaultMachineFolder(); 76 return m_p NamePathSelector->path();77 return m_pPathSelector->path(); 77 78 } 78 79 79 80 void UINameAndSystemEditor::setName(const QString &strName) 80 81 { 81 if (!m_pName PathSelector)82 if (!m_pNameLineEdit) 82 83 return; 83 m_pName PathSelector->setName(strName);84 m_pNameLineEdit->setText(strName); 84 85 } 85 86 … … 119 120 m_pLabelFamily->setText(tr("&Type:")); 120 121 m_pLabelType->setText(tr("&Version:")); 121 m_pNamePathLabel->setText(tr("Path/Name:")); 122 m_pNameLabel->setText(tr("Name:")); 123 m_pPathLabel->setText(tr("Path:")); 122 124 123 125 m_pComboFamily->setWhatsThis(tr("Selects the operating system family that " … … 229 231 pMainLayout->setContentsMargins(0, 0, 0, 0); 230 232 231 m_pNamePathLabel = new QLabel; 232 if (m_pNamePathLabel) 233 { 234 m_pNamePathLabel->setAlignment(Qt::AlignRight); 235 m_pNamePathLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 236 pMainLayout->addWidget(m_pNamePathLabel, 0, 0, 1, 1); 237 } 238 m_pNamePathSelector = new UIVMNamePathSelector; 239 if (m_pNamePathSelector) 240 { 241 m_pNamePathSelector->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); 242 m_pNamePathSelector->setPath(vboxGlobal().virtualBox().GetSystemProperties().GetDefaultMachineFolder()); 243 pMainLayout->addWidget(m_pNamePathSelector, 0, 1, 1, 2); 244 setFocusProxy(m_pNamePathSelector); 233 m_pNameLabel = new QLabel; 234 if (m_pNameLabel) 235 { 236 m_pNameLabel->setAlignment(Qt::AlignRight); 237 m_pNameLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 238 pMainLayout->addWidget(m_pNameLabel, 0, 0, 1, 1); 239 } 240 m_pNameLineEdit = new QILineEdit; 241 if (m_pNameLineEdit) 242 { 243 pMainLayout->addWidget(m_pNameLineEdit, 0, 1, 1, 1); 244 } 245 246 m_pPathLabel = new QLabel; 247 if (m_pPathLabel) 248 { 249 m_pPathLabel->setAlignment(Qt::AlignRight); 250 pMainLayout->addWidget(m_pPathLabel, 1, 0, 1, 1); 251 } 252 253 m_pPathSelector = new UIFilePathSelector; 254 if (m_pPathSelector) 255 { 256 pMainLayout->addWidget(m_pPathSelector, 1, 1, 1, 1); 257 QString strDefaultMachineFolder = vboxGlobal().virtualBox().GetSystemProperties().GetDefaultMachineFolder(); 258 m_pPathSelector->setPath(strDefaultMachineFolder); 259 m_pPathSelector->setDefaultPath(strDefaultMachineFolder); 245 260 } 246 261 … … 253 268 m_pLabelFamily->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 254 269 /* Add VM OS family label into main-layout: */ 255 pMainLayout->addWidget(m_pLabelFamily, 1, 0);270 pMainLayout->addWidget(m_pLabelFamily, 2, 0); 256 271 } 257 272 … … 264 279 m_pLabelFamily->setBuddy(m_pComboFamily); 265 280 /* Add VM OS family combo into main-layout: */ 266 pMainLayout->addWidget(m_pComboFamily, 1, 1);281 pMainLayout->addWidget(m_pComboFamily, 2, 1); 267 282 } 268 283 … … 275 290 m_pLabelType->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 276 291 /* Add VM OS type label into main-layout: */ 277 pMainLayout->addWidget(m_pLabelType, 2, 0);292 pMainLayout->addWidget(m_pLabelType, 3, 0); 278 293 } 279 294 … … 286 301 m_pLabelType->setBuddy(m_pComboType); 287 302 /* Add VM OS type combo into main-layout: */ 288 pMainLayout->addWidget(m_pComboType, 2, 1);303 pMainLayout->addWidget(m_pComboType, 3, 1); 289 304 } 290 305 … … 305 320 pLayoutIcon->addStretch(); 306 321 /* Add sub-layout into main-layout: */ 307 pMainLayout->addLayout(pLayoutIcon, 1, 2, 2, 1);322 pMainLayout->addLayout(pLayoutIcon, 2, 2, 2, 1); 308 323 } 309 324 } … … 334 349 { 335 350 /* Prepare connections: */ 336 connect(m_pName PathSelector, &UIVMNamePathSelector::sigNameChanged,351 connect(m_pNameLineEdit, &QILineEdit::textChanged, 337 352 this, &UINameAndSystemEditor::sigNameChanged); 338 connect(m_p NamePathSelector, &UIVMNamePathSelector::sigPathChanged,353 connect(m_pPathSelector, &UIFilePathSelector::pathChanged, 339 354 this, &UINameAndSystemEditor::sigPathChanged); 340 355 connect(m_pComboFamily, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), … … 346 361 void UINameAndSystemEditor::setNameFieldValidator(const QString &strValidatorString) 347 362 { 348 if (!m_pName PathSelector)363 if (!m_pNameLineEdit) 349 364 return; 350 m_pNamePathSelector->setNameFieldValidator(strValidatorString); 351 } 352 353 void UINameAndSystemEditor::setMachineFolder(const QString &strPath) 354 { 355 if (!m_pNamePathSelector) 356 return; 357 m_pNamePathSelector->setToolTipText(strPath); 358 } 365 m_pNameLineEdit->setValidator(new QRegExpValidator(QRegExp(strValidatorString), this)); 366 } -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.h
r72199 r72279 33 33 class QComboBox; 34 34 class QLabel; 35 class Q LineEdit;35 class QILineEdit; 36 36 class QString; 37 37 class UIFilePathSelector; 38 class UIVMNamePathSelector;39 38 40 39 /** QWidget subclass providing complex editor for basic VM parameters. */ … … 74 73 75 74 void setNameFieldValidator(const QString &strValidatorString); 76 77 /** Forwards the machine name to UIVMNamePathSelector member instance. */78 void setMachineFolder(const QString &strPath);79 75 80 76 protected: … … 125 121 QLabel *m_pIconType; 126 122 127 QLabel *m_pNamePathLabel; 128 UIVMNamePathSelector *m_pNamePathSelector; 123 QLabel *m_pNameLabel; 124 QLabel *m_pPathLabel; 125 QILineEdit *m_pNameLineEdit; 126 UIFilePathSelector *m_pPathSelector; 129 127 /** Holds the VM OS family combo instance. */ 130 128 QComboBox *m_pComboFamily; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp
r72226 r72279 234 234 m_strMachineFolder = fileInfo.absolutePath(); 235 235 m_strMachineBaseName = fileInfo.completeBaseName(); 236 237 if (m_pNameAndSystemEditor)238 m_pNameAndSystemEditor->setMachineFolder(m_strMachineFolder);239 236 } 240 237
Note:
See TracChangeset
for help on using the changeset viewer.