Changeset 13727


Ignore:
Timestamp:
Dec 31, 2012, 2:47:09 AM (8 years ago)
Author:
jordan
Message:

(trunk, qt) make the network status icon's tooltip a little more accurate / useful

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/mainwin.cc

    r13717 r13727  
    13201320    const time_t now = time( NULL );
    13211321    const int period = 3;
    1322     const bool isSending = now - myLastSendTime <= period;
    1323     const bool isReading = now - myLastReadTime <= period;
     1322    const time_t secondsSinceLastSend = now - myLastSendTime;
     1323    const time_t secondsSinceLastRead = now - myLastReadTime;
     1324    const bool isSending = secondsSinceLastSend <= period;
     1325    const bool isReading = secondsSinceLastRead <= period;
    13241326    const char * key;
    13251327
     
    13361338    QPixmap pixmap = icon.pixmap ( 16, 16 );
    13371339    myNetworkLabel->setPixmap( pixmap );
    1338     myNetworkLabel->setToolTip( isSending || isReading
    1339         ? tr( "Transmission server is responding" )
    1340         : tr( "Last response from server was %1 ago" ).arg( Formatter::timeToString( now-std::max(myLastReadTime,myLastSendTime))));
     1340
     1341    QString tip;
     1342    const QString url = mySession.getRemoteUrl().host();
     1343    if( !myLastReadTime )
     1344      tip = tr( "Server '%1' has not responded yet" ).arg (url);
     1345    else if( secondsSinceLastRead < 60 )
     1346      tip = tr( "Server '%1' is responding" ).arg (url);
     1347    else if( secondsSinceLastRead < (60*10) )
     1348      tip = tr( "Server '%1' last responded %2 ago" ).arg(url).arg(Formatter::timeToString(secondsSinceLastRead));
     1349    else
     1350      tip = tr( "Server '%1' is not responding" ).arg (url);
     1351    myNetworkLabel->setToolTip (tip);
    13411352}
    13421353
Note: See TracChangeset for help on using the changeset viewer.