Upstream tarball 10080
[amule.git] / cocoa-mule / amuleData.h
blob4bd9424e2c0b1eb0c1a1a4b23c51b21fabc780a4
1 #import <Cocoa/Cocoa.h>
3 #import "EC.h"
5 @interface amuleFile : NSObject {
6 NSString *m_name;
7 uint64_t m_size;
9 MD5Data m_hash;
12 - (unsigned)hash;
13 - (NSString *)key;
14 - (BOOL)isEqual: (id) object;
16 - (NSString *)convertWithPrefix:(uint64_t)number;
18 @property (readonly) NSString *name;
19 @property (readonly) uint64_t size;
21 @end
23 @interface DownloadingFile : amuleFile {
24 int m_src_count;
25 int m_non_current_src_count;
26 int m_xfer_src_count;
27 int m_a4af_src_count;
29 uint64_t m_size_done;
30 uint64_t m_size_xfer;
32 int m_prio;
33 bool m_auto_prio;
35 int m_speed;
39 + (id)createFromEC:(ECTagMD5 *) tag;
41 - (void)updateFromEC:(ECTagMD5 *) tag;
43 - (NSString *)prioToString:(int)prio;
45 @property (readonly) int src_count;
46 @property (readonly) int non_current_src_count;
47 @property (readonly) int xfer_src_count;
48 @property (readonly) int a4af_src_count;
50 @property (readonly) int speed;
52 @property (readonly) uint64_t size_done;
53 @property (readonly) uint64_t size_xfer;
55 @property (readonly) int prio;
56 @property (copy, readonly) NSString * sprio;
58 @end
60 @interface SearchFile : amuleFile {
61 int m_src_count;
62 int m_complete_src_count;
64 bool m_known;
68 + (id)createFromEC:(ECTagMD5 *) tag;
70 - (void)updateFromEC:(ECTagMD5 *) tag;
72 @property (readonly) int src_count;
73 @property (readonly) int complete_src_count;
75 @end
77 @interface SharedFile : amuleFile {
78 int m_req_count;
79 int m_req_count_all;
80 int m_accept_count;
81 int m_accept_count_all;
83 uint64_t m_size_xfer;
84 uint64_t m_size_xfer_all;
86 int m_prio;
87 bool m_auto_prio;
90 + (id)createFromEC:(ECTagMD5 *) tag;
92 - (void)updateFromEC:(ECTagMD5 *) tag;
94 - (NSString *)prioToString:(int)prio;
96 @property (readonly) int req_count;
97 @property (readonly) int req_count_all;
98 @property (readonly) int accept_count;
99 @property (readonly) int accept_count_all;
101 @property (readonly) uint64_t size_xfer;
102 @property (readonly) uint64_t size_xfer_all;
104 @property (readonly) int prio;
105 @property (copy, readonly) NSString * sprio;
107 @end
109 @interface amuleFileSet : NSObject {
110 NSMutableDictionary *m_file_dict;
111 NSMutableArray *m_file_array;
113 id m_gui_controller;
116 - (id)init;
118 - (int)count;
120 - (void)insertObject:(id)object;
122 - (id)objectAtIndex:(int)index;
123 - (id)objectForKey:(id)key;
125 - (void)removeAtIndex:(int)index;
126 - (void)removeAtKey:(id)key;
128 - (void)setGuiController:(id)controller;
130 - (void)reloadGui;
132 @end
134 @interface amuleData : NSObject {
137 // Core status
139 uint32_t m_ed2k_id;
140 bool m_ed2k_connected;
141 bool m_kad_connected;
142 NSString *m_ed2k_server;
143 int m_down_speed;
144 int m_up_speed;
146 amuleFileSet *m_downloads;
147 amuleFileSet *m_shared;
150 // Search info
152 bool m_search_running;
153 amuleFileSet *m_search_results;
155 ECRemoteConnection *m_connection;
158 + (id)initWithConnection:(ECRemoteConnection *) connection;
161 // Binding to EC
163 - (void)handlePacket:(ECPacket *) packet;
164 - (void)handleError;
166 - (void)handleDownloadQueueUpdate:(ECPacket *) packet;
167 - (void)handleSharedFilesUpdate:(ECPacket *) packet;
168 - (void)handleSearchUpdate:(ECPacket *) packet;
170 - (void)handleStatusUpdate:(ECPacket *) packet;
172 - (void)startSearch:(NSString *)text searchType:(EC_SEARCH_TYPE)searchType
173 minSize:(uint64_t)minSize maxSize:(uint64_t)maxSize avail:(uint32_t)avail;
174 - (void)stopSearch;
176 @property (readonly) amuleFileSet *downloads;
177 @property (readonly) amuleFileSet *shared;
178 @property (readonly) amuleFileSet *search_resuls;
180 @end