Convert SBAppDelegate to Swift.

This commit is contained in:
Damiano Galassi committed 2018-02-17 10:46:53 +01:00
1 parent 40844819e1
commit 66f4575ffc
15 files changed
+272 -361

No files matched your search

+3 -3
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14087.3" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14092" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14087.3"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14092"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
@@ -492,7 +492,7 @@
<point key="canvasLocation" x="-244" y="-303"/>
</menu>
<customObject id="419" customClass="NSFontManager"/>
<customObject id="449" userLabel="AppDelegate" customClass="SBAppDelegate"/>
<customObject id="449" userLabel="AppDelegate" customClass="AppDelegate" customModule="Subler" customModuleProvider="target"/>
<customObject id="530" customClass="SUUpdater"/>
</objects>
</document>
+1 -1
View File
@@ -12,7 +12,7 @@ class ActivityWindowController : NSWindowController, MP42Logging {
@IBOutlet var logView: NSTextView!
let logger: Logger
@objc init(logger: Logger) {
init(logger: Logger) {
self.logger = logger
super.init(window: nil)
self.logger.delegate = self
+240
View File
@@ -0,0 +1,240 @@
//
// AppDelegate.swift
// Subler
//
// Created by Damiano Galassi on 16/02/2018.
//
import Cocoa
class DocumentController : NSDocumentController {
override func openDocument(withContentsOf url: URL, display displayDocument: Bool, completionHandler: @escaping (NSDocument?, Bool, Error?) -> Void) {
let ext = url.pathExtension.lowercased()
if ["mkv", "mka", "mks", "mov"].contains(ext) {
do {
let doc = try self.openUntitledDocumentAndDisplay(displayDocument)
completionHandler(doc, false, nil)
if let windowController = doc.windowControllers.first as? DocumentWindowController {
windowController.showImportSheet(fileURLs: [url])
}
} catch {
completionHandler(nil, false, error)
}
}
else {
super.openDocument(withContentsOf: url, display: displayDocument, completionHandler: completionHandler)
}
}
}
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
private static func appSupportURL() -> URL {
let fileManager = FileManager.default
if let url = fileManager.urls(for: .applicationSupportDirectory, in: .userDomainMask)
.first?.appendingPathComponent("Subler") {
do {
if fileManager.fileExists(atPath: url.path) == false {
try fileManager.createDirectory(at: url, withIntermediateDirectories: true, attributes: [:])
}
}
catch _ {
fatalError("Couldn't create the app support directory")
}
return url
}
else {
fatalError("Couldn't find the app support directory")
}
}
private lazy var prefsController: PrefsWindowController = {
return PrefsWindowController()
}()
private lazy var logger: Logger = {
return Logger(fileURL: AppDelegate.appSupportURL().appendingPathComponent("debugLog.txt"))
}()
private lazy var activityWindowController: ActivityWindowController = {
return ActivityWindowController(logger: logger)
}()
private lazy var documentController: DocumentController = {
return DocumentController()
}()
private func runDonateAlert() {
let defaults = UserDefaults.standard
let firstLaunch = defaults.bool(forKey: "SBFirstLaunch") ? false : true
let donateNagTime = Double(60 * 60 * 24 * 7)
let donateNagTimeLong = Double(60 * 60 * 24 * 120)
let currentVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? ""
let lastVersion = defaults.string(forKey: "SBDonateAskVersion") ?? ""
let versionChanged = currentVersion != lastVersion
if versionChanged {
defaults.set(currentVersion, forKey: "SBDonateAskVersion")
let lastDonateDate = defaults.object(forKey: "SBDonateAskDate") as? Date
let timePassed = lastDonateDate == nil || (-1 * (lastDonateDate?.timeIntervalSinceNow ?? 0)) >= donateNagTimeLong
if timePassed {
defaults.removeObject(forKey: "SBWarningDonate")
defaults.removeObject(forKey: "SBFirstLaunch")
defaults.removeObject(forKey: "SBDonateAskDate")
}
}
if defaults.bool(forKey: "SBWarningDonate") == false {
let lastDonateDate = defaults.object(forKey: "SBDonateAskDate") as? Date
let timePassed = lastDonateDate == nil || (-1 * (lastDonateDate?.timeIntervalSinceNow ?? 0)) >= donateNagTime
if firstLaunch == false && timePassed {
defaults.set(Date(), forKey: "SBDonateAskDate")
let alert = NSAlert()
alert.messageText = NSLocalizedString("Support Subler", comment: "Donation -> title")
alert.informativeText = NSLocalizedString(" A lot of time and effort have gone into development, coding, and refinement.\n If you enjoy using it, please consider showing your appreciation with a donation.", comment: "Donation -> message")
alert.alertStyle = .informational
alert.addButton(withTitle: NSLocalizedString("Donate", comment: "Donation -> button"))
let noDonateButton = alert.addButton(withTitle: NSLocalizedString("Nope", comment: "Donation -> button"))
noDonateButton.keyEquivalent = String(format: "%c", 0x1b) // escape key
let allowAgain = lastDonateDate != nil //hide the "don't show again" check the first time - give them time to try the app
alert.showsSuppressionButton = allowAgain
if allowAgain {
alert.suppressionButton?.title = NSLocalizedString("Don't ask me about this again for this version.", comment: "Donation -> button")
}
let donateResult = alert.runModal()
if donateResult == .alertFirstButtonReturn {
donate(self)
}
if allowAgain {
defaults.set(alert.suppressionButton?.state != .on, forKey: "SBWarningDonate")
}
}
}
if firstLaunch {
defaults.set(true, forKey: "SBFirstLaunch")
}
}
// MARK: delegates
func applicationWillFinishLaunching(_ notification: Notification) {
PrefsWindowController.registerUserDefaults()
_ = documentController
logger.clear()
MP42File.setGlobalLogger(logger)
}
func applicationDidFinishLaunching(_ notification: Notification) {
_ = SBQueueController.sharedManager
if UserDefaults.standard.bool(forKey: "SBShowQueueWindow") {
SBQueueController.sharedManager.showWindow(self)
}
}
func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {
let state = SBQueueController.sharedManager.queue.status
if state == .working {
let alert = NSAlert()
alert.messageText = NSLocalizedString("Are you sure you want to quit Subler?", comment: "Quit alert title.")
alert.informativeText = NSLocalizedString("Your current queue will be lost. Do you want to quit anyway?", comment: "Quit alert description.")
alert.addButton(withTitle: NSLocalizedString("Quit", comment: "Quit alert default action."))
alert.addButton(withTitle: NSLocalizedString("Don't Quit", comment: "Quit alert cancel action."))
alert.alertStyle = .critical
let result = alert.runModal()
return result == .alertFirstButtonReturn ? .terminateNow : .terminateCancel
}
return .terminateNow
}
func applicationWillTerminate(_ notification: Notification) {
try! PresetManager.shared.save()
if SBQueueController.sharedManager.saveQueueToDisk == false {
logger.write(toLog: "Failed to save queue to disk!")
}
UserDefaults.standard.set(SBQueueController.sharedManager.window?.isVisible, forKey: "SBShowQueueWindow")
}
func applicationShouldOpenUntitledFile(_ sender: NSApplication) -> Bool {
return false
}
// MARK: actions
@IBAction func openInQueue(_ sender: Any) {
SBQueueController.sharedManager.showWindow(self)
SBQueueController.sharedManager.open(sender)
}
@IBAction func showBatchWindow(_ sender: Any) {
SBQueueController.sharedManager.showWindow(self)
}
@IBAction func showPrefsWindow(_ sender: Any) {
prefsController.showWindow(self)
}
@IBAction func showDebugLog(_ sender: Any) {
activityWindowController.showWindow(self)
}
@IBAction func donate(_ sender: Any) {
guard let url = URL(string: "https://subler.org/donate.php") else { return }
NSWorkspace.shared.open(url)
}
@IBAction func help(_ sender: Any) {
guard let url = URL(string: "https://bitbucket.org/galad87/subler/wiki/Home") else { return }
NSWorkspace.shared.open(url)
}
}
extension AppDelegate {
override func application(_ sender: NSApplication, delegateHandlesKey key: String) -> Bool {
if key == "items" {
return true
} else {
return false
}
}
@objc(items) func items() -> [SBQueueItem] {
let queue = SBQueueController.sharedManager.queue
let indexes = IndexSet(integersIn: 0..<Int(queue.count))
return queue.items(at: indexes)
}
@objc(insertObject:inItemsAtIndex:) func insert(object: SBQueueItem, inItemsAtIndex index: UInt) {
SBQueueController.sharedManager.queue.insert(object, at: index)
}
@objc(removeObjectFromItemsAtIndex:) func removeObjectFromItemsAtIndex(_ index: UInt) {
SBQueueController.sharedManager.queue.removeItems(at: IndexSet(integer: IndexSet.Element(index)))
}
}
+1 -1
View File
@@ -10,7 +10,7 @@ import IOKit.pwr_mgt
@objc(SBDocument) class Document: NSDocument {
var mp4: MP42File
private(set) var mp4: MP42File
private var unsupportedMp4Brand: Bool
override init() {
+1 -4
View File
@@ -55,9 +55,6 @@ class DocumentWindowController: NSWindowController, TracksViewControllerDelegate
window.setFrameFrom("documentSave")
}
window.contentViewController = splitViewController
window.registerForDraggedTypes([NSPasteboard.PasteboardType.backwardsCompatibleFileURL])
didSelect(tracks: [])
}
@@ -498,7 +495,7 @@ class DocumentWindowController: NSWindowController, TracksViewControllerDelegate
}
}
@objc func showImportSheet(fileURLs: [URL]) {
func showImportSheet(fileURLs: [URL]) {
do {
let controller = try FileImportController(fileURLs: fileURLs, delegate: self)
+4 -4
View File
@@ -11,10 +11,10 @@ class Logger : NSObject, MP42Logging {
var delegate: MP42Logging?
let fileURL: URL
let queue: DispatchQueue
private let fileURL: URL
private let queue: DispatchQueue
@objc init(fileURL: URL) {
init(fileURL: URL) {
self.fileURL = fileURL
self.queue = DispatchQueue(label: "org.subler.LogQueue")
}
@@ -50,7 +50,7 @@ class Logger : NSObject, MP42Logging {
write(toLog: error.localizedDescription)
}
@objc func clear() {
func clear() {
try? FileManager.default.removeItem(at: fileURL)
}
+1 -1
View File
@@ -166,7 +166,7 @@ extension PresetManager.Error: LocalizedError {
preset.changed = false
}
@objc func save() throws {
func save() throws {
let manager = FileManager.default
guard let url = appSupportURL() else { return }
@@ -14,7 +14,10 @@ class MultiSelectViewController : NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
reloadUI()
}
func reloadUI() {
if numberOfTracks == 1 {
label.stringValue = NSLocalizedString("1 track selected", comment: "")
} else {
+3 -3
View File
@@ -6,9 +6,6 @@
// Copyright 2009 Damiano Galassi. All rights reserved.
//
NSString *SublerMetadataPBoardType = @"SublerMetadataPBoardTypeV2";
NSString *SublerCoverArtPBoardType = @"SublerCoverArtPBoardType";
#import "SBMovieViewController.h"
#import <MP42Foundation/MP42Ratings.h>
@@ -18,6 +15,9 @@ NSString *SublerCoverArtPBoardType = @"SublerCoverArtPBoardType";
#import "Subler-Swift.h"
NSString *SublerMetadataPBoardType = @"SublerMetadataPBoardTypeV2";
NSString *SublerCoverArtPBoardType = @"SublerCoverArtPBoardType";
@interface SBMovieViewController () <NSTableViewDataSource, ExpandedTableViewDelegate, SBImageBrowserViewDelegate>
// Metadata tab
@@ -45,6 +45,10 @@ class SoundViewController : NSViewController {
mediaTagsView.addSubview(mediaTagsController.view)
reloadUI()
}
private func reloadUI() {
// Standard audio controls
volume.floatValue = track.volume * 100
alternateGroup.selectItem(at: Int(track.alternateGroup))
@@ -59,8 +63,8 @@ class SoundViewController : NSViewController {
if isAAC(track: audioTrack) {
let trackID = audioTrack.trackId > 0 ? String(audioTrack.trackId) : "na"
let item = NSMenuItem(title: "\(trackID) - \(audioTrack.name) - \(langs.localizedLang(forExtendedTag: audioTrack.language))",
action: #selector(seTracktFallback(_:)),
keyEquivalent: "")
action: #selector(seTrackFallback(_:)),
keyEquivalent: "")
item.target = self
item.representedObject = audioTrack
fallbacksPopUp.menu?.addItem(item)
@@ -79,8 +83,8 @@ class SoundViewController : NSViewController {
for subTrack in subtitlesTracks {
let trackID = subTrack.trackId > 0 ? String(subTrack.trackId) : "na"
let item = NSMenuItem(title: "\(trackID) - \(subTrack.name) - \(langs.localizedLang(forExtendedTag: subTrack.language))",
action: #selector(setTrackFollows(_:)),
keyEquivalent: "")
action: #selector(setTrackFollows(_:)),
keyEquivalent: "")
item.target = self
item.representedObject = subTrack
followsPopUp.menu?.addItem(item)
@@ -112,7 +116,7 @@ class SoundViewController : NSViewController {
}
}
@IBAction func seTracktFallback(_ sender: NSMenuItem) {
@IBAction func seTrackFallback(_ sender: NSMenuItem) {
if let newFallbackTrack = sender.representedObject as? MP42AudioTrack {
if newFallbackTrack != track.fallbackTrack {
track.fallbackTrack = newFallbackTrack
-24
View File
@@ -1,24 +0,0 @@
//
// SBAppDelegate.h
// Subler
//
// Created by Damiano Galassi on 29/01/09.
// Copyright 2009 Damiano Galassi. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface SBDocumentController : NSDocumentController
@end
@interface SBAppDelegate : NSObject
- (IBAction) showBatchWindow: (id) sender;
- (IBAction) showPrefsWindow: (id) sender;
- (IBAction) donate:(id)sender;
- (IBAction) help:(id)sender;
- (IBAction) linkDonate: (id) sender;
@end
-280
View File
@@ -1,280 +0,0 @@
//
// SBAppDelegate.m
// Subler
//
// Created by Damiano Galassi on 29/01/09.
// Copyright 2009 Damiano Galassi. All rights reserved.
//
#import "SBAppDelegate.h"
#import "SBQueueController.h"
#import "Subler-Swift.h"
#import <MP42Foundation/MP42File.h>
#define DONATE_NAG_TIME (60 * 60 * 24 * 7)
#define DONATE_NAG_TIME_LONG (60 * 60 * 24 * 120)
@interface SBAppDelegate ()
{
SBPrefsWindowController *prefController;
ActivityWindowController *debugLogController;
SBDocumentController *documentController;
}
@end
@implementation SBAppDelegate
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification
{
documentController = [[SBDocumentController alloc] init];
[SBPrefsWindowController registerUserDefaults];
NSString *appSupportPath = [NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,
NSUserDomainMask,
YES).firstObject stringByAppendingPathComponent:@"Subler"];
if (![[NSFileManager defaultManager] fileExistsAtPath:appSupportPath]) {
[[NSFileManager defaultManager] createDirectoryAtPath:appSupportPath withIntermediateDirectories:YES attributes:nil error:NULL];
}
NSString *path = [appSupportPath stringByAppendingPathComponent:@"debugLog.txt"];
Logger *logger = [[Logger alloc] initWithFileURL:[NSURL fileURLWithPath:path]];
[logger clear];
debugLogController = [[ActivityWindowController alloc] initWithLogger:logger];
MP42File.globalLogger = logger;
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"SBShowQueueWindow"]) {
[[SBQueueController sharedManager] showWindow:self];
}
}
- (void)applicationWillTerminate:(NSNotification *)notification {
[SBPresetManager.shared saveAndReturnError:nil];
if ([SBQueueController sharedManager].window.visible) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"SBShowQueueWindow"];
}
else {
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"SBShowQueueWindow"];
}
if (![[SBQueueController sharedManager] saveQueueToDisk]) {
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"Debug"]) {
NSLog(@"Failed to save queue to disk!");
}
}
}
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)app
{
SBQueueStatus status= SBQueueController.sharedManager.queue.status;
if (status == SBQueueStatusWorking) {
NSAlert *alert = [[NSAlert alloc] init];
alert.messageText = NSLocalizedString(@"Are you sure you want to quit Subler?", @"Quit alert title.");
alert.informativeText = NSLocalizedString(@"Your current queue will be lost. Do you want to quit anyway?", @"Quit alert description.");
[alert addButtonWithTitle:NSLocalizedString(@"Quit", @"Quit alert default action.")];
[alert addButtonWithTitle:NSLocalizedString(@"Don't Quit", @"Quit alert cancel action.")];
alert.alertStyle = NSAlertStyleCritical;
NSInteger result = [alert runModal];
if (result == NSAlertFirstButtonReturn) {
return NSTerminateNow;
}
else {
return NSTerminateCancel;
}
}
return NSTerminateNow;
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
BOOL firstLaunch = YES;
if ([NSUserDefaults.standardUserDefaults boolForKey:@"SBFirstLaunch"]) {
firstLaunch = NO;
}
NSString *currentVersion = NSBundle.mainBundle.infoDictionary[@"CFBundleShortVersionString"];
NSString *lastVersion = [NSUserDefaults.standardUserDefaults objectForKey:@"SBDonateAskVersion"];
const BOOL versionChanged = currentVersion != nil && ![currentVersion isEqualTo:lastVersion];
if (versionChanged) {
[NSUserDefaults.standardUserDefaults setObject:currentVersion forKey:@"SBDonateAskVersion"];
NSDate *lastDonateDate = [NSUserDefaults.standardUserDefaults objectForKey:@"SBDonateAskDate"];
const BOOL timePassed = !lastDonateDate || (-1 * lastDonateDate.timeIntervalSinceNow) >= DONATE_NAG_TIME_LONG;
if (timePassed) {
[NSUserDefaults.standardUserDefaults removeObjectForKey:@"SBWarningDonate"];
[NSUserDefaults.standardUserDefaults removeObjectForKey:@"SBFirstLaunch"];
[NSUserDefaults.standardUserDefaults removeObjectForKey:@"SBDonateAskDate"];
}
}
if (![NSUserDefaults.standardUserDefaults boolForKey:@"SBWarningDonate"]) {
NSDate *lastDonateDate = [NSUserDefaults.standardUserDefaults objectForKey:@"SBDonateAskDate"];
const BOOL timePassed = !lastDonateDate || (-1 * lastDonateDate.timeIntervalSinceNow) >= DONATE_NAG_TIME;
if (!firstLaunch && timePassed) {
[NSUserDefaults.standardUserDefaults setObject:[NSDate date] forKey:@"SBDonateAskDate"];
NSAlert *alert = [[NSAlert alloc] init];
alert.messageText = NSLocalizedString(@"Support Subler", "Donation -> title");
NSString *donateMessage = [NSString stringWithFormat: @"%@",
NSLocalizedString(@" A lot of time and effort have gone into development, coding, and refinement."
" If you enjoy using it, please consider showing your appreciation with a donation.", "Donation -> message")];
alert.informativeText = donateMessage;
alert.alertStyle = NSAlertStyleInformational;
[alert addButtonWithTitle: NSLocalizedString(@"Donate", "Donation -> button")];
NSButton *noDonateButton = [alert addButtonWithTitle: NSLocalizedString(@"Nope", "Donation -> button")];
noDonateButton.keyEquivalent = [NSString stringWithFormat:@"%c", 0x1B]; //escape key
const BOOL allowAgain = lastDonateDate != nil; //hide the "don't show again" check the first time - give them time to try the app
alert.showsSuppressionButton = allowAgain;
if (allowAgain) {
alert.suppressionButton.title = NSLocalizedString(@"Don't ask me about this again for this version.", "Donation -> button");
}
const NSInteger donateResult = [alert runModal];
if (donateResult == NSAlertFirstButtonReturn) {
[self linkDonate:self];
}
if (allowAgain) {
[NSUserDefaults.standardUserDefaults setBool:(alert.suppressionButton.state != NSOnState) forKey:@"SBWarningDonate"];
}
}
}
if (firstLaunch) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"SBFirstLaunch"];
}
[SBQueueController sharedManager];
}
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
{
return NO;
}
- (IBAction)openInQueue:(id)sender
{
[[SBQueueController sharedManager] showWindow:self];
[[SBQueueController sharedManager] open:sender];
}
- (IBAction) showBatchWindow: (id) sender
{
[[SBQueueController sharedManager] showWindow:self];
}
- (IBAction) showPrefsWindow: (id) sender
{
if (!prefController) {
prefController = [[SBPrefsWindowController alloc] init];
}
[prefController showWindow:self];
}
- (IBAction) showDebugLog:(id)sender
{
[debugLogController showWindow:self];
}
- (IBAction) donate:(id)sender
{
[self linkDonate:sender];
}
- (IBAction) help:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://bitbucket.org/galad87/subler/wiki/Home"]];
}
- (IBAction) linkDonate:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://subler.org/donate.php"]];
}
@end
@implementation SBAppDelegate (QueueScripting)
- (BOOL)application:(NSApplication *)sender delegateHandlesKey:(NSString *)key
{
if ([key isEqualToString:@"items"]) {
return YES;
}
else {
return NO;
}
}
- (NSArray<SBQueueItem *> *)items
{
SBQueue *queue = SBQueueController.sharedManager.queue;
NSMutableArray<SBQueueItem *> *items = [NSMutableArray array];
for (NSUInteger i = 0; i < queue.count; i++) {
[items addObject:[queue itemAtIndex:i]];
}
return items;
}
- (void)insertObject:(SBQueueItem *)object inItemsAtIndex:(NSUInteger)index
{
[SBQueueController.sharedManager.queue insertItem:object atIndex:index];
}
- (void)removeObjectFromItemsAtIndex:(NSUInteger)index
{
[SBQueueController.sharedManager.queue removeItemsAtIndexes:[NSIndexSet indexSetWithIndex:index]];
}
@end
@implementation SBDocumentController
- (void)openDocumentWithContentsOfURL:(NSURL * _Nonnull)url
display:(BOOL)displayDocument
completionHandler:(void (^ _Nonnull)(NSDocument * _Nullable document,
BOOL documentWasAlreadyOpen,
NSError * _Nullable error))completionHandler
{
NSString *extension = url.pathExtension.lowercaseString;
if ([extension isEqualToString: @"mkv"] ||
[extension isEqualToString: @"mka"] ||
[extension isEqualToString: @"mks"] ||
[extension isEqualToString: @"mov"]) {
NSError *outError = nil;
SBDocument *doc = [self openUntitledDocumentAndDisplay:displayDocument error:&outError];
completionHandler(doc, NO, outError);
if (doc) {
[doc.windowControllers.firstObject showImportSheetWithFileURLs:@[url]];
}
}
else {
[super openDocumentWithContentsOfURL:url display:displayDocument completionHandler:completionHandler];
}
}
@end
+6 -14
View File
@@ -11,7 +11,6 @@
61CEC0CE1E7569E4000FECC1 /* MultiSelectView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61CEC0CC1E7569E4000FECC1 /* MultiSelectView.xib */; };
8D15AC2C0486D014006FF6A4 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */; };
8D15AC2F0486D014006FF6A4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165FFE840EACC02AAC07 /* InfoPlist.strings */; };
8D15AC320486D014006FF6A4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A37F4B0FDCFA73011CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8D15AC340486D014006FF6A4 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */; };
A90057B61F99DE2700FA4ED1 /* ComboBoxCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A90057B51F99DE2700FA4ED1 /* ComboBoxCellView.swift */; };
A90057BC1F99E20B00FA4ED1 /* CheckBoxCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A90057BB1F99E20B00FA4ED1 /* CheckBoxCellView.swift */; };
@@ -59,6 +58,7 @@
A984DB530F52D679001A20B2 /* Sparkle.framework in Copy Files */ = {isa = PBXBuildFile; fileRef = A984DB4A0F52D644001A20B2 /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
A984DB740F52DD4B001A20B2 /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = A984DB730F52DD4B001A20B2 /* dsa_pub.pem */; };
A9859ACE1F4B43CC00022828 /* QueuePreset.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9859ACD1F4B43CC00022828 /* QueuePreset.swift */; };
A98D44102036F661005CB092 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98D440F2036F661005CB092 /* AppDelegate.swift */; };
A98D98461F0280CB00A77ABC /* TheMovieDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98D98451F0280CB00A77ABC /* TheMovieDB.swift */; };
A98D98481F02820F00A77ABC /* TheMovieDBService.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98D98471F02820F00A77ABC /* TheMovieDBService.swift */; };
A9915ABF1F4B26CF003C57D1 /* MetadataPreset.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9915ABE1F4B26CF003C57D1 /* MetadataPreset.swift */; };
@@ -74,7 +74,6 @@
A9A77C4E1F306FA70018023B /* AttributedStyles.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A77C4D1F306FA70018023B /* AttributedStyles.swift */; };
A9A8CEF91E43754400BC2AE1 /* SBQueueScriptCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = A9A8CEF81E43754400BC2AE1 /* SBQueueScriptCommand.m */; };
A9A91B5D1FB6FBB700250D93 /* ChapterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A91B5C1FB6FBB700250D93 /* ChapterViewController.swift */; };
A9AB484917F0AEA2000AA72E /* SBAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A9AB484817F0AEA2000AA72E /* SBAppDelegate.m */; };
A9AB485617F0AEAC000AA72E /* SBMovieViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9AB484F17F0AEAC000AA72E /* SBMovieViewController.m */; };
A9AB485817F0AEAC000AA72E /* SBVideoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9AB485317F0AEAC000AA72E /* SBVideoViewController.m */; };
A9AB486417F0AEFD000AA72E /* ChapterView.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9AB485A17F0AEFD000AA72E /* ChapterView.xib */; };
@@ -185,11 +184,9 @@
089C1660FE840EACC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
13E42FBA07B3F13500E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
2A37F4B0FDCFA73011CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
2A37F4BAFDCFA73011CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = English; path = English.lproj/Credits.rtf; sourceTree = "<group>"; };
2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
32DBCF750370BD2300C91783 /* Subler_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Subler_Prefix.pch; sourceTree = "<group>"; };
610362271E76D66A000DAE60 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = Classes/PropertyView/it.lproj/MultiSelectView.strings; sourceTree = "<group>"; };
61CEC0CD1E7569E4000FECC1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Classes/PropertyView/Base.lproj/MultiSelectView.xib; sourceTree = "<group>"; };
8D15AC360486D014006FF6A4 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -259,6 +256,7 @@
A984DB4A0F52D644001A20B2 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Sparkle.framework; sourceTree = "<group>"; };
A984DB730F52DD4B001A20B2 /* dsa_pub.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = dsa_pub.pem; sourceTree = "<group>"; };
A9859ACD1F4B43CC00022828 /* QueuePreset.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = QueuePreset.swift; path = Classes/QueuePreset.swift; sourceTree = "<group>"; };
A98D440F2036F661005CB092 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = Classes/AppDelegate.swift; sourceTree = "<group>"; };
A98D98451F0280CB00A77ABC /* TheMovieDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = TheMovieDB.swift; path = Classes/MetadataImporters/TheMovieDB.swift; sourceTree = "<group>"; };
A98D98471F02820F00A77ABC /* TheMovieDBService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = TheMovieDBService.swift; path = Classes/MetadataImporters/TheMovieDBService.swift; sourceTree = "<group>"; };
A991319913F0615700DCAA12 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
@@ -276,8 +274,6 @@
A9A8CEF71E43754400BC2AE1 /* SBQueueScriptCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBQueueScriptCommand.h; path = Classes/SBQueueScriptCommand.h; sourceTree = "<group>"; };
A9A8CEF81E43754400BC2AE1 /* SBQueueScriptCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBQueueScriptCommand.m; path = Classes/SBQueueScriptCommand.m; sourceTree = "<group>"; };
A9A91B5C1FB6FBB700250D93 /* ChapterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ChapterViewController.swift; path = Classes/PropertyView/ChapterViewController.swift; sourceTree = "<group>"; };
A9AB484717F0AEA2000AA72E /* SBAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBAppDelegate.h; path = Classes/SBAppDelegate.h; sourceTree = "<group>"; };
A9AB484817F0AEA2000AA72E /* SBAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBAppDelegate.m; path = Classes/SBAppDelegate.m; sourceTree = "<group>"; };
A9AB484E17F0AEAC000AA72E /* SBMovieViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBMovieViewController.h; path = Classes/PropertyView/SBMovieViewController.h; sourceTree = "<group>"; };
A9AB484F17F0AEAC000AA72E /* SBMovieViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBMovieViewController.m; path = Classes/PropertyView/SBMovieViewController.m; sourceTree = "<group>"; };
A9AB485217F0AEAC000AA72E /* SBVideoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBVideoViewController.h; path = Classes/PropertyView/SBVideoViewController.h; sourceTree = "<group>"; };
@@ -436,8 +432,7 @@
A9AF6A7818D0537F00FAAB08 /* Queue */,
A9915ABB1F4B26A5003C57D1 /* Presets */,
A9395E341F8B9ACA004C402B /* MP42FileAdditions.swift */,
A9AB484717F0AEA2000AA72E /* SBAppDelegate.h */,
A9AB484817F0AEA2000AA72E /* SBAppDelegate.m */,
A98D440F2036F661005CB092 /* AppDelegate.swift */,
1DDD582A0DA1D0D100B32029 /* MainMenu.xib */,
A947218D1D49D9F700858DD8 /* Preferences */,
CD71FF1A12F1C46900F0A98D /* MetadataImporters */,
@@ -452,10 +447,8 @@
A9F804591FB6F4FD0069FF43 /* ImageBrowserView.swift */,
A909440E1DD4C85B00E9F89C /* Table View */,
A9FC6FF41EF2E3280034CCED /* Subler-Bridging-Header.h */,
32DBCF750370BD2300C91783 /* Subler_Prefix.pch */,
A9A77C4D1F306FA70018023B /* AttributedStyles.swift */,
A956CE681F99E93D00093992 /* ButtonToolbarItem.swift */,
2A37F4B0FDCFA73011CA2CEA /* main.m */,
);
name = "Other Sources";
sourceTree = "<group>";
@@ -850,7 +843,6 @@
buildActionMask = 2147483647;
files = (
A959001A202AF21800FD8F23 /* ProgressViewController.swift in Sources */,
8D15AC320486D014006FF6A4 /* main.m in Sources */,
A9676A341FB6EAAD00C1E300 /* ItemViewController.swift in Sources */,
A90C3E0C1FD16AF200F64532 /* TokensViewController.swift in Sources */,
A9AB485617F0AEAC000AA72E /* SBMovieViewController.m in Sources */,
@@ -866,7 +858,6 @@
A9915AC31F4B293B003C57D1 /* PresetManager.swift in Sources */,
A90BC5E31F3A139700F9F3F3 /* MetadataResult.swift in Sources */,
A99189CD1F2F87EC00623ED7 /* ChapterImporter.swift in Sources */,
A9AB484917F0AEA2000AA72E /* SBAppDelegate.m in Sources */,
A99D23212029CD32002E7F27 /* PrefsWindow.swift in Sources */,
A9915ABF1F4B26CF003C57D1 /* MetadataPreset.swift in Sources */,
A956C1E4202F1B170050C5E2 /* Document.swift in Sources */,
@@ -891,6 +882,7 @@
A956CE6B1F99EAAD00093992 /* Logger.swift in Sources */,
A9C828F5195950C3004C4718 /* SBQueuePreferences.m in Sources */,
A956CE691F99E93D00093992 /* ButtonToolbarItem.swift in Sources */,
A98D44102036F661005CB092 /* AppDelegate.swift in Sources */,
A9C31E572029A75F00CEF474 /* GeneralPrefsViewController.swift in Sources */,
A9AE26C01F3B66470041A57D /* SquaredTVArt.swift in Sources */,
A9B1056E2025D9B9009E91FC /* TracksViewController.swift in Sources */,
@@ -1354,7 +1346,6 @@
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Subler_Prefix.pch;
GCC_VERSION = "";
INFOPLIST_FILE = Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
@@ -1384,7 +1375,6 @@
);
GCC_DYNAMIC_NO_PIC = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Subler_Prefix.pch;
GCC_VERSION = "";
INFOPLIST_FILE = Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
@@ -1393,6 +1383,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "org.galad.${PRODUCT_NAME:identifier}";
PRODUCT_NAME = Subler;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OBJC_BRIDGING_HEADER = "Subler-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
@@ -1527,6 +1518,7 @@
LIBRARY_SEARCH_PATHS = "";
MACOSX_DEPLOYMENT_TARGET = 10.10;
RUN_CLANG_STATIC_ANALYZER = NO;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
USER_HEADER_SEARCH_PATHS = "";
-7
View File
@@ -1,7 +0,0 @@
//
// Prefix header for all source files of the 'Subler' target in the 'Subler' project
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif
-14
View File
@@ -1,14 +0,0 @@
//
// main.m
// Subler
//
// Created by Damiano Galassi on 29/01/09.
// Copyright Damiano Galassi 2009 . All rights reserved.
//
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **) argv);
}