Changeset 2476


Ignore:
Timestamp:
Jul 24, 2007, 4:36:36 AM (15 years ago)
Author:
charles
Message:

the "recheck" button works now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wx/xmission.cc

    r2471 r2476  
    5959}
    6060
    61 class MyFrame : public wxFrame
     61class MyFrame : public wxFrame, public TorrentListCtrl::Listener
    6262{
    6363public:
     
    6969    void OnAbout( wxCommandEvent& );
    7070    void OnOpen( wxCommandEvent& );
     71    void OnRecheck( wxCommandEvent& );
    7172    void OnTimer( wxTimerEvent& );
    7273    void OnItemSelected( wxListEvent& );
     74    virtual void OnTorrentListSelectionChanged( TorrentListCtrl*, const std::set<tr_torrent_t*>& );
    7375
    7476private:
     
    8688    wxIcon * myTrayLogo;
    8789    torrents_v myTorrents;
     90    torrents_v mySelectedTorrents;
    8891
    8992private:
     
    108111BEGIN_EVENT_TABLE(MyFrame, wxFrame)
    109112    EVT_LIST_ITEM_SELECTED( ID_Filter, MyFrame::OnItemSelected )
     113    EVT_MENU( wxID_REFRESH, MyFrame::OnRecheck )
    110114END_EVENT_TABLE()
    111115
     
    221225
    222226void
     227MyFrame :: OnRecheck( wxCommandEvent& unused )
     228{
     229    for( torrents_v::iterator it(mySelectedTorrents.begin()),
     230                             end(mySelectedTorrents.end()); it!=end; ++it )
     231        tr_torrentRecheck( *it );
     232}
     233
     234void
     235MyFrame :: OnTorrentListSelectionChanged( TorrentListCtrl* list,
     236                                          const std::set<tr_torrent_t*>& torrents )
     237{
     238    assert( list == myTorrentList );
     239    mySelectedTorrents.assign( torrents.begin(), torrents.end() );
     240}
     241
     242void
    223243MyFrame :: OnTimer(wxTimerEvent& event)
    224244{
     
    239259MyFrame::~MyFrame()
    240260{
     261    myTorrentList->RemoveListener( this );
     262    delete myTorrentList;
     263
    241264    delete myConfig;
    242265}
     
    338361
    339362    myTorrentList = new TorrentListCtrl( handle, myConfig, row1 );
     363    myTorrentList->AddListener( this );
    340364
    341365    wxBoxSizer * boxSizer = new wxBoxSizer( wxHORIZONTAL );
Note: See TracChangeset for help on using the changeset viewer.