Skip to content

Commit

Permalink
Persist the FPS setting
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jan 30, 2022
1 parent de2dce3 commit c8d0752
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Gifski.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@
repositoryURL = "https://github.com/firebase/firebase-ios-sdk";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 8.10.0;
minimumVersion = 8.11.0;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down
1 change: 1 addition & 0 deletions Gifski/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ extension NSColor {
extension Defaults.Keys {
static let outputQuality = Key<Double>("outputQuality", default: 1)
static let outputSpeed = Key<Double>("outputSpeed", default: 1)
static let outputFPS = Key<Int>("outputFPS", default: 10)
static let loopGif = Key<Bool>("loopGif", default: true)
static let bounceGif = Key<Bool>("bounceGif", default: false)
static let suppressKeyframeWarning = Key<Bool>("suppressKeyframeWarning", default: false)
Expand Down
7 changes: 2 additions & 5 deletions Gifski/EditVideoViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ final class EditVideoViewController: NSViewController {
}

let frameRate = self.frameRateSlider.integerValue
Defaults[.outputFPS] = frameRate
self.frameRateLabel.stringValue = "\(frameRate)"
self.estimatedFileSizeModel.updateEstimate()
}
Expand Down Expand Up @@ -353,7 +354,7 @@ final class EditVideoViewController: NSViewController {
frameRateSlider.maxValue = frameRate.clamped(to: Constants.allowedFrameRate)

if isInit {
frameRateSlider.doubleValue = defaultFrameRate(inputFrameRate: frameRate)
frameRateSlider.integerValue = Defaults[.outputFPS]
}

frameRateSlider.triggerAction()
Expand Down Expand Up @@ -626,10 +627,6 @@ final class EditVideoViewController: NSViewController {
predefinedSizesDropdown.selectItem(at: 0)
}

private func defaultFrameRate(inputFrameRate frameRate: Double) -> Double {
frameRate.clamped(to: Constants.allowedFrameRate.lowerBound...20)
}

private func getNaiveEstimate() -> Double {
let duration: Double = {
guard let timeRange = timeRange else {
Expand Down

0 comments on commit c8d0752

Please sign in to comment.