Changeset 72822 in vbox
- Timestamp:
- Jul 3, 2018 1:43:06 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
-
globals/VBoxGlobal.cpp (modified) (7 diffs)
-
globals/VBoxGlobal.h (modified) (1 diff)
-
medium/UIMediumDefs.cpp (modified) (2 diffs)
-
medium/UIMediumDefs.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r72821 r72822 90 90 # include "CExtPackManager.h" 91 91 # include "CMachine.h" 92 # include "CSystemProperties.h"93 92 # include "CUSBDevice.h" 94 93 # include "CUSBDeviceFilters.h" … … 104 103 # include "CHostUSBDevice.h" 105 104 # include "CHostVideoInputDevice.h" 106 # include "CMediumFormat.h"107 105 # include "CSharedFolder.h" 108 106 # include "CConsole.h" … … 179 177 /* Namespaces: */ 180 178 using namespace UIExtraDataDefs; 179 using namespace UIMediumDefs; 181 180 182 181 … … 2415 2414 } 2416 2415 2417 QList<QPair<QString, QString> > VBoxGlobal::MediumBackends(KDeviceType enmType) const2418 {2419 /* Prepare a list of pairs with the form <tt>{"Backend Name", "*.suffix1 .suffix2 ..."}</tt>. */2420 CSystemProperties comSystemProperties = virtualBox().GetSystemProperties();2421 QVector<CMediumFormat> mediumFormats = comSystemProperties.GetMediumFormats();2422 QList< QPair<QString, QString> > backendPropList;2423 for (int i = 0; i < mediumFormats.size(); ++i)2424 {2425 /* File extensions */2426 QVector <QString> fileExtensions;2427 QVector <KDeviceType> deviceTypes;2428 2429 mediumFormats[i].DescribeFileExtensions(fileExtensions, deviceTypes);2430 2431 QStringList f;2432 for (int a = 0; a < fileExtensions.size(); ++a)2433 if (deviceTypes[a] == enmType)2434 f << QString("*.%1").arg(fileExtensions[a]);2435 /* Create a pair out of the backend description and all suffix's. */2436 if (!f.isEmpty())2437 backendPropList << QPair<QString, QString>(mediumFormats[i].GetName(), f.join(" "));2438 }2439 return backendPropList;2440 }2441 2442 /* static */2443 QList<QPair<QString, QString> > VBoxGlobal::HDDBackends() const2444 {2445 return MediumBackends(KDeviceType_HardDisk);2446 }2447 2448 /* static */2449 QList<QPair<QString, QString> > VBoxGlobal::DVDBackends() const2450 {2451 return MediumBackends(KDeviceType_DVD);2452 }2453 2454 /* static */2455 QList<QPair<QString, QString> > VBoxGlobal::FloppyBackends() const2456 {2457 return MediumBackends(KDeviceType_Floppy);2458 }2459 2460 2416 void VBoxGlobal::startMediumEnumeration() 2461 2417 { … … 2626 2582 case UIMediumType_HardDisk: 2627 2583 { 2628 filters = HDDBackends( );2584 filters = HDDBackends(virtualBox()); 2629 2585 strTitle = tr("Please choose a virtual hard disk file"); 2630 2586 allType = tr("All virtual hard disk files (%1)"); … … 2638 2594 case UIMediumType_DVD: 2639 2595 { 2640 filters = DVDBackends( );2596 filters = DVDBackends(virtualBox()); 2641 2597 strTitle = tr("Please choose a virtual optical disk file"); 2642 2598 allType = tr("All virtual optical disk files (%1)"); … … 2650 2606 case UIMediumType_Floppy: 2651 2607 { 2652 filters = FloppyBackends( );2608 filters = FloppyBackends(virtualBox()); 2653 2609 strTitle = tr("Please choose a virtual floppy disk file"); 2654 2610 allType = tr("All virtual floppy disk files (%1)"); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r72821 r72822 475 475 /** @name COM: Virtual Media stuff. 476 476 * @{ */ 477 /** Returns medium formats which are currently supported by VirtualBox for the given @a enmDeviceType. */478 QList<QPair<QString, QString> > MediumBackends(KDeviceType enmDeviceType) const;479 /** Returns which hard disk formats are currently supported by VirtualBox. */480 QList<QPair<QString, QString> > HDDBackends() const;481 /** Returns which optical disk formats are currently supported by VirtualBox. */482 QList<QPair<QString, QString> > DVDBackends() const;483 /** Returns which floppy disk formats are currently supported by VirtualBox. */484 QList<QPair<QString, QString> > FloppyBackends() const;485 486 477 /** Starts medium enumeration. */ 487 478 void startMediumEnumeration(); -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDefs.cpp
r69500 r72822 22 22 /* GUI includes: */ 23 23 # include "UIMediumDefs.h" 24 25 /* COM includes: */ 26 # include "CMediumFormat.h" 27 # include "CSystemProperties.h" 28 # include "CVirtualBox.h" 24 29 25 30 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ … … 60 65 } 61 66 67 QList<QPair<QString, QString> > UIMediumDefs::MediumBackends(const CVirtualBox &comVBox, KDeviceType enmType) 68 { 69 /* Prepare a list of pairs with the form <tt>{"Backend Name", "*.suffix1 .suffix2 ..."}</tt>. */ 70 const CSystemProperties comSystemProperties = comVBox.GetSystemProperties(); 71 QVector<CMediumFormat> mediumFormats = comSystemProperties.GetMediumFormats(); 72 QList<QPair<QString, QString> > backendPropList; 73 for (int i = 0; i < mediumFormats.size(); ++i) 74 { 75 /* Acquire file extensions & device types: */ 76 QVector<QString> fileExtensions; 77 QVector<KDeviceType> deviceTypes; 78 mediumFormats[i].DescribeFileExtensions(fileExtensions, deviceTypes); 79 80 /* Compose filters list: */ 81 QStringList filters; 82 for (int iExtensionIndex = 0; iExtensionIndex < fileExtensions.size(); ++iExtensionIndex) 83 if (deviceTypes[iExtensionIndex] == enmType) 84 filters << QString("*.%1").arg(fileExtensions[iExtensionIndex]); 85 /* Create a pair out of the backend description and all suffix's. */ 86 if (!filters.isEmpty()) 87 backendPropList << QPair<QString, QString>(mediumFormats[i].GetName(), filters.join(" ")); 88 } 89 return backendPropList; 90 } 91 92 QList<QPair<QString, QString> > UIMediumDefs::HDDBackends(const CVirtualBox &comVBox) 93 { 94 return MediumBackends(comVBox, KDeviceType_HardDisk); 95 } 96 97 QList<QPair<QString, QString> > UIMediumDefs::DVDBackends(const CVirtualBox &comVBox) 98 { 99 return MediumBackends(comVBox, KDeviceType_DVD); 100 } 101 102 QList<QPair<QString, QString> > UIMediumDefs::FloppyBackends(const CVirtualBox &comVBox) 103 { 104 return MediumBackends(comVBox, KDeviceType_Floppy); 105 } -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDefs.h
r72821 r72822 27 27 /* COM includes: */ 28 28 #include "COMEnums.h" 29 #include "CVirtualBox.h" 29 30 30 31 /* Other VBox includes: */ 31 32 #include <VBox/com/defs.h> 33 34 /* Forward declarations: */ 35 class CVirtualBox; 32 36 33 37 … … 58 62 /** Converts global medium type (KDeviceType) to local (UIMediumType). */ 59 63 SHARED_LIBRARY_STUFF UIMediumType mediumTypeToLocal(KDeviceType globalType); 60 61 64 /** Convert local medium type (UIMediumType) to global (KDeviceType). */ 62 65 SHARED_LIBRARY_STUFF KDeviceType mediumTypeToGlobal(UIMediumType localType); 66 67 /** Returns medium formats which are currently supported by @a comVBox for the given @a enmDeviceType. */ 68 QList<QPair<QString, QString> > MediumBackends(const CVirtualBox &comVBox, KDeviceType enmDeviceType); 69 /** Returns which hard disk formats are currently supported by @a comVBox. */ 70 QList<QPair<QString, QString> > HDDBackends(const CVirtualBox &comVBox); 71 /** Returns which optical disk formats are currently supported by @a comVBox. */ 72 QList<QPair<QString, QString> > DVDBackends(const CVirtualBox &comVBox); 73 /** Returns which floppy disk formats are currently supported by @a comVBox. */ 74 QList<QPair<QString, QString> > FloppyBackends(const CVirtualBox &comVBox); 63 75 } 64 76 /* Using this namespace globally: */
Note:
See TracChangeset
for help on using the changeset viewer.

