VirtualBox

Changeset 101263 in vbox


Ignore:
Timestamp:
Sep 26, 2023 10:42:38 AM (14 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10523. Refactoring in machine setting related code to use UIGuestOSType instead of CGuestOSType.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
10 edited

Legend:

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

    r101253 r101263  
    218218    return 0;
    219219}
     220
     221KGraphicsControllerType UIGuestOSTypeII::getRecommendedGraphicsController() const
     222{
     223    if (m_comGuestOSType.isOk())
     224        return m_comGuestOSType.GetRecommendedGraphicsController();
     225    return KGraphicsControllerType_Null;
     226}
     227
     228bool UIGuestOSTypeII::operator==(const UIGuestOSTypeII &other)
     229{
     230    return m_comGuestOSType == other.m_comGuestOSType;
     231}
     232
     233bool UIGuestOSTypeII::operator!=(const UIGuestOSTypeII &other)
     234{
     235    return m_comGuestOSType != other.m_comGuestOSType;
     236}
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSTypeII.h

    r101253 r101263  
    9898        bool getRecommendedFloppy() const;
    9999        LONG64 getRecommendedHDD() const;
     100        KGraphicsControllerType getRecommendedGraphicsController() const;
    100101    /** @} */
    101102
    102103    bool isOk() const;
     104    bool operator==(const UIGuestOSTypeII &other);
     105    bool operator!=(const UIGuestOSTypeII &other);
    103106
    104107private:
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.cpp

    r101253 r101263  
    3535#include "QILineEdit.h"
    3636#include "UICommon.h"
    37 #include "UIGuestOSTypeII.h"
    3837#include "UIIconPool.h"
    3938#include "UIFilePathSelector.h"
     
    304303QString UINameAndSystemEditor::typeId() const
    305304{
    306     if (!m_pComboType)
    307         return QString();
    308305    return m_strTypeId;
    309306}
     
    329326// }
    330327
    331 CGuestOSType UINameAndSystemEditor::type() const
    332 {
    333     return uiCommon().vmGuestOSType(typeId(), familyId());
     328UIGuestOSTypeII UINameAndSystemEditor::type() const
     329{
     330    const UIGuestOSTypeManager * const pGuestOSTypeManager = uiCommon().guestOSTypeManager();
     331    AssertReturn(pGuestOSTypeManager, UIGuestOSTypeII());
     332    return pGuestOSTypeManager->findGuestTypeById(m_strTypeId);
    334333}
    335334
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.h

    r101242 r101263  
    3434/* GUI includes: */
    3535#include "UIEditor.h"
     36#include "UIGuestOSTypeII.h"
    3637
    3738/* COM includes: */
     
    130131
    131132    /** Returns the VM OS type. */
    132     CGuestOSType type() const;
     133    UIGuestOSTypeII type() const;
    133134
    134135    /** Passes the @p fError to QILineEdit::mark(bool) effectively marking it for error. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIVideoMemoryEditor.cpp

    r101011 r101263  
    4545    : UIEditor(pParent)
    4646    , m_iValue(0)
    47     , m_comGuestOSType(CGuestOSType())
     47    , m_guestOSType(UIGuestOSTypeII())
    4848    , m_cGuestScreenCount(1)
    4949    , m_enmGraphicsControllerType(KGraphicsControllerType_Null)
     
    8585}
    8686
    87 void UIVideoMemoryEditor::setGuestOSType(const CGuestOSType &comGuestOSType)
    88 {
    89     /* Update cached value and
    90      * requirements if value has changed: */
    91     if (m_comGuestOSType != comGuestOSType)
     87void UIVideoMemoryEditor::setGuestOSType(const UIGuestOSTypeII &guestOSType)
     88{
     89    /* Update cached value and
     90     * requirements if value has changed: */
     91    if (m_guestOSType != guestOSType)
    9292    {
    9393        /* Remember new guest OS type: */
    94         m_comGuestOSType = comGuestOSType;
     94        m_guestOSType = guestOSType;
    9595
    9696        /* Update requirements: */
     
    316316{
    317317    /* Make sure guest OS type is set: */
    318     if (m_comGuestOSType.isNull())
     318    if (!m_guestOSType.isOk())
    319319        return;
    320320
     
    323323
    324324    /* Get monitors count and recommended VRAM: */
    325     int iNeedMBytes = UICommon::requiredVideoMemory(m_comGuestOSType.GetId(), m_cGuestScreenCount) / _1M;
     325    int iNeedMBytes = UICommon::requiredVideoMemory(m_guestOSType.getId(), m_cGuestScreenCount) / _1M;
    326326    /* Adjust visible maximum VRAM to be no less than 128MB (if possible): */
    327327    if (m_iMaxVRAMVisible < 128 && m_iMaxVRAM >= 128)
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIVideoMemoryEditor.h

    r101011 r101263  
    3434/* GUI includes: */
    3535#include "UIEditor.h"
     36#include "UIGuestOSTypeII.h"
    3637
    3738/* COM includes: */
    3839#include "COMEnums.h"
    39 #include "CGuestOSType.h"
    4040
    4141/* Forward declarations: */
     
    6666
    6767    /** Defines @a comGuestOSType. */
    68     void setGuestOSType(const CGuestOSType &comGuestOSType);
     68    void setGuestOSType(const UIGuestOSTypeII &comGuestOSType);
    6969
    7070    /** Defines @a cGuestScreenCount. */
     
    118118     * @{ */
    119119        /** Holds the guest OS type ID. */
    120         CGuestOSType             m_comGuestOSType;
     120        UIGuestOSTypeII          m_guestOSType;
    121121        /** Holds the guest screen count. */
    122122        int                      m_cGuestScreenCount;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp

    r101231 r101263  
    294294
    295295UIMachineSettingsDisplay::UIMachineSettingsDisplay()
    296     : m_comGuestOSType(CGuestOSType())
     296    : m_guestOSType(CGuestOSType())
    297297#ifdef VBOX_WITH_3D_ACCELERATION
    298298    , m_fWddmModeSupported(false)
     
    322322}
    323323
    324 void UIMachineSettingsDisplay::setGuestOSType(CGuestOSType comGuestOSType)
     324void UIMachineSettingsDisplay::setGuestOSType(UIGuestOSTypeII guestOSType)
    325325{
    326326    /* Check if guest OS type changed: */
    327     if (m_comGuestOSType == comGuestOSType)
     327    if (m_guestOSType == guestOSType)
    328328        return;
    329329
    330330    /* Remember new guest OS type: */
    331     m_comGuestOSType = comGuestOSType;
    332     m_pEditorVideoMemorySize->setGuestOSType(m_comGuestOSType);
     331    m_guestOSType = guestOSType;
     332    m_pEditorVideoMemorySize->setGuestOSType(m_guestOSType);
    333333
    334334#ifdef VBOX_WITH_3D_ACCELERATION
    335335    /* Check if WDDM mode supported by the guest OS type: */
    336     const QString strGuestOSTypeId = m_comGuestOSType.isNotNull() ? m_comGuestOSType.GetId() : QString();
     336    const QString strGuestOSTypeId = m_guestOSType.isOk() ? m_guestOSType.getId() : QString();
    337337    m_fWddmModeSupported = UICommon::isWddmCompatibleOsType(strGuestOSTypeId);
    338338    m_pEditorVideoMemorySize->set3DAccelerationSupported(m_fWddmModeSupported);
    339339#endif /* VBOX_WITH_3D_ACCELERATION */
    340340    /* Acquire recommended graphics controller type: */
    341     m_enmGraphicsControllerTypeRecommended = m_comGuestOSType.GetRecommendedGraphicsController();
     341    m_enmGraphicsControllerTypeRecommended = m_guestOSType.getRecommendedGraphicsController();
    342342
    343343    /* Revalidate: */
     
    636636
    637637        /* Video RAM amount test: */
    638         if (shouldWeWarnAboutLowVRAM() && !m_comGuestOSType.isNull())
    639         {
    640             quint64 uNeedBytes = UICommon::requiredVideoMemory(m_comGuestOSType.GetId(), m_pEditorMonitorCount->value());
     638        if (shouldWeWarnAboutLowVRAM() && m_guestOSType.isOk())
     639        {
     640            quint64 uNeedBytes = UICommon::requiredVideoMemory(m_guestOSType.getId(), m_pEditorMonitorCount->value());
    641641
    642642            /* Basic video RAM amount test: */
     
    664664
    665665        /* Graphics controller type test: */
    666         if (!m_comGuestOSType.isNull())
     666        if (m_guestOSType.isOk())
    667667        {
    668668            if (graphicsControllerTypeCurrent() != graphicsControllerTypeRecommended())
     
    10271027    QStringList excludingOSList = QStringList()
    10281028        << "Other" << "DOS" << "Netware" << "L4" << "QNX" << "JRockitVE";
    1029     if (m_comGuestOSType.isNull() || excludingOSList.contains(m_comGuestOSType.GetId()))
     1029    if (!m_guestOSType.isOk() || excludingOSList.contains(m_guestOSType.getId()))
    10301030        fResult = false;
    10311031
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h

    r101231 r101263  
    3333
    3434/* GUI includes: */
     35#include "UIGuestOSTypeII.h"
    3536#include "UISettingsPage.h"
    36 
    37 /* COM includes: */
    38 #include "CGuestOSType.h"
    3937
    4038/* Forward declarations: */
     
    6563
    6664    /** Defines @a comGuestOSType. */
    67     void setGuestOSType(CGuestOSType comGuestOSType);
     65    void setGuestOSType(UIGuestOSTypeII comGuestOSType);
    6866
    6967#ifdef VBOX_WITH_3D_ACCELERATION
     
    150148    bool saveRecordingData();
    151149
    152     /** Holds the guest OS type ID. */
    153     CGuestOSType  m_comGuestOSType;
     150    /** Holds the guest OS type. */
     151    UIGuestOSTypeII  m_guestOSType;
    154152#ifdef VBOX_WITH_3D_ACCELERATION
    155153    /** Holds whether the guest OS supports WDDM. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp

    r101231 r101263  
    158158}
    159159
    160 CGuestOSType UIMachineSettingsGeneral::guestOSType() const
    161 {
    162     AssertPtrReturn(m_pEditorNameAndSystem, CGuestOSType());
     160UIGuestOSTypeII UIMachineSettingsGeneral::guestOSType() const
     161{
     162    AssertPtrReturn(m_pEditorNameAndSystem, UIGuestOSTypeII());
    163163    return m_pEditorNameAndSystem->type();
    164164}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h

    r101231 r101263  
    3333
    3434/* GUI includes: */
     35#include "UIGuestOSTypeII.h"
    3536#include "UISettingsPage.h"
    3637
     
    5859    virtual ~UIMachineSettingsGeneral() RT_OVERRIDE;
    5960
    60     /** Returns the VM OS type ID. */
    61     CGuestOSType guestOSType() const;
     61    /** Returns the VM OS type. */
     62    UIGuestOSTypeII guestOSType() const;
    6263
    6364protected:
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