Changeset 87775 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Feb 17, 2021 11:42:01 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 142831
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic1.cpp
r82968 r87775 24 24 #include "UIConverter.h" 25 25 #include "UIWizardNewVDPageBasic1.h" 26 #include "UIWizardNewVDPageBasic3.h" 26 27 #include "UIWizardNewVD.h" 27 28 #include "UICommon.h" … … 71 72 m_formatNames << medFormat.GetName(); 72 73 m_pFormatButtonGroup->addButton(pFormatButton, m_formatNames.size() - 1); 74 m_formatExtensions << UIWizardNewVDPage3::defaultExtension(medFormat); 73 75 } 74 76 } … … 204 206 return UIWizardNewVD::Page3; 205 207 } 206 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic1.h
r82968 r87775 55 55 QList<CMediumFormat> m_formats; 56 56 QStringList m_formatNames; 57 QStringList m_formatExtensions; 57 58 }; 58 59 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.h
r82968 r87775 36 36 class SHARED_LIBRARY_STUFF UIWizardNewVDPage3 : public UIWizardPageBase 37 37 { 38 39 public: 40 41 static QString defaultExtension(const CMediumFormat &mediumFormatRef); 42 38 43 protected: 39 44 … … 50 55 /* Returns the full image file path including the extension. */ 51 56 static QString absoluteFilePath(const QString &strFileName, const QString &strPath, const QString &strExtension); 52 static QString defaultExtension(const CMediumFormat &mediumFormatRef);53 57 54 58 /* Checks if the medium file is bigger than what is allowed in FAT file systems. */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp
r85466 r87775 213 213 if (fileInfo.suffix() != m_strDefaultExtension) 214 214 { 215 QFileInfo newFileInfo(fileInfo.absolutePath(), QString("%1.%2").arg(fileInfo.completeBaseName()).arg(m_strDefaultExtension)); 215 QFileInfo newFileInfo(fileInfo.absolutePath(), 216 QString("%1.%2").arg(stripFormatExtension(fileInfo.fileName())).arg(m_strDefaultExtension)); 216 217 m_pLocationEditor->setText(newFileInfo.absoluteFilePath()); 217 218 } … … 296 297 return fResult; 297 298 } 299 300 QString UIWizardNewVDPageExpert::stripFormatExtension(const QString &strFileName) 301 { 302 QString result(strFileName); 303 foreach (const QString &strExtension, m_formatExtensions) 304 { 305 if (strFileName.endsWith(strExtension, Qt::CaseInsensitive)) 306 { 307 /* Add the dot to extenstion: */ 308 QString strExtensionWithDot(strExtension); 309 strExtensionWithDot.prepend('.'); 310 int iIndex = strFileName.lastIndexOf(strExtensionWithDot, -1, Qt::CaseInsensitive); 311 result.remove(iIndex, strExtensionWithDot.length()); 312 } 313 } 314 return result; 315 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.h
r82968 r87775 73 73 bool isComplete() const; 74 74 bool validatePage(); 75 /** Strips the format extension from the @p strFileName. foo.dd.vdi becomes foo.dd. any extension which is not 76 * a format extension is left alone. */ 77 QString stripFormatExtension(const QString &strFileName); 75 78 76 79 /* Widgets: */
Note:
See TracChangeset
for help on using the changeset viewer.