mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-23 07:01:39 +00:00
Updated cocoalib subtree.
This commit is contained in:
28
cocoalib/controllers/HSProgressWindow.h
Normal file
28
cocoalib/controllers/HSProgressWindow.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
Copyright 2013 Hardcoded Software (http://www.hardcoded.net)
|
||||
|
||||
This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
||||
which should be included with this package. The terms are also available at
|
||||
http://www.hardcoded.net/licenses/bsd_license
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "HSGUIController.h"
|
||||
#import "HSTextField.h"
|
||||
#import "Worker.h"
|
||||
#import "PyProgressWindow.h"
|
||||
|
||||
@interface HSProgressWindow : HSGUIController <Worker>
|
||||
{
|
||||
NSInteger progress;
|
||||
HSTextField *jobdescTextField;
|
||||
HSTextField *progressdescTextField;
|
||||
}
|
||||
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef view:(NSView *)aView;
|
||||
- (PyProgressWindow *)model;
|
||||
|
||||
- (void)setProgress:(NSInteger)aProgress;
|
||||
- (void)showWindow;
|
||||
- (void)closeWindow;
|
||||
@end
|
||||
68
cocoalib/controllers/HSProgressWindow.m
Normal file
68
cocoalib/controllers/HSProgressWindow.m
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
Copyright 2013 Hardcoded Software (http://www.hardcoded.net)
|
||||
|
||||
This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
||||
which should be included with this package. The terms are also available at
|
||||
http://www.hardcoded.net/licenses/bsd_license
|
||||
*/
|
||||
|
||||
#import "HSProgressWindow.h"
|
||||
#import "ProgressController.h"
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation HSProgressWindow
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef view:(NSView *)aView
|
||||
{
|
||||
self = [self initWithPyRef:aPyRef wrapperClass:[PyProgressWindow class] callbackClassName:@"ProgressWindowView" view:aView];
|
||||
[[ProgressController mainProgressController] setWorker:self];
|
||||
jobdescTextField = [[HSTextField alloc] initWithPyRef:[[self model] jobdescTextField] view:[[ProgressController mainProgressController] descText]];
|
||||
progressdescTextField = [[HSTextField alloc] initWithPyRef:[[self model] progressdescTextField] view:[[ProgressController mainProgressController] statusText]];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (PyProgressWindow *)model
|
||||
{
|
||||
return (PyProgressWindow *)model;
|
||||
}
|
||||
|
||||
/* Public */
|
||||
- (void)setProgress:(NSInteger)aProgress
|
||||
{
|
||||
progress = aProgress;
|
||||
}
|
||||
|
||||
- (void)showWindow
|
||||
{
|
||||
[[ProgressController mainProgressController] show];
|
||||
}
|
||||
|
||||
- (void)closeWindow
|
||||
{
|
||||
[[ProgressController mainProgressController] hide];
|
||||
}
|
||||
|
||||
/* Worker */
|
||||
|
||||
- (NSNumber *)getJobProgress
|
||||
{
|
||||
[[self model] pulse];
|
||||
return [NSNumber numberWithInt:progress];
|
||||
}
|
||||
|
||||
- (NSString *)getJobDesc
|
||||
{
|
||||
// Our desc label is updated independently.
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)cancelJob
|
||||
{
|
||||
[[self model] cancel];
|
||||
}
|
||||
|
||||
- (void)jobCompleted:(NSString *)jobid
|
||||
{
|
||||
// With the new hscommon.gui.progress_window, this call is done from within the core. Do nothing.
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user