2023-11-01 21:11:11 +00:00
|
|
|
// This file Copyright © Transmission authors and contributors.
|
2022-01-20 18:27:56 +00:00
|
|
|
// It may be used under the MIT (SPDX: MIT) license.
|
|
|
|
// License text can be found in the licenses/ folder.
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2022-06-29 00:15:52 +00:00
|
|
|
#import <AppKit/AppKit.h>
|
2009-10-11 23:16:46 +00:00
|
|
|
#import <Quartz/Quartz.h>
|
2018-09-30 10:37:30 +00:00
|
|
|
|
2021-09-24 12:56:57 +00:00
|
|
|
#import <Sparkle/SUUpdaterDelegate.h>
|
|
|
|
|
2018-09-30 10:37:30 +00:00
|
|
|
#include <libtransmission/transmission.h>
|
|
|
|
|
2013-01-19 05:03:00 +00:00
|
|
|
#import "VDKQueue.h"
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2010-04-12 00:55:31 +00:00
|
|
|
@class AddMagnetWindowController;
|
2009-10-11 02:22:38 +00:00
|
|
|
@class AddWindowController;
|
|
|
|
@class MessageWindowController;
|
|
|
|
@class PrefsController;
|
|
|
|
@class Torrent;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2023-04-15 21:33:43 +00:00
|
|
|
typedef NS_ENUM(NSUInteger, AddType) { //
|
|
|
|
AddTypeManual,
|
|
|
|
AddTypeAuto,
|
|
|
|
AddTypeShowOptions,
|
|
|
|
AddTypeURL,
|
|
|
|
AddTypeCreated
|
2021-08-07 07:27:56 +00:00
|
|
|
};
|
2008-01-05 02:48:10 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@interface Controller
|
2023-04-14 20:02:52 +00:00
|
|
|
: NSObject<NSApplicationDelegate, NSPopoverDelegate, NSSharingServiceDelegate, NSSharingServicePickerDelegate, NSSoundDelegate, NSToolbarDelegate, NSWindowDelegate, QLPreviewPanelDataSource, QLPreviewPanelDelegate, VDKQueueDelegate, SUUpdaterDelegate>
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2023-04-15 21:33:43 +00:00
|
|
|
- (void)openFiles:(NSArray<NSString*>*)filenames addType:(AddType)type forcePath:(NSString*)path;
|
2009-11-25 04:11:52 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)askOpenConfirmed:(AddWindowController*)addController add:(BOOL)add;
|
|
|
|
- (void)openCreatedFile:(NSNotification*)notification;
|
|
|
|
- (void)openFilesWithDict:(NSDictionary*)dictionary;
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)openShowSheet:(id)sender;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)openMagnet:(NSString*)address;
|
|
|
|
- (void)askOpenMagnetConfirmed:(AddMagnetWindowController*)addController add:(BOOL)add;
|
2010-04-12 00:55:31 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)invalidOpenAlert:(NSString*)filename;
|
|
|
|
- (void)invalidOpenMagnetAlert:(NSString*)address;
|
|
|
|
- (void)duplicateOpenAlert:(NSString*)name;
|
|
|
|
- (void)duplicateOpenMagnetAlert:(NSString*)address transferName:(NSString*)name;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)openURL:(NSString*)urlString;
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)openURLShowSheet:(id)sender;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2024-01-02 04:35:57 +00:00
|
|
|
- (void)openPasteboard;
|
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, readonly) tr_session* sessionHandle;
|
2012-05-27 22:31:58 +00:00
|
|
|
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)createFile:(id)sender;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)resumeSelectedTorrents:(id)sender;
|
|
|
|
- (IBAction)resumeAllTorrents:(id)sender;
|
2022-11-23 23:09:32 +00:00
|
|
|
- (void)resumeTorrents:(NSArray<Torrent*>*)torrents;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)resumeSelectedTorrentsNoWait:(id)sender;
|
|
|
|
- (IBAction)resumeWaitingTorrents:(id)sender;
|
2022-04-29 22:51:40 +00:00
|
|
|
- (void)resumeTorrentsNoWait:(NSArray<Torrent*>*)torrents;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)stopSelectedTorrents:(id)sender;
|
|
|
|
- (IBAction)stopAllTorrents:(id)sender;
|
2022-04-29 22:51:40 +00:00
|
|
|
- (void)stopTorrents:(NSArray<Torrent*>*)torrents;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2022-04-29 22:51:40 +00:00
|
|
|
- (void)removeTorrents:(NSArray<Torrent*>*)torrents deleteData:(BOOL)deleteData;
|
|
|
|
- (void)confirmRemoveTorrents:(NSArray<Torrent*>*)torrents deleteData:(BOOL)deleteData;
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)removeNoDelete:(id)sender;
|
|
|
|
- (IBAction)removeDeleteData:(id)sender;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)clearCompleted:(id)sender;
|
2011-02-13 02:02:13 +00:00
|
|
|
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)moveDataFilesSelected:(id)sender;
|
2022-04-29 22:51:40 +00:00
|
|
|
- (void)moveDataFiles:(NSArray<Torrent*>*)torrents;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)copyTorrentFiles:(id)sender;
|
2022-04-29 22:51:40 +00:00
|
|
|
- (void)copyTorrentFileForTorrents:(NSMutableArray<Torrent*>*)torrents;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)copyMagnetLinks:(id)sender;
|
2009-12-04 13:35:15 +00:00
|
|
|
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)revealFile:(id)sender;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (IBAction)renameSelected:(id)sender;
|
2013-01-22 00:09:48 +00:00
|
|
|
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)announceSelectedTorrents:(id)sender;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)verifySelectedTorrents:(id)sender;
|
2022-11-23 23:09:32 +00:00
|
|
|
- (void)verifyTorrents:(NSArray<Torrent*>*)torrents;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2022-04-29 22:51:40 +00:00
|
|
|
@property(nonatomic, readonly) NSArray<Torrent*>* selectedTorrents;
|
2014-01-09 16:23:54 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, readonly) PrefsController* prefsController;
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)showPreferenceWindow:(id)sender;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)showAboutWindow:(id)sender;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)showInfo:(id)sender;
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)resetInfo;
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)setInfoTab:(id)sender;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, readonly) MessageWindowController* messageWindowController;
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)showMessageWindow:(id)sender;
|
|
|
|
- (IBAction)showStatsWindow:(id)sender;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)updateUI;
|
|
|
|
- (void)fullUpdateUI;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)setBottomCountText:(BOOL)filtering;
|
2008-02-06 23:45:44 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (Torrent*)torrentForHash:(NSString*)hash;
|
2012-07-25 12:49:11 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)torrentFinishedDownloading:(NSNotification*)notification;
|
|
|
|
- (void)torrentRestartedDownloading:(NSNotification*)notification;
|
|
|
|
- (void)torrentFinishedSeeding:(NSNotification*)notification;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)updateTorrentHistory;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)applyFilter;
|
2008-01-23 17:22:41 +00:00
|
|
|
|
2022-05-14 19:00:55 +00:00
|
|
|
- (void)sortTorrentsAndIncludeQueueOrder:(BOOL)includeQueueOrder;
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)sortTorrentsCallUpdates:(BOOL)callUpdates includeQueueOrder:(BOOL)includeQueueOrder;
|
|
|
|
- (void)rearrangeTorrentTableArray:(NSMutableArray*)rearrangeArray
|
|
|
|
forParent:(id)parent
|
|
|
|
withSortDescriptors:(NSArray*)descriptors
|
|
|
|
beganTableUpdate:(BOOL*)beganTableUpdate;
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)setSort:(id)sender;
|
|
|
|
- (IBAction)setSortByGroup:(id)sender;
|
|
|
|
- (IBAction)setSortReverse:(id)sender;
|
2007-12-17 19:47:06 +00:00
|
|
|
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)switchFilter:(id)sender;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (IBAction)showGlobalPopover:(id)sender;
|
2011-07-23 15:54:02 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)setGroup:(id)sender; //used by delegate-generated menu items
|
2007-12-17 16:06:20 +00:00
|
|
|
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)toggleSpeedLimit:(id)sender;
|
|
|
|
- (IBAction)speedLimitChanged:(id)sender;
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)altSpeedToggledCallbackIsLimited:(NSDictionary*)dict;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)changeAutoImport;
|
|
|
|
- (void)checkAutoImportDirectory;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)beginCreateFile:(NSNotification*)notification;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)sleepCallback:(natural_t)messageType argument:(void*)messageArgument;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, readonly) VDKQueue* fileWatcherQueue;
|
2013-01-19 05:03:00 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)torrentTableViewSelectionDidChange:(NSNotification*)notification;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)toggleSmallView:(id)sender;
|
|
|
|
- (IBAction)togglePiecesBar:(id)sender;
|
|
|
|
- (IBAction)toggleAvailabilityBar:(id)sender;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)toggleStatusBar:(id)sender;
|
|
|
|
- (IBAction)toggleFilterBar:(id)sender;
|
2023-04-14 18:09:12 +00:00
|
|
|
- (IBAction)toggleToolbarShown:(id)sender;
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)focusFilterField;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)allToolbarClicked:(id)sender;
|
|
|
|
- (void)selectedToolbarClicked:(id)sender;
|
2007-12-06 17:21:42 +00:00
|
|
|
|
2022-06-16 19:59:54 +00:00
|
|
|
- (void)updateMainWindow;
|
|
|
|
|
2022-06-16 17:55:33 +00:00
|
|
|
- (void)setWindowSizeToFit;
|
|
|
|
- (void)updateForAutoSize;
|
2022-06-24 05:26:36 +00:00
|
|
|
- (void)updateWindowAfterToolbarChange;
|
2022-06-16 19:59:54 +00:00
|
|
|
- (void)removeStackViewHeightConstraints;
|
2022-06-18 17:39:22 +00:00
|
|
|
@property(nonatomic, readonly) CGFloat minScrollViewHeightAllowed;
|
|
|
|
@property(nonatomic, readonly) CGFloat toolbarHeight;
|
|
|
|
@property(nonatomic, readonly) CGFloat mainWindowComponentHeight;
|
|
|
|
@property(nonatomic, readonly) CGFloat scrollViewHeight;
|
2022-06-29 04:20:42 +00:00
|
|
|
@property(nonatomic, getter=isFullScreen, readonly) BOOL fullScreen;
|
2022-06-16 17:55:33 +00:00
|
|
|
|
2022-04-21 14:28:38 +00:00
|
|
|
- (void)updateForExpandCollapse;
|
2008-02-06 23:45:44 +00:00
|
|
|
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)showMainWindow:(id)sender;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)toggleQuickLook:(id)sender;
|
2008-05-21 15:45:27 +00:00
|
|
|
|
2022-11-15 16:50:16 +00:00
|
|
|
- (IBAction)linkHomepage:(id)sender;
|
|
|
|
- (IBAction)linkForums:(id)sender;
|
|
|
|
- (IBAction)linkGitHub:(id)sender;
|
|
|
|
- (IBAction)linkDonate:(id)sender;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)rpcCallback:(tr_rpc_callback_type)type forTorrentStruct:(struct tr_torrent*)torrentStruct;
|
|
|
|
- (void)rpcAddTorrentStruct:(struct tr_torrent*)torrentStruct;
|
|
|
|
- (void)rpcRemoveTorrent:(Torrent*)torrent deleteData:(BOOL)deleteData;
|
|
|
|
- (void)rpcStartedStoppedTorrent:(Torrent*)torrent;
|
|
|
|
- (void)rpcChangedTorrent:(Torrent*)torrent;
|
|
|
|
- (void)rpcMovedTorrent:(Torrent*)torrent;
|
|
|
|
- (void)rpcUpdateQueue;
|
2008-05-20 15:16:34 +00:00
|
|
|
|
2007-09-16 01:02:06 +00:00
|
|
|
@end
|