Fix language getting reset to system default on saving preferences
[amule.git] / src / UploadQueue.h
blobcc25acd5667a898d80e52826cffddbc1ec337099
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-2008 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 UPLOADQUEUE_H
27 #define UPLOADQUEUE_H
29 #include "MD4Hash.h" // Needed for CMD4Hash
30 #include <set>
32 class CUpDownClient;
33 class CKnownFile;
35 class CUploadQueue
37 public:
38 CUploadQueue();
39 ~CUploadQueue();
40 void Process();
41 void AddClientToQueue(CUpDownClient* client);
42 bool RemoveFromUploadQueue(CUpDownClient* client);
43 bool RemoveFromWaitingQueue(CUpDownClient* client);
44 bool IsOnUploadQueue(const CUpDownClient* client) const;
45 bool IsDownloading(CUpDownClient* client) const;
46 bool CheckForTimeOver(CUpDownClient* client);
48 const CClientPtrList& GetWaitingList() const { return m_waitinglist; }
49 const CClientPtrList& GetUploadingList() const { return m_uploadinglist; }
51 CUpDownClient* GetWaitingClientByIP_UDP(uint32 dwIP, uint16 nUDPPort, bool bIgnorePortOnUniqueIP, bool* pbMultipleIPs = NULL);
53 uint16 SuspendUpload(const CMD4Hash &, bool terminate);
54 void ResumeUpload(const CMD4Hash &);
55 CKnownFile* GetAllUploadingKnownFile() { return m_allUploadingKnownFile; }
57 private:
58 void RemoveFromWaitingQueue(CClientPtrList::iterator pos);
59 uint16 GetMaxSlots() const;
60 void AddUpNextClient(CUpDownClient* directadd = 0);
61 bool IsSuspended(const CMD4Hash& hash) { return suspendedUploadsSet.find(hash) != suspendedUploadsSet.end(); }
62 CUpDownClient* SortGetBestClient(bool sortonly);
64 CClientPtrList m_waitinglist;
65 CClientPtrList m_uploadinglist;
67 std::set<CMD4Hash> suspendedUploadsSet; // set for suspended uploads
68 uint32 m_nLastStartUpload;
69 uint32 m_lastSort;
70 bool lastupslotHighID; // VQB lowID alternation
71 bool m_allowKicking;
72 // This KnownFile collects all currently uploading clients for display in the upload list control
73 CKnownFile * m_allUploadingKnownFile;
76 #endif // UPLOADQUEUE_H
77 // File_checked_for_headers