diff --git a/Gifski/Base.lproj/MainMenu.xib b/Gifski/Base.lproj/MainMenu.xib index f3d2f950..70363153 100644 --- a/Gifski/Base.lproj/MainMenu.xib +++ b/Gifski/Base.lproj/MainMenu.xib @@ -1,8 +1,8 @@ - + - + @@ -67,16 +67,21 @@ - - + - + - - + - + + + + + + + + diff --git a/Gifski/ConversionCompletedViewController.swift b/Gifski/ConversionCompletedViewController.swift index ae3d4197..6ad621a2 100644 --- a/Gifski/ConversionCompletedViewController.swift +++ b/Gifski/ConversionCompletedViewController.swift @@ -36,7 +36,7 @@ final class ConversionCompletedViewController: NSViewController { setUpUI() setUpDropView() - setUp(url: gifUrl) + setUp() if !NSApp.isActive || view.window?.isVisible == false { let notification = UNMutableNotificationContent() @@ -92,64 +92,64 @@ final class ConversionCompletedViewController: NSViewController { draggableFile.constrainEdgesToSuperview() } - private func setUp(url: URL) { - draggableFile.fileUrl = url - fileNameLabel.text = url.filename - fileSizeLabel.text = url.fileSizeFormatted + private func setUp() { + draggableFile.fileUrl = gifUrl + fileNameLabel.text = gifUrl.filename + fileSizeLabel.text = gifUrl.fileSizeFormatted + + copyButton.onAction = { [weak self] _ in + self?.copyGif() + } shareButton.sendAction(on: .leftMouseDown) shareButton.onAction = { [weak self] _ in - guard let self = self else { - return - } - - NSSharingService.share(items: [url as NSURL], from: self.shareButton) + self?.shareGif() } - copyButton.onAction = { [weak self] _ in - guard let self = self else { - return - } - - NSPasteboard.general.with { - $0.writeObjects([url as NSURL]) - $0.setString(url.filenameWithoutExtension, forType: .urlName) - } + saveAsButton.onAction = { [weak self] _ in + self?.saveGif() + } + } - self.copyButton.title = "Copied!" - self.copyButton.isEnabled = false + private func copyGif() { + NSPasteboard.general.with { + $0.writeObjects([gifUrl as NSURL]) + $0.setString(gifUrl.filenameWithoutExtension, forType: .urlName) + } - SSApp.runOnce(identifier: "copyWarning") { - NSAlert.showModal( - for: self.copyButton.window, - message: "The GIF was copied to the clipboard.", - informativeText: "However…", - buttonTitles: ["Continue"] - ) + copyButton.title = "Copied!" + copyButton.isEnabled = false + + SSApp.runOnce(identifier: "copyWarning") { + NSAlert.showModal( + for: copyButton.window, + message: "The GIF was copied to the clipboard.", + informativeText: "However…", + buttonTitles: ["Continue"] + ) + + NSAlert.showModal( + for: copyButton.window, + message: "Please read!", + informativeText: "Many apps like Chrome and Slack do not properly handle copied animated GIFs and will paste them as non-animated PNG.\n\nInstead, drag and drop the GIF into such apps." + ) + } - NSAlert.showModal( - for: self.copyButton.window, - message: "Please read!", - informativeText: "Many apps like Chrome and Slack do not properly handle copied animated GIFs and will paste them as non-animated PNG.\n\nInstead, drag and drop the GIF into such apps." - ) + delay(seconds: 1) { [weak self] in + guard let self = self else { + return } - delay(seconds: 1) { [weak self] in - guard let self = self else { - return - } - - self.copyButton.title = "Copy" - self.copyButton.isEnabled = true - } + self.copyButton.title = "Copy" + self.copyButton.isEnabled = true } + } - saveAsButton.onAction = { [weak self] _ in - self?.openSavePanel() - } + private func shareGif() { + NSSharingService.share(items: [gifUrl as NSURL], from: shareButton) } - private func openSavePanel() { + private func saveGif() { let inputUrl = conversion.video let panel = NSSavePanel() @@ -174,7 +174,7 @@ final class ConversionCompletedViewController: NSViewController { try FileManager.default.copyItem(at: self.gifUrl, to: outputUrl, overwrite: true) } catch { error.presentAsModalSheet(for: self.view.window) - self.openSavePanel() + self.saveGif() } } } @@ -192,6 +192,19 @@ final class ConversionCompletedViewController: NSViewController { } } +// MARK: First responders +extension ConversionCompletedViewController { + @objc + func copy(_ sender: Any) { + copyGif() + } + + @objc + func saveDocumentAs(_ sender: Any) { + saveGif() + } +} + extension ConversionCompletedViewController: QLPreviewPanelDataSource { @IBAction private func quickLook(_ sender: Any) { @@ -239,13 +252,14 @@ extension ConversionCompletedViewController: QLPreviewPanelDelegate { } } +// TODO: This doesn't seem to be needed on macOS 10.15, so drop it when we target that. extension ConversionCompletedViewController: NSMenuItemValidation { func validateMenuItem(_ menuItem: NSMenuItem) -> Bool { switch menuItem.action { case #selector(quickLook(_:))?: return true default: - return false + return true } } } diff --git a/app-store-description.txt b/app-store-description.txt index 89b3329e..1c4b055b 100644 --- a/app-store-description.txt +++ b/app-store-description.txt @@ -37,6 +37,10 @@ Gifski includes a system service that lets you quickly convert a video to GIF fr ■ Tips +‣ Quickly copy or save the GIF + +After converting, press Command+C to copy the GIF or Command+S to save it. + ‣ Change GIF dimensions with the keyboard In the width/height input fields in the editor view, press the arrow up/down keys to change the value by 1. Hold the Option key meanwhile to change it by 10. diff --git a/readme.md b/readme.md index 20a86d50..e2bf3d1a 100644 --- a/readme.md +++ b/readme.md @@ -35,7 +35,13 @@ Gifski includes a share extension that lets you share videos to Gifski. Just sel Gifski includes a [system service](https://www.computerworld.com/article/2476298/os-x-a-quick-guide-to-services-on-your-mac.html) that lets you quickly convert a video to GIF from the **Services** menu in any app that provides a compatible video file. -### Change GIF dimensions with the keyboard +## Tips + +#### Quickly copy or save the GIF + +After converting, press Command+C to copy the GIF or Command+S to save it. + +#### Change GIF dimensions with the keyboard