Fix compilation with wxWidgets 2.8.12
[amule.git] / src / PartFileConvert.h
blobdaa7c9d5665537f60e9ac98ec7147cb26852e069
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 // Copyright (c) 2002-2011 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.
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 #if !defined __need_convertinfo
28 # define PARTFILECONVERT_H
29 #endif
31 #if !defined __have_convertinfo && (defined __need_convertinfo || defined PARTFILECONVERT_H)
32 #define __have_convertinfo
34 #include "Constants.h"
35 #include "Types.h"
36 #include <common/Path.h>
38 struct ConvertJob;
40 struct ConvertInfo {
41 unsigned id;
42 CPath folder;
43 CPath filename;
44 wxString filehash;
45 ConvStatus state;
46 uint32_t size;
47 uint32_t spaceneeded;
48 ConvertInfo(ConvertJob *);
51 #endif /* convertinfo */
52 #undef __need_convertinfo
54 #ifdef PARTFILECONVERT_H
56 #include <wx/thread.h>
58 class CPartFileConvert : private wxThread
60 public:
61 static int ScanFolderToAdd(const CPath& folder, bool deletesource = false);
62 static void ConvertToeMule(const CPath& file, bool deletesource = false);
63 static void StartThread();
64 static void StopThread();
66 static void RemoveJob(unsigned id);
67 static void RetryJob(unsigned id);
68 static void ReaddAllJobs();
70 private:
71 CPartFileConvert() : wxThread(wxTHREAD_DETACHED) {}
73 static ConvStatus performConvertToeMule(const CPath& file);
74 virtual ExitCode Entry();
76 static wxMutex s_mutex;
77 static wxThread* s_convertPfThread;
78 static std::list<ConvertJob*> s_jobs;
79 static ConvertJob* s_pfconverting;
82 #endif
84 #endif /* PARTFILECONVERT_H */