Changeset 29403 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 12, 2010 10:07:50 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 61515
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp
r29148 r29403 268 268 { 269 269 const CMachine &machine = m_session.GetMachine(); 270 QString strFullData; 270 271 271 272 ulong uMaxCount = vboxGlobal().virtualBox().GetSystemProperties().GetNetworkAdapterCount(); 272 ulong uCount = 0; 273 274 QString strToolTip = QApplication::translate("VBoxConsoleWnd", 275 "<p style='white-space:pre'><nobr>Indicates the activity of the " 276 "network interfaces:</nobr>%1</p>", "Network adapters tooltip"); 277 278 RTTIMESPEC time; 279 uint64_t u64Now = RTTimeSpecGetNano(RTTimeNow(&time)); 280 281 QString strFlags, strCount; 282 ULONG64 timestamp; 283 machine.GetGuestProperty("/VirtualBox/GuestInfo/Net/Count", strCount, timestamp, strFlags); 284 bool fPropsValid = (u64Now - timestamp < UINT64_C(60000000000)); /* timeout beacon */ 285 286 QStringList aIp, aMac; 287 if (fPropsValid) 288 { 289 int cAdapters = RT_MIN(strCount.toInt(), uMaxCount); 290 for (int i = 0; i < cAdapters; i++) 291 { 292 aIp << machine.GetGuestPropertyValue(QString("/VirtualBox/GuestInfo/Net/%1/V4/IP").arg(i)); 293 aMac << machine.GetGuestPropertyValue(QString("/VirtualBox/GuestInfo/Net/%1/MAC").arg(i)); 294 } 295 } 296 297 ulong uEnabled = 0; 273 298 for (ulong uSlot = 0; uSlot < uMaxCount; ++ uSlot) 274 if (machine.GetNetworkAdapter(uSlot).GetEnabled())275 ++ uCount;276 setState(uCount > 0 ? KDeviceActivity_Idle : KDeviceActivity_Null);277 if (!uCount)278 setHidden(true);279 280 QString strToolTip = QApplication::translate("VBoxConsoleWnd", "<p style='white-space:pre'><nobr>Indicates the activity of the "281 "network interfaces:</nobr>%1</p>", "Network adapters tooltip");282 QString strFullData;283 284 for (ulong uSlot = 0, uEnabled = 0; uSlot < uMaxCount; ++ uSlot)285 299 { 286 300 const CNetworkAdapter &adapter = machine.GetNetworkAdapter(uSlot); 287 301 if (adapter.GetEnabled()) 288 302 { 289 QString strFlags; 290 QString strCount; 291 ULONG64 timestamp; 292 machine.GetGuestProperty("/VirtualBox/GuestInfo/Net/Count", strCount, timestamp, strFlags); 293 RTTIMESPEC time; 294 uint64_t u64Now = RTTimeSpecGetNano(RTTimeNow(&time)); 295 QString strIP; 296 if ( u64Now - timestamp < UINT64_C(60000000000) 297 && strCount.toInt() > 0) 298 strIP = machine.GetGuestPropertyValue(QString("/VirtualBox/GuestInfo/Net/%1/V4/IP").arg(uEnabled)); 299 strFullData += QApplication::translate("VBoxConsoleWnd", "<br><nobr><b>Adapter %1 (%2)</b>: %3 cable %4</nobr>", "Network adapters tooltip") 303 QString strGuestIp; 304 if (fPropsValid) 305 { 306 QString strGuestMac = adapter.GetMACAddress(); 307 int iIp = aMac.indexOf(strGuestMac); 308 if (iIp >= 0) 309 strGuestIp = aIp[iIp]; 310 } 311 strFullData += QApplication::translate("VBoxConsoleWnd", 312 "<br><nobr><b>Adapter %1 (%2)</b>: %3 cable %4</nobr>", "Network adapters tooltip") 300 313 .arg(uSlot + 1) 301 314 .arg(vboxGlobal().toString(adapter.GetAttachmentType())) 302 .arg(str IP.isEmpty() ? "" : "IP " + strIP+ ", ")315 .arg(strGuestIp.isEmpty() ? "" : "IP " + strGuestIp + ", ") 303 316 .arg(adapter.GetCableConnected() ? 304 317 QApplication::translate("VBoxConsoleWnd", "connected", "Network adapters tooltip") : 305 318 QApplication::translate("VBoxConsoleWnd", "disconnected", "Network adapters tooltip")); 306 uEnabled++;319 ++ uEnabled; 307 320 } 308 321 } 309 322 323 setState(uEnabled > 0 ? KDeviceActivity_Idle : KDeviceActivity_Null); 324 if (!uEnabled) 325 setHidden(true); 326 310 327 if (strFullData.isNull()) 311 strFullData = QApplication::translate("VBoxConsoleWnd", "<br><nobr><b>All network adapters are disabled</b></nobr>", "Network adapters tooltip"); 328 strFullData = QApplication::translate("VBoxConsoleWnd", 329 "<br><nobr><b>All network adapters are disabled</b></nobr>", "Network adapters tooltip"); 312 330 313 331 setToolTip(strToolTip.arg(strFullData));
Note:
See TracChangeset
for help on using the changeset viewer.