VirtualBox

Changeset 28632 in vbox


Ignore:
Timestamp:
Apr 23, 2010 8:59:14 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
60484
Message:

FE/Qt / network tooltip: use a 60 seconds timeout; use the /VirtualBox/GuestInfo/Net/Count property as a beacon

File:
1 edited

Legend:

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

    r28597 r28632  
    270270        QString strFullData;
    271271
    272         for (ulong uSlot = 0; uSlot < uMaxCount; ++ uSlot)
     272        for (ulong uSlot = 0, uEnabled = 0; uSlot < uMaxCount; ++ uSlot)
    273273        {
    274274            CNetworkAdapter adapter = machine.GetNetworkAdapter(uSlot);
    275275            if (adapter.GetEnabled())
    276276            {
    277                 QString strIP;
     277                QString strFlags;
     278                QString strCount;
    278279                ULONG64 timestamp;
     280                machine.GetGuestProperty("/VirtualBox/GuestInfo/Net/Count", strCount, timestamp, strFlags);
    279281                RTTIMESPEC time;
    280282                uint64_t u64Now = RTTimeSpecGetNano(RTTimeNow(&time));
    281                 QString strFlags;
    282                 machine.GetGuestProperty(QString("/VirtualBox/GuestInfo/Net/%1/V4/IP").arg(uSlot),
    283                                          strIP, timestamp, strFlags);
     283                QString strIP;
     284                if (   u64Now - timestamp < UINT64_C(60000000000)
     285                    && strCount.toInt() > 0)
     286                    strIP = machine.GetGuestPropertyValue(QString("/VirtualBox/GuestInfo/Net/%1/V4/IP").arg(uEnabled));
    284287                strFullData += QApplication::translate("VBoxConsoleWnd", "<br><nobr><b>Adapter %1 (%2)</b>: %3 cable %4</nobr>", "Network adapters tooltip")
    285288                    .arg(uSlot + 1)
    286289                    .arg(vboxGlobal().toString(adapter.GetAttachmentType()))
    287                     .arg(strIP.isEmpty() || (u64Now - timestamp > UINT64_C(20000000000)) ? "" : "IP " + strIP + ", ")
     290                    .arg(strIP.isEmpty() ? "" : "IP " + strIP + ", ")
    288291                    .arg(adapter.GetCableConnected() ?
    289292                          QApplication::translate("VBoxConsoleWnd", "connected", "Network adapters tooltip") :
    290293                          QApplication::translate("VBoxConsoleWnd", "disconnected", "Network adapters tooltip"));
     294                uEnabled++;
    291295            }
    292296        }
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