Almost working prefs panel to download tessdata.
This commit is contained in:
6 files changed
+394
-7
No files matched your search
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14105" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14105"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@@ -13,14 +13,14 @@
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<window title="Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="1" customClass="PrefsWindow" customModule="Subler" customModuleProvider="target">
|
||||
<window title="Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="1" customClass="PrefsWindow" customModule="Subler" customModuleProvider="target">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="625" y="992" width="620" height="220"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
|
||||
<rect key="contentRect" x="625" y="500" width="620" height="220"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
|
||||
<view key="contentView" id="2">
|
||||
<rect key="frame" x="0.0" y="0.0" width="620" height="220"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
</view>
|
||||
<toolbar key="toolbar" implicitIdentifier="62479E7E-FF80-430F-8339-ECA67F66BBB3" autosavesConfiguration="NO" allowsUserCustomization="NO" displayMode="iconAndLabel" sizeMode="regular" id="Qgp-ap-Qwi">
|
||||
<allowedToolbarItems>
|
||||
@@ -46,6 +46,11 @@
|
||||
<action selector="setPrefView:" target="-2" id="Wer-vH-QP9"/>
|
||||
</connections>
|
||||
</toolbarItem>
|
||||
<toolbarItem implicitItemIdentifier="E563B234-18F6-4A09-9F56-4BB6C8F6A93E" explicitItemIdentifier="TOOLBAR_OCR" label="OCR" paletteLabel="OCR" tag="-1" image="NSEveryone" selectable="YES" id="btg-Uy-o7I">
|
||||
<connections>
|
||||
<action selector="setPrefView:" target="-2" id="rii-FH-ihc"/>
|
||||
</connections>
|
||||
</toolbarItem>
|
||||
<toolbarItem implicitItemIdentifier="58DDAD82-C0AC-42A2-842E-E52C50A91828" explicitItemIdentifier="TOOLBAR_ADVANCED" label="Advanced" paletteLabel="Advanced" tag="-1" image="NSAdvanced" selectable="YES" id="udf-m4-mG8">
|
||||
<connections>
|
||||
<action selector="setPrefView:" target="-2" id="da5-1C-vGr"/>
|
||||
@@ -57,6 +62,7 @@
|
||||
<toolbarItem reference="Z2w-05-k1g"/>
|
||||
<toolbarItem reference="PFq-0J-qih"/>
|
||||
<toolbarItem reference="uxW-fx-zpe"/>
|
||||
<toolbarItem reference="btg-Uy-o7I"/>
|
||||
<toolbarItem reference="udf-m4-mG8"/>
|
||||
<toolbarItem reference="R2N-58-umt"/>
|
||||
</defaultToolbarItems>
|
||||
@@ -64,11 +70,12 @@
|
||||
<connections>
|
||||
<outlet property="delegate" destination="-2" id="fTZ-1L-fn7"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="-687" y="-1529"/>
|
||||
<point key="canvasLocation" x="-735" y="-1609"/>
|
||||
</window>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="NSAdvanced" width="32" height="32"/>
|
||||
<image name="NSEveryone" width="32" height="32"/>
|
||||
<image name="NSFolderSmart" width="32" height="32"/>
|
||||
<image name="NSPreferencesGeneral" width="32" height="32"/>
|
||||
<image name="NSUserAccounts" width="32" height="32"/>
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
//
|
||||
// OCRManager.swift
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 30/05/2019.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import MP42Foundation
|
||||
|
||||
final class OCRLanguage {
|
||||
|
||||
enum Status {
|
||||
case available
|
||||
case downloading
|
||||
case downloaded
|
||||
}
|
||||
|
||||
private(set) var status: Status
|
||||
|
||||
let langCode: String
|
||||
let name: String
|
||||
|
||||
init(langCode: String, name: String) {
|
||||
self.status = .available
|
||||
self.langCode = langCode
|
||||
self.name = name
|
||||
}
|
||||
|
||||
var displayName: String {
|
||||
get {
|
||||
return OCRLanguage.langManager.localizedLang(forExtendedTag: langCode)
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate func checkIfDownloaded(_ to: URL) {
|
||||
if (FileManager.default.fileExists(atPath: to.appendingPathComponent(name, isDirectory: false).path)) {
|
||||
status = .downloaded
|
||||
} else {
|
||||
status = .available
|
||||
}
|
||||
}
|
||||
|
||||
private var task: URLSessionDownloadTask?
|
||||
|
||||
fileprivate func startDownload(from remoteURL: URL, to localURL: URL, completionHandler: @escaping (Bool) -> Void) -> URLSessionTask? {
|
||||
let sessionConfig = URLSessionConfiguration.default
|
||||
let session = URLSession(configuration: sessionConfig)
|
||||
let request = URLRequest(url: remoteURL.appendingPathComponent(name))
|
||||
|
||||
let task = session.downloadTask(with: request) { (tempLocalUrl, response, error) in
|
||||
if let tempLocalUrl = tempLocalUrl, error == nil {
|
||||
// Success
|
||||
// if let statusCode = (response as? HTTPURLResponse)?.statusCode {
|
||||
// print("Success: \(statusCode)")
|
||||
// }
|
||||
|
||||
do {
|
||||
try FileManager.default.copyItem(at: tempLocalUrl, to: localURL.appendingPathComponent(self.name, isDirectory: false))
|
||||
self.status = .downloaded
|
||||
self.task = nil
|
||||
completionHandler(true)
|
||||
} catch {
|
||||
self.status = . available
|
||||
self.task = nil
|
||||
completionHandler(false)
|
||||
// print("error writing file \(localURL) : \(writeError)")
|
||||
}
|
||||
|
||||
} else {
|
||||
self.status = .available
|
||||
self.task = nil
|
||||
completionHandler(false)
|
||||
// print("Failure: \(String(describing: error?.localizedDescription))")
|
||||
}
|
||||
}
|
||||
|
||||
self.task = task
|
||||
self.status = .downloading
|
||||
|
||||
task.resume()
|
||||
return task
|
||||
}
|
||||
|
||||
fileprivate func cancel() {
|
||||
guard let task = task else { return }
|
||||
task.cancel()
|
||||
}
|
||||
|
||||
fileprivate func remove(_ from: URL) throws {
|
||||
try FileManager.default.removeItem(at: from.appendingPathComponent(name, isDirectory: false))
|
||||
status = .available
|
||||
}
|
||||
|
||||
private static let langManager = MP42Languages.defaultManager
|
||||
}
|
||||
|
||||
final class OCRManager {
|
||||
static let shared = OCRManager()
|
||||
|
||||
static let updateNotification = Notification.Name(rawValue: "OCRManagerUpdatedNotification")
|
||||
|
||||
let languages: [OCRLanguage] = [OCRLanguage(langCode: "af", name: "afr.traineddata"),
|
||||
OCRLanguage(langCode: "am", name: "amh.traineddata"),
|
||||
OCRLanguage(langCode: "ar", name: "ara.traineddata"),
|
||||
OCRLanguage(langCode: "as", name: "asm.traineddata"),
|
||||
OCRLanguage(langCode: "it", name: "ita.traineddata")]
|
||||
|
||||
private init() {
|
||||
try? load()
|
||||
}
|
||||
|
||||
// MARK: management
|
||||
|
||||
private func postNotification() {
|
||||
NotificationCenter.default.post(name: OCRManager.updateNotification, object: self)
|
||||
}
|
||||
|
||||
private func destinationURL() -> URL? {
|
||||
return FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first?.appendingPathComponent("Subler", isDirectory: true).appendingPathComponent("tessdata", isDirectory: true)
|
||||
}
|
||||
|
||||
private func baseURL() -> URL? {
|
||||
return URL(string: "https://github.com/tesseract-ocr/tessdata_fast/raw/master/")
|
||||
}
|
||||
|
||||
func download(item: OCRLanguage) {
|
||||
if let baseURL = baseURL(), let destURL = destinationURL() {
|
||||
_ = item.startDownload(from: baseURL, to: destURL, completionHandler: { _ in self.postNotification() })
|
||||
postNotification()
|
||||
}
|
||||
}
|
||||
|
||||
func cancelDownload(item: OCRLanguage) {
|
||||
item.cancel()
|
||||
}
|
||||
|
||||
func removeDownload(item: OCRLanguage) throws {
|
||||
if let destURL = destinationURL() {
|
||||
try item.remove(destURL)
|
||||
postNotification()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: read/write
|
||||
|
||||
private func load() throws {
|
||||
if let destinationURL = destinationURL() {
|
||||
languages.forEach { $0.checkIfDownloaded(destinationURL) }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// OCRPrefsViewController.swift
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 30/05/2019.
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
|
||||
class OCRTableCellView : NSTableCellView {
|
||||
|
||||
var item: OCRLanguage? {
|
||||
didSet {
|
||||
guard let item = item else { return }
|
||||
|
||||
textField?.stringValue = item.displayName
|
||||
|
||||
switch item.status {
|
||||
case .available:
|
||||
actionButton.title = NSLocalizedString("Download", comment: "")
|
||||
case .downloading:
|
||||
actionButton.title = NSLocalizedString("Cancel Download", comment: "")
|
||||
case .downloaded:
|
||||
actionButton.title = NSLocalizedString("Remove", comment: "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@IBOutlet var actionButton: NSButton!
|
||||
|
||||
@IBAction func buttonPressed(_ sender: Any) {
|
||||
guard let item = item else { return }
|
||||
|
||||
switch item.status {
|
||||
case .available:
|
||||
OCRManager.shared.download(item: item)
|
||||
case .downloading:
|
||||
OCRManager.shared.cancelDownload(item: item)
|
||||
case .downloaded:
|
||||
try! OCRManager.shared.removeDownload(item: item)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class OCRPrefsViewController: NSViewController, NSTableViewDataSource, NSTableViewDelegate {
|
||||
|
||||
private let manager = OCRManager.shared
|
||||
|
||||
@IBOutlet var tableView: NSTableView!
|
||||
var observer: Any?
|
||||
|
||||
init() {
|
||||
super.init(nibName: nil, bundle: nil)
|
||||
self.title = NSLocalizedString("OCR", comment: "")
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
override var nibName: NSNib.Name? {
|
||||
return "OCRPrefsViewController"
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
tableView.reloadData()
|
||||
observer = NotificationCenter.default.addObserver(forName: OCRManager.updateNotification,
|
||||
object: nil,
|
||||
queue: OperationQueue.main) { [weak self] notification in
|
||||
guard let s = self else { return }
|
||||
s.tableView.reloadData()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Table View
|
||||
|
||||
func numberOfRows(in tableView: NSTableView) -> Int {
|
||||
return manager.languages.count
|
||||
}
|
||||
|
||||
private let languageItemColumn = NSUserInterfaceItemIdentifier(rawValue: "languageItem")
|
||||
|
||||
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
|
||||
let item = manager.languages[row]
|
||||
|
||||
if let cell = tableView.makeView(withIdentifier: languageItemColumn, owner: self) as? OCRTableCellView {
|
||||
cell.item = item
|
||||
return cell
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="OCRPrefsViewController" customModule="Subler" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="tableView" destination="eSu-XV-7Vu" id="ywm-As-kfw"/>
|
||||
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<customView id="Hz6-mo-xeY">
|
||||
<rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<subviews>
|
||||
<scrollView autohidesScrollers="YES" horizontalLineScroll="20" horizontalPageScroll="10" verticalLineScroll="20" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QYE-NI-76o">
|
||||
<rect key="frame" x="20" y="20" width="440" height="232"/>
|
||||
<clipView key="contentView" id="OFf-eT-AOX">
|
||||
<rect key="frame" x="1" y="1" width="438" height="230"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowHeight="18" rowSizeStyle="automatic" viewBased="YES" id="eSu-XV-7Vu">
|
||||
<rect key="frame" x="0.0" y="0.0" width="438" height="230"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<size key="intercellSpacing" width="3" height="2"/>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
|
||||
<tableColumns>
|
||||
<tableColumn width="435" minWidth="40" maxWidth="1000" id="7YG-8f-1AH">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Trained languages">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
|
||||
</tableHeaderCell>
|
||||
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" title="Text Cell" id="XaZ-zW-P04">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView identifier="languageItem" id="lSD-av-rXp" customClass="OCRTableCellView" customModule="Subler" customModuleProvider="target">
|
||||
<rect key="frame" x="1" y="1" width="435" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="249" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="Fec-S0-J1M">
|
||||
<rect key="frame" x="0.0" y="1" width="361" height="17"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="Zhz-YB-L6R">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Lhm-Hc-3on">
|
||||
<rect key="frame" x="362" y="-6" width="78" height="27"/>
|
||||
<buttonCell key="cell" type="push" title="Download" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="DIS-cU-NvL">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="buttonPressed:" target="lSD-av-rXp" id="Pur-Kz-KOJ"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="Lhm-Hc-3on" firstAttribute="top" secondItem="lSD-av-rXp" secondAttribute="top" id="HFY-Dv-gax"/>
|
||||
<constraint firstItem="Fec-S0-J1M" firstAttribute="leading" secondItem="lSD-av-rXp" secondAttribute="leading" constant="2" id="TFm-Og-N3R"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Lhm-Hc-3on" secondAttribute="trailing" id="fj8-Gq-9Mz"/>
|
||||
<constraint firstItem="Fec-S0-J1M" firstAttribute="top" secondItem="lSD-av-rXp" secondAttribute="top" id="gVf-Vu-uuK"/>
|
||||
<constraint firstItem="Lhm-Hc-3on" firstAttribute="leading" secondItem="Fec-S0-J1M" secondAttribute="trailing" constant="8" id="sBh-Qb-yBo"/>
|
||||
<constraint firstAttribute="bottom" secondItem="Fec-S0-J1M" secondAttribute="bottom" constant="1" id="uWd-3R-MSq"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="actionButton" destination="Lhm-Hc-3on" id="2kv-5U-ZWH"/>
|
||||
<outlet property="textField" destination="Fec-S0-J1M" id="b97-1S-89j"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
</prototypeCellViews>
|
||||
</tableColumn>
|
||||
</tableColumns>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="-2" id="DjD-vs-3kw"/>
|
||||
<outlet property="delegate" destination="-2" id="DcU-ko-eKn"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
</subviews>
|
||||
</clipView>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="232" id="B0d-iH-QVk"/>
|
||||
</constraints>
|
||||
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="C8S-5f-eDe">
|
||||
<rect key="frame" x="1" y="215" width="438" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</scroller>
|
||||
<scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="wh4-54-wY1">
|
||||
<rect key="frame" x="224" y="17" width="15" height="102"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</scroller>
|
||||
</scrollView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="QYE-NI-76o" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="20" id="9Fy-vA-llH"/>
|
||||
<constraint firstAttribute="trailing" secondItem="QYE-NI-76o" secondAttribute="trailing" constant="20" id="Vwb-4Y-WhU"/>
|
||||
<constraint firstItem="QYE-NI-76o" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="em8-39-Ga2"/>
|
||||
<constraint firstAttribute="bottom" secondItem="QYE-NI-76o" secondAttribute="bottom" constant="20" id="fRG-bD-lu1"/>
|
||||
</constraints>
|
||||
<point key="canvasLocation" x="-366" y="98"/>
|
||||
</customView>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -88,12 +88,14 @@ class PrefsWindowController: NSWindowController, NSWindowDelegate {
|
||||
lazy var metadataController: MetadataPrefsViewController = { return MetadataPrefsViewController() }()
|
||||
lazy var presetController: PresetPrefsViewController = { return PresetPrefsViewController() }()
|
||||
lazy var outputController: OutputPrefsViewController = { return OutputPrefsViewController() }()
|
||||
lazy var ocrController: OCRPrefsViewController = { return OCRPrefsViewController() }()
|
||||
lazy var advancedController: AdvancedPrefsViewController = { return AdvancedPrefsViewController() }()
|
||||
|
||||
let general: NSToolbarItem.Identifier = NSToolbarItem.Identifier("TOOLBAR_GENERAL")
|
||||
let metadata: NSToolbarItem.Identifier = NSToolbarItem.Identifier("TOOLBAR_METADATA")
|
||||
let presets: NSToolbarItem.Identifier = NSToolbarItem.Identifier("TOOLBAR_SETS")
|
||||
let output: NSToolbarItem.Identifier = NSToolbarItem.Identifier("TOOLBAR_OUTPUT")
|
||||
let ocr: NSToolbarItem.Identifier = NSToolbarItem.Identifier("TOOLBAR_OCR")
|
||||
let advanced: NSToolbarItem.Identifier = NSToolbarItem.Identifier("TOOLBAR_ADVANCED")
|
||||
|
||||
// MARK: Panel switching
|
||||
@@ -103,6 +105,7 @@ class PrefsWindowController: NSWindowController, NSWindowDelegate {
|
||||
if identifier == metadata { return metadataController.view }
|
||||
if identifier == presets { return presetController.view }
|
||||
if identifier == output { return outputController.view }
|
||||
if identifier == ocr { return ocrController.view }
|
||||
if identifier == advanced { return advancedController.view }
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
A9676A341FB6EAAD00C1E300 /* ItemViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9676A331FB6EAAD00C1E300 /* ItemViewController.swift */; };
|
||||
A979B3862025C8BF00468362 /* DocumentWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A979B3842025C8BF00468362 /* DocumentWindowController.swift */; };
|
||||
A97C3AA5204F18C90007AD38 /* TokenCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A97C3AA4204F18C90007AD38 /* TokenCellView.swift */; };
|
||||
A97D99DA22A0240C001FA3A7 /* OCRManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A97D99D922A0240C001FA3A7 /* OCRManager.swift */; };
|
||||
A97FBE3C21FC7F1C00F1FD35 /* QueueController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A97FBE3B21FC7F1C00F1FD35 /* QueueController.swift */; };
|
||||
A983E80B22365B5400221BAE /* MovieViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A983E80A22365B5400221BAE /* MovieViewController.swift */; };
|
||||
A984DB740F52DD4B001A20B2 /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = A984DB730F52DD4B001A20B2 /* dsa_pub.pem */; };
|
||||
@@ -115,6 +116,8 @@
|
||||
A9CBAB1E1F29C083001C26B3 /* MetadataImporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9CBAB1D1F29C083001C26B3 /* MetadataImporter.swift */; };
|
||||
A9D4B8671C05BD04007845C4 /* SBChapterSearch.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9D4B8651C05BD04007845C4 /* SBChapterSearch.xib */; };
|
||||
A9D64527202CA92400BA172B /* SaveOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9D64525202CA92400BA172B /* SaveOptions.swift */; };
|
||||
A9DA03E322A0211C0056AE7B /* OCRPrefsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9DA03E122A0211C0056AE7B /* OCRPrefsViewController.swift */; };
|
||||
A9DA03E422A0211C0056AE7B /* OCRPrefsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9DA03E222A0211C0056AE7B /* OCRPrefsViewController.xib */; };
|
||||
A9DA3B9C1B918D5C00F1E40C /* SBApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = A9DA3B991B918D5C00F1E40C /* SBApplication.m */; };
|
||||
A9DA3BA31B918D6F00F1E40C /* ExceptionAlert.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9DA3BA11B918D6F00F1E40C /* ExceptionAlert.xib */; };
|
||||
A9E97F141F274F1100DBA586 /* iTunesStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9E97F131F274F1100DBA586 /* iTunesStore.swift */; };
|
||||
@@ -283,6 +286,7 @@
|
||||
A96EA9E921FA47520033EC5F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
A979B3842025C8BF00468362 /* DocumentWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = DocumentWindowController.swift; path = Classes/DocumentWindowController.swift; sourceTree = "<group>"; };
|
||||
A97C3AA4204F18C90007AD38 /* TokenCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = TokenCellView.swift; path = Classes/TokenCellView.swift; sourceTree = "<group>"; };
|
||||
A97D99D922A0240C001FA3A7 /* OCRManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = OCRManager.swift; path = Classes/OCRManager.swift; sourceTree = "<group>"; };
|
||||
A97FBE3B21FC7F1C00F1FD35 /* QueueController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = QueueController.swift; path = Classes/QueueController.swift; sourceTree = "<group>"; };
|
||||
A983E80A22365B5400221BAE /* MovieViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MovieViewController.swift; path = Classes/PropertyView/MovieViewController.swift; sourceTree = "<group>"; };
|
||||
A984DB4A0F52D644001A20B2 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Sparkle.framework; sourceTree = "<group>"; };
|
||||
@@ -351,6 +355,8 @@
|
||||
A9C73535206B8F9900794673 /* QueuePreferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = QueuePreferences.swift; path = Classes/QueuePreferences.swift; sourceTree = "<group>"; };
|
||||
A9CBAB1D1F29C083001C26B3 /* MetadataImporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MetadataImporter.swift; path = Classes/MetadataImporters/MetadataImporter.swift; sourceTree = "<group>"; };
|
||||
A9D64525202CA92400BA172B /* SaveOptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SaveOptions.swift; path = Classes/SaveOptions.swift; sourceTree = "<group>"; };
|
||||
A9DA03E122A0211C0056AE7B /* OCRPrefsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = OCRPrefsViewController.swift; path = Classes/OCRPrefsViewController.swift; sourceTree = "<group>"; };
|
||||
A9DA03E222A0211C0056AE7B /* OCRPrefsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = OCRPrefsViewController.xib; path = Classes/OCRPrefsViewController.xib; sourceTree = "<group>"; };
|
||||
A9DA3B991B918D5C00F1E40C /* SBApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBApplication.m; path = Classes/SBApplication.m; sourceTree = "<group>"; };
|
||||
A9DA3BA01B918D6200F1E40C /* SBApplication.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBApplication.h; path = Classes/SBApplication.h; sourceTree = "<group>"; };
|
||||
A9E97F131F274F1100DBA586 /* iTunesStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = iTunesStore.swift; path = Classes/MetadataImporters/iTunesStore.swift; sourceTree = "<group>"; };
|
||||
@@ -545,6 +551,9 @@
|
||||
A90CD5C71FD177280070A067 /* OutputPrefsViewController.xib */,
|
||||
A90C3E0A1FD16AF200F64532 /* TokensViewController.swift */,
|
||||
A90CD5C21FD177230070A067 /* TokensViewController.xib */,
|
||||
A97D99D922A0240C001FA3A7 /* OCRManager.swift */,
|
||||
A9DA03E122A0211C0056AE7B /* OCRPrefsViewController.swift */,
|
||||
A9DA03E222A0211C0056AE7B /* OCRPrefsViewController.xib */,
|
||||
A99D23202029CD32002E7F27 /* PrefsWindow.swift */,
|
||||
);
|
||||
name = Preferences;
|
||||
@@ -842,6 +851,7 @@
|
||||
A998DABF1BA54CFF004D7969 /* MediaTagsController.xib in Resources */,
|
||||
A98542D720D197D300EB9803 /* ArtworkSelector.xib in Resources */,
|
||||
A9ECA0602029A13800D5F30C /* OffsetViewController.xib in Resources */,
|
||||
A9DA03E422A0211C0056AE7B /* OCRPrefsViewController.xib in Resources */,
|
||||
A961476713F568210068F161 /* Queue.xib in Resources */,
|
||||
A9BA1AF31DBF7DD800FD0B38 /* Localizable.strings in Resources */,
|
||||
A9ECA0572029A10B00D5F30C /* DocumentWindowController.xib in Resources */,
|
||||
@@ -876,6 +886,8 @@
|
||||
A98D6BAB21FDC62800F0D886 /* Queue.swift in Sources */,
|
||||
A98542DC20D1A7E500EB9803 /* ArtworkSelectorViewItem.swift in Sources */,
|
||||
A90C3E0C1FD16AF200F64532 /* TokensViewController.swift in Sources */,
|
||||
A97D99DA22A0240C001FA3A7 /* OCRManager.swift in Sources */,
|
||||
A9DA03E322A0211C0056AE7B /* OCRPrefsViewController.swift in Sources */,
|
||||
A9C09C7C1F99F460007939EE /* ExceptionAlertController.swift in Sources */,
|
||||
A9A91B5D1FB6FBB700250D93 /* ChapterViewController.swift in Sources */,
|
||||
A9676A301FB6E85300C1E300 /* LanguageTransformer.swift in Sources */,
|
||||
|
||||
Reference in new issue
Block a user