Upstream tarball 20080414
[amule.git] / src / PartFileConvert.h
blobf79ac3286df68651d739f75f27b45ab5c0b43b4c
1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org )
5 // Copyright (c) 2002 Merkur ( devs@emule-project.net / http://www.emule-project.net )
6 //
7 // Any parts of this program derived from the xMule, lMule or eMule project,
8 // or contributed by third-party developers are copyrighted by their
9 // respective authors.
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #ifndef PARTFILECONVERT_H
27 #define PARTFILECONVERT_H
29 #include <wx/dialog.h>
30 #include <wx/listctrl.h>
31 #include <wx/gauge.h>
34 #include "Types.h"
36 struct ConvertJob;
37 class CPartFileConvertDlg;
38 class CPath;
41 class CPartFileConvert : private wxThread
43 public:
44 static int ScanFolderToAdd(const CPath& folder, bool deletesource = false);
45 static void ConvertToeMule(const CPath& file, bool deletesource = false);
46 static void StartThread();
47 static void StopThread();
49 static void ShowGUI(wxWindow *parent);
50 static void UpdateGUI(float percent, wxString text, bool fullinfo = false); // current file information
51 static void UpdateGUI(ConvertJob* job); // listcontrol update
52 static void CloseGUI();
54 static void RemoveAllJobs();
55 static void RemoveAllSuccJobs();
56 static void RemoveJob(ConvertJob* job);
57 static wxString GetReturncodeText(int ret);
59 static wxMutex s_mutex;
61 private:
62 CPartFileConvert() : wxThread(wxTHREAD_DETACHED) {}
64 static int performConvertToeMule(const CPath& file);
65 virtual ExitCode Entry();
67 static wxThread* s_convertPfThread;
68 static std::list<ConvertJob*> s_jobs;
69 static ConvertJob* s_pfconverting;
71 static CPartFileConvertDlg* s_convertgui;
75 class CConvertListCtrl : public wxListCtrl
77 public:
78 CConvertListCtrl(
79 wxWindow* parent,
80 wxWindowID winid = -1,
81 const wxPoint& pos = wxDefaultPosition,
82 const wxSize& size = wxDefaultSize,
83 long style = wxLC_ICON,
84 const wxValidator& validator = wxDefaultValidator,
85 const wxString& name = wxT("convertlistctrl"))
89 class CPartFileConvertDlg : public wxDialog
91 friend class CPartFileConvert;
92 public:
93 CPartFileConvertDlg(wxWindow *parent);
95 void AddJob(ConvertJob* job);
96 void RemoveJob(ConvertJob* job);
97 void UpdateJobInfo(ConvertJob* job);
99 protected:
100 wxGauge* m_pb_current;
101 CConvertListCtrl* m_joblist;
103 void OnAddFolder(wxCommandEvent& event);
104 void OnClose(wxCloseEvent& event);
105 void OnCloseButton(wxCommandEvent& event);
106 void RetrySel(wxCommandEvent& event);
107 void RemoveSel(wxCommandEvent& event);
109 DECLARE_EVENT_TABLE()
112 #endif /* PARTFILECONVERT_H */
113 // File_checked_for_headers