Conversion to swift 4
This commit is contained in:
parent
965db2c81a
commit
7fc78049d2
@ -21,9 +21,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
// Insert code here to tear down your application
|
||||
}
|
||||
|
||||
func applicationShouldTerminate(_ sender: NSApplication) -> NSApplicationTerminateReply {
|
||||
guard isConverting else { return NSApplicationTerminateReply.terminateNow }
|
||||
return NSApplicationTerminateReply.terminateCancel
|
||||
func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {
|
||||
guard isConverting else { return NSApplication.TerminateReply.terminateNow }
|
||||
return NSApplication.TerminateReply.terminateCancel
|
||||
}
|
||||
|
||||
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
|
||||
|
||||
@ -577,18 +577,19 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0830;
|
||||
LastUpgradeCheck = 0830;
|
||||
LastUpgradeCheck = 0900;
|
||||
ORGANIZATIONNAME = "Kilian Hofmann";
|
||||
TargetAttributes = {
|
||||
E220BF9B1EFB22D400DF5A97 = {
|
||||
CreatedOnToolsVersion = 8.3.3;
|
||||
DevelopmentTeam = 795KPDV76S;
|
||||
LastSwiftMigration = 0900;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
E2218C971EF2D345004298F6 = {
|
||||
CreatedOnToolsVersion = 8.3.3;
|
||||
DevelopmentTeam = 795KPDV76S;
|
||||
LastSwiftMigration = 0830;
|
||||
LastSwiftMigration = 0900;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
E2218CE51EF2D577004298F6 = {
|
||||
@ -599,6 +600,7 @@
|
||||
E2218D281EF3271F004298F6 = {
|
||||
CreatedOnToolsVersion = 8.3.3;
|
||||
DevelopmentTeam = 795KPDV76S;
|
||||
LastSwiftMigration = 0900;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
E2218D3D1EF32803004298F6 = {
|
||||
@ -755,7 +757,8 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.weebly.alikja.Converter;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@ -771,7 +774,8 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.weebly.alikja.Converter;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@ -785,7 +789,9 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
@ -793,7 +799,11 @@
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
@ -823,6 +833,7 @@
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_DISABLE_SAFETY_CHECKS = NO;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@ -836,7 +847,9 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
@ -844,7 +857,11 @@
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
@ -866,6 +883,7 @@
|
||||
SDKROOT = macosx;
|
||||
SWIFT_DISABLE_SAFETY_CHECKS = NO;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@ -884,7 +902,8 @@
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Logger4/Logger4-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@ -902,7 +921,8 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Logger4/Logger4-Bridging-Header.h";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@ -944,7 +964,8 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_DISABLE_SAFETY_CHECKS = NO;
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@ -962,7 +983,8 @@
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_DISABLE_SAFETY_CHECKS = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0830"
|
||||
LastUpgradeVersion = "0900"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@ -54,6 +54,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
@ -73,6 +74,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0830"
|
||||
LastUpgradeVersion = "0900"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@ -14,7 +14,7 @@
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "E27A9DBD1EF9B7FD000BC7A3"
|
||||
BlueprintIdentifier = "E220BF9B1EFB22D400DF5A97"
|
||||
BuildableName = "Converter.app"
|
||||
BlueprintName = "Converter"
|
||||
ReferencedContainer = "container:Docsis Toolkit.xcodeproj">
|
||||
@ -26,13 +26,14 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "E27A9DBD1EF9B7FD000BC7A3"
|
||||
BlueprintIdentifier = "E220BF9B1EFB22D400DF5A97"
|
||||
BuildableName = "Converter.app"
|
||||
BlueprintName = "Converter"
|
||||
ReferencedContainer = "container:Docsis Toolkit.xcodeproj">
|
||||
@ -45,6 +46,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
@ -55,7 +57,7 @@
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "E27A9DBD1EF9B7FD000BC7A3"
|
||||
BlueprintIdentifier = "E220BF9B1EFB22D400DF5A97"
|
||||
BuildableName = "Converter.app"
|
||||
BlueprintName = "Converter"
|
||||
ReferencedContainer = "container:Docsis Toolkit.xcodeproj">
|
||||
@ -74,7 +76,7 @@
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "E27A9DBD1EF9B7FD000BC7A3"
|
||||
BlueprintIdentifier = "E220BF9B1EFB22D400DF5A97"
|
||||
BuildableName = "Converter.app"
|
||||
BlueprintName = "Converter"
|
||||
ReferencedContainer = "container:Docsis Toolkit.xcodeproj">
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0830"
|
||||
LastUpgradeVersion = "0900"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@ -26,6 +26,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
@ -45,6 +46,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0830"
|
||||
LastUpgradeVersion = "0900"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@ -26,6 +26,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
@ -45,6 +46,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
||||
@ -14,7 +14,7 @@ class FileOperations: NSObject {
|
||||
// 15 in threshold indicates some error
|
||||
|
||||
static func encodeTimeStamp(stamp: String, threshold: String) -> UInt32 {
|
||||
let mappingEncode: Dictionary<String, UInt32> = ["-" : 0, "62.81": 1, "58.21": 2, "57": 3, "59.81": 4, "55.21": 5, "54": 6, "56.18": 7, "52.21": 8, "51": 9]
|
||||
let mappingEncode: Dictionary<String, UInt32> = ["-" : 0, "62.18": 1, "58.21": 2, "57": 3, "59.18": 4, "55.21": 5, "54": 6, "56.18": 7, "52.21": 8, "51": 9]
|
||||
let separated: Array<String> = stamp.components(separatedBy: ":")
|
||||
let hours: UInt32 = UInt32(separated[0])! << 16
|
||||
let minutes: UInt32 = UInt32(separated[1])! << 10
|
||||
@ -24,7 +24,7 @@ class FileOperations: NSObject {
|
||||
}
|
||||
|
||||
static func decodeTimestamp(stamp: UInt32) -> (String, String) {
|
||||
let mappingDecode: Dictionary<UInt32, String> = [0: "-", 1: "62.81", 2: "58.21", 3: "57", 4: "59.81", 5: "55.21", 6: "54", 7: "56.18", 8: "52.21", 9: "51", 15: "-"]
|
||||
let mappingDecode: Dictionary<UInt32, String> = [0: "-", 1: "62.18", 2: "58.21", 3: "57", 4: "59.18", 5: "55.21", 6: "54", 7: "56.18", 8: "52.21", 9: "51", 15: "-"]
|
||||
let threshold: UInt32 = stamp & 0b1111
|
||||
let seconds: UInt32 = (stamp >> 4) & 0b111111
|
||||
let minutes: UInt32 = (stamp >> 10) & 0b111111
|
||||
|
||||
@ -33,7 +33,7 @@ extension CollectionViewMonth: NSCollectionViewDataSource {
|
||||
}
|
||||
|
||||
func collectionView(_ itemForRepresentedObjectAtcollectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem {
|
||||
let item = itemForRepresentedObjectAtcollectionView.makeItem(withIdentifier: "CollectionViewItemMonth", for: indexPath)
|
||||
let item = itemForRepresentedObjectAtcollectionView.makeItem(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "CollectionViewItemMonth"), for: indexPath)
|
||||
guard let item2 = item as? CollectionViewItemMonth else {
|
||||
self.doc.progress.increment(by: 100/31)
|
||||
if self.doc.progress.doubleValue > 98 {
|
||||
|
||||
@ -34,7 +34,7 @@ extension CollectionViewYear: NSCollectionViewDataSource {
|
||||
}
|
||||
|
||||
func collectionView(_ itemForRepresentedObjectAtcollectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem {
|
||||
let item = itemForRepresentedObjectAtcollectionView.makeItem(withIdentifier: "CollectionViewItemYear", for: indexPath)
|
||||
let item = itemForRepresentedObjectAtcollectionView.makeItem(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "CollectionViewItemYear"), for: indexPath)
|
||||
guard let item2 = item as? CollectionViewItemYear else { return item }
|
||||
if item2.isSelected {
|
||||
item2.view.layer?.borderColor = NSColor.gray.cgColor
|
||||
|
||||
@ -26,6 +26,10 @@ class Document: NSDocument {
|
||||
@IBOutlet var progress: NSProgressIndicator!
|
||||
@IBOutlet var exportProgress: NSProgressIndicator!
|
||||
|
||||
override class var autosavesInPlace: Bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
override init() {
|
||||
super.init()
|
||||
for _ in 0..<12 {
|
||||
@ -37,12 +41,8 @@ class Document: NSDocument {
|
||||
}
|
||||
}
|
||||
|
||||
override class func autosavesInPlace() -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
override var windowNibName: String? {
|
||||
return "Document"
|
||||
override var windowNibName: NSNib.Name? {
|
||||
return NSNib.Name(rawValue: "Document")
|
||||
}
|
||||
|
||||
override func read(from fileWrapper: FileWrapper, ofType typeName: String) throws {
|
||||
@ -63,13 +63,13 @@ class Document: NSDocument {
|
||||
// Setup collection layout
|
||||
let flowLayout = NSCollectionViewFlowLayout()
|
||||
flowLayout.itemSize = NSSize(width: 228, height: 211)
|
||||
flowLayout.sectionInset = EdgeInsets(top: 10, left: 0, bottom: 10, right: 0)
|
||||
flowLayout.sectionInset = NSEdgeInsets(top: 10, left: 0, bottom: 10, right: 0)
|
||||
flowLayout.minimumInteritemSpacing = 10
|
||||
flowLayout.minimumLineSpacing = 10
|
||||
collectionViewYear.collectionViewLayout = flowLayout
|
||||
let flowLayout2 = NSCollectionViewFlowLayout()
|
||||
flowLayout2.itemSize = NSSize(width: 135, height: 132)
|
||||
flowLayout2.sectionInset = EdgeInsets(top: 2, left: 2, bottom: 2, right: 2)
|
||||
flowLayout2.sectionInset = NSEdgeInsets(top: 2, left: 2, bottom: 2, right: 2)
|
||||
flowLayout2.minimumInteritemSpacing = 2
|
||||
flowLayout2.minimumLineSpacing = 2
|
||||
collectionViewMonth.collectionViewLayout = flowLayout2
|
||||
@ -93,14 +93,14 @@ class Document: NSDocument {
|
||||
let alert = NSAlert()
|
||||
alert.messageText = "Warning"
|
||||
alert.informativeText = "PDF export active. Please wait until completed."
|
||||
alert.alertStyle = NSAlertStyle.warning
|
||||
alert.alertStyle = NSAlert.Style.warning
|
||||
alert.addButton(withTitle: "OK")
|
||||
alert.runModal()
|
||||
}
|
||||
pthread_mutex_unlock(&(NSApp.delegate as! AppDelegate).lock)
|
||||
}
|
||||
|
||||
override func printOperation(withSettings printSettings: [String : Any]) throws -> NSPrintOperation {
|
||||
override func printOperation(withSettings printSettings: [NSPrintInfo.AttributeKey : Any]) throws -> NSPrintOperation {
|
||||
let printOperation: NSPrintOperation = NSPrintOperation(view: collectionViewMonth)
|
||||
printOperation.printInfo.orientation = .landscape
|
||||
printOperation.printInfo.horizontalPagination = .fitPagination
|
||||
@ -119,7 +119,7 @@ class Document: NSDocument {
|
||||
savePanel.nameFieldStringValue = name
|
||||
savePanel.canCreateDirectories = true
|
||||
savePanel.beginSheetModal(for: windowController.window!) { result in
|
||||
if result == NSFileHandlingPanelOKButton {
|
||||
if result.rawValue == NSFileHandlingPanelOKButton {
|
||||
self.exportProgress.doubleValue = 0
|
||||
self.exportProgress.isHidden = false
|
||||
let operationQueue: OperationQueue = OperationQueue()
|
||||
|
||||
@ -57,7 +57,7 @@ class FrequencyGraph: NSView {
|
||||
override func draw(_ dirtyRect: NSRect) {
|
||||
|
||||
NSColor.white.setFill()
|
||||
NSRectFill(dirtyRect)
|
||||
__NSRectFill(dirtyRect)
|
||||
|
||||
threshold.lineWidth = 0.5
|
||||
|
||||
|
||||
@ -23,8 +23,8 @@ class GraphWindow: NSWindowController {
|
||||
let loadingQueue3: OperationQueue = OperationQueue()
|
||||
let loadingQueue4: OperationQueue = OperationQueue()
|
||||
|
||||
override var windowNibName: String! {
|
||||
return "GraphWindow"
|
||||
override var windowNibName: NSNib.Name? {
|
||||
return NSNib.Name(rawValue: "GraphWindow")
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
@ -103,7 +103,7 @@ class GraphWindow: NSWindowController {
|
||||
}
|
||||
|
||||
extension GraphWindow: NSWindowDelegate {
|
||||
func windowShouldClose(_ sender: Any) -> Bool {
|
||||
func windowShouldClose(_ sender: NSWindow) -> Bool {
|
||||
for op in loadingQueue1.operations {
|
||||
if !op.isFinished {
|
||||
return false
|
||||
@ -124,7 +124,7 @@ extension GraphWindow: NSWindowDelegate {
|
||||
return false
|
||||
}
|
||||
}
|
||||
collectionViewItem.collectionView.deselectAll(self)
|
||||
collectionViewItem.collectionView?.deselectAll(self)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.1</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>481</string>
|
||||
<string>491</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.utilities</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
||||
@ -39,10 +39,10 @@ class LossDistributionPie: NSView {
|
||||
arc.move(to: center)
|
||||
arc.addArc(center: center, radius: 18, startAngle: startAngle - CGFloat(i)*increment, endAngle: startAngle - CGFloat(i+1)*increment, clockwise: true)
|
||||
arc.closeSubpath()
|
||||
NSGraphicsContext.current()!.cgContext.addPath(arc)
|
||||
NSGraphicsContext.current()!.cgContext.setFillColor(CGColor(red: 1, green: 0, blue: 0, alpha: CGFloat(distribution[i]) / 60))
|
||||
NSGraphicsContext.current()!.cgContext.setStrokeColor(NSColor.controlShadowColor.cgColor)
|
||||
NSGraphicsContext.current()!.cgContext.drawPath(using: CGPathDrawingMode.fillStroke)
|
||||
NSGraphicsContext.current!.cgContext.addPath(arc)
|
||||
NSGraphicsContext.current!.cgContext.setFillColor(CGColor(red: 1, green: 0, blue: 0, alpha: CGFloat(distribution[i]) / 60))
|
||||
NSGraphicsContext.current!.cgContext.setStrokeColor(NSColor.controlShadowColor.cgColor)
|
||||
NSGraphicsContext.current!.cgContext.drawPath(using: CGPathDrawingMode.fillStroke)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,8 +46,9 @@ class PDFDraw: NSWindowController {
|
||||
var month: Int = 0
|
||||
var days: [FileWrapper?] = [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil]
|
||||
|
||||
override var windowNibName: String! {
|
||||
return "PDFDraw"
|
||||
//override var windowNibName: NSNib.Name! {
|
||||
override var windowNibName: NSNib.Name? {
|
||||
return NSNib.Name(rawValue: "PDFDraw")
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder)
|
||||
|
||||
@ -25,14 +25,14 @@ class PDFItemViewController: NSViewController {
|
||||
}
|
||||
|
||||
init(dayFW: FileWrapper?, day: Int, monthName: String) {
|
||||
super.init(nibName: "PDFItemViewController", bundle: Bundle.main)!
|
||||
super.init(nibName: NSNib.Name(rawValue: "PDFItemViewController"), bundle: Bundle.main)
|
||||
self.dayFW = dayFW
|
||||
self.dayI = day
|
||||
self.monthName = monthName
|
||||
}
|
||||
|
||||
init(dayFW: FileWrapper?, day: Int) {
|
||||
super.init(nibName: "PDFItemViewController", bundle: Bundle.main)!
|
||||
super.init(nibName: NSNib.Name(rawValue: "PDFItemViewController"), bundle: Bundle.main)
|
||||
self.dayFW = dayFW
|
||||
self.dayI = day
|
||||
}
|
||||
|
||||
@ -30,8 +30,8 @@ class PDFTitle: NSWindowController {
|
||||
appName.stringValue = "Graphic Analysis 2 Version \(version())"
|
||||
}
|
||||
|
||||
override var windowNibName: String! {
|
||||
return "PDFTitle"
|
||||
override var windowNibName: NSNib.Name? {
|
||||
return NSNib.Name(rawValue: "PDFTitle")
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder)
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
version 2.1
|
||||
build 481
|
||||
build 491
|
||||
|
||||
@ -24,7 +24,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
// URL Session for DOCSIS data and Internet check
|
||||
let urlSession: URLSession = URLSession(configuration: .default)
|
||||
// Preferences
|
||||
let pref: NSWindowController = NSWindowController(windowNibName: "SettingsWindowController")
|
||||
let pref: NSWindowController = NSWindowController(windowNibName: NSNib.Name(rawValue: "SettingsWindowController"))
|
||||
// Timers
|
||||
var timerFreqs: Timer = Timer()
|
||||
var timerFails: Timer = Timer()
|
||||
@ -52,7 +52,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
justTime.locale = Locale(identifier: "de_DE")
|
||||
|
||||
// Set status item
|
||||
statusItem = NSStatusBar.system().statusItem(withLength: -2)
|
||||
statusItem = NSStatusBar.system.statusItem(withLength: -2)
|
||||
statusItem.title = "AL"
|
||||
// Create status item menu
|
||||
let menu: NSMenu = NSMenu.init()
|
||||
@ -60,7 +60,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
let menuAbout: NSMenuItem = NSMenuItem(title: "About Logger", action: #selector(NSApp.orderFrontStandardAboutPanel(_:)), keyEquivalent: "")
|
||||
let menuQuit: NSMenuItem = NSMenuItem.init(title: "Quit", action: #selector(NSApp.terminate(_:)), keyEquivalent: "q")
|
||||
let menuPref: NSMenuItem = NSMenuItem(title: "Preferences", action: #selector(self.preferences(_:)), keyEquivalent: "")
|
||||
menuPref.image = NSImage(named: NSImageNameActionTemplate)
|
||||
menuPref.image = NSImage(named: NSImage.Name.actionTemplate)
|
||||
// Layout menu
|
||||
menu.addItem(menuAbout)
|
||||
menu.addItem(NSMenuItem.separator())
|
||||
@ -97,26 +97,26 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
func applicationShouldTerminate(_ sender: NSApplication) -> NSApplicationTerminateReply {
|
||||
func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {
|
||||
urlSession.invalidateAndCancel()
|
||||
return .terminateNow
|
||||
}
|
||||
|
||||
// MARK: - Logging Functions
|
||||
|
||||
func logFreqs(_: Timer) {
|
||||
@objc func logFreqs(_: Timer) {
|
||||
let frequencyOperation: FrequencyOperation = FrequencyOperation()
|
||||
OperationQueue.main.addOperation(frequencyOperation)
|
||||
}
|
||||
|
||||
func logFails(_: Timer) {
|
||||
@objc func logFails(_: Timer) {
|
||||
let connectionLossOperation: ConnectionLossOperation = ConnectionLossOperation()
|
||||
OperationQueue.main.addOperation(connectionLossOperation)
|
||||
}
|
||||
|
||||
// MARK: - General functions
|
||||
|
||||
func preferences(_ sender: NSMenuItem) {
|
||||
@objc func preferences(_ sender: NSMenuItem) {
|
||||
timerFreqs.invalidate()
|
||||
timerFails.invalidate()
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>4.2</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>49</string>
|
||||
<string>50</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.utilities</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
version 4.2
|
||||
build 49
|
||||
build 50
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user