VirtualBox

Changeset 102102 in vbox


Ignore:
Timestamp:
Nov 15, 2023 1:35:02 PM (15 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10535. Using API properties rather than string comparison to determine verlay string.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/globals
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSType.cpp

    r101593 r102102  
    2727
    2828/* GUI includes: */
     29#include "UICommon.h"
    2930#include "UIGuestOSType.h"
    3031
     
    195196}
    196197
     198bool UIGuestOSTypeManager::is64Bit(const QString &strTypeId) const
     199{
     200    return m_guestOSTypes.value(m_typeIdIndexMap.value(strTypeId, -1)).is64Bit();
     201}
     202
     203KPlatformArchitecture UIGuestOSTypeManager::getPlatformArchitecture(const QString &strTypeId) const
     204{
     205    return m_guestOSTypes.value(m_typeIdIndexMap.value(strTypeId, -1)).getPlatformArchitecture();
     206}
     207
    197208/* static */
    198209bool UIGuestOSTypeManager::isDOSType(const QString &strOSTypeId)
     
    321332    return KStorageControllerType_Null;
    322333}
     334
     335bool UIGuestOSType::is64Bit() const
     336{
     337    if (m_comGuestOSType.isOk())
     338        return m_comGuestOSType.GetIs64Bit();
     339    return false;
     340}
     341
     342KPlatformArchitecture UIGuestOSType::getPlatformArchitecture() const
     343{
     344    if (m_comGuestOSType.isOk())
     345        return m_comGuestOSType.GetPlatformArchitecture();
     346    return KPlatformArchitecture_Max;
     347}
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSType.h

    r101519 r102102  
    7070        KGraphicsControllerType getRecommendedGraphicsController() const;
    7171        KStorageControllerType  getRecommendedDVDStorageController() const;
     72        bool                    is64Bit() const;
     73        KPlatformArchitecture   getPlatformArchitecture() const;
    7274    /** @} */
    7375
     
    136138        bool                    isLinux(const QString &strTypeId) const;
    137139        bool                    isWindows(const QString &strTypeId) const;
     140        bool                    is64Bit(const QString &strOSTypeId) const;
     141        KPlatformArchitecture   getPlatformArchitecture(const QString &strTypeId) const;
    138142    /** @} */
    139143
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIIconPool.cpp

    r101590 r102102  
    3535
    3636/* GUI includes: */
     37#include "UICommon.h"
    3738#include "UIIconPool.h"
    3839#include "UIExtraDataManager.h"
     40#include "UIGuestOSType.h"
    3941#include "UIModalWindowManager.h"
    4042
     
    781783
    782784/* static */
    783 QString UIIconPoolGeneral::determineOSArchString(const QString &osTypeId)
    784 {
    785     if (osTypeId.contains("_x64") || osTypeId.contains("_64"))
    786         return QString("x64");
    787     else if (osTypeId.contains("arm32"))
    788         return QString("A32");
    789     else if (osTypeId.contains("arm64"))
    790         return QString("A64");
    791     return QString("32");
     785QString UIIconPoolGeneral::determineOSArchString(const QString &strOSTypeId)
     786{
     787    bool fIs64Bit = uiCommon().guestOSTypeManager().is64Bit(strOSTypeId);
     788    KPlatformArchitecture enmPlatformArchitecture = uiCommon().guestOSTypeManager().getPlatformArchitecture(strOSTypeId);
     789
     790    if (enmPlatformArchitecture == KPlatformArchitecture_ARM)
     791    {
     792        if (fIs64Bit)
     793            return QString("A64");
     794        else
     795            return QString("A32");
     796    }
     797    else if (enmPlatformArchitecture == KPlatformArchitecture_x86)
     798    {
     799        if (fIs64Bit)
     800            return QString("x64");
     801        else
     802            return QString("32");
     803    }
     804    return QString();
    792805}
    793806
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIIconPool.h

    r101590 r102102  
    177177    static void overlayArchitectureTextOnPixmap(const QString &strArch, QPixmap &pixmap);
    178178    /** Returns the architecture text we overlay on guest OS type id icon.*/
    179     static QString determineOSArchString(const QString &osTypeId);
     179    static QString determineOSArchString(const QString &strOSTypeId);
    180180    /** Holds the singleton instance. */
    181181    static UIIconPoolGeneral *s_pInstance;
Note: See TracChangeset for help on using the changeset viewer.

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