diff --git a/qt/details.cc b/qt/details.cc index 6647b9696..87e593632 100644 --- a/qt/details.cc +++ b/qt/details.cc @@ -381,7 +381,7 @@ Details :: refresh( ) string = Formatter::ratioToString( torrents.first()->ratio() ); else { bool isMixed = false; - int ratioType = torrents.first()->ratio(); + int ratioType = (int) torrents.first()->ratio(); if( ratioType > 0 ) ratioType = 0; foreach( const Torrent *t, torrents ) { @@ -636,11 +636,11 @@ Details :: refresh( ) myBandwidthPriorityCombo->blockSignals( false ); mySingleDownSpin->blockSignals( true ); - mySingleDownSpin->setValue( tor->downloadLimit().KBps() ); + mySingleDownSpin->setValue( (int)tor->downloadLimit().KBps() ); mySingleDownSpin->blockSignals( false ); mySingleUpSpin->blockSignals( true ); - mySingleUpSpin->setValue( tor->uploadLimit().KBps() ); + mySingleUpSpin->setValue( (int)tor->uploadLimit().KBps() ); mySingleUpSpin->blockSignals( false ); myPeerLimitSpin->blockSignals( true ); diff --git a/qt/formatter.cc b/qt/formatter.cc index a6908107f..1da7b0baa 100644 --- a/qt/formatter.cc +++ b/qt/formatter.cc @@ -84,7 +84,7 @@ Speed :: KBps( ) const Speed Speed :: fromKBps( double KBps ) { - return KBps * speed_K; + return int( KBps * speed_K ); } /*** @@ -92,7 +92,7 @@ Speed :: fromKBps( double KBps ) ***/ QString -Formatter :: memToString( double bytes ) +Formatter :: memToString( uint64_t bytes ) { if( !bytes ) return tr( "None" ); @@ -104,7 +104,7 @@ Formatter :: memToString( double bytes ) } QString -Formatter :: sizeToString( double bytes ) +Formatter :: sizeToString( uint64_t bytes ) { if( !bytes ) return tr( "None" ); diff --git a/qt/formatter.h b/qt/formatter.h index 25cb6004d..e667c0861 100644 --- a/qt/formatter.h +++ b/qt/formatter.h @@ -30,8 +30,8 @@ class Formatter: public QObject public: - static QString memToString( double bytes ); - static QString sizeToString( double bytes ); + static QString memToString( uint64_t bytes ); + static QString sizeToString( uint64_t bytes ); static QString speedToString( const Speed& speed ); static QString percentToString( double x ); static QString ratioToString( double ratio ); diff --git a/qt/speed.h b/qt/speed.h index b7e94d0ca..b057592ca 100644 --- a/qt/speed.h +++ b/qt/speed.h @@ -27,7 +27,7 @@ class Speed bool isZero( ) const { return _Bps == 0; } static Speed fromKBps( double KBps ); static Speed fromBps( int Bps ) { return Speed( Bps ); } - void setBps( double Bps ) { _Bps = 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; }