VirtualBox

儲存庫 vbox 的更動 46350


忽略:
時間撮記:
2013-5-31 下午08:12:02 (11 年 以前)
作者:
vboxsync
訊息:

The GUI an its assumptions... Fixed assertion due to missing OS icon info for the new type and fixed the ordering.

位置:
trunk/src/VBox
檔案:
修改 2 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r46058 r46350  
    699699 *  IVirtualBox corresponding to every family id.
    700700 */
    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];
     701QList<CGuestOSType> VBoxGlobal::vmGuestOSFamilyList() const
     702{
     703    QList<CGuestOSType> result;
     704    for (int i = 0; i < mFamilyIDs.size(); ++i)
     705        result << mTypes[i][0];
    706706    return result;
    707707}
     
    711711 *  IVirtualBox corresponding to passed family id.
    712712 */
    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>();
     713QList<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>();
    718718}
    719719
     
    721721 *  Returns the icon corresponding to the given guest OS type id.
    722722 */
    723 QPixmap VBoxGlobal::vmGuestOSTypeIcon (const QString &aTypeId) const
     723QPixmap VBoxGlobal::vmGuestOSTypeIcon(const QString &aTypeId) const
    724724{
    725725    static const QPixmap none;
    726     QPixmap *p = mOsTypeIcons.value (aTypeId);
    727     AssertMsg (p, ("Icon for type '%s' must be defined.", aTypeId.toLatin1().constData()));
     726    QPixmap *p = mOsTypeIcons.value(aTypeId);
     727    AssertMsg(p, ("Icon for type '%s' must be defined.", aTypeId.toLatin1().constData()));
    728728    return p ? *p : none;
    729729}
     
    734734 *  If the index is invalid a null object is returned.
    735735 */
    736 CGuestOSType VBoxGlobal::vmGuestOSType (const QString &aTypeId,
     736CGuestOSType VBoxGlobal::vmGuestOSType(const QString &aTypeId,
    737737             const QString &aFamilyId /* = QString::null */) const
    738738{
     
    40304030    CGuestOSTypeVector coll = mVBox.GetGuestOSTypes();
    40314031    int osTypeCount = coll.size();
    4032     AssertMsg (osTypeCount > 0, ("Number of OS types must not be zero"));
     4032    AssertMsg(osTypeCount > 0, ("Number of OS types must not be zero"));
    40334033    if (osTypeCount > 0)
    40344034    {
    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)
    40474043            {
    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);
    40504052            }
    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        }
    40614054    }
    40624055
    40634056    /* Fill in OS type icon dictionary. */
    4064     static const char *kOSTypeIcons [][2] =
     4057    static const char * const s_kOSTypeIcons[][2] =
    40654058    {
    40664059        {"Other",           ":/os_other.png"},
     4060        {"Other_64",        ":/os_other.png"}, /// @todo os_other_64.png.
    40674061        {"DOS",             ":/os_dos.png"},
    40684062        {"Netware",         ":/os_netware.png"},
     
    40884082        {"Windows2012_64",  ":/os_win2k12_64.png"},
    40894083        {"WindowsNT",       ":/os_win_other.png"},
     4084        {"WindowsNT_64",    ":/os_win_other.png"}, /// @todo os_win_other_64.png
    40904085        {"OS2Warp3",        ":/os_os2warp3.png"},
    40914086        {"OS2Warp4",        ":/os_os2warp4.png"},
     
    41214116        {"Oracle_64",       ":/os_oracle_64.png"},
    41224117        {"Linux",           ":/os_linux_other.png"},
     4118        {"Linux_64",        ":/os_linux_other.png"}, /// @todo os_linux_other_64.png
    41234119        {"FreeBSD",         ":/os_freebsd.png"},
    41244120        {"FreeBSD_64",      ":/os_freebsd_64.png"},
     
    41374133        {"JRockitVE",       ":/os_jrockitve.png"},
    41384134    };
    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]));
    41434138    }
    41444139
  • trunk/src/VBox/Main/src-all/Global.cpp

    r46341 r46350  
    2727const Global::OSType Global::sOSTypes[] =
    2828{
    29     /* NOTE1: we assume that unknown is always the first entry!
     29    /* NOTE1: we assume that unknown is always the first two entries!
    3030     * NOTE2: please use powers of 2 when specifying the size of harddisks since
    3131     *        '2GB' looks better than '1.95GB' (= 2000MB) */
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette