VirtualBox

Ignore:
Timestamp:
Jul 19, 2013 2:16:54 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: Machine settings: System page: Cleanup/rework (part 4): Proper code order.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp

    r47255 r47264  
    4040    , m_fOHCIEnabled(false)
    4141{
    42     /* Apply UI decorations */
    43     Ui::UIMachineSettingsSystem::setupUi (this);
    44 
    45     /* Setup constants */
     42    /* Apply UI decorations: */
     43    Ui::UIMachineSettingsSystem::setupUi(this);
     44
     45    /* Setup constants: */
    4646    CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties();
    4747    uint hostCPUs = vboxGlobal().host().GetProcessorCount();
     
    197197    UIDataSettingsMachineSystem systemData;
    198198
     199    /* Load support flags: */
     200    systemData.m_fSupportedPAE = vboxGlobal().host().GetProcessorFeature(KProcessorFeature_PAE);
     201    systemData.m_fSupportedHwVirtEx = vboxGlobal().host().GetProcessorFeature(KProcessorFeature_HWVirtEx);
     202
     203    /* Load motherboard data: */
     204    systemData.m_iRAMSize = m_machine.GetMemorySize();
    199205    /* Load boot-items of current VM: */
    200206    QList<KDeviceType> usedBootItems;
     
    223229        }
    224230    }
    225     /* Gather other system data: */
    226     systemData.m_fPFHwVirtExSupported = vboxGlobal().host().GetProcessorFeature(KProcessorFeature_HWVirtEx);
    227     systemData.m_fPFPAESupported = vboxGlobal().host().GetProcessorFeature(KProcessorFeature_PAE);
    228     systemData.m_fIoApicEnabled = m_machine.GetBIOSSettings().GetIOAPICEnabled();
    229     systemData.m_fEFIEnabled = m_machine.GetFirmwareType() >= KFirmwareType_EFI && m_machine.GetFirmwareType() <= KFirmwareType_EFIDUAL;
    230     systemData.m_fUTCEnabled = m_machine.GetRTCUseUTC();
    231     systemData.m_fUseAbsHID = m_machine.GetPointingHIDType() == KPointingHIDType_USBTablet;
    232     systemData.m_fPAEEnabled = m_machine.GetCPUProperty(KCPUPropertyType_PAE);
    233     systemData.m_fHwVirtExEnabled = m_machine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled);
    234     systemData.m_fNestedPagingEnabled = m_machine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging);
    235     systemData.m_iRAMSize = m_machine.GetMemorySize();
    236     systemData.m_cCPUCount = systemData.m_fPFHwVirtExSupported ? m_machine.GetCPUCount() : 1;
    237     systemData.m_cCPUExecCap = m_machine.GetCPUExecutionCap();
     231    /* Load other motherboard data: */
    238232    systemData.m_chipsetType = m_machine.GetChipsetType();
     233    systemData.m_fEnabledIoApic = m_machine.GetBIOSSettings().GetIOAPICEnabled();
     234    systemData.m_fEnabledEFI = m_machine.GetFirmwareType() >= KFirmwareType_EFI && m_machine.GetFirmwareType() <= KFirmwareType_EFIDUAL;
     235    systemData.m_fEnabledUTC = m_machine.GetRTCUseUTC();
     236    systemData.m_fEnabledAbsoluteHID = m_machine.GetPointingHIDType() == KPointingHIDType_USBTablet;
     237
     238    /* Load CPU data: */
     239    systemData.m_cCPUCount = systemData.m_fSupportedHwVirtEx ? m_machine.GetCPUCount() : 1;
     240    systemData.m_iCPUExecCap = m_machine.GetCPUExecutionCap();
     241    systemData.m_fEnabledPAE = m_machine.GetCPUProperty(KCPUPropertyType_PAE);
     242
     243    /* Load acceleration data: */
     244    systemData.m_fEnabledHwVirtEx = m_machine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled);
     245    systemData.m_fEnabledNestedPaging = m_machine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging);
    239246
    240247    /* Cache system data: */
     
    252259    const UIDataSettingsMachineSystem &systemData = m_cache.base();
    253260
     261    /* Load motherboard data to page: */
     262    mSlMemory->setValue(systemData.m_iRAMSize);
    254263    /* Remove any old data in the boot view: */
    255264    QAbstractItemView *iv = qobject_cast <QAbstractItemView*> (mTwBootOrder);
     
    263272        mTwBootOrder->addItem(pItem);
    264273    }
    265     /* Load other system data to page: */
    266     mCbApic->setChecked(systemData.m_fIoApicEnabled);
    267     mCbEFI->setChecked(systemData.m_fEFIEnabled);
    268     mCbTCUseUTC->setChecked(systemData.m_fUTCEnabled);
    269     mCbUseAbsHID->setChecked(systemData.m_fUseAbsHID);
    270     mCbPae->setChecked(systemData.m_fPAEEnabled);
    271     mCbVirt->setChecked(systemData.m_fHwVirtExEnabled);
    272     mCbNestedPaging->setChecked(systemData.m_fNestedPagingEnabled);
    273     mSlMemory->setValue(systemData.m_iRAMSize);
    274     mSlCPU->setValue(systemData.m_cCPUCount);
    275     mSlCPUExecCap->setValue(systemData.m_cCPUExecCap);
     274    /* Load other motherboard data to page: */
    276275    int iChipsetPosition = mCbChipset->findData(systemData.m_chipsetType);
    277276    mCbChipset->setCurrentIndex(iChipsetPosition == -1 ? 0 : iChipsetPosition);
     277    mCbApic->setChecked(systemData.m_fEnabledIoApic);
     278    mCbEFI->setChecked(systemData.m_fEnabledEFI);
     279    mCbTCUseUTC->setChecked(systemData.m_fEnabledUTC);
     280    mCbUseAbsHID->setChecked(systemData.m_fEnabledAbsoluteHID);
     281
     282    /* Load CPU data to page: */
     283    mSlCPU->setValue(systemData.m_cCPUCount);
     284    mSlCPUExecCap->setValue(systemData.m_iCPUExecCap);
     285    mCbPae->setChecked(systemData.m_fEnabledPAE);
     286
     287    /* Load acceleration data to page: */
     288        mCbVirt->setChecked(systemData.m_fEnabledHwVirtEx);
     289    mCbNestedPaging->setChecked(systemData.m_fEnabledNestedPaging);
    278290
    279291    /* Polish page finally: */
     
    292304    UIDataSettingsMachineSystem systemData = m_cache.base();
    293305
    294     /* Gather system data: */
     306    /* Gather motherboard data: */
     307    systemData.m_iRAMSize = mSlMemory->value();
     308    /* Gather boot-table data: */
    295309    systemData.m_bootItems.clear();
    296310    for (int i = 0; i < mTwBootOrder->count(); ++i)
     
    302316        systemData.m_bootItems << data;
    303317    }
    304     systemData.m_fIoApicEnabled = mCbApic->isChecked() || mSlCPU->value() > 1 ||
     318    /* Gather other motherboard data: */
     319    systemData.m_chipsetType = (KChipsetType)mCbChipset->itemData(mCbChipset->currentIndex()).toInt();
     320    systemData.m_fEnabledIoApic = mCbApic->isChecked() || mSlCPU->value() > 1 ||
    305321                                  (KChipsetType)mCbChipset->itemData(mCbChipset->currentIndex()).toInt() == KChipsetType_ICH9;
    306     systemData.m_fEFIEnabled = mCbEFI->isChecked();
    307     systemData.m_fUTCEnabled = mCbTCUseUTC->isChecked();
    308     systemData.m_fUseAbsHID = mCbUseAbsHID->isChecked();
    309     systemData.m_fPAEEnabled = mCbPae->isChecked();
    310     systemData.m_fHwVirtExEnabled = mCbVirt->checkState() == Qt::Checked || mSlCPU->value() > 1;
    311     systemData.m_fNestedPagingEnabled = mCbNestedPaging->isChecked();
    312     systemData.m_iRAMSize = mSlMemory->value();
     322    systemData.m_fEnabledEFI = mCbEFI->isChecked();
     323    systemData.m_fEnabledUTC = mCbTCUseUTC->isChecked();
     324    systemData.m_fEnabledAbsoluteHID = mCbUseAbsHID->isChecked();
     325
     326    /* Gather CPU data: */
    313327    systemData.m_cCPUCount = mSlCPU->value();
    314     systemData.m_cCPUExecCap = mSlCPUExecCap->value();
    315     systemData.m_chipsetType = (KChipsetType)mCbChipset->itemData(mCbChipset->currentIndex()).toInt();
     328    systemData.m_iCPUExecCap = mSlCPUExecCap->value();
     329    systemData.m_fEnabledPAE = mCbPae->isChecked();
     330
     331    /* Gather acceleration data: */
     332    systemData.m_fEnabledHwVirtEx = mCbVirt->checkState() == Qt::Checked || mSlCPU->value() > 1;
     333    systemData.m_fEnabledNestedPaging = mCbNestedPaging->isChecked();
    316334
    317335    /* Cache system data: */
     
    337355            /* Motherboard tab: */
    338356            m_machine.SetMemorySize(systemData.m_iRAMSize);
     357            /* Save boot-items of current VM: */
    339358            int iBootIndex = 0;
    340             /* Save boot-items of current VM: */
    341359            for (int i = 0; i < systemData.m_bootItems.size(); ++i)
    342360            {
     
    351369            }
    352370            m_machine.SetChipsetType(systemData.m_chipsetType);
    353             m_machine.GetBIOSSettings().SetIOAPICEnabled(systemData.m_fIoApicEnabled);
    354             m_machine.SetFirmwareType(systemData.m_fEFIEnabled ? KFirmwareType_EFI : KFirmwareType_BIOS);
    355             m_machine.SetRTCUseUTC(systemData.m_fUTCEnabled);
    356             m_machine.SetPointingHIDType(systemData.m_fUseAbsHID ? KPointingHIDType_USBTablet : KPointingHIDType_PS2Mouse);
     371            m_machine.GetBIOSSettings().SetIOAPICEnabled(systemData.m_fEnabledIoApic);
     372            m_machine.SetFirmwareType(systemData.m_fEnabledEFI ? KFirmwareType_EFI : KFirmwareType_BIOS);
     373            m_machine.SetRTCUseUTC(systemData.m_fEnabledUTC);
     374            m_machine.SetPointingHIDType(systemData.m_fEnabledAbsoluteHID ? KPointingHIDType_USBTablet : KPointingHIDType_PS2Mouse);
     375
    357376            /* Processor tab: */
    358377            m_machine.SetCPUCount(systemData.m_cCPUCount);
    359             m_machine.SetCPUProperty(KCPUPropertyType_PAE, systemData.m_fPAEEnabled);
     378            m_machine.SetCPUProperty(KCPUPropertyType_PAE, systemData.m_fEnabledPAE);
     379
    360380            /* Acceleration tab: */
    361             m_machine.SetHWVirtExProperty(KHWVirtExPropertyType_Enabled, systemData.m_fHwVirtExEnabled);
    362             m_machine.SetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging, systemData.m_fNestedPagingEnabled);
     381            m_machine.SetHWVirtExProperty(KHWVirtExPropertyType_Enabled, systemData.m_fEnabledHwVirtEx);
     382            m_machine.SetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging, systemData.m_fEnabledNestedPaging);
    363383        }
    364384        if (isMachineInValidMode())
    365385        {
    366386            /* Processor tab: */
    367             m_machine.SetCPUExecutionCap(systemData.m_cCPUExecCap);
     387            m_machine.SetCPUExecutionCap(systemData.m_iCPUExecCap);
    368388        }
    369389    }
     
    616636    mLbCPUMin->setEnabled(isMachineOffline());
    617637    mLbCPUMax->setEnabled(isMachineOffline());
    618     mSlCPU->setEnabled(isMachineOffline() && systemData.m_fPFHwVirtExSupported);
    619     mLeCPU->setEnabled(isMachineOffline() && systemData.m_fPFHwVirtExSupported);
     638    mSlCPU->setEnabled(isMachineOffline() && systemData.m_fSupportedHwVirtEx);
     639    mLeCPU->setEnabled(isMachineOffline() && systemData.m_fSupportedHwVirtEx);
    620640    mLbCPUExecCap->setEnabled(isMachineInValidMode());
    621641    mLbCPUExecCapMin->setEnabled(isMachineInValidMode());
     
    624644    mLeCPUExecCap->setEnabled(isMachineInValidMode());
    625645    mLbProcessorExtended->setEnabled(isMachineOffline());
    626     mCbPae->setEnabled(isMachineOffline() && systemData.m_fPFPAESupported);
     646    mCbPae->setEnabled(isMachineOffline() && systemData.m_fSupportedPAE);
    627647
    628648    /* Acceleration tab: */
    629     mTwSystem->setTabEnabled(2, systemData.m_fPFHwVirtExSupported);
     649    mTwSystem->setTabEnabled(2, systemData.m_fSupportedHwVirtEx);
    630650    mLbVirt->setEnabled(isMachineOffline());
    631651    mCbVirt->setEnabled(isMachineOffline());
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h

    r47255 r47264  
    2727struct UIBootItemData
    2828{
    29     /* Default constructor: */
     29    /* Constructor: */
    3030    UIBootItemData() : m_type(KDeviceType_Null), m_fEnabled(false) {}
    3131
     
    4545struct UIDataSettingsMachineSystem
    4646{
    47     /* Default constructor: */
     47    /* Constructor: */
    4848    UIDataSettingsMachineSystem()
    49         : m_bootItems(QList<UIBootItemData>())
     49        /* Support flags: */
     50        : m_fSupportedPAE(false)
     51        , m_fSupportedHwVirtEx(false)
     52        /* Motherboard data: */
     53        , m_iRAMSize(-1)
     54        , m_bootItems(QList<UIBootItemData>())
    5055        , m_chipsetType(KChipsetType_Null)
    51         , m_fPFHwVirtExSupported(false)
    52         , m_fPFPAESupported(false)
    53         , m_fIoApicEnabled(false)
    54         , m_fEFIEnabled(false)
    55         , m_fUTCEnabled(false)
    56         , m_fUseAbsHID(false)
    57         , m_fPAEEnabled(false)
    58         , m_fHwVirtExEnabled(false)
    59         , m_fNestedPagingEnabled(false)
    60         , m_iRAMSize(-1)
     56        , m_fEnabledIoApic(false)
     57        , m_fEnabledEFI(false)
     58        , m_fEnabledUTC(false)
     59        , m_fEnabledAbsoluteHID(false)
     60        /* CPU data: */
    6161        , m_cCPUCount(-1)
    62         , m_cCPUExecCap(-1) {}
     62        , m_iCPUExecCap(-1)
     63        , m_fEnabledPAE(false)
     64        /* Acceleration data: */
     65        , m_fEnabledHwVirtEx(false)
     66        , m_fEnabledNestedPaging(false)
     67    {}
    6368
    6469    /* Functions: */
    6570    bool equal(const UIDataSettingsMachineSystem &other) const
    6671    {
    67         return (m_bootItems == other.m_bootItems) &&
     72        return /* Support flags: */
     73               (m_fSupportedPAE == other.m_fSupportedPAE) &&
     74               (m_fSupportedHwVirtEx == other.m_fSupportedHwVirtEx) &&
     75               /* Motherboard data: */
     76               (m_iRAMSize == other.m_iRAMSize) &&
     77               (m_bootItems == other.m_bootItems) &&
    6878               (m_chipsetType == other.m_chipsetType) &&
    69                (m_fPFHwVirtExSupported == other.m_fPFHwVirtExSupported) &&
    70                (m_fPFPAESupported == other.m_fPFPAESupported) &&
    71                (m_fIoApicEnabled == other.m_fIoApicEnabled) &&
    72                (m_fEFIEnabled == other.m_fEFIEnabled) &&
    73                (m_fUTCEnabled == other.m_fUTCEnabled) &&
    74                (m_fUseAbsHID == other.m_fUseAbsHID) &&
    75                (m_fPAEEnabled == other.m_fPAEEnabled) &&
    76                (m_fHwVirtExEnabled == other.m_fHwVirtExEnabled) &&
    77                (m_fNestedPagingEnabled == other.m_fNestedPagingEnabled) &&
    78                (m_iRAMSize == other.m_iRAMSize) &&
     79               (m_fEnabledIoApic == other.m_fEnabledIoApic) &&
     80               (m_fEnabledEFI == other.m_fEnabledEFI) &&
     81               (m_fEnabledUTC == other.m_fEnabledUTC) &&
     82               (m_fEnabledAbsoluteHID == other.m_fEnabledAbsoluteHID) &&
     83               /* CPU data: */
    7984               (m_cCPUCount == other.m_cCPUCount) &&
    80                (m_cCPUExecCap == other.m_cCPUExecCap);
     85               (m_iCPUExecCap == other.m_iCPUExecCap) &&
     86               (m_fEnabledPAE == other.m_fEnabledPAE) &&
     87                /* Acceleration data: */
     88               (m_fEnabledHwVirtEx == other.m_fEnabledHwVirtEx) &&
     89               (m_fEnabledNestedPaging == other.m_fEnabledNestedPaging);
    8190    }
    8291
     
    8594    bool operator!=(const UIDataSettingsMachineSystem &other) const { return !equal(other); }
    8695
    87     /* Variables: */
     96    /* Variables: Support flags: */
     97    bool m_fSupportedPAE;
     98    bool m_fSupportedHwVirtEx;
     99
     100    /* Variables: Motherboard data: */
     101    int m_iRAMSize;
    88102    QList<UIBootItemData> m_bootItems;
    89103    KChipsetType m_chipsetType;
    90     bool m_fPFHwVirtExSupported;
    91     bool m_fPFPAESupported;
    92     bool m_fIoApicEnabled;
    93     bool m_fEFIEnabled;
    94     bool m_fUTCEnabled;
    95     bool m_fUseAbsHID;
    96     bool m_fPAEEnabled;
    97     bool m_fHwVirtExEnabled;
    98     bool m_fNestedPagingEnabled;
    99     int m_iRAMSize;
     104    bool m_fEnabledIoApic;
     105    bool m_fEnabledEFI;
     106    bool m_fEnabledUTC;
     107    bool m_fEnabledAbsoluteHID;
     108    /* Variables: CPU data: */
    100109    int m_cCPUCount;
    101     int m_cCPUExecCap;
     110    int m_iCPUExecCap;
     111    bool m_fEnabledPAE;
     112    /* Variables: Acceleration data: */
     113    bool m_fEnabledHwVirtEx;
     114    bool m_fEnabledNestedPaging;
    102115};
    103116typedef UISettingsCache<UIDataSettingsMachineSystem> UICacheSettingsMachineSystem;
     
    178191    QIWidgetValidator *m_pValidator;
    179192
     193    /* Variable: Boot-table stuff: */
     194    QList<KDeviceType> m_possibleBootItems;
     195
    180196    /* Variables: CPU stuff: */
    181197    uint m_uMinGuestCPU;
     
    185201    uint m_uMaxGuestCPUExecCap;
    186202
    187     /* Variable: Boot-table stuff: */
    188     QList<KDeviceType> m_possibleBootItems;
    189 
    190203    /* Variable: Correlation stuff: */
    191204    bool m_fOHCIEnabled;
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