1 | /****************************************************************************** |
---|
2 | * Copyright (c) 2005 Eric Petit |
---|
3 | * |
---|
4 | * Permission is hereby granted, free of charge, to any person obtaining a |
---|
5 | * copy of this software and associated documentation files (the "Software"), |
---|
6 | * to deal in the Software without restriction, including without limitation |
---|
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
---|
8 | * and/or sell copies of the Software, and to permit persons to whom the |
---|
9 | * Software is furnished to do so, subject to the following conditions: |
---|
10 | * |
---|
11 | * The above copyright notice and this permission notice shall be included in |
---|
12 | * all copies or substantial portions of the Software. |
---|
13 | * |
---|
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
---|
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
---|
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
---|
20 | * DEALINGS IN THE SOFTWARE. |
---|
21 | *****************************************************************************/ |
---|
22 | |
---|
23 | #ifndef CONTROLLER_H |
---|
24 | #define CONTROLLER_H |
---|
25 | |
---|
26 | #include <Cocoa/Cocoa.h> |
---|
27 | #include <transmission.h> |
---|
28 | #include "PrefsController.h" |
---|
29 | |
---|
30 | @class TorrentTableView; |
---|
31 | |
---|
32 | @interface Controller : NSObject |
---|
33 | { |
---|
34 | tr_handle_t * fHandle; |
---|
35 | int fCount; |
---|
36 | tr_stat_t * fStat; |
---|
37 | int fResumeOnWake[TR_MAX_TORRENT_COUNT]; |
---|
38 | |
---|
39 | NSToolbar * fToolbar; |
---|
40 | |
---|
41 | IBOutlet PrefsController * fPrefsController; |
---|
42 | |
---|
43 | IBOutlet NSMenuItem * fAdvancedBarItem; |
---|
44 | IBOutlet NSMenuItem * fPauseResumeItem; |
---|
45 | IBOutlet NSMenuItem * fRemoveItem; |
---|
46 | IBOutlet NSMenuItem * fRevealItem; |
---|
47 | |
---|
48 | IBOutlet NSWindow * fWindow; |
---|
49 | IBOutlet TorrentTableView * fTableView; |
---|
50 | IBOutlet NSTextField * fTotalDLField; |
---|
51 | IBOutlet NSTextField * fTotalULField; |
---|
52 | IBOutlet NSMenu * fContextMenu; |
---|
53 | |
---|
54 | IBOutlet NSPanel * fInfoPanel; |
---|
55 | IBOutlet NSTextField * fInfoTitle; |
---|
56 | IBOutlet NSTextField * fInfoTracker; |
---|
57 | IBOutlet NSTextField * fInfoAnnounce; |
---|
58 | IBOutlet NSTextField * fInfoSize; |
---|
59 | IBOutlet NSTextField * fInfoPieces; |
---|
60 | IBOutlet NSTextField * fInfoPieceSize; |
---|
61 | IBOutlet NSTextField * fInfoSeeders; |
---|
62 | IBOutlet NSTextField * fInfoLeechers; |
---|
63 | IBOutlet NSTextField * fInfoFolder; |
---|
64 | IBOutlet NSTextField * fInfoDownloaded; |
---|
65 | IBOutlet NSTextField * fInfoUploaded; |
---|
66 | |
---|
67 | io_connect_t fRootPort; |
---|
68 | NSArray * fFilenames; |
---|
69 | NSTimer * fTimer; |
---|
70 | } |
---|
71 | |
---|
72 | - (void) advancedChanged: (id) sender; |
---|
73 | - (void) openShowSheet: (id) sender; |
---|
74 | - (void) openSheetClosed: (NSOpenPanel *) s returnCode: (int) code |
---|
75 | contextInfo: (void *) info; |
---|
76 | - (void) stopTorrent: (id) sender; |
---|
77 | - (void) stopAllTorrents: (id) sender; |
---|
78 | - (void) stopTorrentWithIndex: (int) index; |
---|
79 | - (void) resumeTorrent: (id) sender; |
---|
80 | - (void) resumeAllTorrents: (id) sender; |
---|
81 | - (void) resumeTorrentWithIndex: (int) index; |
---|
82 | - (void) removeTorrent: (id) sender; |
---|
83 | - (void) removeTorrentDeleteFile: (id) sender; |
---|
84 | - (void) removeTorrentDeleteData: (id) sender; |
---|
85 | - (void) removeTorrentDeleteBoth: (id) sender; |
---|
86 | - (void) removeTorrentWithIndex: (int) idx |
---|
87 | deleteTorrent: (BOOL) deleteTorrent |
---|
88 | deleteData: (BOOL) deleteData; |
---|
89 | - (void) showInfo: (id) sender; |
---|
90 | |
---|
91 | - (void) updateUI: (NSTimer *) timer; |
---|
92 | - (void) sleepCallBack: (natural_t) messageType argument: |
---|
93 | (void *) messageArgument; |
---|
94 | |
---|
95 | - (NSMenu *) menuForIndex: (int) idx; |
---|
96 | |
---|
97 | - (void) showMainWindow: (id) sender; |
---|
98 | - (void) linkHomepage: (id) sender; |
---|
99 | - (void) linkForums: (id) sender; |
---|
100 | - (void) notifyGrowl: (NSString *) file; |
---|
101 | - (void) finderReveal: (NSString *) path; |
---|
102 | - (void) finderTrash: (NSString *) path; |
---|
103 | - (void) growlRegister: (id) sender; |
---|
104 | |
---|
105 | @end |
---|
106 | |
---|
107 | #endif |
---|