1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-30 19:03:04 +00:00

(qt) copyediting: whitespace/indentation

This commit is contained in:
Jordan Lee 2013-02-03 19:40:20 +00:00
parent 7f8415d59e
commit 5ae75bfced
9 changed files with 926 additions and 893 deletions

View file

@ -16,27 +16,27 @@
#include "license.h"
LicenseDialog :: LicenseDialog( QWidget * parent ):
QDialog( parent, Qt::Dialog )
LicenseDialog :: LicenseDialog (QWidget * parent):
QDialog (parent, Qt::Dialog)
{
setWindowTitle( tr( "License" ) );
resize( 400, 300 );
QVBoxLayout * v = new QVBoxLayout( this );
setWindowTitle (tr ("License"));
resize (400, 300);
QVBoxLayout * v = new QVBoxLayout (this);
QPlainTextEdit * t = new QPlainTextEdit( this );
t->setReadOnly( true );
t->setPlainText(
QPlainTextEdit * t = new QPlainTextEdit (this);
t->setReadOnly (true);
t->setPlainText (
"The OS X client, CLI client, and parts of libtransmission are licensed under the terms of the MIT license.\n\n"
"The Transmission daemon, GTK+ client, Qt client, Web client, and most of libtransmission are licensed under the terms of the GNU GPL version 2, with two special exceptions:\n\n"
"1. The MIT-licensed portions of Transmission listed above are exempt from GPLv2 clause 2(b) and may retain their MIT license.\n\n"
"2. Permission is granted to link the code in this release with the OpenSSL project's 'OpenSSL' library and to distribute the linked executables. Works derived from Transmission may, at their authors' discretion, keep or delete this exception." );
v->addWidget( t );
"1. The MIT-licensed portions of Transmission listed above are exempt from GPLv2 clause 2 (b) and may retain their MIT license.\n\n"
"2. Permission is granted to link the code in this release with the OpenSSL project's 'OpenSSL' library and to distribute the linked executables. Works derived from Transmission may, at their authors' discretion, keep or delete this exception.");
v->addWidget (t);
QDialogButtonBox * box = new QDialogButtonBox;
box->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
box->setOrientation( Qt::Horizontal );
box->setStandardButtons( QDialogButtonBox::Close );
v->addWidget( box );
QDialogButtonBox * box = new QDialogButtonBox;
box->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Fixed);
box->setOrientation (Qt::Horizontal);
box->setStandardButtons (QDialogButtonBox::Close);
v->addWidget (box);
connect( box, SIGNAL(rejected()), this, SLOT(hide()) );
connect (box, SIGNAL (rejected ()), this, SLOT (hide ()));
}

View file

@ -17,12 +17,11 @@
class LicenseDialog: public QDialog
{
Q_OBJECT
public:
LicenseDialog( QWidget * parent = 0 );
~LicenseDialog( ) { }
Q_OBJECT
public:
LicenseDialog (QWidget * parent = 0);
~LicenseDialog () {}
};
#endif

View file

@ -32,82 +32,89 @@
bool RelocateDialog :: myMoveFlag = true;
void
RelocateDialog :: onSetLocation( )
RelocateDialog :: onSetLocation ()
{
mySession.torrentSetLocation( myIds, myPath, myMoveFlag );
deleteLater( );
mySession.torrentSetLocation (myIds, myPath, myMoveFlag);
deleteLater ();
}
void
RelocateDialog :: onFileSelected( const QString& path )
RelocateDialog :: onFileSelected (const QString& path)
{
myPath = path;
myDirButton->setText( myPath );
myPath = path;
myDirButton->setText (myPath);
}
void
RelocateDialog :: onDirButtonClicked( )
RelocateDialog :: onDirButtonClicked ()
{
const QString title = tr( "Select Location" );
const QString path = Utils::remoteFileChooser( this, title, myPath, true, mySession.isServer() );
const QString title = tr ("Select Location");
const QString path = Utils::remoteFileChooser (this, title, myPath, true, mySession.isServer ());
if( !path.isEmpty() )
onFileSelected( path );
if (!path.isEmpty ())
onFileSelected (path);
}
void
RelocateDialog :: onMoveToggled( bool b )
RelocateDialog :: onMoveToggled (bool b)
{
myMoveFlag = b;
myMoveFlag = b;
}
RelocateDialog :: RelocateDialog( Session& session, TorrentModel& model, const QSet<int>& ids, QWidget * parent ):
QDialog( parent ),
mySession( session ),
myModel( model ),
myIds( ids )
RelocateDialog :: RelocateDialog (Session & session,
TorrentModel & model,
const QSet<int> & ids,
QWidget * parent):
QDialog (parent),
mySession (session),
myModel (model),
myIds (ids)
{
const int iconSize( style( )->pixelMetric( QStyle :: PM_SmallIconSize ) );
const QFileIconProvider iconProvider;
const QIcon folderIcon = iconProvider.icon( QFileIconProvider::Folder );
const QPixmap folderPixmap = folderIcon.pixmap( iconSize );
const int iconSize (style ()->pixelMetric (QStyle :: PM_SmallIconSize));
const QFileIconProvider iconProvider;
const QIcon folderIcon = iconProvider.icon (QFileIconProvider::Folder);
const QPixmap folderPixmap = folderIcon.pixmap (iconSize);
QRadioButton * find_rb;
setWindowTitle( tr( "Set Torrent Location" ) );
QRadioButton * find_rb;
setWindowTitle (tr ("Set Torrent Location"));
foreach( int id, myIds ) {
const Torrent * tor = myModel.getTorrentFromId( id );
if( myPath.isEmpty() )
myPath = tor->getPath();
else if( myPath != tor->getPath() )
foreach (int id, myIds)
{
const Torrent * tor = myModel.getTorrentFromId (id);
if (myPath.isEmpty ())
{
if( mySession.isServer() )
myPath = QDir::homePath( );
else
myPath = QDir::rootPath( );
myPath = tor->getPath ();
}
else if (myPath != tor->getPath ())
{
if (mySession.isServer ())
myPath = QDir::homePath ();
else
myPath = QDir::rootPath ();
}
}
HIG * hig = new HIG( );
hig->addSectionTitle( tr( "Set Location" ) );
hig->addRow( tr( "New &location:" ), myDirButton = new QPushButton( folderPixmap, myPath ) );
hig->addWideControl( myMoveRadio = new QRadioButton( tr( "&Move from the current folder" ), this ) );
hig->addWideControl( find_rb = new QRadioButton( tr( "Local data is &already there" ), this ) );
hig->finish( );
HIG * hig = new HIG ();
hig->addSectionTitle (tr ("Set Location"));
hig->addRow (tr ("New &location:"), myDirButton = new QPushButton (folderPixmap, myPath));
hig->addWideControl (myMoveRadio = new QRadioButton (tr ("&Move from the current folder"), this));
hig->addWideControl (find_rb = new QRadioButton (tr ("Local data is &already there"), this));
hig->finish ();
if( myMoveFlag )
myMoveRadio->setChecked( true );
else
find_rb->setChecked( true );
if (myMoveFlag)
myMoveRadio->setChecked (true);
else
find_rb->setChecked (true);
connect( myMoveRadio, SIGNAL(toggled(bool)), this, SLOT(onMoveToggled(bool)));
connect( myDirButton, SIGNAL(clicked(bool)), this, SLOT(onDirButtonClicked()));
connect (myMoveRadio, SIGNAL (toggled (bool)), this, SLOT (onMoveToggled (bool)));
connect (myDirButton, SIGNAL (clicked (bool)), this, SLOT (onDirButtonClicked ()));
QLayout * layout = new QVBoxLayout( this );
layout->addWidget( hig );
QDialogButtonBox * buttons = new QDialogButtonBox( QDialogButtonBox::Ok|QDialogButtonBox::Cancel );
connect( buttons, SIGNAL(rejected()), this, SLOT(deleteLater()));
connect( buttons, SIGNAL(accepted()), this, SLOT(onSetLocation()));
layout->addWidget( buttons );
QWidget::setAttribute( Qt::WA_DeleteOnClose, true );
QLayout * layout = new QVBoxLayout (this);
layout->addWidget (hig);
QDialogButtonBox * buttons = new QDialogButtonBox (QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
connect (buttons, SIGNAL (rejected ()), this, SLOT (deleteLater ()));
connect (buttons, SIGNAL (accepted ()), this, SLOT (onSetLocation ()));
layout->addWidget (buttons);
QWidget::setAttribute (Qt::WA_DeleteOnClose, true);
}

View file

@ -25,28 +25,28 @@ class TorrentModel;
class RelocateDialog: public QDialog
{
Q_OBJECT
Q_OBJECT
private:
QString myPath;
static bool myMoveFlag;
private:
QString myPath;
static bool myMoveFlag;
private:
Session & mySession;
TorrentModel& myModel;
QSet<int> myIds;
QPushButton * myDirButton;
QRadioButton * myMoveRadio;
private:
Session & mySession;
TorrentModel& myModel;
QSet<int> myIds;
QPushButton * myDirButton;
QRadioButton * myMoveRadio;
private slots:
void onFileSelected( const QString& path );
void onDirButtonClicked( );
void onSetLocation( );
void onMoveToggled( bool );
private slots:
void onFileSelected (const QString& path);
void onDirButtonClicked ();
void onSetLocation ();
void onMoveToggled (bool);
public:
RelocateDialog( Session&, TorrentModel&, const QSet<int>& ids, QWidget * parent = 0 );
~RelocateDialog( ) { }
public:
RelocateDialog (Session&, TorrentModel&, const QSet<int>& ids, QWidget * parent = 0);
~RelocateDialog () { }
};
#endif

File diff suppressed because it is too large Load diff

View file

@ -31,136 +31,136 @@ class AddData;
extern "C"
{
struct evbuffer;
struct tr_variant;
struct evbuffer;
struct tr_variant;
}
class Prefs;
class Session: public QObject
{
Q_OBJECT
Q_OBJECT
public:
Session( const char * configDir, Prefs& prefs );
~Session( );
public:
Session (const char * configDir, Prefs& prefs);
~Session ();
public:
void stop( );
void restart( );
public:
void stop ();
void restart ();
private:
void start( );
private:
void start ();
public:
const QUrl& getRemoteUrl( ) const { return myUrl; }
const struct tr_session_stats& getStats( ) const { return myStats; }
const struct tr_session_stats& getCumulativeStats( ) const { return myCumulativeStats; }
const QString& sessionVersion( ) const { return mySessionVersion; }
int64_t downloadDirFreeSpace( ) const { return myDownloadDirFreeSpace; }
public:
const QUrl& getRemoteUrl () const { return myUrl; }
const struct tr_session_stats& getStats () const { return myStats; }
const struct tr_session_stats& getCumulativeStats () const { return myCumulativeStats; }
const QString& sessionVersion () const { return mySessionVersion; }
int64_t downloadDirFreeSpace () const { return myDownloadDirFreeSpace; }
public:
int64_t blocklistSize( ) const { return myBlocklistSize; }
void setBlocklistSize( int64_t i );
void updateBlocklist( );
void portTest( );
void copyMagnetLinkToClipboard( int torrentId );
public:
int64_t blocklistSize () const { return myBlocklistSize; }
void setBlocklistSize (int64_t i);
void updateBlocklist ();
void portTest ();
void copyMagnetLinkToClipboard (int torrentId);
public:
public:
/** returns true if the transmission session is being run inside this client */
bool isServer( ) const;
/** returns true if the transmission session is being run inside this client */
bool isServer () const;
/** returns true if isServer() is true or if the remote address is the localhost */
bool isLocal( ) const;
/** returns true if isServer () is true or if the remote address is the localhost */
bool isLocal () const;
private:
void updateStats( struct tr_variant * args );
void updateInfo( struct tr_variant * args );
void parseResponse( const char * json, size_t len );
static void localSessionCallback( tr_session *, struct evbuffer *, void * );
private:
void updateStats (struct tr_variant * args);
void updateInfo (struct tr_variant * args);
void parseResponse (const char * json, size_t len);
static void localSessionCallback (tr_session *, struct evbuffer *, void *);
public:
void exec( const char * json );
void exec( const struct tr_variant * request );
public:
void exec (const char * json);
void exec (const struct tr_variant * request);
public:
int64_t getUniqueTag( ) { return nextUniqueTag++; }
public:
int64_t getUniqueTag () { return nextUniqueTag++; }
private:
void sessionSet( const tr_quark key, const QVariant& variant );
void pumpRequests( );
void sendTorrentRequest( const char * request, const QSet<int>& torrentIds );
static void updateStats( struct tr_variant * d, struct tr_session_stats * stats );
void refreshTorrents( const QSet<int>& torrentIds );
QNetworkAccessManager * networkAccessManager( );
private:
void sessionSet (const tr_quark key, const QVariant& variant);
void pumpRequests ();
void sendTorrentRequest (const char * request, const QSet<int>& torrentIds);
static void updateStats (struct tr_variant * d, struct tr_session_stats * stats);
void refreshTorrents (const QSet<int>& torrentIds);
QNetworkAccessManager * networkAccessManager ();
public:
void torrentSet( const QSet<int>& ids, const tr_quark key, bool val );
void torrentSet( const QSet<int>& ids, const tr_quark key, int val );
void torrentSet( const QSet<int>& ids, const tr_quark key, double val );
void torrentSet( const QSet<int>& ids, const tr_quark key, const QList<int>& val );
void torrentSet( const QSet<int>& ids, const tr_quark key, const QStringList& val );
void torrentSet( const QSet<int>& ids, const tr_quark key, const QPair<int,QString>& val);
void torrentSetLocation( const QSet<int>& ids, const QString& path, bool doMove );
void torrentRenamePath( const QSet<int>& ids, const QString& oldpath, const QString& newname );
public:
void torrentSet (const QSet<int>& ids, const tr_quark key, bool val);
void torrentSet (const QSet<int>& ids, const tr_quark key, int val);
void torrentSet (const QSet<int>& ids, const tr_quark key, double val);
void torrentSet (const QSet<int>& ids, const tr_quark key, const QList<int>& val);
void torrentSet (const QSet<int>& ids, const tr_quark key, const QStringList& val);
void torrentSet (const QSet<int>& ids, const tr_quark key, const QPair<int,QString>& val);
void torrentSetLocation (const QSet<int>& ids, const QString& path, bool doMove);
void torrentRenamePath (const QSet<int>& ids, const QString& oldpath, const QString& newname);
public slots:
void pauseTorrents( const QSet<int>& torrentIds = QSet<int>() );
void startTorrents( const QSet<int>& torrentIds = QSet<int>() );
void startTorrentsNow( const QSet<int>& torrentIds = QSet<int>() );
void queueMoveTop( const QSet<int>& torrentIds = QSet<int>() );
void queueMoveUp( const QSet<int>& torrentIds = QSet<int>() );
void queueMoveDown( const QSet<int>& torrentIds = QSet<int>() );
void queueMoveBottom( const QSet<int>& torrentIds = QSet<int>() );
void refreshSessionInfo( );
void refreshSessionStats( );
void refreshActiveTorrents( );
void refreshAllTorrents( );
void initTorrents( const QSet<int>& ids = QSet<int>() );
void addNewlyCreatedTorrent( const QString& filename, const QString& localPath );
void addTorrent( const AddData& addme );
void removeTorrents( const QSet<int>& torrentIds, bool deleteFiles=false );
void verifyTorrents( const QSet<int>& torrentIds );
void reannounceTorrents( const QSet<int>& torrentIds );
void launchWebInterface( );
void updatePref( int key );
public slots:
void pauseTorrents (const QSet<int>& torrentIds = QSet<int> ());
void startTorrents (const QSet<int>& torrentIds = QSet<int> ());
void startTorrentsNow (const QSet<int>& torrentIds = QSet<int> ());
void queueMoveTop (const QSet<int>& torrentIds = QSet<int> ());
void queueMoveUp (const QSet<int>& torrentIds = QSet<int> ());
void queueMoveDown (const QSet<int>& torrentIds = QSet<int> ());
void queueMoveBottom (const QSet<int>& torrentIds = QSet<int> ());
void refreshSessionInfo ();
void refreshSessionStats ();
void refreshActiveTorrents ();
void refreshAllTorrents ();
void initTorrents (const QSet<int>& ids = QSet<int> ());
void addNewlyCreatedTorrent (const QString& filename, const QString& localPath);
void addTorrent (const AddData& addme);
void removeTorrents (const QSet<int>& torrentIds, bool deleteFiles=false);
void verifyTorrents (const QSet<int>& torrentIds);
void reannounceTorrents (const QSet<int>& torrentIds);
void launchWebInterface ();
void updatePref (int key);
/** request a refresh for statistics, including the ones only used by the properties dialog, for a specific torrent */
void refreshExtraStats( const QSet<int>& ids );
/** request a refresh for statistics, including the ones only used by the properties dialog, for a specific torrent */
void refreshExtraStats (const QSet<int>& ids);
private slots:
void onFinished( QNetworkReply * reply );
void onResponseReceived (const QByteArray& json);
private slots:
void onFinished (QNetworkReply * reply);
void onResponseReceived (const QByteArray& json);
signals:
void responseReceived (const QByteArray& json);
void executed( int64_t tag, const QString& result, struct tr_variant * arguments );
void sourceChanged( );
void portTested( bool isOpen );
void statsUpdated( );
void sessionUpdated( );
void blocklistUpdated( int );
void torrentsUpdated( struct tr_variant * torrentList, bool completeList );
void torrentsRemoved( struct tr_variant * torrentList );
void dataReadProgress( );
void dataSendProgress( );
void httpAuthenticationRequired( );
signals:
void responseReceived (const QByteArray& json);
void executed (int64_t tag, const QString& result, struct tr_variant * arguments);
void sourceChanged ();
void portTested (bool isOpen);
void statsUpdated ();
void sessionUpdated ();
void blocklistUpdated (int);
void torrentsUpdated (struct tr_variant * torrentList, bool completeList);
void torrentsRemoved (struct tr_variant * torrentList);
void dataReadProgress ();
void dataSendProgress ();
void httpAuthenticationRequired ();
private:
int64_t nextUniqueTag;
int64_t myBlocklistSize;
Prefs& myPrefs;
tr_session * mySession;
QString myConfigDir;
QString mySessionId;
QStringList myIdleJSON;
QUrl myUrl;
QNetworkAccessManager * myNAM;
struct tr_session_stats myStats;
struct tr_session_stats myCumulativeStats;
QString mySessionVersion;
int64_t myDownloadDirFreeSpace;
private:
int64_t nextUniqueTag;
int64_t myBlocklistSize;
Prefs& myPrefs;
tr_session * mySession;
QString myConfigDir;
QString mySessionId;
QStringList myIdleJSON;
QUrl myUrl;
QNetworkAccessManager * myNAM;
struct tr_session_stats myStats;
struct tr_session_stats myCumulativeStats;
QString mySessionVersion;
int64_t myDownloadDirFreeSpace;
};
#endif

View file

@ -17,20 +17,21 @@
class Speed
{
private:
int _Bps;
Speed( int Bps ): _Bps(Bps) { }
public:
Speed( ): _Bps(0) { }
double KBps( ) const;
int Bps( ) const { return _Bps; }
bool isZero( ) const { return _Bps == 0; }
static Speed fromKBps( double KBps );
static Speed fromBps( int Bps ) { return Speed( Bps ); }
void setBps( int Bps ) { _Bps = Bps; }
Speed& operator+=( const Speed& that ) { _Bps += that._Bps; return *this; }
Speed operator+( const Speed& that ) const { return Speed( _Bps + that._Bps ); }
bool operator<( const Speed& that ) const { return _Bps < that._Bps; }
private:
int _Bps;
Speed (int Bps): _Bps (Bps) {}
public:
Speed (): _Bps (0) { }
double KBps () const;
int Bps () const { return _Bps; }
bool isZero () const { return _Bps == 0; }
static Speed fromKBps (double KBps);
static Speed fromBps (int Bps) { return Speed (Bps); }
void setBps (int Bps) { _Bps = Bps; }
Speed& operator+= (const Speed& that) { _Bps += that._Bps; return *this; }
Speed operator+ (const Speed& that) const { return Speed (_Bps + that._Bps); }
bool operator< (const Speed& that) const { return _Bps < that._Bps; }
};
#endif

View file

@ -22,78 +22,78 @@
enum
{
REFRESH_INTERVAL_MSEC = (15*1000)
REFRESH_INTERVAL_MSEC = (15*1000)
};
StatsDialog :: StatsDialog( Session & session, QWidget * parent ):
QDialog( parent, Qt::Dialog ),
mySession( session ),
myTimer( new QTimer( this ) )
StatsDialog :: StatsDialog (Session & session, QWidget * parent):
QDialog (parent, Qt::Dialog),
mySession (session),
myTimer (new QTimer (this))
{
myTimer->setSingleShot( false );
connect( myTimer, SIGNAL(timeout()), this, SLOT(onTimer()) );
setWindowTitle( tr( "Statistics" ) );
myTimer->setSingleShot (false);
connect (myTimer, SIGNAL (timeout ()), this, SLOT (onTimer ()));
setWindowTitle (tr ("Statistics"));
HIG * hig = new HIG( );
hig->addSectionTitle( tr( "Current Session" ) );
hig->addRow( tr( "Uploaded:" ), myCurrentUp = new QLabel( ) );
hig->addRow( tr( "Downloaded:" ), myCurrentDown = new QLabel( ) );
hig->addRow( tr( "Ratio:" ), myCurrentRatio = new QLabel( ) );
hig->addRow( tr( "Duration:" ), myCurrentDuration = new QLabel( ) );
hig->addSectionDivider( );
hig->addSectionTitle( tr( "Total" ) );
hig->addRow( myStartCount = new QLabel( tr( "Started %n time(s)", 0, 1 ) ), 0 );
hig->addRow( tr( "Uploaded:" ), myTotalUp = new QLabel( ) );
hig->addRow( tr( "Downloaded:" ), myTotalDown = new QLabel( ) );
hig->addRow( tr( "Ratio:" ), myTotalRatio = new QLabel( ) );
hig->addRow( tr( "Duration:" ), myTotalDuration = new QLabel( ) );
hig->finish( );
HIG * hig = new HIG ();
hig->addSectionTitle (tr ("Current Session"));
hig->addRow (tr ("Uploaded:"), myCurrentUp = new QLabel ());
hig->addRow (tr ("Downloaded:"), myCurrentDown = new QLabel ());
hig->addRow (tr ("Ratio:"), myCurrentRatio = new QLabel ());
hig->addRow (tr ("Duration:"), myCurrentDuration = new QLabel ());
hig->addSectionDivider ();
hig->addSectionTitle (tr ("Total"));
hig->addRow (myStartCount = new QLabel (tr ("Started %n time (s)", 0, 1)), 0);
hig->addRow (tr ("Uploaded:"), myTotalUp = new QLabel ());
hig->addRow (tr ("Downloaded:"), myTotalDown = new QLabel ());
hig->addRow (tr ("Ratio:"), myTotalRatio = new QLabel ());
hig->addRow (tr ("Duration:"), myTotalDuration = new QLabel ());
hig->finish ();
QLayout * layout = new QVBoxLayout( this );
layout->addWidget( hig );
QDialogButtonBox * buttons = new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal, this );
connect( buttons, SIGNAL(rejected()), this, SLOT(hide()) ); // "close" triggers rejected
layout->addWidget( buttons );
QLayout * layout = new QVBoxLayout (this);
layout->addWidget (hig);
QDialogButtonBox * buttons = new QDialogButtonBox (QDialogButtonBox::Close, Qt::Horizontal, this);
connect (buttons, SIGNAL (rejected ()), this, SLOT (hide ())); // "close" triggers rejected
layout->addWidget (buttons);
connect( &mySession, SIGNAL(statsUpdated()), this, SLOT(updateStats()) );
updateStats( );
mySession.refreshSessionStats( );
connect (&mySession, SIGNAL (statsUpdated ()), this, SLOT (updateStats ()));
updateStats ();
mySession.refreshSessionStats ();
}
StatsDialog :: ~StatsDialog( )
StatsDialog :: ~StatsDialog ()
{
}
void
StatsDialog :: setVisible( bool visible )
StatsDialog :: setVisible (bool visible)
{
myTimer->stop( );
if( visible )
myTimer->start( REFRESH_INTERVAL_MSEC );
QDialog::setVisible( visible );
myTimer->stop ();
if (visible)
myTimer->start (REFRESH_INTERVAL_MSEC);
QDialog::setVisible (visible);
}
void
StatsDialog :: onTimer( )
StatsDialog :: onTimer ()
{
mySession.refreshSessionStats( );
mySession.refreshSessionStats ();
}
void
StatsDialog :: updateStats( )
StatsDialog :: updateStats ()
{
const struct tr_session_stats& current( mySession.getStats( ) );
const struct tr_session_stats& total( mySession.getCumulativeStats( ) );
const struct tr_session_stats& current (mySession.getStats ());
const struct tr_session_stats& total (mySession.getCumulativeStats ());
myCurrentUp->setText( Formatter::sizeToString( current.uploadedBytes ) );
myCurrentDown->setText( Formatter::sizeToString( current.downloadedBytes ) );
myCurrentRatio->setText( Formatter::ratioToString( current.ratio ) );
myCurrentDuration->setText( Formatter::timeToString( current.secondsActive ) );
myCurrentUp->setText (Formatter::sizeToString (current.uploadedBytes));
myCurrentDown->setText (Formatter::sizeToString (current.downloadedBytes));
myCurrentRatio->setText (Formatter::ratioToString (current.ratio));
myCurrentDuration->setText (Formatter::timeToString (current.secondsActive));
myTotalUp->setText( Formatter::sizeToString( total.uploadedBytes ) );
myTotalDown->setText( Formatter::sizeToString( total.downloadedBytes ) );
myTotalRatio->setText( Formatter::ratioToString( total.ratio ) );
myTotalDuration->setText( Formatter::timeToString( total.secondsActive ) );
myTotalUp->setText (Formatter::sizeToString (total.uploadedBytes));
myTotalDown->setText (Formatter::sizeToString (total.downloadedBytes));
myTotalRatio->setText (Formatter::ratioToString (total.ratio));
myTotalDuration->setText (Formatter::timeToString (total.secondsActive));
myStartCount->setText( tr( "Started %n time(s)", 0, total.sessionCount ) );
myStartCount->setText (tr ("Started %n time (s)", 0, total.sessionCount));
}

View file

@ -21,34 +21,34 @@ class QTimer;
class StatsDialog: public QDialog
{
Q_OBJECT
Q_OBJECT
signals:
void accepted( );
signals:
void accepted ();
public slots:
void updateStats( );
public slots:
void updateStats ();
private slots:
void onTimer( );
private slots:
void onTimer ();
public:
StatsDialog( Session&, QWidget * parent = 0 );
~StatsDialog( );
virtual void setVisible( bool visible );
public:
StatsDialog (Session&, QWidget * parent = 0);
~StatsDialog ();
virtual void setVisible (bool visible);
private:
Session & mySession;
QTimer * myTimer;
QLabel * myCurrentUp;
QLabel * myCurrentDown;
QLabel * myCurrentRatio;
QLabel * myCurrentDuration;
QLabel * myStartCount;
QLabel * myTotalUp;
QLabel * myTotalDown;
QLabel * myTotalRatio;
QLabel * myTotalDuration;
private:
Session & mySession;
QTimer * myTimer;
QLabel * myCurrentUp;
QLabel * myCurrentDown;
QLabel * myCurrentRatio;
QLabel * myCurrentDuration;
QLabel * myStartCount;
QLabel * myTotalUp;
QLabel * myTotalDown;
QLabel * myTotalRatio;
QLabel * myTotalDuration;
};
#endif