From f69f4e15cf1a4e010aef3f1a77c768425562cc67 Mon Sep 17 00:00:00 2001 From: ritsuka Date: Mon, 19 Jan 2015 08:48:18 +0000 Subject: MacGui: moved the queue code from HBController to HBQueueController, reworked the way the queue synchronise itself between multiple instances to be more resilient (hopefully). Modified HBCore to take callback blocks instead of notifications. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6770 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- macosx/Controller.h | 85 ++++++++++++----------------------------------------- 1 file changed, 18 insertions(+), 67 deletions(-) (limited to 'macosx/Controller.h') diff --git a/macosx/Controller.h b/macosx/Controller.h index 87d305bb3..499051225 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -5,7 +5,6 @@ It may be used under the terms of the GNU General Public License. */ #import -#import @class HBQueueController; @@ -24,9 +23,11 @@ @class HBPresetsManager; @class HBDockTile; -@interface HBController : NSObject +@class HBJob; + +@interface HBController : NSObject { - IBOutlet NSWindow * fWindow; + IBOutlet NSWindow *fWindow; IBOutlet NSTabView *fMainTabView; @@ -124,37 +125,16 @@ IBOutlet NSProgressIndicator * fRipIndicator; BOOL fRipIndicatorShown; - /* Queue File variables */ - FSEventStreamRef QueueStream; - NSString * QueueFile; - NSMutableArray * QueueFileArray; - NSInteger currentQueueEncodeIndex; // Used to track the currently encoding queueu item - /* User Preset variables here */ HBPresetsManager * presetManager; HBPresetsViewController * fPresetsView; IBOutlet NSMenu * presetsMenu; IBOutlet NSDrawer * fPresetDrawer; - - /* Queue variables */ - int hbInstanceNum; //stores the number of HandBrake instances currently running - int fPendingCount; // Number of various kinds of job groups in fJobGroups. - int fWorkingCount; - - pid_t pidNum; // The pid number for this instance - NSString * currentQueueEncodeNameString; - - /* integer to set to determine the previous state - of encode 0==idle, 1==encoding, 2==cancelled*/ - int fEncodeState; - - /* Dock progress variables */ - double dockIconProgress; - - HBDockTile *dockTile; } +@property (nonatomic, readonly) NSWindow *window; + - (IBAction) browseSources: (id) sender; - (IBAction) showSourceTitleScanPanel: (id) sender; - (IBAction) closeSourceTitleScanPanel: (id) sender; @@ -174,47 +154,22 @@ - (void)pictureSettingsDidChange; - (IBAction) openMainWindow: (id) sender; -/* Add All titles to the queue */ -- (IBAction) addAllTitlesToQueue: (id) sender; -- (void) addAllTitlesToQueueAlertDone: (NSWindow *) sheet - returnCode: (int) returnCode contextInfo: (void *) contextInfo; -- (void) doAddAllTitlesToQueue; - -/* Queue File Stuff */ -- (void) initQueueFSEvent; -- (void) closeQueueFSEvent; -- (void) loadQueueFile; -- (void) reloadQueue; -- (void)saveQueueFileItem; -- (void) incrementQueueItemDone:(NSInteger) queueItemDoneIndexNum; -- (void) performNewQueueScan:(NSString *) scanPath scanTitleNum: (NSInteger) scanTitleNum; -- (void) processNewQueueEncode; -- (void) clearQueueEncodedItems; -/* Queue Editing */ -- (void)rescanQueueItemToMainWindow:(NSUInteger) selectedQueueItem; - -- (void) removeQueueFileItem:(NSUInteger) queueItemToRemove; -- (void) clearQueueAllItems; -- (void)moveObjectsInQueueArray:(NSMutableArray *)array fromIndexes:(NSIndexSet *)indexSet toIndex:(NSUInteger)insertIndex; -- (void)getQueueStats; -- (void)setQueueEncodingItemsAsPending; -- (IBAction) addToQueue: (id) sender; -- (void) overwriteAddToQueueAlertDone: (NSWindow *) sheet - returnCode: (int) returnCode contextInfo: (void *) contextInfo; -- (void) doAddToQueue; - -- (IBAction) showQueueWindow:(id)sender; +// Queue +- (IBAction)addToQueue:(id)sender; +- (IBAction)addAllTitlesToQueue:(id)sender; + +- (void)rescanJobToMainWindow:(HBJob *)queueItem; +- (void)setQueueState:(NSString *)info; +- (void)setQueueInfo:(NSString *)info progress:(double)progress hidden:(BOOL)hidden; + +- (IBAction)showQueueWindow:(id)sender; - (IBAction)showPreferencesWindow:(id)sender; -- (IBAction) Rip: (id) sender; -- (void) overWriteAlertDone: (NSWindow *) sheet - returnCode: (int) returnCode contextInfo: (void *) contextInfo; +- (IBAction)rip:(id)sender; -- (IBAction) Cancel: (id) sender; -- (void) doCancelCurrentJob; -- (void) doCancelCurrentJobAndStop; -- (IBAction) Pause: (id) sender; +- (IBAction)cancel:(id)sender; +- (IBAction)pause:(id)sender; - (IBAction) openHomepage: (id) sender; - (IBAction) openForums: (id) sender; @@ -231,8 +186,4 @@ - (IBAction)addFactoryPresets:(id)sender; - (IBAction)showDebugOutputPanel:(id)sender; -- (void) remindUserOfSleepOrShutdown; - -- (int) hbInstances; - @end -- cgit v1.2.3