mirror of
https://github.com/transmission/transmission
synced 2024-12-25 01:03:01 +00:00
(trunk qt) #3489 "Qt client should have up/down speeds in the tray icon's tooltip" -- fixed
This commit is contained in:
parent
70be70d85f
commit
4e30aad464
3 changed files with 24 additions and 1 deletions
|
@ -200,6 +200,8 @@ TrMainWindow :: TrMainWindow( Session& session, Prefs& prefs, TorrentModel& mode
|
|||
connect( &myModel, SIGNAL(modelReset()), this, SLOT(onModelReset()));
|
||||
connect( &myModel, SIGNAL(rowsRemoved(const QModelIndex&,int,int)), this, SLOT(onModelReset()));
|
||||
connect( &myModel, SIGNAL(rowsInserted(const QModelIndex&,int,int)), this, SLOT(onModelReset()));
|
||||
connect( &myModel, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&)), this, SLOT(refreshTrayIcon()));
|
||||
|
||||
ui.listView->setModel( &myFilterModel );
|
||||
connect( ui.listView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)), this, SLOT(refreshActionSensitivity()));
|
||||
|
||||
|
@ -274,6 +276,7 @@ TrMainWindow :: TrMainWindow( Session& session, Prefs& prefs, TorrentModel& mode
|
|||
}
|
||||
|
||||
refreshActionSensitivity( );
|
||||
refreshTrayIcon( );
|
||||
refreshStatusBar( );
|
||||
refreshTitle( );
|
||||
refreshVisibleCount( );
|
||||
|
@ -317,6 +320,7 @@ TrMainWindow :: onModelReset( )
|
|||
refreshVisibleCount( );
|
||||
refreshActionSensitivity( );
|
||||
refreshStatusBar( );
|
||||
refreshTrayIcon( );
|
||||
}
|
||||
|
||||
/****
|
||||
|
@ -648,6 +652,23 @@ TrMainWindow :: refreshVisibleCount( )
|
|||
myVisibleCountLabel->setVisible( totalCount > 0 );
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: refreshTrayIcon( )
|
||||
{
|
||||
Speed u, d;
|
||||
const QString idle = tr( "Idle" );
|
||||
|
||||
foreach( int id, myModel.getIds( ) ) {
|
||||
const Torrent * tor = myModel.getTorrentFromId( id );
|
||||
u += tor->uploadSpeed( );
|
||||
d += tor->downloadSpeed( );
|
||||
}
|
||||
|
||||
myTrayIcon.setToolTip( tr( "Transmission\nUp: %1\nDown: %2" )
|
||||
.arg( u.isZero() ? idle : Formatter::speedToString( u ) )
|
||||
.arg( d.isZero() ? idle : Formatter::speedToString( d ) ) );
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: refreshStatusBar( )
|
||||
{
|
||||
|
@ -957,6 +978,7 @@ TrMainWindow :: refreshPref( int key )
|
|||
b = myPrefs.getBool( key );
|
||||
ui.action_TrayIcon->setChecked( b );
|
||||
myTrayIcon.setVisible( b );
|
||||
refreshTrayIcon( );
|
||||
break;
|
||||
|
||||
case Prefs::COMPACT_VIEW:
|
||||
|
|
|
@ -104,6 +104,7 @@ class TrMainWindow: public QMainWindow
|
|||
void refreshVisibleCount( );
|
||||
void refreshTitle( );
|
||||
void refreshStatusBar( );
|
||||
void refreshTrayIcon( );
|
||||
void openTorrent( );
|
||||
void openURL( );
|
||||
void newTorrent( );
|
||||
|
|
|
@ -51,9 +51,9 @@ class TorrentModel: public QAbstractListModel
|
|||
public:
|
||||
Torrent* getTorrentFromId( int id );
|
||||
const Torrent* getTorrentFromId( int id ) const;
|
||||
QSet<int> getIds( ) const;
|
||||
|
||||
private:
|
||||
QSet<int> getIds( ) const;
|
||||
void addTorrent( Torrent * );
|
||||
|
||||
public:
|
||||
|
|
Loading…
Reference in a new issue