Skip to content
This repository has been archived by the owner on Sep 19, 2019. It is now read-only.

Commit

Permalink
Reduce update intervals
Browse files Browse the repository at this point in the history
  • Loading branch information
leonspok committed Dec 13, 2016
1 parent f4a271b commit 2d519a1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
5 changes: 2 additions & 3 deletions Irvue Screensaver/ConfigureSheet.xib
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2555" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
<capability name="box content view" minToolsVersion="7.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand All @@ -27,7 +26,7 @@
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="116" width="509" height="378"/>
<rect key="screenRect" x="0.0" y="0.0" width="1280" height="777"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1057"/>
<view key="contentView" id="uH8-h8-Dbe">
<rect key="frame" x="0.0" y="0.0" width="509" height="378"/>
<autoresizingMask key="autoresizingMask"/>
Expand Down Expand Up @@ -145,7 +144,7 @@
<subviews>
<slider verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="45b-G2-f7o">
<rect key="frame" x="18" y="46" width="435" height="24"/>
<sliderCell key="cell" state="on" alignment="left" minValue="1" maxValue="120" doubleValue="5" tickMarkPosition="below" numberOfTickMarks="10" sliderType="linear" id="Jre-rs-Aik"/>
<sliderCell key="cell" state="on" alignment="left" minValue="15" maxValue="300" doubleValue="60" tickMarkPosition="below" numberOfTickMarks="20" allowsTickMarkValuesOnly="YES" sliderType="linear" id="Jre-rs-Aik"/>
<connections>
<action selector="updateIntervalChanged:" target="-2" id="mD8-Vu-XMd"/>
</connections>
Expand Down
4 changes: 2 additions & 2 deletions Irvue Screensaver/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.2</string>
<string>1.0.3</string>
<key>CFBundleVersion</key>
<string>1020</string>
<string>1030</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2016 Leonspok. All rights reserved.</string>
<key>NSPrincipalClass</key>
Expand Down
11 changes: 6 additions & 5 deletions Irvue Screensaver/Irvue_ScreensaverView.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ - (void)setUpdateInterval:(NSTimeInterval)updateInterval {
- (NSTimeInterval)updateInterval {
NSNumber *number = [self.defaults objectForKey:kUpdateIntervalKey];
if (!number) {
[self setUpdateInterval:600.0f];
[self setUpdateInterval:60.0f];
return [self updateInterval];
}
return [number doubleValue];
Expand Down Expand Up @@ -524,9 +524,10 @@ - (IBAction)selectedSearch:(id)sender {
}

- (IBAction)updateIntervalChanged:(id)sender {
self.updateInterval = self.updateIntervalSlider.doubleValue*60.0;
long minutes = (long)round(self.updateInterval/60);
NSString *timeStr = (minutes == 1)? @"minute" : [NSString stringWithFormat:@"%ld minutes", minutes];
self.updateInterval = self.updateIntervalSlider.doubleValue;
NSInteger minutes = ((NSInteger)round(self.updateInterval))/60;
NSInteger seconds = ((NSInteger)self.updateInterval)%60;
NSString *timeStr = [NSString stringWithFormat:@"%02ld:%02ld", (long)minutes, (long)seconds];
self.updateIntervalLabel.stringValue = [NSString stringWithFormat:@"Photos will update every %@", timeStr];
}

Expand Down Expand Up @@ -561,7 +562,7 @@ - (IBAction)close:(id)sender {
}
}
[self.defaults synchronize];
self.updateInterval = self.updateIntervalSlider.doubleValue*60.0;
self.updateInterval = self.updateIntervalSlider.doubleValue;
}

@end
8 changes: 4 additions & 4 deletions ScreenSaverRunner/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ @implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
self.screenSaver = [[Irvue_ScreensaverView alloc] initWithFrame:self.window.contentView.bounds isPreview:YES];
[self.screenSaver setAutoresizingMask:NSViewHeightSizable|NSViewWidthSizable];
[self.screenSaver setSource:PhotosSourceSearch];
[self.screenSaver.defaults setObject:@"city" forKey:@"search_query"];
[self.screenSaver.defaults synchronize];
[self.screenSaver setUpdateInterval:5.0f];
// [self.screenSaver setSource:PhotosSourceSearch];
// [self.screenSaver.defaults setObject:@"city" forKey:@"search_query"];
// [self.screenSaver.defaults synchronize];
// [self.screenSaver setUpdateInterval:5.0f];
[self.window.contentView addSubview:self.screenSaver];
}

Expand Down

0 comments on commit 2d519a1

Please sign in to comment.