From 66f4575ffc3264f2b11f2975c0717e2e84178872 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Sat, 17 Feb 2018 10:46:53 +0100 Subject: [PATCH] Convert SBAppDelegate to Swift. --- Base.lproj/MainMenu.xib | 6 +- Classes/ActivityWindowController.swift | 2 +- Classes/AppDelegate.swift | 240 +++++++++++++++ Classes/Document.swift | 2 +- Classes/DocumentWindowController.swift | 5 +- Classes/Logger.swift | 8 +- Classes/PresetManager.swift | 2 +- .../MultiSelectViewController.swift | 3 + Classes/PropertyView/SBMovieViewController.m | 6 +- .../PropertyView/SoundViewController.swift | 14 +- Classes/SBAppDelegate.h | 24 -- Classes/SBAppDelegate.m | 280 ------------------ Subler.xcodeproj/project.pbxproj | 20 +- Subler_Prefix.pch | 7 - main.m | 14 - 15 files changed, 272 insertions(+), 361 deletions(-) create mode 100644 Classes/AppDelegate.swift delete mode 100755 Classes/SBAppDelegate.h delete mode 100644 Classes/SBAppDelegate.m delete mode 100755 Subler_Prefix.pch delete mode 100755 main.m diff --git a/Base.lproj/MainMenu.xib b/Base.lproj/MainMenu.xib index 1bb7a19..f6db325 100755 --- a/Base.lproj/MainMenu.xib +++ b/Base.lproj/MainMenu.xib @@ -1,8 +1,8 @@ - + - + @@ -492,7 +492,7 @@ - + diff --git a/Classes/ActivityWindowController.swift b/Classes/ActivityWindowController.swift index 7cd3e26..8c90c06 100644 --- a/Classes/ActivityWindowController.swift +++ b/Classes/ActivityWindowController.swift @@ -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 diff --git a/Classes/AppDelegate.swift b/Classes/AppDelegate.swift new file mode 100644 index 0000000..3a443bb --- /dev/null +++ b/Classes/AppDelegate.swift @@ -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.. @@ -18,6 +15,9 @@ NSString *SublerCoverArtPBoardType = @"SublerCoverArtPBoardType"; #import "Subler-Swift.h" +NSString *SublerMetadataPBoardType = @"SublerMetadataPBoardTypeV2"; +NSString *SublerCoverArtPBoardType = @"SublerCoverArtPBoardType"; + @interface SBMovieViewController () // Metadata tab diff --git a/Classes/PropertyView/SoundViewController.swift b/Classes/PropertyView/SoundViewController.swift index 8e6a2eb..22088c7 100644 --- a/Classes/PropertyView/SoundViewController.swift +++ b/Classes/PropertyView/SoundViewController.swift @@ -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 diff --git a/Classes/SBAppDelegate.h b/Classes/SBAppDelegate.h deleted file mode 100755 index 0ddfddd..0000000 --- a/Classes/SBAppDelegate.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// SBAppDelegate.h -// Subler -// -// Created by Damiano Galassi on 29/01/09. -// Copyright 2009 Damiano Galassi. All rights reserved. -// - -#import - -@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 - diff --git a/Classes/SBAppDelegate.m b/Classes/SBAppDelegate.m deleted file mode 100644 index 67703cf..0000000 --- a/Classes/SBAppDelegate.m +++ /dev/null @@ -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 - -#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 *)items -{ - SBQueue *queue = SBQueueController.sharedManager.queue; - - NSMutableArray *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 diff --git a/Subler.xcodeproj/project.pbxproj b/Subler.xcodeproj/project.pbxproj index b8a0d14..88ea82d 100644 --- a/Subler.xcodeproj/project.pbxproj +++ b/Subler.xcodeproj/project.pbxproj @@ -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 = ""; }; 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 13E42FBA07B3F13500E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; - 2A37F4B0FDCFA73011CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 2A37F4BAFDCFA73011CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = English; path = English.lproj/Credits.rtf; sourceTree = ""; }; 2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; - 32DBCF750370BD2300C91783 /* Subler_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Subler_Prefix.pch; sourceTree = ""; }; 610362271E76D66A000DAE60 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = Classes/PropertyView/it.lproj/MultiSelectView.strings; sourceTree = ""; }; 61CEC0CD1E7569E4000FECC1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Classes/PropertyView/Base.lproj/MultiSelectView.xib; sourceTree = ""; }; 8D15AC360486D014006FF6A4 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -259,6 +256,7 @@ A984DB4A0F52D644001A20B2 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Sparkle.framework; sourceTree = ""; }; A984DB730F52DD4B001A20B2 /* dsa_pub.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = dsa_pub.pem; sourceTree = ""; }; A9859ACD1F4B43CC00022828 /* QueuePreset.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = QueuePreset.swift; path = Classes/QueuePreset.swift; sourceTree = ""; }; + A98D440F2036F661005CB092 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = Classes/AppDelegate.swift; sourceTree = ""; }; A98D98451F0280CB00A77ABC /* TheMovieDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = TheMovieDB.swift; path = Classes/MetadataImporters/TheMovieDB.swift; sourceTree = ""; }; A98D98471F02820F00A77ABC /* TheMovieDBService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = TheMovieDBService.swift; path = Classes/MetadataImporters/TheMovieDBService.swift; sourceTree = ""; }; 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 = ""; }; A9A8CEF81E43754400BC2AE1 /* SBQueueScriptCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBQueueScriptCommand.m; path = Classes/SBQueueScriptCommand.m; sourceTree = ""; }; A9A91B5C1FB6FBB700250D93 /* ChapterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ChapterViewController.swift; path = Classes/PropertyView/ChapterViewController.swift; sourceTree = ""; }; - A9AB484717F0AEA2000AA72E /* SBAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBAppDelegate.h; path = Classes/SBAppDelegate.h; sourceTree = ""; }; - A9AB484817F0AEA2000AA72E /* SBAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBAppDelegate.m; path = Classes/SBAppDelegate.m; sourceTree = ""; }; A9AB484E17F0AEAC000AA72E /* SBMovieViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBMovieViewController.h; path = Classes/PropertyView/SBMovieViewController.h; sourceTree = ""; }; A9AB484F17F0AEAC000AA72E /* SBMovieViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBMovieViewController.m; path = Classes/PropertyView/SBMovieViewController.m; sourceTree = ""; }; A9AB485217F0AEAC000AA72E /* SBVideoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBVideoViewController.h; path = Classes/PropertyView/SBVideoViewController.h; sourceTree = ""; }; @@ -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 = ""; @@ -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 = ""; diff --git a/Subler_Prefix.pch b/Subler_Prefix.pch deleted file mode 100755 index 40b1b4c..0000000 --- a/Subler_Prefix.pch +++ /dev/null @@ -1,7 +0,0 @@ -// -// Prefix header for all source files of the 'Subler' target in the 'Subler' project -// - -#ifdef __OBJC__ - #import -#endif diff --git a/main.m b/main.m deleted file mode 100755 index 53a18b1..0000000 --- a/main.m +++ /dev/null @@ -1,14 +0,0 @@ -// -// main.m -// Subler -// -// Created by Damiano Galassi on 29/01/09. -// Copyright Damiano Galassi 2009 . All rights reserved. -// - -#import - -int main(int argc, char *argv[]) -{ - return NSApplicationMain(argc, (const char **) argv); -}