Changeset 103338 in vbox for trunk/src/VBox
- Timestamp:
- Feb 13, 2024 4:37:06 PM (12 months ago)
- svn:sync-xref-src-repo-rev:
- 161647
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIFDCreationDialog.cpp
r100896 r103338 104 104 /* Acquire medium path & formats: */ 105 105 const QString strMediumLocation = m_pFilePathSelector->path(); 106 const QVector<CMediumFormat> mediumFormats = UIMediumDefs::getFormatsForDeviceType(KDeviceType_Floppy);106 const QVector<CMediumFormat> mediumFormats = getFormatsForDeviceType(KDeviceType_Floppy); 107 107 /* Make sure we have both path and formats selected: */ 108 108 if (strMediumLocation.isEmpty() || mediumFormats.isEmpty()) … … 173 173 } 174 174 175 void UIFDCreationDialog::sltHandleMediumCreated(const CMedium &comMedium) 176 { 177 /* Store the ID of the newly created medium: */ 178 m_uMediumID = comMedium.GetId(); 179 180 /* Close the dialog now: */ 181 QDialog::accept(); 182 } 183 175 184 void UIFDCreationDialog::sltPathChanged(const QString &strPath) 176 185 { … … 180 189 if (m_pButtonBox && m_pButtonBox->button(QDialogButtonBox::Ok)) 181 190 m_pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(fIsFileUnique); 182 }183 184 bool UIFDCreationDialog::checkFilePath(const QString &strPath) const185 {186 return !QFileInfo(strPath).exists();187 }188 189 void UIFDCreationDialog::sltHandleMediumCreated(const CMedium &comMedium)190 {191 /* Store the ID of the newly created medium: */192 m_uMediumID = comMedium.GetId();193 194 /* Close the dialog now: */195 QDialog::accept();196 191 } 197 192 … … 312 307 return strDefaultFilePath; 313 308 } 309 310 bool UIFDCreationDialog::checkFilePath(const QString &strPath) const 311 { 312 return !QFileInfo(strPath).exists(); 313 } 314 315 /* static */ 316 QVector<CMediumFormat> UIFDCreationDialog::getFormatsForDeviceType(KDeviceType enmDeviceType) 317 { 318 CSystemProperties comSystemProperties = uiCommon().virtualBox().GetSystemProperties(); 319 QVector<CMediumFormat> mediumFormats = comSystemProperties.GetMediumFormats(); 320 QVector<CMediumFormat> formatList; 321 for (int i = 0; i < mediumFormats.size(); ++i) 322 { 323 /* File extensions */ 324 QVector<QString> fileExtensions; 325 QVector<KDeviceType> deviceTypes; 326 327 mediumFormats[i].DescribeFileExtensions(fileExtensions, deviceTypes); 328 if (deviceTypes.contains(enmDeviceType)) 329 formatList.push_back(mediumFormats[i]); 330 } 331 return formatList; 332 } -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIFDCreationDialog.h
r98103 r103338 39 39 #include "QIWithRetranslateUI.h" 40 40 41 /* COM includes: */ 42 #include "COMEnums.h" 43 #include "CMediumFormat.h" 44 41 45 /* Forward declarations: */ 42 46 class QCheckBox; … … 70 74 * returns the UUID of the newly created medium if successful, a null QUuid otherwise.*/ 71 75 static QUuid createFloppyDisk(QWidget *pParent, const QString &strDefaultFolder = QString(), 72 const QString &strMachineName = QString()); 73 76 const QString &strMachineName = QString()); 74 77 75 78 public slots: 76 79 77 80 /** Creates the floppy disc image, asynchronously. */ 78 virtual void accept() /* override final */;81 virtual void accept() RT_OVERRIDE; 79 82 80 83 protected: 81 84 82 85 /** Handles translation event. */ 83 virtual void retranslateUi() /* override final */;86 virtual void retranslateUi() RT_OVERRIDE; 84 87 85 88 private slots: … … 109 112 bool checkFilePath(const QString &strPath) const; 110 113 114 /** Returns a list of formats for certain @a enmDeviceType. */ 115 static QVector<CMediumFormat> getFormatsForDeviceType(KDeviceType enmDeviceType); 116 111 117 /** Holds the default folder. */ 112 118 QString m_strDefaultFolder; -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDefs.cpp
r98103 r103338 135 135 return QString(); 136 136 } 137 138 QVector<CMediumFormat> UIMediumDefs::getFormatsForDeviceType(KDeviceType enmDeviceType)139 {140 CSystemProperties comSystemProperties = uiCommon().virtualBox().GetSystemProperties();141 QVector<CMediumFormat> mediumFormats = comSystemProperties.GetMediumFormats();142 QVector<CMediumFormat> formatList;143 for (int i = 0; i < mediumFormats.size(); ++i)144 {145 /* File extensions */146 QVector <QString> fileExtensions;147 QVector <KDeviceType> deviceTypes;148 149 mediumFormats[i].DescribeFileExtensions(fileExtensions, deviceTypes);150 if (deviceTypes.contains(enmDeviceType))151 formatList.push_back(mediumFormats[i]);152 }153 return formatList;154 } -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDefs.h
r98103 r103338 40 40 /* COM includes: */ 41 41 #include "COMEnums.h" 42 #include "CVirtualBox.h"43 42 44 43 /* Other VBox includes: */ … … 89 88 /** Returns the first file extension of the list of file extension support for the @a enmDeviceType. */ 90 89 QString getPreferredExtensionForMedium(KDeviceType enmDeviceType); 91 QVector<CMediumFormat> getFormatsForDeviceType(KDeviceType enmDeviceType);92 90 } 93 91 /* Using this namespace globally: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIStorageSettingsEditor.h
r103309 r103338 31 31 # pragma once 32 32 #endif 33 34 /* Qt includes: */ 35 #include <QUuid> 33 36 34 37 /* GUI includes: */
Note:
See TracChangeset
for help on using the changeset viewer.