the "recheck" button works now.
This commit is contained in:
parent
c9f9a07415
commit
b74e6a3c12
|
@ -58,7 +58,7 @@ namespace
|
||||||
typedef std::vector<tr_torrent_t*> torrents_v;
|
typedef std::vector<tr_torrent_t*> torrents_v;
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyFrame : public wxFrame
|
class MyFrame : public wxFrame, public TorrentListCtrl::Listener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
|
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
|
||||||
|
@ -68,8 +68,10 @@ public:
|
||||||
void OnQuit( wxCommandEvent& );
|
void OnQuit( wxCommandEvent& );
|
||||||
void OnAbout( wxCommandEvent& );
|
void OnAbout( wxCommandEvent& );
|
||||||
void OnOpen( wxCommandEvent& );
|
void OnOpen( wxCommandEvent& );
|
||||||
|
void OnRecheck( wxCommandEvent& );
|
||||||
void OnTimer( wxTimerEvent& );
|
void OnTimer( wxTimerEvent& );
|
||||||
void OnItemSelected( wxListEvent& );
|
void OnItemSelected( wxListEvent& );
|
||||||
|
virtual void OnTorrentListSelectionChanged( TorrentListCtrl*, const std::set<tr_torrent_t*>& );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void RefreshFilterCounts( );
|
void RefreshFilterCounts( );
|
||||||
|
@ -85,6 +87,7 @@ private:
|
||||||
wxIcon * myLogoIcon;
|
wxIcon * myLogoIcon;
|
||||||
wxIcon * myTrayLogo;
|
wxIcon * myTrayLogo;
|
||||||
torrents_v myTorrents;
|
torrents_v myTorrents;
|
||||||
|
torrents_v mySelectedTorrents;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
@ -107,6 +110,7 @@ enum
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||||
EVT_LIST_ITEM_SELECTED( ID_Filter, MyFrame::OnItemSelected )
|
EVT_LIST_ITEM_SELECTED( ID_Filter, MyFrame::OnItemSelected )
|
||||||
|
EVT_MENU( wxID_REFRESH, MyFrame::OnRecheck )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
IMPLEMENT_APP(MyApp)
|
IMPLEMENT_APP(MyApp)
|
||||||
|
@ -219,6 +223,22 @@ MyFrame :: OnItemSelected( wxListEvent& event )
|
||||||
myTorrentList->Assign( tmp );
|
myTorrentList->Assign( tmp );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MyFrame :: OnRecheck( wxCommandEvent& unused )
|
||||||
|
{
|
||||||
|
for( torrents_v::iterator it(mySelectedTorrents.begin()),
|
||||||
|
end(mySelectedTorrents.end()); it!=end; ++it )
|
||||||
|
tr_torrentRecheck( *it );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MyFrame :: OnTorrentListSelectionChanged( TorrentListCtrl* list,
|
||||||
|
const std::set<tr_torrent_t*>& torrents )
|
||||||
|
{
|
||||||
|
assert( list == myTorrentList );
|
||||||
|
mySelectedTorrents.assign( torrents.begin(), torrents.end() );
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MyFrame :: OnTimer(wxTimerEvent& event)
|
MyFrame :: OnTimer(wxTimerEvent& event)
|
||||||
{
|
{
|
||||||
|
@ -238,6 +258,9 @@ MyFrame :: OnTimer(wxTimerEvent& event)
|
||||||
|
|
||||||
MyFrame::~MyFrame()
|
MyFrame::~MyFrame()
|
||||||
{
|
{
|
||||||
|
myTorrentList->RemoveListener( this );
|
||||||
|
delete myTorrentList;
|
||||||
|
|
||||||
delete myConfig;
|
delete myConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,6 +360,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size):
|
||||||
/* Torrent List */
|
/* Torrent List */
|
||||||
|
|
||||||
myTorrentList = new TorrentListCtrl( handle, myConfig, row1 );
|
myTorrentList = new TorrentListCtrl( handle, myConfig, row1 );
|
||||||
|
myTorrentList->AddListener( this );
|
||||||
|
|
||||||
wxBoxSizer * boxSizer = new wxBoxSizer( wxHORIZONTAL );
|
wxBoxSizer * boxSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
boxSizer->Add( myFilters, 0, wxEXPAND|wxRIGHT, 5 );
|
boxSizer->Add( myFilters, 0, wxEXPAND|wxRIGHT, 5 );
|
||||||
|
|
Loading…
Reference in New Issue