(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
|
@ -200,6 +200,8 @@ TrMainWindow :: TrMainWindow( Session& session, Prefs& prefs, TorrentModel& mode
|
||||||
connect( &myModel, SIGNAL(modelReset()), this, SLOT(onModelReset()));
|
connect( &myModel, SIGNAL(modelReset()), this, SLOT(onModelReset()));
|
||||||
connect( &myModel, SIGNAL(rowsRemoved(const QModelIndex&,int,int)), 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(rowsInserted(const QModelIndex&,int,int)), this, SLOT(onModelReset()));
|
||||||
|
connect( &myModel, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&)), this, SLOT(refreshTrayIcon()));
|
||||||
|
|
||||||
ui.listView->setModel( &myFilterModel );
|
ui.listView->setModel( &myFilterModel );
|
||||||
connect( ui.listView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)), this, SLOT(refreshActionSensitivity()));
|
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( );
|
refreshActionSensitivity( );
|
||||||
|
refreshTrayIcon( );
|
||||||
refreshStatusBar( );
|
refreshStatusBar( );
|
||||||
refreshTitle( );
|
refreshTitle( );
|
||||||
refreshVisibleCount( );
|
refreshVisibleCount( );
|
||||||
|
@ -317,6 +320,7 @@ TrMainWindow :: onModelReset( )
|
||||||
refreshVisibleCount( );
|
refreshVisibleCount( );
|
||||||
refreshActionSensitivity( );
|
refreshActionSensitivity( );
|
||||||
refreshStatusBar( );
|
refreshStatusBar( );
|
||||||
|
refreshTrayIcon( );
|
||||||
}
|
}
|
||||||
|
|
||||||
/****
|
/****
|
||||||
|
@ -648,6 +652,23 @@ TrMainWindow :: refreshVisibleCount( )
|
||||||
myVisibleCountLabel->setVisible( totalCount > 0 );
|
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
|
void
|
||||||
TrMainWindow :: refreshStatusBar( )
|
TrMainWindow :: refreshStatusBar( )
|
||||||
{
|
{
|
||||||
|
@ -957,6 +978,7 @@ TrMainWindow :: refreshPref( int key )
|
||||||
b = myPrefs.getBool( key );
|
b = myPrefs.getBool( key );
|
||||||
ui.action_TrayIcon->setChecked( b );
|
ui.action_TrayIcon->setChecked( b );
|
||||||
myTrayIcon.setVisible( b );
|
myTrayIcon.setVisible( b );
|
||||||
|
refreshTrayIcon( );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Prefs::COMPACT_VIEW:
|
case Prefs::COMPACT_VIEW:
|
||||||
|
|
|
@ -104,6 +104,7 @@ class TrMainWindow: public QMainWindow
|
||||||
void refreshVisibleCount( );
|
void refreshVisibleCount( );
|
||||||
void refreshTitle( );
|
void refreshTitle( );
|
||||||
void refreshStatusBar( );
|
void refreshStatusBar( );
|
||||||
|
void refreshTrayIcon( );
|
||||||
void openTorrent( );
|
void openTorrent( );
|
||||||
void openURL( );
|
void openURL( );
|
||||||
void newTorrent( );
|
void newTorrent( );
|
||||||
|
|
|
@ -51,9 +51,9 @@ class TorrentModel: public QAbstractListModel
|
||||||
public:
|
public:
|
||||||
Torrent* getTorrentFromId( int id );
|
Torrent* getTorrentFromId( int id );
|
||||||
const Torrent* getTorrentFromId( int id ) const;
|
const Torrent* getTorrentFromId( int id ) const;
|
||||||
|
QSet<int> getIds( ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSet<int> getIds( ) const;
|
|
||||||
void addTorrent( Torrent * );
|
void addTorrent( Torrent * );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue