OSDN Git Service

MacGui: Constant Quality Slider now QP/RF based.
[handbrake-jp/handbrake-jp-git.git] / macosx / HBQueueController.h
index cab1c20..51e01f6 100644 (file)
@@ -1,26 +1,20 @@
 /* HBQueueController
 
    This file is part of the HandBrake source code.
-   Homepage: <http://handbrake.m0k.org/>.
+   Homepage: <http://handbrake.fr/>.
    It may be used under the terms of the GNU General Public License. */
 
 
-#include <Cocoa/Cocoa.h>
+#import <Cocoa/Cocoa.h>
 #include "hb.h"
 
 @class HBController;
 
+
 #define HB_QUEUE_DRAGGING 0             // <--- NOT COMPLETELY FUNCTIONAL YET
-#define HB_OUTLINE_METRIC_CONTROLS 1    // for tweaking the outline cell spacings
+#define HB_OUTLINE_METRIC_CONTROLS 0    // for tweaking the outline cell spacings
+
 
-typedef enum _HBQueueJobGroupStatus
-{
-    HBStatusNone          = 0,
-    HBStatusPending       = 1,
-    HBStatusWorking       = 2,
-    HBStatusComplete      = 3,
-    HBStatusCanceled      = 4
-} HBQueueJobGroupStatus;
 
 //------------------------------------------------------------------------------------
 // As usual, we need to subclass NSOutlineView to handle a few special cases:
@@ -42,99 +36,41 @@ typedef enum _HBQueueJobGroupStatus
 
 @interface HBQueueOutlineView : NSOutlineView
 {
-#if HB_QUEUE_DRAGGING
-BOOL                        fIsDragging;
-#endif
-}
-#if HB_QUEUE_DRAGGING
-- (BOOL) isDragging;
-#endif
-@end
 
-//------------------------------------------------------------------------------------
+BOOL                        fIsDragging;
 
-@interface HBJob : NSObject
-{
-    hb_job_t                     *hbJob;
 }
 
-+ (HBJob*)             jobWithJob: (hb_job_t *) job;
-- (id)                 initWithJob: (hb_job_t *) job;
-- (hb_job_t *)         job;
-- (NSMutableAttributedString *) attributedDescriptionWithHBHandle: (hb_handle_t *)handle
-                               withIcon: (BOOL)withIcon
-                              withTitle: (BOOL)withTitle
-                           withPassName: (BOOL)withPassName
-                         withFormatInfo: (BOOL)withFormatInfo
-                        withDestination: (BOOL)withDestination
-                        withPictureInfo: (BOOL)withPictureInfo
-                          withVideoInfo: (BOOL)withVideoInfo
-                           withx264Info: (BOOL)withx264Info
-                          withAudioInfo: (BOOL)withAudioInfo
-                       withSubtitleInfo: (BOOL)withSubtitleInfo;
+- (BOOL) isDragging;
 
 @end
 
-//------------------------------------------------------------------------------------
-
-@interface HBJobGroup : NSObject
-{
-    NSMutableArray               *fJobs;   // array of HBJob
-    NSMutableAttributedString    *fDescription;
-    BOOL                         fNeedsDescription;
-    float                        fLastDescriptionHeight;
-    float                        fLastDescriptionWidth;
-    HBQueueJobGroupStatus        fStatus;
-    NSString                     *fPath;
-}
-
-// Creating a job group
-+ (HBJobGroup *)       jobGroup;
-
-// Adding jobs
-- (void)               addJob: (HBJob *)aJob;
 
-// Removing jobs
-- (void)               removeAllJobs;
 
-// Querying a job group
-- (unsigned int)       count;
-- (HBJob *)            jobAtIndex: (unsigned)index;
-- (unsigned)           indexOfJob: (HBJob *)aJob;
-- (NSEnumerator *)     jobEnumerator;
-- (void)               setStatus: (HBQueueJobGroupStatus)status;
-- (HBQueueJobGroupStatus)  status;
-- (void)               setPath: (NSString *)path;
-- (NSString *)         path;
-
-// Creating a description
-- (void)               setNeedsDescription: (BOOL)flag;
-- (NSMutableAttributedString *) attributedDescriptionWithHBHandle: (hb_handle_t *)handle;
-- (float)              heightOfDescriptionForWidth:(float)width withHBHandle: (hb_handle_t *)handle;
-- (float)              lastDescriptionHeight;
-
-@end
 
-//------------------------------------------------------------------------------------
-
-@interface HBQueueController : NSObject
+@interface HBQueueController : NSWindowController
 {
-    hb_handle_t                  *fHandle;              // reference to hblib
+    hb_handle_t                  *fQueueEncodeLibhb;              // reference to libhb
     HBController                 *fHBController;        // reference to HBController
-    NSMutableArray               *fJobGroups;           // hblib's job list organized in a hierarchy of HBJobGroup and HBJob
-    HBJobGroup                   *fCurrentJobGroup;     // the HJobGroup current being processed by hblib
+    NSMutableArray               *fJobGroups;           // mirror image of the queue array from controller.mm
+
+    int                          fEncodingQueueItem;     // corresponds to the index of fJobGroups encoding item
+    int                          fPendingCount;         // Number of various kinds of job groups in fJobGroups.
+    int                          fCompletedCount;
+    int                          fCanceledCount;
+    int                          fWorkingCount;
+    BOOL                         fJobGroupCountsNeedUpdating;
+
     BOOL                         fCurrentJobPaneShown;  // NO when fCurrentJobPane has been shifted out of view (see showCurrentJobPane)
-    hb_job_t                     *fLastKnownCurrentJob; // this is how we track when hbib has started processing a different job
     NSMutableIndexSet            *fSavedExpandedItems;  // used by save/restoreOutlineViewState to preserve which items are expanded
     NSMutableIndexSet            *fSavedSelectedItems;  // used by save/restoreOutlineViewState to preserve which items are selected
 #if HB_QUEUE_DRAGGING
     NSArray                      *fDraggedNodes;
 #endif
-    NSMutableArray               *fCompleted;           // HBJobGroups that have been completed. These also appear in fJobGroups.
     NSTimer                      *fAnimationTimer;      // animates the icon of the current job in the queue outline view
     int                          fAnimationIndex;       // used to generate name of image used to animate the current job in the queue outline view
-    
-    //  +---------------fQueueWindow----------------+
+
+    //  +------------------window-------------------+
     //  |+-------------fCurrentJobPane-------------+|
     //  ||                                         ||
     //  ||                                         ||
@@ -150,8 +86,6 @@ BOOL                        fIsDragging;
     //  ||                                         ||
     //  |+-----------------------------------------+|
     //  +-------------------------------------------+
-    
-    IBOutlet NSWindow            *fQueueWindow;
 
     // fCurrentJobPane - visible only when processing a job
     IBOutlet NSView              *fCurrentJobPane;
@@ -159,35 +93,58 @@ BOOL                        fIsDragging;
     IBOutlet NSTextField         *fJobDescTextField;
     IBOutlet NSProgressIndicator *fProgressBar;
     IBOutlet NSTextField         *fProgressTextField;
-    
+
     // fQueuePane - always visible; fills entire window when fCurrentJobPane is hidden
     IBOutlet NSView              *fQueuePane;
     IBOutlet HBQueueOutlineView  *fOutlineView;
     IBOutlet NSTextField         *fQueueCountField;
+    NSArray                      *fDraggedNodes;
+    BOOL                          fIsDragging;
 #if HB_OUTLINE_METRIC_CONTROLS
     IBOutlet NSSlider            *fIndentation; // debug
     IBOutlet NSSlider            *fSpacing;     // debug
 #endif
-    
+
 }
 
 - (void)setHandle: (hb_handle_t *)handle;
 - (void)setHBController: (HBController *)controller;
-- (void)hblibJobListChanged;
-- (void)hblibStateChanged: (hb_state_t &)state;
-- (void)hblibWillStop;
+
+- (void)setupToolbar;
+
+- (void)setQueueArray: (NSMutableArray *)QueueFileArray;
+- (id)outlineView:(NSOutlineView *)fOutlineView child:(NSInteger)index ofItem:(id)item;
+
+- (BOOL)outlineView:(NSOutlineView *)fOutlineView isItemExpandable:(id)item;
+
+- (BOOL)outlineView:(NSOutlineView *)fOutlineView shouldExpandItem:(id)item;
+
+- (NSInteger)outlineView:(NSOutlineView *)fOutlineView numberOfChildrenOfItem:(id)item;
+
+- (id)outlineView:(NSOutlineView *)fOutlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
+
+- (void)outlineView:(NSOutlineView *)fOutlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item;
+
+/* Animate the icon for the current encode */
+- (void) animateWorkingEncodeIconInQueue;
+- (void) startAnimatingCurrentWorkingEncodeInQueue;
+- (void) stopAnimatingCurrentJobGroupInQueue;
+- (void)setQueueStatusString: (NSString *)statusString;
 
 - (IBAction)showQueueWindow: (id)sender;
-- (IBAction)removeSelectedJobGroups: (id)sender;
-- (IBAction)revealSelectedJobGroups: (id)sender;
-- (IBAction)cancelCurrentJob: (id)sender;
-- (IBAction)toggleStartCancel: (id)sender;
-- (IBAction)togglePauseResume: (id)sender;
+
+
+/* control encodes in the window */
+- (IBAction)removeSelectedQueueItem: (id)sender;
+- (IBAction)revealSelectedQueueItem: (id)sender;
 
 #if HB_OUTLINE_METRIC_CONTROLS
 - (IBAction)imageSpacingChanged: (id)sender;
 - (IBAction)indentChanged: (id)sender;
 #endif
 
-@end
 
+
+
+
+@end