mirror of
https://github.com/transmission/transmission.git
synced 2026-05-08 09:39:08 +01:00
sync the wx prototype with the new libtransmission class names
This commit is contained in:
+2
-2
@@ -22,10 +22,10 @@
|
||||
#include "filter.h"
|
||||
|
||||
int
|
||||
TorrentFilter :: GetFlags( const tr_torrent_t * tor )
|
||||
TorrentFilter :: GetFlags( const tr_torrent * tor )
|
||||
{
|
||||
int flags = 0;
|
||||
const tr_stat_t * s = tr_torrentStat( (tr_torrent_t*)tor );
|
||||
const tr_stat * s = tr_torrentStat( (tr_torrent*)tor );
|
||||
|
||||
switch( s->status )
|
||||
{
|
||||
|
||||
+2
-2
@@ -42,7 +42,7 @@ class TorrentFilter
|
||||
|
||||
public:
|
||||
|
||||
typedef std::vector<tr_torrent_t*> torrents_v;
|
||||
typedef std::vector<tr_torrent*> torrents_v;
|
||||
|
||||
enum Show {
|
||||
ALL,
|
||||
@@ -52,7 +52,7 @@ class TorrentFilter
|
||||
N_FILTERS
|
||||
};
|
||||
|
||||
static int GetFlags( const tr_torrent_t * );
|
||||
static int GetFlags( const tr_torrent * );
|
||||
|
||||
static void CountHits( const torrents_v & torrents,
|
||||
int * counts );
|
||||
|
||||
+3
-3
@@ -192,7 +192,7 @@ SpeedStats :: OnPaint( wxPaintEvent& WXUNUSED(event) )
|
||||
}
|
||||
|
||||
void
|
||||
SpeedStats :: SetTorrent( tr_torrent_t * tor )
|
||||
SpeedStats :: SetTorrent( tr_torrent * tor )
|
||||
{
|
||||
if( tor != myTorrent )
|
||||
{
|
||||
@@ -210,7 +210,7 @@ SpeedStats :: SetTorrent( tr_torrent_t * tor )
|
||||
}
|
||||
|
||||
void
|
||||
SpeedStats :: Pulse( tr_handle_t * handle )
|
||||
SpeedStats :: Pulse( tr_handle * handle )
|
||||
{
|
||||
// add a new record
|
||||
float allUp, allDown;
|
||||
@@ -220,7 +220,7 @@ SpeedStats :: Pulse( tr_handle_t * handle )
|
||||
s.allUp = allUp;
|
||||
s.allDown = allDown;
|
||||
if( myTorrent ) {
|
||||
const tr_stat_t * stat = tr_torrentStat( myTorrent );
|
||||
const tr_stat * stat = tr_torrentStat( myTorrent );
|
||||
s.torrentUp = stat->rateUpload;
|
||||
s.torrentDown = stat->rateDownload;
|
||||
}
|
||||
|
||||
+4
-4
@@ -29,7 +29,7 @@
|
||||
|
||||
extern "C"
|
||||
{
|
||||
struct tr_torrent_s;
|
||||
struct tr_torrent;
|
||||
}
|
||||
|
||||
class SpeedStats: public wxPanel
|
||||
@@ -47,9 +47,9 @@ class SpeedStats: public wxPanel
|
||||
|
||||
public:
|
||||
|
||||
void SetTorrent( struct tr_torrent_s * );
|
||||
void SetTorrent( struct tr_torrent * );
|
||||
|
||||
void Pulse( tr_handle_t * handle );
|
||||
void Pulse( tr_handle * handle );
|
||||
|
||||
public:
|
||||
|
||||
@@ -79,7 +79,7 @@ class SpeedStats: public wxPanel
|
||||
|
||||
wxBitmap * myBitmap;
|
||||
|
||||
struct tr_torrent_s * myTorrent;
|
||||
struct tr_torrent * myTorrent;
|
||||
|
||||
struct Speed
|
||||
{
|
||||
|
||||
+22
-22
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
typedef std::vector<tr_torrent_t*> torrents_t;
|
||||
typedef std::vector<tr_torrent*> torrents_t;
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -182,11 +182,11 @@ END_EVENT_TABLE()
|
||||
|
||||
|
||||
|
||||
TorrentListCtrl :: TorrentListCtrl( tr_handle_t * handle,
|
||||
wxConfig * config,
|
||||
wxWindow * parent,
|
||||
const wxPoint & pos,
|
||||
const wxSize & size):
|
||||
TorrentListCtrl :: TorrentListCtrl( tr_handle * handle,
|
||||
wxConfig * config,
|
||||
wxWindow * parent,
|
||||
const wxPoint & pos,
|
||||
const wxSize & size):
|
||||
wxListCtrl( parent, TORRENT_LIST_CTRL, pos, size, wxLC_REPORT|wxLC_HRULES ),
|
||||
myHandle( handle ),
|
||||
myConfig( config )
|
||||
@@ -218,15 +218,15 @@ TorrentListCtrl :: SetCell( int item, int column, const wxString& xstr )
|
||||
}
|
||||
|
||||
void
|
||||
TorrentListCtrl :: RefreshTorrent( tr_torrent_t * tor,
|
||||
int myTorrents_index,
|
||||
const int_v & cols )
|
||||
TorrentListCtrl :: RefreshTorrent( tr_torrent * tor,
|
||||
int myTorrents_index,
|
||||
const int_v & cols )
|
||||
{
|
||||
int row = -1;
|
||||
int col = 0;
|
||||
char buf[512];
|
||||
std::string str;
|
||||
const tr_stat_t * s = getStat( tor );
|
||||
const tr_stat * s = getStat( tor );
|
||||
const tr_info_t* info = tr_torrentInfo( tor );
|
||||
|
||||
for( int_v::const_iterator it(cols.begin()), end(cols.end()); it!=end; ++it )
|
||||
@@ -369,7 +369,7 @@ TorrentListCtrl :: OnSort( wxListEvent& event )
|
||||
void
|
||||
TorrentListCtrl :: OnItemSelected( wxListEvent& WXUNUSED(event) )
|
||||
{
|
||||
std::set<tr_torrent_t*> sel;
|
||||
std::set<tr_torrent*> sel;
|
||||
long item = -1;
|
||||
for ( ;; ) {
|
||||
item = GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
||||
@@ -396,12 +396,12 @@ int wxCALLBACK
|
||||
TorrentListCtrl :: Compare( long item1, long item2, long sortData )
|
||||
{
|
||||
TorrentListCtrl * self = uglyHack;
|
||||
tr_torrent_t * a = self->myTorrents[item1];
|
||||
tr_torrent_t * b = self->myTorrents[item2];
|
||||
const tr_info_t* ia = tr_torrentInfo( a );
|
||||
const tr_info_t* ib = tr_torrentInfo( b );
|
||||
const tr_stat_t* sa = self->getStat( a );
|
||||
const tr_stat_t* sb = self->getStat( b );
|
||||
tr_torrent * a = self->myTorrents[item1];
|
||||
tr_torrent * b = self->myTorrents[item2];
|
||||
const tr_info* ia = tr_torrentInfo( a );
|
||||
const tr_info* ib = tr_torrentInfo( b );
|
||||
const tr_stat* sa = self->getStat( a );
|
||||
const tr_stat* sb = self->getStat( b );
|
||||
int ret = 0;
|
||||
|
||||
switch( abs(sortData) )
|
||||
@@ -590,7 +590,7 @@ TorrentListCtrl :: Refresh ()
|
||||
for( int row=0; row<rowCount; ++row )
|
||||
{
|
||||
int array_index = GetItemData( row );
|
||||
tr_torrent_t * tor = myTorrents[array_index];
|
||||
tr_torrent * tor = myTorrents[array_index];
|
||||
RefreshTorrent( tor, array_index, cols );
|
||||
}
|
||||
}
|
||||
@@ -652,7 +652,7 @@ TorrentListCtrl :: Rebuild()
|
||||
Repopulate( );
|
||||
}
|
||||
|
||||
typedef std::set<tr_torrent_t*> torrent_set;
|
||||
typedef std::set<tr_torrent*> torrent_set;
|
||||
|
||||
void
|
||||
TorrentListCtrl :: Assign( const torrents_t& torrents )
|
||||
@@ -689,7 +689,7 @@ TorrentListCtrl :: Remove( const torrent_set& remove )
|
||||
|
||||
for( int item=0; item<GetItemCount(); )
|
||||
{
|
||||
tr_torrent_t * tor = myTorrents[GetItemData(item)];
|
||||
tr_torrent * tor = myTorrents[GetItemData(item)];
|
||||
const tr_info_t* info = tr_torrentInfo( tor );
|
||||
|
||||
if( remove.count( tor ) )
|
||||
@@ -712,8 +712,8 @@ TorrentListCtrl :: Remove( const torrent_set& remove )
|
||||
****
|
||||
***/
|
||||
|
||||
const tr_stat_t*
|
||||
TorrentListCtrl :: getStat( tr_torrent_t * tor )
|
||||
const tr_stat*
|
||||
TorrentListCtrl :: getStat( tr_torrent * tor )
|
||||
{
|
||||
const tr_info_t * info = tr_torrentInfo( tor );
|
||||
const time_t now = time( 0 );
|
||||
|
||||
+8
-8
@@ -66,13 +66,13 @@ class TorrentListCtrl: public wxListCtrl
|
||||
|
||||
virtual void OnTorrentListSelectionChanged(
|
||||
TorrentListCtrl*,
|
||||
const std::set<tr_torrent_t*>& ) = 0;
|
||||
const std::set<tr_torrent*>& ) = 0;
|
||||
};
|
||||
|
||||
private:
|
||||
typedef std::set<Listener*> listeners_t;
|
||||
listeners_t myListeners;
|
||||
void fire_selection_changed( const std::set<tr_torrent_t*>& t ) {
|
||||
void fire_selection_changed( const std::set<tr_torrent*>& t ) {
|
||||
for( listeners_t::iterator it(myListeners.begin()), end(myListeners.end()); it!=end; )
|
||||
(*it++)->OnTorrentListSelectionChanged( this, t );
|
||||
}
|
||||
@@ -88,15 +88,15 @@ class TorrentListCtrl: public wxListCtrl
|
||||
void DeselectAll ();
|
||||
|
||||
public:
|
||||
typedef std::vector<tr_torrent_t*> torrents_v;
|
||||
typedef std::vector<tr_torrent*> torrents_v;
|
||||
void Assign( const torrents_v& torrents );
|
||||
|
||||
private:
|
||||
void Add( const torrents_v& torrents );
|
||||
void Sort( int column );
|
||||
void Resort( );
|
||||
void RefreshTorrent( tr_torrent_t*, int, const std::vector<int>& );
|
||||
void Remove( const std::set<tr_torrent_t*>& );
|
||||
void RefreshTorrent( tr_torrent*, int, const std::vector<int>& );
|
||||
void Remove( const std::set<tr_torrent*>& );
|
||||
static int wxCALLBACK Compare( long, long, long );
|
||||
|
||||
/** torrent hash -> the torrent's row in myTorrentList */
|
||||
@@ -109,12 +109,12 @@ class TorrentListCtrl: public wxListCtrl
|
||||
private:
|
||||
struct TorStat {
|
||||
time_t time;
|
||||
const tr_stat_t * stat;
|
||||
const tr_stat * stat;
|
||||
TorStat(): time(0), stat(0) {}
|
||||
};
|
||||
typedef std::map<std::string,TorStat> hash2stat_t;
|
||||
hash2stat_t myHashToStat;
|
||||
const tr_stat_t* getStat( tr_torrent_t* );
|
||||
const tr_stat* getStat( tr_torrent* );
|
||||
|
||||
private:
|
||||
void OnSort( wxListEvent& );
|
||||
@@ -123,7 +123,7 @@ class TorrentListCtrl: public wxListCtrl
|
||||
bool IsSorted( ) const;
|
||||
|
||||
private:
|
||||
tr_handle_t * myHandle;
|
||||
tr_handle * myHandle;
|
||||
wxConfig * myConfig;
|
||||
torrents_v myTorrents;
|
||||
int prevSortCol;
|
||||
|
||||
+10
-10
@@ -135,9 +135,9 @@ class MyApp : public wxApp
|
||||
|
||||
namespace
|
||||
{
|
||||
tr_handle_t * handle = NULL;
|
||||
tr_handle * handle = NULL;
|
||||
|
||||
typedef std::vector<tr_torrent_t*> torrents_v;
|
||||
typedef std::vector<tr_torrent*> torrents_v;
|
||||
}
|
||||
|
||||
class MyFrame : public wxFrame, public TorrentListCtrl::Listener
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
|
||||
void OnPulse( wxTimerEvent& );
|
||||
|
||||
virtual void OnTorrentListSelectionChanged( TorrentListCtrl*, const std::set<tr_torrent_t*>& );
|
||||
virtual void OnTorrentListSelectionChanged( TorrentListCtrl*, const std::set<tr_torrent*>& );
|
||||
|
||||
private:
|
||||
void RefreshFilterCounts( );
|
||||
@@ -368,10 +368,10 @@ void MyFrame :: OnOpen( wxCommandEvent& WXUNUSED(event) )
|
||||
for( size_t i=0; i<nPaths; ++i )
|
||||
{
|
||||
const std::string filename = toStr( paths[i] );
|
||||
tr_torrent_t * tor = tr_torrentInit( handle,
|
||||
filename.c_str(),
|
||||
mySavePath.c_str(),
|
||||
TR_FLAG_SAVE, NULL );
|
||||
tr_torrent * tor = tr_torrentInit( handle,
|
||||
filename.c_str(),
|
||||
mySavePath.c_str(),
|
||||
TR_FLAG_SAVE, NULL );
|
||||
if( tor )
|
||||
myTorrents.push_back( tor );
|
||||
}
|
||||
@@ -439,12 +439,12 @@ MyFrame :: ApplyCurrentFilter( )
|
||||
|
||||
void
|
||||
MyFrame :: OnTorrentListSelectionChanged( TorrentListCtrl* list,
|
||||
const std::set<tr_torrent_t*>& torrents )
|
||||
const std::set<tr_torrent*>& torrents )
|
||||
{
|
||||
assert( list == myTorrentList );
|
||||
mySelectedTorrents.assign( torrents.begin(), torrents.end() );
|
||||
|
||||
tr_torrent_t * tor = mySelectedTorrents.empty() ? NULL : mySelectedTorrents.front();
|
||||
tr_torrent * tor = mySelectedTorrents.empty() ? NULL : mySelectedTorrents.front();
|
||||
mySpeedStats->SetTorrent( tor );
|
||||
}
|
||||
|
||||
@@ -677,7 +677,7 @@ MyFrame :: MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size
|
||||
if( paused )
|
||||
flags |= TR_FLAG_PAUSED;
|
||||
int count = 0;
|
||||
tr_torrent_t ** torrents = tr_loadTorrents ( handle, mySavePath.c_str(), flags, &count );
|
||||
tr_torrent ** torrents = tr_loadTorrents ( handle, mySavePath.c_str(), flags, &count );
|
||||
myTorrents.insert( myTorrents.end(), torrents, torrents+count );
|
||||
tr_free( torrents );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user