VirtualBox

Changeset 54146 in vbox for trunk


Ignore:
Timestamp:
Feb 11, 2015 4:02:18 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
98178
Message:

FE/Qt: 7115: Cache some stuff for the network indicator of the UIIndicatorPool.

File:
1 edited

Legend:

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

    r54145 r54146  
    318318        : UISessionStateStatusBarIndicator(pSession)
    319319        , m_pTimerAutoUpdate(0)
     320        , m_cMaxNetworkAdapters(0)
    320321    {
    321322        /* Assign state-icons: */
     
    327328        connect(m_pSession, SIGNAL(sigMachineStateChange()),
    328329                this, SLOT(sltHandleMachineStateChange()));
     330        /* Fetch maximum network adapters count: */
     331        const CVirtualBox vbox = vboxGlobal().virtualBox();
     332        const CMachine machine = m_pSession->machine();
     333        m_cMaxNetworkAdapters = vbox.GetSystemProperties().GetMaxNetworkAdapters(machine.GetChipsetType());
    329334        /* Create auto-update timer: */
    330335        m_pTimerAutoUpdate = new QTimer(this);
     
    388393        machine.GetGuestProperty("/VirtualBox/GuestInfo/Net/Count", strCount, iTimestamp, strFlags);
    389394        bool fPropsValid = (u64Now - iTimestamp < UINT64_C(60000000000)); /* timeout beacon */
    390         ulong uMaxCount = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(machine.GetChipsetType());
    391395        QStringList ipList, macList;
    392396        if (fPropsValid)
    393397        {
    394             const int cAdapters = RT_MIN(strCount.toInt(), (int)uMaxCount);
     398            const int cAdapters = RT_MIN(strCount.toInt(), m_cMaxNetworkAdapters);
    395399            for (int i = 0; i < cAdapters; ++i)
    396400            {
     
    400404        }
    401405
    402         /* Enumerate up to uMaxCount adapters: */
     406        /* Enumerate up to m_cMaxNetworkAdapters adapters: */
    403407        bool fAdaptersPresent = false;
    404408        bool fCablesDisconnected = true;
    405         for (ulong uSlot = 0; uSlot < uMaxCount; ++uSlot)
     409        for (ulong uSlot = 0; uSlot < m_cMaxNetworkAdapters; ++uSlot)
    406410        {
    407411            const CNetworkAdapter &adapter = machine.GetNetworkAdapter(uSlot);
     
    453457    /** Holds the auto-update timer instance. */
    454458    QTimer *m_pTimerAutoUpdate;
     459    /** Holds the maximum amount of the network adapters. */
     460    int m_cMaxNetworkAdapters;
    455461};
    456462
Note: See TracChangeset for help on using the changeset viewer.

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