VirtualBox

Changeset 102599 in vbox


Ignore:
Timestamp:
Dec 14, 2023 4:03:06 PM (12 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10543: A bit of fixes for Runtime UI to acquire real machine architecture instead of using x86.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp

    r102419 r102599  
    258258{
    259259    return uisession()->acquireUserMachineIcon(icon);
     260}
     261
     262bool UIMachine::acquireArchitectureType(KPlatformArchitecture &enmType)
     263{
     264    return uisession()->acquireArchitectureType(enmType);
    260265}
    261266
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r102419 r102599  
    203203        void acquireUserMachineIcon(QIcon &icon);
    204204
     205        /** Acquires architecture type. */
     206        bool acquireArchitectureType(KPlatformArchitecture &enmType);
    205207        /** Acquires chipset type. */
    206208        bool acquireChipsetType(KChipsetType &enmType);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r102574 r102599  
    26662666{
    26672667    /* Determine how many adapters we should display: */
     2668    KPlatformArchitecture enmArchType = KPlatformArchitecture_None;
     2669    uimachine()->acquireArchitectureType(enmArchType);
    26682670    KChipsetType enmChipsetType = KChipsetType_Null;
    26692671    uimachine()->acquireChipsetType(enmChipsetType);
    2670     CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(KPlatformArchitecture_x86);
     2672    CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(enmArchType);
    26712673    const ulong uCount = qMin((ulong)4, (ulong)comProperties.GetMaxNetworkAdapters(enmChipsetType));
    26722674
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r102139 r102599  
    300300}
    301301
     302bool UISession::acquireArchitectureType(KPlatformArchitecture &enmType)
     303{
     304    CMachine comMachine = machine();
     305    if (comMachine.isNull())
     306        return false;
     307    CPlatform comPlatform = comMachine.GetPlatform();
     308    const KPlatformArchitecture enmArchType = comPlatform.GetArchitecture();
     309    const bool fSuccess = comMachine.isOk();
     310    if (!fSuccess)
     311        UINotificationMessage::cannotAcquireMachineParameter(comMachine);
     312    else
     313        enmType = enmArchType;
     314    return fSuccess;
     315}
     316
    302317bool UISession::acquireChipsetType(KChipsetType &enmType)
    303318{
     
    12451260bool UISession::acquireWhetherAtLeastOneNetworkAdapterEnabled(bool &fEnabled)
    12461261{
    1247     /* Acquire system properties: */
    1248     CVirtualBox comVBox = uiCommon().virtualBox();
    1249     AssertReturn(comVBox.isNotNull(), false);
    1250     CPlatformProperties comProperties = comVBox.GetPlatformProperties(KPlatformArchitecture_x86);
    1251     if (!comVBox.isOk())
    1252     {
    1253         UINotificationMessage::cannotAcquireVirtualBoxParameter(comVBox);
    1254         return false;
    1255     }
    1256 
    1257     /* Acquire chipset type: */
    1258     KChipsetType enmChipsetType = KChipsetType_Null;
    1259     bool fSuccess = acquireChipsetType(enmChipsetType);
    1260     if (fSuccess)
    1261     {
    1262         /* Acquire maximum network adapters count: */
    1263         const ulong uSlots = comProperties.GetMaxNetworkAdapters(enmChipsetType);
    1264         fSuccess = comProperties.isOk();
     1262    /* Acquire architecture type: */
     1263    KPlatformArchitecture enmArchType = KPlatformArchitecture_None;
     1264    bool fSuccess = acquireArchitectureType(enmArchType);
     1265    {
     1266        /* Acquire system properties: */
     1267        CVirtualBox comVBox = uiCommon().virtualBox();
     1268        AssertReturn(comVBox.isNotNull(), false);
     1269        CPlatformProperties comProperties = comVBox.GetPlatformProperties(enmArchType);
     1270        fSuccess = comVBox.isOk();
    12651271        if (!fSuccess)
    1266             UINotificationMessage::cannotAcquirePlatformPropertiesParameter(comProperties);
     1272            UINotificationMessage::cannotAcquireVirtualBoxParameter(comVBox);
    12671273        else
    12681274        {
    1269             /* Search for 1st enabled adapter: */
    1270             for (ulong uSlot = 0; uSlot < uSlots; ++uSlot)
    1271             {
    1272                 bool fAdapterEnabled = false;
    1273                 fSuccess = acquireWhetherNetworkAdapterEnabled(uSlot, fAdapterEnabled);
     1275            /* Acquire chipset type: */
     1276            KChipsetType enmChipsetType = KChipsetType_Null;
     1277            fSuccess = acquireChipsetType(enmChipsetType);
     1278            if (fSuccess)
     1279            {
     1280                /* Acquire maximum network adapters count: */
     1281                const ulong cMaxNetworkAdapters = comProperties.GetMaxNetworkAdapters(enmChipsetType);
     1282                fSuccess = comProperties.isOk();
    12741283                if (!fSuccess)
    1275                     break;
    1276                 if (!fAdapterEnabled)
    1277                     continue;
    1278                 fEnabled = true;
    1279                 break;
     1284                    UINotificationMessage::cannotAcquirePlatformPropertiesParameter(comProperties);
     1285                else
     1286                {
     1287                    /* Search for 1st enabled adapter: */
     1288                    for (ulong uSlot = 0; uSlot < cMaxNetworkAdapters; ++uSlot)
     1289                    {
     1290                        bool fAdapterEnabled = false;
     1291                        fSuccess = acquireWhetherNetworkAdapterEnabled(uSlot, fAdapterEnabled);
     1292                        if (!fSuccess)
     1293                            break;
     1294                        if (!fAdapterEnabled)
     1295                            continue;
     1296                        fEnabled = true;
     1297                        break;
     1298                    }
     1299                }
    12801300            }
    12811301        }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r102018 r102599  
    201201        void acquireUserMachineIcon(QIcon &icon);
    202202
     203        /** Acquires architecture type. */
     204        bool acquireArchitectureType(KPlatformArchitecture &enmType);
    203205        /** Acquires chipset type. */
    204206        bool acquireChipsetType(KChipsetType &enmType);
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