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()));
}
refreshActionSensitivity( );
+ refreshTrayIcon( );
refreshStatusBar( );
refreshTitle( );
refreshVisibleCount( );
refreshVisibleCount( );
refreshActionSensitivity( );
refreshStatusBar( );
+ refreshTrayIcon( );
}
/****
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( )
{
b = myPrefs.getBool( key );
ui.action_TrayIcon->setChecked( b );
myTrayIcon.setVisible( b );
+ refreshTrayIcon( );
break;
case Prefs::COMPACT_VIEW: