儲存庫 vbox 的更動 46350
- 時間撮記:
- 2013-5-31 下午08:12:02 (11 年 以前)
- 位置:
- trunk/src/VBox
- 檔案:
-
- 修改 2 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r46058 r46350 699 699 * IVirtualBox corresponding to every family id. 700 700 */ 701 QList 702 { 703 QList 704 for (int i = 0 ; i < mFamilyIDs.size(); ++i)705 result << mTypes 701 QList<CGuestOSType> VBoxGlobal::vmGuestOSFamilyList() const 702 { 703 QList<CGuestOSType> result; 704 for (int i = 0; i < mFamilyIDs.size(); ++i) 705 result << mTypes[i][0]; 706 706 return result; 707 707 } … … 711 711 * IVirtualBox corresponding to passed family id. 712 712 */ 713 QList <CGuestOSType> VBoxGlobal::vmGuestOSTypeList(const QString &aFamilyId) const714 { 715 AssertMsg (mFamilyIDs.contains(aFamilyId), ("Family ID incorrect: '%s'.", aFamilyId.toLatin1().constData()));716 return mFamilyIDs.contains 717 mTypes [mFamilyIDs.indexOf (aFamilyId)] : QList<CGuestOSType>();713 QList<CGuestOSType> VBoxGlobal::vmGuestOSTypeList(const QString &aFamilyId) const 714 { 715 AssertMsg(mFamilyIDs.contains(aFamilyId), ("Family ID incorrect: '%s'.", aFamilyId.toLatin1().constData())); 716 return mFamilyIDs.contains(aFamilyId) ? 717 mTypes[mFamilyIDs.indexOf(aFamilyId)] : QList<CGuestOSType>(); 718 718 } 719 719 … … 721 721 * Returns the icon corresponding to the given guest OS type id. 722 722 */ 723 QPixmap VBoxGlobal::vmGuestOSTypeIcon 723 QPixmap VBoxGlobal::vmGuestOSTypeIcon(const QString &aTypeId) const 724 724 { 725 725 static const QPixmap none; 726 QPixmap *p = mOsTypeIcons.value 727 AssertMsg 726 QPixmap *p = mOsTypeIcons.value(aTypeId); 727 AssertMsg(p, ("Icon for type '%s' must be defined.", aTypeId.toLatin1().constData())); 728 728 return p ? *p : none; 729 729 } … … 734 734 * If the index is invalid a null object is returned. 735 735 */ 736 CGuestOSType VBoxGlobal::vmGuestOSType 736 CGuestOSType VBoxGlobal::vmGuestOSType(const QString &aTypeId, 737 737 const QString &aFamilyId /* = QString::null */) const 738 738 { … … 4030 4030 CGuestOSTypeVector coll = mVBox.GetGuestOSTypes(); 4031 4031 int osTypeCount = coll.size(); 4032 AssertMsg 4032 AssertMsg(osTypeCount > 0, ("Number of OS types must not be zero")); 4033 4033 if (osTypeCount > 0) 4034 4034 { 4035 /* Here we assume the 'Other' type is always the first, so we 4036 * remember it and will append it to the list when finished. */ 4037 CGuestOSType otherType = coll[0]; 4038 QString otherFamilyId (otherType.GetFamilyId()); 4039 4040 /* Fill the lists with all the available OS Types except 4041 * the 'Other' type, which will be appended. */ 4042 for (int i = 1; i < coll.size(); ++i) 4043 { 4044 CGuestOSType os = coll[i]; 4045 QString familyId (os.GetFamilyId()); 4046 if (!mFamilyIDs.contains (familyId)) 4035 /* Here we ASSUME the 'Other' types are always the first, so we 4036 * remember it and will append it to the list when finished. 4037 * We do a two pass, first adding the specific types, then the two 4038 * 'Other' types. */ 4039 for (int j = 0; j < 2; j++) 4040 { 4041 int cMax = j == 0 ? coll.size() : RT_MIN(2, coll.size()); 4042 for (int i = j == 0 ? 2 : 0; i < cMax; ++i) 4047 4043 { 4048 mFamilyIDs << familyId; 4049 mTypes << QList <CGuestOSType> (); 4044 CGuestOSType os = coll[i]; 4045 QString familyId(os.GetFamilyId()); 4046 if (!mFamilyIDs.contains(familyId)) 4047 { 4048 mFamilyIDs << familyId; 4049 mTypes << QList<CGuestOSType>(); 4050 } 4051 mTypes[mFamilyIDs.indexOf(familyId)].append(os); 4050 4052 } 4051 mTypes [mFamilyIDs.indexOf (familyId)].append (os); 4052 } 4053 4054 /* Append the 'Other' OS Type to the end of list. */ 4055 if (!mFamilyIDs.contains (otherFamilyId)) 4056 { 4057 mFamilyIDs << otherFamilyId; 4058 mTypes << QList <CGuestOSType> (); 4059 } 4060 mTypes [mFamilyIDs.indexOf (otherFamilyId)].append (otherType); 4053 } 4061 4054 } 4062 4055 4063 4056 /* Fill in OS type icon dictionary. */ 4064 static const char * kOSTypeIcons[][2] =4057 static const char * const s_kOSTypeIcons[][2] = 4065 4058 { 4066 4059 {"Other", ":/os_other.png"}, 4060 {"Other_64", ":/os_other.png"}, /// @todo os_other_64.png. 4067 4061 {"DOS", ":/os_dos.png"}, 4068 4062 {"Netware", ":/os_netware.png"}, … … 4088 4082 {"Windows2012_64", ":/os_win2k12_64.png"}, 4089 4083 {"WindowsNT", ":/os_win_other.png"}, 4084 {"WindowsNT_64", ":/os_win_other.png"}, /// @todo os_win_other_64.png 4090 4085 {"OS2Warp3", ":/os_os2warp3.png"}, 4091 4086 {"OS2Warp4", ":/os_os2warp4.png"}, … … 4121 4116 {"Oracle_64", ":/os_oracle_64.png"}, 4122 4117 {"Linux", ":/os_linux_other.png"}, 4118 {"Linux_64", ":/os_linux_other.png"}, /// @todo os_linux_other_64.png 4123 4119 {"FreeBSD", ":/os_freebsd.png"}, 4124 4120 {"FreeBSD_64", ":/os_freebsd_64.png"}, … … 4137 4133 {"JRockitVE", ":/os_jrockitve.png"}, 4138 4134 }; 4139 for (uint n = 0; n < SIZEOF_ARRAY (kOSTypeIcons); ++ n) 4140 { 4141 mOsTypeIcons.insert (kOSTypeIcons [n][0], 4142 new QPixmap (kOSTypeIcons [n][1])); 4135 for (uint n = 0; n < SIZEOF_ARRAY(s_kOSTypeIcons); ++ n) 4136 { 4137 mOsTypeIcons.insert(s_kOSTypeIcons[n][0], new QPixmap(s_kOSTypeIcons[n][1])); 4143 4138 } 4144 4139 -
trunk/src/VBox/Main/src-all/Global.cpp
r46341 r46350 27 27 const Global::OSType Global::sOSTypes[] = 28 28 { 29 /* NOTE1: we assume that unknown is always the first entry!29 /* NOTE1: we assume that unknown is always the first two entries! 30 30 * NOTE2: please use powers of 2 when specifying the size of harddisks since 31 31 * '2GB' looks better than '1.95GB' (= 2000MB) */
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器