Changeset 107119 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Nov 22, 2024 1:04:52 PM (8 weeks ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.cpp
r106061 r107119 28 28 /* Qt includes: */ 29 29 #include <QComboBox> 30 #include <QDir> 30 31 #include <QGridLayout> 31 32 #include <QLabel> … … 167 168 } 168 169 170 QString UINameAndSystemEditor::fullPath() const 171 { 172 QDir dir(path()); 173 QString strFullPath = dir.filePath(name()); 174 return QDir::cleanPath(strFullPath); 175 } 176 169 177 void UINameAndSystemEditor::setISOImagePath(const QString &strPath) 170 178 { … … 234 242 } 235 243 236 void UINameAndSystemEditor::markNameEditor(bool fError )244 void UINameAndSystemEditor::markNameEditor(bool fError, const QString &strErrorMessage, const QString &strNoErrorMessage) 237 245 { 238 246 if (m_pEditorName) 239 m_pEditorName->mark(fError, tr("Invalid guest machine name"), tr("Guest machine name is valid"));247 m_pEditorName->mark(fError, strErrorMessage, strNoErrorMessage); 240 248 } 241 249 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.h
r106061 r107119 109 109 /** Defines the VM @a strPath. */ 110 110 void setPath(const QString &strPath); 111 /** Returns path string selected by the user. */111 /** Returns path string selected by the user. This does not include name().*/ 112 112 QString path() const; 113 /** Returns path and name joined and cleaned. */ 114 QString fullPath() const; 113 115 114 116 /** Sets image path. */ … … 127 129 128 130 /** Passes the @p fError to QILineEdit::mark(bool) effectively marking it for error. */ 129 void markNameEditor(bool fError );131 void markNameEditor(bool fError, const QString &strErrorMessage, const QString &strNoErrorMessage); 130 132 /** Passes the @p fError and @a strErrorMessage to UIFilePathSelector::mark(bool) 131 133 * effectively changing the background color and error-text. */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp
r107108 r107119 287 287 if (!comHDDController.isNull()) 288 288 { 289 LONG uPortNumber = portNumberForDevice(comHDDController); 290 machine.AttachDevice(comHDDController.GetName(), uPortNumber, 0, KDeviceType_HardDisk, m_virtualDisk); 291 if (!machine.isOk()) 292 UINotificationMessage::cannotAttachDevice(machine, UIMediumDeviceType_HardDisk, m_strMediumPath, 293 StorageSlot(enmHDDBus, uPortNumber, 0), notificationCenter()); 289 LONG iPortNumber = portNumberForDevice(comHDDController); 290 if (iPortNumber != -1) 291 { 292 machine.AttachDevice(comHDDController.GetName(), iPortNumber, 0, KDeviceType_HardDisk, m_virtualDisk); 293 if (!machine.isOk()) 294 UINotificationMessage::cannotAttachDevice(machine, UIMediumDeviceType_HardDisk, m_strMediumPath, 295 StorageSlot(enmHDDBus, iPortNumber, 0), notificationCenter()); 296 } 294 297 } 295 298 } … … 319 322 UINotificationMessage::cannotOpenMedium(vbox, strISOFilePath, notificationCenter()); 320 323 } 321 LONG uPortNumber = portNumberForDevice(comDVDController); 322 machine.AttachDevice(comDVDController.GetName(), uPortNumber, 0, KDeviceType_DVD, opticalDisk); 323 if (!machine.isOk()) 324 UINotificationMessage::cannotAttachDevice(machine, UIMediumDeviceType_DVD, QString(), 325 StorageSlot(enmDVDBus, 1, 0), notificationCenter()); 324 LONG iPortNumber = portNumberForDevice(comDVDController); 325 if (iPortNumber != -1) 326 { 327 machine.AttachDevice(comDVDController.GetName(), iPortNumber, 0, KDeviceType_DVD, opticalDisk); 328 if (!machine.isOk()) 329 UINotificationMessage::cannotAttachDevice(machine, UIMediumDeviceType_DVD, QString(), 330 StorageSlot(enmDVDBus, 1, 0), notificationCenter()); 331 } 326 332 } 327 333 /* Save machine settings here because portNumberForDevice needs to inquiry port attachments of the controller: */ … … 865 871 } 866 872 867 868 873 if (!comController.isOk()) 869 874 { -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMExpertPage.cpp
r106118 r107119 468 468 if (m_pNameAndSystemEditor) 469 469 { 470 m_pNameAndSystemEditor->markNameEditor(m_pNameAndSystemEditor->name().isEmpty()); 470 m_pNameAndSystemEditor->markNameEditor(m_pNameAndSystemEditor->name().isEmpty(), 471 tr("Guest machine name cannot be empty"), tr("Guest machine name is valid")); 471 472 m_pNameAndSystemEditor->markImageEditor(!UIWizardNewVMNameOSTypeCommon::checkISOFile(m_pNameAndSystemEditor), 472 473 UIWizardNewVM::tr("Invalid file path or unreadable file"), 473 474 UIWizardNewVM::tr("File path is valid")); 475 m_pNameAndSystemEditor->markNameEditor((QDir(m_pNameAndSystemEditor->fullPath()).exists()), 476 tr("Guest machine path is not unique"), tr("Guest machine name is valid")); 474 477 } 475 478 UIWizardNewVM *pWizard = wizardWindow<UIWizardNewVM>(); … … 629 632 UIIconPool::iconSet(":/status_error_16px.png"), 630 633 UIWizardNewVM::tr("Invalid ISO file")); 634 fIsComplete = false; 635 } 636 if (QDir(m_pNameAndSystemEditor->fullPath()).exists()) 637 { 638 m_pToolBox->setPageTitleIcon(ExpertToolboxItems_NameAndOSType, 639 UIIconPool::iconSet(":/status_error_16px.png"), 640 UIWizardNewVM::tr("Guest machine path is not unique")); 631 641 fIsComplete = false; 632 642 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMNameOSTypePage.cpp
r107002 r107119 523 523 if (m_pNameAndSystemEditor->name().isEmpty()) 524 524 return false; 525 if (QDir(m_pNameAndSystemEditor->fullPath()).exists()) 526 return false; 525 527 return UIWizardNewVMNameOSTypeCommon::checkISOFile(m_pNameAndSystemEditor); 526 528 } … … 766 768 if (m_pNameAndSystemEditor) 767 769 { 768 m_pNameAndSystemEditor->markNameEditor(m_pNameAndSystemEditor->name().isEmpty()); 770 m_pNameAndSystemEditor->markNameEditor(m_pNameAndSystemEditor->name().isEmpty(), 771 tr("Guest machine name cannot be empty"), tr("Guest machine name is valid")); 772 m_pNameAndSystemEditor->markNameEditor((QDir(m_pNameAndSystemEditor->fullPath()).exists()), 773 tr("Guest machine path is not unique"), tr("Guest machine name is valid")); 769 774 m_pNameAndSystemEditor->markImageEditor(!UIWizardNewVMNameOSTypeCommon::checkISOFile(m_pNameAndSystemEditor), 770 775 UIWizardNewVM::tr("Invalid file path or unreadable file"),
Note:
See TracChangeset
for help on using the changeset viewer.