Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Commit

Permalink
visualize current focus setting
Browse files Browse the repository at this point in the history
  • Loading branch information
HBehrens committed Feb 1, 2012
1 parent b5e92fd commit 60ace1a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CamHolderApp/CHDocument.h
Expand Up @@ -21,6 +21,8 @@ extern NSArray* CHCachedCaptureDevices;
@property (nonatomic, assign) BOOL isAutoFocusActive;
@property (nonatomic, assign) float focusFactor;

-(void)readCameraValuesIntoProperties;

@property (nonatomic, readonly) BOOL isZoomed;

@property (nonatomic, readonly) NSArray* captureDevices;
Expand Down
5 changes: 5 additions & 0 deletions CamHolderApp/CHDocument.m
Expand Up @@ -152,6 +152,11 @@ -(void)setFocusFactor:(float)focusFactor_ {
[_cameraControl setAbsoluteFocus:focusFactor];
}

-(void)readCameraValuesIntoProperties {
if(self.isAutoFocusActive)
self.focusFactor = [_cameraControl getAbsoluteFocus];
}

-(void)tryToHaveActiveCaptureDevice {
if(self.activeCaptureDevice == nil && self.captureDevices.count > 0) {
self.activeCaptureDevice = [self.captureDevices objectAtIndex:0];
Expand Down
2 changes: 2 additions & 0 deletions CamHolderApp/CHWindowController.h
Expand Up @@ -21,6 +21,8 @@
NSRect _fullscreenFrame;
BOOL _ignoreWindowDidResize;

NSTimer *_updateTimer;

IBOutlet NSComboBox *captureDevicesCombobox;
IBOutlet NSSlider *exposureSlider;
IBOutlet CroppingQTCaptureView *captureView;
Expand Down
13 changes: 13 additions & 0 deletions CamHolderApp/CHWindowController.m
Expand Up @@ -36,6 +36,13 @@ - (void)windowDidLoad
for (QTCaptureDevice* d in self.document.captureDevices) {
[captureDevicesCombobox addItemWithObjectValue: [d localizedDisplayName]];
}

_updateTimer = [[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(reflectCameraStateInUI) userInfo:nil repeats:YES] retain];
}

-(void)dealloc {
[_updateTimer release];
[super dealloc];
}

#pragma mark - Preview Delegate and Handling
Expand Down Expand Up @@ -190,6 +197,12 @@ -(void)setWindow:(CHDraggableWindow *)window {
[super setWindow:window];
}

-(void)reflectCameraStateInUI {
if(self.document) {
[self.document readCameraValuesIntoProperties];
}
}

#pragma mark - view options

-(void)windowDidResize:(NSNotification *)notification {
Expand Down

0 comments on commit 60ace1a

Please sign in to comment.