Changeset 72821 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jul 3, 2018 11:57:53 AM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
r71630 r72821 28 28 #include "UIDefs.h" 29 29 #include "UILibraryDefs.h" 30 #include "UIMediumDefs.h" 30 31 #include "UIExtraDataDefs.h" 31 32 … … 108 109 template<> SHARED_LIBRARY_STUFF bool canConvert<InformationElementType>(); 109 110 template<> SHARED_LIBRARY_STUFF bool canConvert<MaxGuestResolutionPolicy>(); 111 template<> SHARED_LIBRARY_STUFF bool canConvert<UIMediumFormat>(); 110 112 111 113 … … 212 214 template<> SHARED_LIBRARY_STUFF QString toInternalString(const MaxGuestResolutionPolicy &enmMaxGuestResolutionPolicy); 213 215 template<> SHARED_LIBRARY_STUFF MaxGuestResolutionPolicy fromInternalString<MaxGuestResolutionPolicy>(const QString &strMaxGuestResolutionPolicy); 216 template<> SHARED_LIBRARY_STUFF QString toString(const UIMediumFormat &enmUIMediumFormat); 217 template<> SHARED_LIBRARY_STUFF QString toInternalString(const UIMediumFormat &enmUIMediumFormat); 218 template<> SHARED_LIBRARY_STUFF UIMediumFormat fromInternalString<UIMediumFormat>(const QString &strUIMediumFormat); 214 219 215 220 -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r71427 r72821 73 73 template<> bool canConvert<InformationElementType>() { return true; } 74 74 template<> bool canConvert<MaxGuestResolutionPolicy>() { return true; } 75 template<> bool canConvert<UIMediumFormat>() { return true; } 75 76 76 77 … … 1858 1859 } 1859 1860 1861 /* QString <= UIMediumFormat: */ 1862 template<> QString toString(const UIMediumFormat &enmUIMediumFormat) 1863 { 1864 QString strResult; 1865 switch (enmUIMediumFormat) 1866 { 1867 case UIMediumFormat_VDI: strResult = QApplication::translate("VBoxGlobal", "VDI (VirtualBox Disk Image)", "UIMediumFormat"); break; 1868 case UIMediumFormat_VMDK: strResult = QApplication::translate("VBoxGlobal", "VMDK (Virtual Machine Disk)", "UIMediumFormat"); break; 1869 case UIMediumFormat_VHD: strResult = QApplication::translate("VBoxGlobal", "VHD (Virtual Hard Disk)", "UIMediumFormat"); break; 1870 case UIMediumFormat_Parallels: strResult = QApplication::translate("VBoxGlobal", "HDD (Parallels Hard Disk)", "UIMediumFormat"); break; 1871 case UIMediumFormat_QED: strResult = QApplication::translate("VBoxGlobal", "QED (QEMU enhanced disk)", "UIMediumFormat"); break; 1872 case UIMediumFormat_QCOW: strResult = QApplication::translate("VBoxGlobal", "QCOW (QEMU Copy-On-Write)", "UIMediumFormat"); break; 1873 default: 1874 { 1875 AssertMsgFailed(("No text for medium format=%d", enmUIMediumFormat)); 1876 break; 1877 } 1878 } 1879 return strResult; 1880 } 1881 1882 /* QString <= UIMediumFormat: */ 1883 template<> QString toInternalString(const UIMediumFormat &enmUIMediumFormat) 1884 { 1885 QString strResult; 1886 switch (enmUIMediumFormat) 1887 { 1888 case UIMediumFormat_VDI: strResult = "VDI"; break; 1889 case UIMediumFormat_VMDK: strResult = "VMDK"; break; 1890 case UIMediumFormat_VHD: strResult = "VHD"; break; 1891 case UIMediumFormat_Parallels: strResult = "Parallels"; break; 1892 case UIMediumFormat_QED: strResult = "QED"; break; 1893 case UIMediumFormat_QCOW: strResult = "QCOW"; break; 1894 default: 1895 { 1896 AssertMsgFailed(("No text for medium format=%d", enmUIMediumFormat)); 1897 break; 1898 } 1899 } 1900 return strResult; 1901 } 1902 1903 /* UIMediumFormat <= QString: */ 1904 template<> UIMediumFormat fromInternalString<UIMediumFormat>(const QString &strUIMediumFormat) 1905 { 1906 /* Here we have some fancy stuff allowing us 1907 * to search through the keys using 'case-insensitive' rule: */ 1908 QStringList keys; QList<UIMediumFormat> values; 1909 keys << "VDI"; values << UIMediumFormat_VDI; 1910 keys << "VMDK"; values << UIMediumFormat_VMDK; 1911 keys << "VHD"; values << UIMediumFormat_VHD; 1912 keys << "Parallels"; values << UIMediumFormat_Parallels; 1913 keys << "QED"; values << UIMediumFormat_QED; 1914 keys << "QCOW"; values << UIMediumFormat_QCOW; 1915 /* VDI format for unknown words: */ 1916 if (!keys.contains(strUIMediumFormat, Qt::CaseInsensitive)) 1917 return UIMediumFormat_VDI; 1918 /* Corresponding format for known words: */ 1919 return values.at(keys.indexOf(QRegExp(strUIMediumFormat, Qt::CaseInsensitive))); 1920 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r72692 r72821 1065 1065 1066 1066 /* static */ 1067 QString VBoxGlobal::fullMediumFormatName(const QString &strBaseMediumFormatName)1068 {1069 if (strBaseMediumFormatName == "VDI")1070 return tr("VDI (VirtualBox Disk Image)");1071 else if (strBaseMediumFormatName == "VMDK")1072 return tr("VMDK (Virtual Machine Disk)");1073 else if (strBaseMediumFormatName == "VHD")1074 return tr("VHD (Virtual Hard Disk)");1075 else if (strBaseMediumFormatName == "Parallels")1076 return tr("HDD (Parallels Hard Disk)");1077 else if (strBaseMediumFormatName == "QED")1078 return tr("QED (QEMU enhanced disk)");1079 else if (strBaseMediumFormatName == "QCOW")1080 return tr("QCOW (QEMU Copy-On-Write)");1081 return strBaseMediumFormatName;1082 }1083 1084 /* static */1085 1067 QStringList VBoxGlobal::COMPortNames() 1086 1068 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r72692 r72821 328 328 * @param cDecimal Brings the number of decimal digits in result. */ 329 329 static QString formatSize(quint64 uSize, uint cDecimal = 2, FormatSize enmMode = FormatSize_Round); 330 331 /** Returns full medium-format name for the given @a strBaseMediumFormatName. */332 static QString fullMediumFormatName(const QString &strBaseMediumFormatName);333 330 334 331 /** Returns the list of the standard COM port names (i.e. "COMx"). */ -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDefs.h
r71630 r72821 31 31 #include <VBox/com/defs.h> 32 32 33 34 /** Medium formats. */ 35 enum UIMediumFormat 36 { 37 UIMediumFormat_VDI, 38 UIMediumFormat_VMDK, 39 UIMediumFormat_VHD, 40 UIMediumFormat_Parallels, 41 UIMediumFormat_QED, 42 UIMediumFormat_QCOW, 43 }; 33 44 34 45 /** UIMediumDefs namespace. */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic2.cpp
r71027 r72821 26 26 27 27 /* GUI includes: */ 28 # include "UIConverter.h" 28 29 # include "UIWizardCloneVDPageBasic2.h" 29 30 # include "UIWizardCloneVD.h" … … 169 170 { 170 171 QAbstractButton *pButton = buttons[i]; 171 pButton->setText(VBoxGlobal::fullMediumFormatName(m_formatNames[m_pFormatButtonGroup->id(pButton)])); 172 UIMediumFormat enmFormat = gpConverter->fromInternalString<UIMediumFormat>(m_formatNames[m_pFormatButtonGroup->id(pButton)]); 173 pButton->setText(gpConverter->toString(enmFormat)); 172 174 } 173 175 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp
r71948 r72821 32 32 /* GUI includes: */ 33 33 # include "QIToolButton.h" 34 # include "UIConverter.h" 34 35 # include "UIIconPool.h" 35 36 # include "UIMediaComboBox.h" … … 265 266 { 266 267 QAbstractButton *pButton = buttons[i]; 267 pButton->setText(VBoxGlobal::fullMediumFormatName(m_formatNames[m_pFormatButtonGroup->id(pButton)])); 268 UIMediumFormat enmFormat = gpConverter->fromInternalString<UIMediumFormat>(m_formatNames[m_pFormatButtonGroup->id(pButton)]); 269 pButton->setText(gpConverter->toString(enmFormat)); 268 270 } 269 271 m_pVariantCnt->setTitle(UIWizardCloneVD::tr("Storage on physical hard disk")); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic1.cpp
r71027 r72821 26 26 27 27 /* GUI includes: */ 28 # include "UIConverter.h" 28 29 # include "UIWizardNewVDPageBasic1.h" 29 30 # include "UIWizardNewVD.h" … … 163 164 { 164 165 QAbstractButton *pButton = buttons[i]; 165 pButton->setText(VBoxGlobal::fullMediumFormatName(m_formatNames[m_pFormatButtonGroup->id(pButton)])); 166 UIMediumFormat enmFormat = gpConverter->fromInternalString<UIMediumFormat>(m_formatNames[m_pFormatButtonGroup->id(pButton)]); 167 pButton->setText(gpConverter->toString(enmFormat)); 166 168 } 167 169 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp
r71027 r72821 33 33 34 34 /* GUI includes: */ 35 # include "UIConverter.h" 35 36 # include "UIWizardNewVDPageExpert.h" 36 37 # include "UIWizardNewVD.h" … … 229 230 { 230 231 QAbstractButton *pButton = buttons[i]; 231 pButton->setText(VBoxGlobal::fullMediumFormatName(m_formatNames[m_pFormatButtonGroup->id(pButton)])); 232 UIMediumFormat enmFormat = gpConverter->fromInternalString<UIMediumFormat>(m_formatNames[m_pFormatButtonGroup->id(pButton)]); 233 pButton->setText(gpConverter->toString(enmFormat)); 232 234 } 233 235 m_pVariantCnt->setTitle(UIWizardNewVD::tr("Storage on physical hard disk"));
Note:
See TracChangeset
for help on using the changeset viewer.