- Timestamp:
- Mar 17, 2021 11:06:53 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 143298
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.cpp
r86275 r88149 891 891 { 892 892 /* Prepare editor: */ 893 UINameAndSystemEditor *pEditor = new UINameAndSystemEditor(pPopup, fChooseName, fChoosePath, fChooseType); 893 UINameAndSystemEditor *pEditor = new UINameAndSystemEditor(pPopup, 894 fChooseName, 895 fChoosePath, 896 false /* image? */, 897 fChooseType); 894 898 if (pEditor) 895 899 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.cpp
r88148 r88149 5 5 6 6 /* 7 * Copyright (C) 2008-202 0Oracle Corporation7 * Copyright (C) 2008-2021 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 42 42 bool fChooseName /* = true */, 43 43 bool fChoosePath /* = false */, 44 bool fChoose Type /* = true */,45 bool fChoose ISOFile /* = false */)44 bool fChooseImage /* = false */, 45 bool fChooseType /* = true */) 46 46 : QIWithRetranslateUI<QWidget>(pParent) 47 47 , m_fChooseName(fChooseName) 48 48 , m_fChoosePath(fChoosePath) 49 , m_fChooseI SOFile(fChooseISOFile)49 , m_fChooseImage(fChooseImage) 50 50 , m_fChooseType(fChooseType) 51 51 , m_fSupportsHWVirtEx(false) … … 54 54 , m_pNameLabel(0) 55 55 , m_pPathLabel(0) 56 , m_pI SOFileSelectorLabel(0)56 , m_pImageLabel(0) 57 57 , m_pLabelFamily(0) 58 58 , m_pLabelType(0) … … 60 60 , m_pNameLineEdit(0) 61 61 , m_pPathSelector(0) 62 , m_pI SOFileSelector(0)62 , m_pImageSelector(0) 63 63 , m_pComboFamily(0) 64 64 , m_pComboType(0) … … 103 103 } 104 104 105 void UINameAndSystemEditor::setFileSelectorDialogFilters(const QString &strFilters)106 {107 if (m_pISOFileSelector)108 m_pISOFileSelector->setFileDialogFilters(strFilters);109 }110 111 105 void UINameAndSystemEditor::setName(const QString &strName) 112 106 { … … 135 129 return uiCommon().virtualBox().GetSystemProperties().GetDefaultMachineFolder(); 136 130 return m_pPathSelector->path(); 131 } 132 133 QString UINameAndSystemEditor::image() const 134 { 135 if (!m_pImageSelector) 136 return QString(); 137 return m_pImageSelector->path(); 137 138 } 138 139 … … 239 240 } 240 241 241 QString UINameAndSystemEditor::ISOFilePath() const242 {243 if (!m_pISOFileSelector)244 return QString();245 return m_pISOFileSelector->path();246 }247 248 242 void UINameAndSystemEditor::setType(const CGuestOSType &enmType) 249 243 { … … 271 265 } 272 266 273 void UINameAndSystemEditor::markName LineEdit(bool fError)267 void UINameAndSystemEditor::markNameEditor(bool fError) 274 268 { 275 269 if (m_pNameLineEdit) … … 277 271 } 278 272 279 void UINameAndSystemEditor::markI SOFileSelector(bool fError, const QString &strErrorMessage)280 { 281 if (m_pI SOFileSelector)282 m_pI SOFileSelector->mark(fError, strErrorMessage);273 void UINameAndSystemEditor::markImageEditor(bool fError, const QString &strErrorMessage) 274 { 275 if (m_pImageSelector) 276 m_pImageSelector->mark(fError, strErrorMessage); 283 277 } 284 278 … … 289 283 if (m_pPathLabel) 290 284 m_pPathLabel->setText(tr("&Folder:")); 291 if (m_pI SOFileSelectorLabel)292 m_pI SOFileSelectorLabel->setText(tr("&Image:"));285 if (m_pImageLabel) 286 m_pImageLabel->setText(tr("&Image:")); 293 287 if (m_pLabelFamily) 294 288 m_pLabelFamily->setText(tr("&Type:")); … … 475 469 } 476 470 477 if (m_fChooseI SOFile)471 if (m_fChooseImage) 478 472 { 479 /* Prepare ISOlabel: */480 m_pI SOFileSelectorLabel = new QLabel(this);481 if (m_pI SOFileSelectorLabel)482 { 483 m_pI SOFileSelectorLabel->setAlignment(Qt::AlignRight);484 m_pI SOFileSelectorLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);485 486 m_pMainLayout->addWidget(m_pI SOFileSelectorLabel, iRow, 0);487 } 488 /* Prepare ISOselector: */489 m_pI SOFileSelector = new UIFilePathSelector(this);490 if (m_pI SOFileSelector)491 { 492 m_pI SOFileSelector->setResetEnabled(false);493 m_pI SOFileSelector->setMode(UIFilePathSelector::Mode_File_Open);494 m_pI SOFileSelector->setFileDialogFilters("*.iso *.ISO");495 m_pI SOFileSelector->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);496 m_pI SOFileSelector->setInitialPath(uiCommon().defaultFolderPathForType(UIMediumDeviceType_DVD));497 m_pI SOFileSelectorLabel->setBuddy(m_pISOFileSelector);498 499 m_pMainLayout->addWidget(m_pI SOFileSelector, iRow, 1, 1, 2);473 /* Prepare image label: */ 474 m_pImageLabel = new QLabel(this); 475 if (m_pImageLabel) 476 { 477 m_pImageLabel->setAlignment(Qt::AlignRight); 478 m_pImageLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 479 480 m_pMainLayout->addWidget(m_pImageLabel, iRow, 0); 481 } 482 /* Prepare image selector: */ 483 m_pImageSelector = new UIFilePathSelector(this); 484 if (m_pImageSelector) 485 { 486 m_pImageSelector->setResetEnabled(false); 487 m_pImageSelector->setMode(UIFilePathSelector::Mode_File_Open); 488 m_pImageSelector->setFileDialogFilters("*.iso *.ISO"); 489 m_pImageSelector->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); 490 m_pImageSelector->setInitialPath(uiCommon().defaultFolderPathForType(UIMediumDeviceType_DVD)); 491 m_pImageLabel->setBuddy(m_pImageSelector); 492 493 m_pMainLayout->addWidget(m_pImageSelector, iRow, 1, 1, 2); 500 494 } 501 495 … … 623 617 connect(m_pComboType, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), 624 618 this, &UINameAndSystemEditor::sltTypeChanged); 625 if (m_pI SOFileSelector)626 connect(m_pI SOFileSelector, &UIFilePathSelector::pathChanged,627 this, &UINameAndSystemEditor::sigI SOPathChanged);628 } 619 if (m_pImageSelector) 620 connect(m_pImageSelector, &UIFilePathSelector::pathChanged, 621 this, &UINameAndSystemEditor::sigImageChanged); 622 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.h
r88107 r88149 5 5 6 6 /* 7 * Copyright (C) 2008-202 0Oracle Corporation7 * Copyright (C) 2008-2021 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 60 60 /** Notifies listeners about VM name change. */ 61 61 void sigNameChanged(const QString &strNewName); 62 void sigPathChanged(const QString &strName); 62 63 /** Notifies listeners about VM path change. */ 64 void sigPathChanged(const QString &strPath); 65 66 /** Notifies listeners about VM image change. */ 67 void sigImageChanged(const QString &strImage); 63 68 64 69 /** Notifies listeners about VM OS type change. */ … … 66 71 /** Notifies listeners about VM OS family change. */ 67 72 void sigOSFamilyChanged(); 68 void sigISOPathChanged(const QString &strISOPath);69 73 70 74 public: 71 75 72 76 /** Constructs VM parameters editor passing @a pParent to the base-class. 73 * @param fChooseName 74 * @param fChoosePath 75 * @param fChoose Type Controls whether we should propose to choose type.76 * @param fChoose ISOFile Controls whether we should have a ISO file selector. */77 * @param fChooseName Controls whether we should propose to choose name. 78 * @param fChoosePath Controls whether we should propose to choose path. 79 * @param fChooseImage Controls whether we should propose to choose image. 80 * @param fChooseType Controls whether we should propose to choose type. */ 77 81 UINameAndSystemEditor(QWidget *pParent, 78 82 bool fChooseName = true, 79 83 bool fChoosePath = false, 80 bool fChoose Type = true,81 bool fChoose ISOFile = false);84 bool fChooseImage = false, 85 bool fChooseType = true); 82 86 83 87 /** Defines minimum layout @a iIndent. */ … … 91 95 void setOSTypeStuffEnabled(bool fEnabled); 92 96 93 void setFileSelectorDialogFilters(const QString &strFilters);94 95 97 /** Defines the VM @a strName. */ 96 98 void setName(const QString &strName); … … 102 104 /** Returns path string selected by the user. */ 103 105 QString path() const; 106 107 /** Returns image string selected by the user. */ 108 QString image() const; 104 109 105 110 /** Defines the VM OS @a strTypeId and @a strFamilyId if passed. */ … … 110 115 QString familyId() const; 111 116 112 QString ISOFilePath() const;113 114 117 /** Defines the VM OS @a enmType. */ 115 118 void setType(const CGuestOSType &enmType); … … 121 124 122 125 /** Passes the @p fError to QILineEdit::mark(bool) effectively changing the background color. */ 123 void markNameLineEdit(bool fError); 124 125 void markISOFileSelector(bool fError, const QString &strErrorMessage); 126 void markNameEditor(bool fError); 127 /** Passes the @p fError and @a strErrorMessage to UIFilePathSelector::mark(bool) 128 * effectively changing the background color and error-text. */ 129 void markImageEditor(bool fError, const QString &strErrorMessage); 126 130 127 131 protected: … … 171 175 /** Holds whether we should propose to choose a path. */ 172 176 bool m_fChoosePath; 173 /** Holds whether we should propose a file selector. */174 bool m_fChooseI SOFile;177 /** Holds whether we should propose to choose an image. */ 178 bool m_fChooseImage; 175 179 /** Holds whether we should propose to choose a type. */ 176 180 bool m_fChooseType; … … 187 191 /** Holds the VM path label instance. */ 188 192 QLabel *m_pPathLabel; 189 QLabel *m_pISOFileSelectorLabel; 193 /** Holds the VM image label instance. */ 194 QLabel *m_pImageLabel; 190 195 /** Holds the VM OS family label instance. */ 191 196 QLabel *m_pLabelFamily; … … 199 204 /** Holds the VM path editor instance. */ 200 205 UIFilePathSelector *m_pPathSelector; 201 /** Holds the ISO file selector instance. */202 UIFilePathSelector *m_pISOFileSelector;206 /** Holds the VM image editor instance. */ 207 UIFilePathSelector *m_pImageSelector; 203 208 /** Holds the VM OS family combo instance. */ 204 209 QComboBox *m_pComboFamily; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp
r88148 r88149 249 249 true /* fChooseName? */, 250 250 true /* fChoosePath? */, 251 true /* fChoose Type? */,252 true /* fChoose ISOFile? */);251 true /* fChooseImage? */, 252 true /* fChooseType? */); 253 253 if (m_pNameAndSystemEditor) 254 254 pLayout->addWidget(m_pNameAndSystemEditor); … … 363 363 if (m_pNameAndSystemEditor) 364 364 { 365 m_pNameAndSystemEditor->markName LineEdit(m_pNameAndSystemEditor->name().isEmpty());366 m_pNameAndSystemEditor->markI SOFileSelector(!checkISOFile(), UIWizardNewVM::tr("Invalid file path or unreadable file"));365 m_pNameAndSystemEditor->markNameEditor(m_pNameAndSystemEditor->name().isEmpty()); 366 m_pNameAndSystemEditor->markImageEditor(!checkISOFile(), UIWizardNewVM::tr("Invalid file path or unreadable file")); 367 367 } 368 368 } … … 383 383 if (!m_pNameAndSystemEditor) 384 384 return QString(); 385 return m_pNameAndSystemEditor-> ISOFilePath();385 return m_pNameAndSystemEditor->image(); 386 386 } 387 387 … … 390 390 if (!m_pNameAndSystemEditor) 391 391 return false; 392 const QString &strPath = m_pNameAndSystemEditor-> ISOFilePath();392 const QString &strPath = m_pNameAndSystemEditor->image(); 393 393 if (strPath.isNull() || strPath.isEmpty()) 394 394 return false; … … 429 429 if (!m_pNameAndSystemEditor) 430 430 return true; 431 const QString &strPath = m_pNameAndSystemEditor-> ISOFilePath();431 const QString &strPath = m_pNameAndSystemEditor->image(); 432 432 if (strPath.isNull() || strPath.isEmpty()) 433 433 return true; … … 444 444 if (m_pNameAndSystemEditor) 445 445 { 446 const QString &strPath = m_pNameAndSystemEditor-> ISOFilePath();446 const QString &strPath = m_pNameAndSystemEditor->image(); 447 447 m_pSkipUnattendedCheckBox->setEnabled(!strPath.isNull() && !strPath.isEmpty()); 448 448 } … … 502 502 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigPathChanged, this, &UIWizardNewVMPageBasic1::sltPathChanged); 503 503 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigOsTypeChanged, this, &UIWizardNewVMPageBasic1::sltOsTypeChanged); 504 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigI SOPathChanged, this, &UIWizardNewVMPageBasic1::sltISOPathChanged);504 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigImageChanged, this, &UIWizardNewVMPageBasic1::sltISOPathChanged); 505 505 } 506 506 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp
r88147 r88149 207 207 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigOSFamilyChanged, 208 208 this, &UIWizardNewVMPageExpert::sltOSFamilyTypeChanged); 209 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigI SOPathChanged,209 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigImageChanged, 210 210 this, &UIWizardNewVMPageExpert::sltISOPathChanged); 211 211 }
Note:
See TracChangeset
for help on using the changeset viewer.