Changeset 13735


Ignore:
Timestamp:
Jan 3, 2013, 4:21:45 AM (8 years ago)
Author:
jordan
Message:

(qt) tweak the network status icon's tooltip again. This is a followup to r13727

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/mainwin.cc

    r13733 r13735  
    13271327TrMainWindow :: updateNetworkIcon( )
    13281328{
    1329     const time_t now = time( NULL );
    1330     const int period = 3;
    1331     const time_t secondsSinceLastSend = now - myLastSendTime;
    1332     const time_t secondsSinceLastRead = now - myLastReadTime;
    1333     const bool isSending = secondsSinceLastSend <= period;
    1334     const bool isReading = secondsSinceLastRead <= period;
    1335     const char * key;
    1336 
    1337     if( isSending && isReading )
    1338         key = "network-transmit-receive";
    1339     else if( isSending )
    1340         key = "network-transmit";
    1341     else if( isReading )
    1342         key = "network-receive";
    1343     else
    1344         key = "network-idle";
    1345 
    1346     QIcon icon = getStockIcon( key, QStyle::SP_DriveNetIcon );
    1347     QPixmap pixmap = icon.pixmap ( 16, 16 );
    1348     myNetworkLabel->setPixmap( pixmap );
    1349 
    1350     QString tip;
    1351     const QString url = mySession.getRemoteUrl().host();
    1352     if( !myLastReadTime )
    1353       tip = tr( "Server '%1' has not responded yet" ).arg (url);
    1354     else if( secondsSinceLastRead < 60 )
    1355       tip = tr( "Server '%1' is responding" ).arg (url);
    1356     else if( secondsSinceLastRead < (60*10) )
    1357       tip = tr( "Server '%1' last responded %2 ago" ).arg(url).arg(Formatter::timeToString(secondsSinceLastRead));
    1358     else
    1359       tip = tr( "Server '%1' is not responding" ).arg (url);
    1360     myNetworkLabel->setToolTip (tip);
     1329  const time_t now = time( NULL );
     1330  const int period = 3;
     1331  const time_t secondsSinceLastSend = now - myLastSendTime;
     1332  const time_t secondsSinceLastRead = now - myLastReadTime;
     1333  const bool isSending = secondsSinceLastSend <= period;
     1334  const bool isReading = secondsSinceLastRead <= period;
     1335  const char * key;
     1336
     1337  if( isSending && isReading )
     1338    key = "network-transmit-receive";
     1339  else if( isSending )
     1340    key = "network-transmit";
     1341  else if( isReading )
     1342    key = "network-receive";
     1343  else
     1344    key = "network-idle";
     1345  const QIcon icon = getStockIcon (key, QStyle::SP_DriveNetIcon);
     1346  const QPixmap pixmap = icon.pixmap (16, 16);
     1347
     1348  QString tip;
     1349  const QString url = mySession.getRemoteUrl().host();
     1350  if( !myLastReadTime )
     1351    tip = tr( "%1 has not responded yet" ).arg (url);
     1352  else if( secondsSinceLastRead < 60 )
     1353    tip = tr( "%1 is responding" ).arg (url);
     1354  else if( secondsSinceLastRead < (60*10) )
     1355    tip = tr( "%1 last responded %2 ago" ).arg(url).arg(Formatter::timeToString(secondsSinceLastRead));
     1356  else
     1357    tip = tr( "%1 is not responding" ).arg (url);
     1358
     1359  myNetworkLabel->setPixmap (pixmap);
     1360  myNetworkLabel->setToolTip (tip);
    13611361}
    13621362
Note: See TracChangeset for help on using the changeset viewer.