From 32a9006121b9c41100879a3ebeec480d1aa2689c Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 21 Dec 2008 20:02:21 +0000 Subject: [PATCH] (trunk wx) get the wx client mostly building again. --- wx/filter.cc | 4 ++-- wx/speed-stats.cc | 8 ++++---- wx/torrent-list.cc | 20 ++++++++++---------- wx/xmission.cc | 14 +++++++------- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/wx/filter.cc b/wx/filter.cc index 93bd81f47..889eef113 100644 --- a/wx/filter.cc +++ b/wx/filter.cc @@ -27,7 +27,7 @@ TorrentFilter :: GetFlags( const tr_torrent * tor ) int flags = 0; const tr_stat * s = tr_torrentStat( (tr_torrent*)tor ); - switch( s->status ) + switch( s->activity ) { case TR_STATUS_DOWNLOAD: flags |= FLAG_LEECHING; @@ -43,7 +43,7 @@ TorrentFilter :: GetFlags( const tr_torrent * tor ) break; } - flags |= ( ( s->rateUpload + s->rateDownload ) > 0.01 ) + flags |= ( ( s->pieceUploadSpeed + s->pieceDownloadSpeed ) > 0.01 ) ? FLAG_ACTIVE : FLAG_IDLE; diff --git a/wx/speed-stats.cc b/wx/speed-stats.cc index a4980ab49..ecba60913 100644 --- a/wx/speed-stats.cc +++ b/wx/speed-stats.cc @@ -213,16 +213,16 @@ void SpeedStats :: Pulse( tr_handle * handle ) { // add a new record - float allUp, allDown; - tr_sessionGetSpeed( handle, &allDown, &allUp ); + const double allUp = tr_sessionGetPieceSpeed( handle, TR_UP ); + const double allDown = tr_sessionGetPieceSpeed( handle, TR_DOWN ); Speed s; s.time = time( NULL ); s.allUp = allUp; s.allDown = allDown; if( myTorrent ) { const tr_stat * stat = tr_torrentStat( myTorrent ); - s.torrentUp = stat->rateUpload; - s.torrentDown = stat->rateDownload; + s.torrentUp = stat->pieceUploadSpeed; + s.torrentDown = stat->pieceDownloadSpeed; } myStats.push_back( s ); diff --git a/wx/torrent-list.cc b/wx/torrent-list.cc index 732509281..62ea6e867 100644 --- a/wx/torrent-list.cc +++ b/wx/torrent-list.cc @@ -248,8 +248,8 @@ TorrentListCtrl :: RefreshTorrent( tr_torrent * tor, break; case COL_DOWNLOAD_SPEED: - if( s->rateDownload > 0.01 ) - xstr = getReadableSpeed( s->rateDownload ); + if( s->pieceDownloadSpeed > 0.01 ) + xstr = getReadableSpeed( s->pieceDownloadSpeed ); else xstr.Clear( ); break; @@ -304,7 +304,7 @@ TorrentListCtrl :: RefreshTorrent( tr_torrent * tor, case COL_STATE: /* FIXME: divine the meaning of these two columns */ case COL_STATUS: - switch( s->status ) { + switch( s->activity ) { case TR_STATUS_STOPPED: xstr = _("Stopped"); break; case TR_STATUS_CHECK: xstr = wxString::Format ( _("Checking Files (%.0f)"), s->recheckProgress ); break; case TR_STATUS_CHECK_WAIT: xstr = _("Waiting to Check"); break; @@ -319,8 +319,8 @@ TorrentListCtrl :: RefreshTorrent( tr_torrent * tor, break; case COL_UPLOAD_SPEED: - if( s->rateUpload > 0.01 ) - xstr = getReadableSpeed( s->rateUpload ); + if( s->pieceUploadSpeed > 0.01 ) + xstr = getReadableSpeed( s->pieceUploadSpeed ); else xstr.Clear( ); break; @@ -420,9 +420,9 @@ TorrentListCtrl :: Compare( long item1, long item2, long sortData ) break; case COL_DOWNLOAD_SPEED: - if( sa->rateDownload < sb->rateDownload ) + if( sa->pieceDownloadSpeed < sb->pieceDownloadSpeed ) ret = -1; - else if( sa->rateDownload > sb->rateDownload ) + else if( sa->pieceDownloadSpeed > sb->pieceDownloadSpeed ) ret = 1; else ret = 0; @@ -498,7 +498,7 @@ TorrentListCtrl :: Compare( long item1, long item2, long sortData ) case COL_STATE: /* FIXME */ case COL_STATUS: - ret = sa->status - sb->status; + ret = sa->activity - sb->activity; break; case COL_TOTAL: @@ -506,9 +506,9 @@ TorrentListCtrl :: Compare( long item1, long item2, long sortData ) break; case COL_UPLOAD_SPEED: - if( sa->rateUpload < sb->rateUpload ) + if( sa->pieceUploadSpeed < sb->pieceUploadSpeed ) ret = -1; - else if( sa->rateUpload > sb->rateUpload ) + else if( sa->pieceUploadSpeed > sb->pieceUploadSpeed ) ret = 1; else ret = 0; diff --git a/wx/xmission.cc b/wx/xmission.cc index 3d0aa3544..b942194c1 100755 --- a/wx/xmission.cc +++ b/wx/xmission.cc @@ -285,7 +285,7 @@ MyFrame :: OnStartUpdate( wxUpdateUIEvent& event ) { bool enable = false; foreach( torrents_v, mySelectedTorrents, it ) - if( tr_torrentStatCached(*it)->status == TR_STATUS_STOPPED ) + if( tr_torrentStatCached(*it)->activity == TR_STATUS_STOPPED ) enable = true; event.Enable( enable ); } @@ -293,7 +293,7 @@ void MyFrame :: OnStart( wxCommandEvent& WXUNUSED(unused) ) { foreach( torrents_v, mySelectedTorrents, it ) - if( tr_torrentStatCached(*it)->status == TR_STATUS_STOPPED ) + if( tr_torrentStatCached(*it)->activity == TR_STATUS_STOPPED ) tr_torrentStart( *it ); } @@ -305,7 +305,7 @@ MyFrame :: OnStopUpdate( wxUpdateUIEvent& event ) { bool enable = false; foreach( torrents_v, mySelectedTorrents, it ) - if( tr_torrentStatCached(*it)->status != TR_STATUS_STOPPED ) + if( tr_torrentStatCached(*it)->activity != TR_STATUS_STOPPED ) enable = true; event.Enable( enable ); } @@ -313,7 +313,7 @@ void MyFrame :: OnStop( wxCommandEvent& WXUNUSED(unused) ) { foreach( torrents_v, mySelectedTorrents, it ) - if( tr_torrentStat(*it)->status != TR_STATUS_STOPPED ) + if( tr_torrentStat(*it)->activity != TR_STATUS_STOPPED ) tr_torrentStop( *it ); } @@ -473,8 +473,8 @@ MyFrame :: OnPulse(wxTimerEvent& WXUNUSED(event) ) mySpeedStats->Pulse( handle ); - float down, up; - tr_sessionGetSpeed( handle, &down, &up ); + const double up = tr_sessionGetPieceSpeed( handle, TR_UP ); + const double down = tr_sessionGetPieceSpeed( handle, TR_DOWN ); wxString xstr = _("Total DL: "); xstr += getReadableSpeed( down ); SetStatusText( xstr, 1 ); @@ -519,7 +519,7 @@ MyFrame :: MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size long port; wxString key = _T("port"); - if( !myConfig->Read( key, &port, TR_DEFAULT_PORT ) ) + if( !myConfig->Read( key, &port, atoi( TR_DEFAULT_PEER_PORT_STR ) ) ) myConfig->Write( key, port ); tr_sessionSetPeerPort( handle, port );