1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org )
5 //
6 // Any parts of this program derived from the xMule, lMule or eMule project,
7 // or contributed by third-party developers are copyrighted by their
8 // respective authors.
9 //
10 // This program is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU General Public License as published by
12 // the Free Software Foundation; either version 2 of the License, or
13 // (at your option) any later version.
14 //
15 // This program is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with this program; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
23 //
24 #include "SourceListCtrl.h"
25 #include "KnownFile.h"
26 
27 static CGenericClientListCtrlColumn s_sources_column_info[] = {
28 	{ ColumnUserName,		wxTRANSLATE("User Name"),	260 },
29 	{ ColumnUserDownloaded,		wxTRANSLATE("Downloaded"),	65 },
30 	{ ColumnUserSpeedDown,		wxTRANSLATE("Speed"),		65 },
31 	{ ColumnUserUploaded,		wxTRANSLATE("Uploaded"),	65 },
32 	{ ColumnUserProgress,		wxTRANSLATE("Available Parts"),	170 },
33 	{ ColumnUserVersion,		wxTRANSLATE("Version"),		50 },
34 	{ ColumnUserQueueRankRemote,	wxTRANSLATE("Download Status"),	55 },
35 	{ ColumnUserOrigin,		wxTRANSLATE("Origin"),		110 },
36 	{ ColumnUserFileNameDownload,	wxTRANSLATE("Local File Name"),	200 },
37 	{ ColumnUserFileNameDownloadRemote, wxTRANSLATE("Remote File Name"), 200 },
38 	{ ColumnUserSharedFiles,	wxTRANSLATE("Shares File List"), 100 }
39 };
40 
BEGIN_EVENT_TABLE(CSourceListCtrl,CGenericClientListCtrl)41 BEGIN_EVENT_TABLE(CSourceListCtrl, CGenericClientListCtrl)
42 END_EVENT_TABLE()
43 
44 CSourceListCtrl::CSourceListCtrl(
45 	wxWindow *parent, wxWindowID winid, const wxPoint& pos, const wxSize& size,
46 	long style, const wxValidator& validator, const wxString& name )
47 :
48 CGenericClientListCtrl( wxT("Sources"), parent, winid, pos, size, style | wxLC_OWNERDRAW, validator, name )
49 {
50 	// Setting the sorter function.
51 	SetSortFunc( SourceSortProc );
52 
53 	m_columndata.n_columns = sizeof(s_sources_column_info) / sizeof(CGenericClientListCtrlColumn);
54 	m_columndata.columns = s_sources_column_info;
55 
56 	InitColumnData();
57 }
58 
~CSourceListCtrl()59 CSourceListCtrl::~CSourceListCtrl()
60 {
61 }
62 
SourceSortProc(wxUIntPtr param1,wxUIntPtr param2,long sortData)63 int CSourceListCtrl::SourceSortProc(wxUIntPtr param1, wxUIntPtr param2, long sortData)
64 {
65 	return CGenericClientListCtrl::SortProc(param1, param2, s_sources_column_info[sortData & CMuleListCtrl::COLUMN_MASK].cid | (sortData & CMuleListCtrl::SORT_DES));
66 }
67 
SetShowSources(CKnownFile * f,bool b) const68 void CSourceListCtrl::SetShowSources(CKnownFile * f, bool b) const
69 {
70 	f->SetShowSources(b);
71 }
72 
73 // File_checked_for_headers
74