Conversion to swift 4

This commit is contained in:
Kilian Hofmann 2017-06-28 14:38:12 +02:00
parent 965db2c81a
commit 7fc78049d2
21 changed files with 91 additions and 60 deletions

View File

@ -21,9 +21,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// Insert code here to tear down your application // Insert code here to tear down your application
} }
func applicationShouldTerminate(_ sender: NSApplication) -> NSApplicationTerminateReply { func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {
guard isConverting else { return NSApplicationTerminateReply.terminateNow } guard isConverting else { return NSApplication.TerminateReply.terminateNow }
return NSApplicationTerminateReply.terminateCancel return NSApplication.TerminateReply.terminateCancel
} }
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {

View File

@ -577,18 +577,19 @@
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastSwiftUpdateCheck = 0830; LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0830; LastUpgradeCheck = 0900;
ORGANIZATIONNAME = "Kilian Hofmann"; ORGANIZATIONNAME = "Kilian Hofmann";
TargetAttributes = { TargetAttributes = {
E220BF9B1EFB22D400DF5A97 = { E220BF9B1EFB22D400DF5A97 = {
CreatedOnToolsVersion = 8.3.3; CreatedOnToolsVersion = 8.3.3;
DevelopmentTeam = 795KPDV76S; DevelopmentTeam = 795KPDV76S;
LastSwiftMigration = 0900;
ProvisioningStyle = Automatic; ProvisioningStyle = Automatic;
}; };
E2218C971EF2D345004298F6 = { E2218C971EF2D345004298F6 = {
CreatedOnToolsVersion = 8.3.3; CreatedOnToolsVersion = 8.3.3;
DevelopmentTeam = 795KPDV76S; DevelopmentTeam = 795KPDV76S;
LastSwiftMigration = 0830; LastSwiftMigration = 0900;
ProvisioningStyle = Automatic; ProvisioningStyle = Automatic;
}; };
E2218CE51EF2D577004298F6 = { E2218CE51EF2D577004298F6 = {
@ -599,6 +600,7 @@
E2218D281EF3271F004298F6 = { E2218D281EF3271F004298F6 = {
CreatedOnToolsVersion = 8.3.3; CreatedOnToolsVersion = 8.3.3;
DevelopmentTeam = 795KPDV76S; DevelopmentTeam = 795KPDV76S;
LastSwiftMigration = 0900;
ProvisioningStyle = Automatic; ProvisioningStyle = Automatic;
}; };
E2218D3D1EF32803004298F6 = { E2218D3D1EF32803004298F6 = {
@ -755,7 +757,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.weebly.alikja.Converter; PRODUCT_BUNDLE_IDENTIFIER = com.weebly.alikja.Converter;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 3.0; SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
}; };
name = Debug; name = Debug;
}; };
@ -771,7 +774,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.weebly.alikja.Converter; PRODUCT_BUNDLE_IDENTIFIER = com.weebly.alikja.Converter;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 3.0; SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
}; };
name = Release; name = Release;
}; };
@ -785,7 +789,9 @@
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
@ -793,7 +799,11 @@
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = 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_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@ -823,6 +833,7 @@
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_DISABLE_SAFETY_CHECKS = NO; SWIFT_DISABLE_SAFETY_CHECKS = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
}; };
name = Debug; name = Debug;
}; };
@ -836,7 +847,9 @@
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
@ -844,7 +857,11 @@
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = 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_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@ -866,6 +883,7 @@
SDKROOT = macosx; SDKROOT = macosx;
SWIFT_DISABLE_SAFETY_CHECKS = NO; SWIFT_DISABLE_SAFETY_CHECKS = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
}; };
name = Release; name = Release;
}; };
@ -884,7 +902,8 @@
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Logger4/Logger4-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Logger4/Logger4-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0; SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
}; };
name = Debug; name = Debug;
}; };
@ -902,7 +921,8 @@
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Logger4/Logger4-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Logger4/Logger4-Bridging-Header.h";
SWIFT_VERSION = 3.0; SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
}; };
name = Release; name = Release;
}; };
@ -944,7 +964,8 @@
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_DISABLE_SAFETY_CHECKS = NO; SWIFT_DISABLE_SAFETY_CHECKS = NO;
SWIFT_VERSION = 3.0; SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
}; };
name = Debug; name = Debug;
}; };
@ -962,7 +983,8 @@
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_DISABLE_SAFETY_CHECKS = YES; SWIFT_DISABLE_SAFETY_CHECKS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0; SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
}; };
name = Release; name = Release;
}; };

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "0830" LastUpgradeVersion = "0900"
version = "1.3"> version = "1.3">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"
@ -54,6 +54,7 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES">
<Testables> <Testables>
</Testables> </Testables>
@ -73,6 +74,7 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "0830" LastUpgradeVersion = "0900"
version = "1.3"> version = "1.3">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"
@ -14,7 +14,7 @@
buildForAnalyzing = "YES"> buildForAnalyzing = "YES">
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "E27A9DBD1EF9B7FD000BC7A3" BlueprintIdentifier = "E220BF9B1EFB22D400DF5A97"
BuildableName = "Converter.app" BuildableName = "Converter.app"
BlueprintName = "Converter" BlueprintName = "Converter"
ReferencedContainer = "container:Docsis Toolkit.xcodeproj"> ReferencedContainer = "container:Docsis Toolkit.xcodeproj">
@ -26,13 +26,14 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES">
<Testables> <Testables>
</Testables> </Testables>
<MacroExpansion> <MacroExpansion>
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "E27A9DBD1EF9B7FD000BC7A3" BlueprintIdentifier = "E220BF9B1EFB22D400DF5A97"
BuildableName = "Converter.app" BuildableName = "Converter.app"
BlueprintName = "Converter" BlueprintName = "Converter"
ReferencedContainer = "container:Docsis Toolkit.xcodeproj"> ReferencedContainer = "container:Docsis Toolkit.xcodeproj">
@ -45,6 +46,7 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"
@ -55,7 +57,7 @@
runnableDebuggingMode = "0"> runnableDebuggingMode = "0">
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "E27A9DBD1EF9B7FD000BC7A3" BlueprintIdentifier = "E220BF9B1EFB22D400DF5A97"
BuildableName = "Converter.app" BuildableName = "Converter.app"
BlueprintName = "Converter" BlueprintName = "Converter"
ReferencedContainer = "container:Docsis Toolkit.xcodeproj"> ReferencedContainer = "container:Docsis Toolkit.xcodeproj">
@ -74,7 +76,7 @@
runnableDebuggingMode = "0"> runnableDebuggingMode = "0">
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "E27A9DBD1EF9B7FD000BC7A3" BlueprintIdentifier = "E220BF9B1EFB22D400DF5A97"
BuildableName = "Converter.app" BuildableName = "Converter.app"
BlueprintName = "Converter" BlueprintName = "Converter"
ReferencedContainer = "container:Docsis Toolkit.xcodeproj"> ReferencedContainer = "container:Docsis Toolkit.xcodeproj">

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "0830" LastUpgradeVersion = "0900"
version = "1.3"> version = "1.3">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"
@ -26,6 +26,7 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES">
<Testables> <Testables>
</Testables> </Testables>
@ -45,6 +46,7 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "0830" LastUpgradeVersion = "0900"
version = "1.3"> version = "1.3">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"
@ -26,6 +26,7 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES">
<Testables> <Testables>
</Testables> </Testables>
@ -45,6 +46,7 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"

View File

@ -14,7 +14,7 @@ class FileOperations: NSObject {
// 15 in threshold indicates some error // 15 in threshold indicates some error
static func encodeTimeStamp(stamp: String, threshold: String) -> UInt32 { 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 separated: Array<String> = stamp.components(separatedBy: ":")
let hours: UInt32 = UInt32(separated[0])! << 16 let hours: UInt32 = UInt32(separated[0])! << 16
let minutes: UInt32 = UInt32(separated[1])! << 10 let minutes: UInt32 = UInt32(separated[1])! << 10
@ -24,7 +24,7 @@ class FileOperations: NSObject {
} }
static func decodeTimestamp(stamp: UInt32) -> (String, String) { 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 threshold: UInt32 = stamp & 0b1111
let seconds: UInt32 = (stamp >> 4) & 0b111111 let seconds: UInt32 = (stamp >> 4) & 0b111111
let minutes: UInt32 = (stamp >> 10) & 0b111111 let minutes: UInt32 = (stamp >> 10) & 0b111111

View File

@ -33,7 +33,7 @@ extension CollectionViewMonth: NSCollectionViewDataSource {
} }
func collectionView(_ itemForRepresentedObjectAtcollectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem { 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 { guard let item2 = item as? CollectionViewItemMonth else {
self.doc.progress.increment(by: 100/31) self.doc.progress.increment(by: 100/31)
if self.doc.progress.doubleValue > 98 { if self.doc.progress.doubleValue > 98 {

View File

@ -34,7 +34,7 @@ extension CollectionViewYear: NSCollectionViewDataSource {
} }
func collectionView(_ itemForRepresentedObjectAtcollectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem { 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 } guard let item2 = item as? CollectionViewItemYear else { return item }
if item2.isSelected { if item2.isSelected {
item2.view.layer?.borderColor = NSColor.gray.cgColor item2.view.layer?.borderColor = NSColor.gray.cgColor

View File

@ -26,6 +26,10 @@ class Document: NSDocument {
@IBOutlet var progress: NSProgressIndicator! @IBOutlet var progress: NSProgressIndicator!
@IBOutlet var exportProgress: NSProgressIndicator! @IBOutlet var exportProgress: NSProgressIndicator!
override class var autosavesInPlace: Bool {
return false;
}
override init() { override init() {
super.init() super.init()
for _ in 0..<12 { for _ in 0..<12 {
@ -37,12 +41,8 @@ class Document: NSDocument {
} }
} }
override class func autosavesInPlace() -> Bool { override var windowNibName: NSNib.Name? {
return false return NSNib.Name(rawValue: "Document")
}
override var windowNibName: String? {
return "Document"
} }
override func read(from fileWrapper: FileWrapper, ofType typeName: String) throws { override func read(from fileWrapper: FileWrapper, ofType typeName: String) throws {
@ -63,13 +63,13 @@ class Document: NSDocument {
// Setup collection layout // Setup collection layout
let flowLayout = NSCollectionViewFlowLayout() let flowLayout = NSCollectionViewFlowLayout()
flowLayout.itemSize = NSSize(width: 228, height: 211) 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.minimumInteritemSpacing = 10
flowLayout.minimumLineSpacing = 10 flowLayout.minimumLineSpacing = 10
collectionViewYear.collectionViewLayout = flowLayout collectionViewYear.collectionViewLayout = flowLayout
let flowLayout2 = NSCollectionViewFlowLayout() let flowLayout2 = NSCollectionViewFlowLayout()
flowLayout2.itemSize = NSSize(width: 135, height: 132) 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.minimumInteritemSpacing = 2
flowLayout2.minimumLineSpacing = 2 flowLayout2.minimumLineSpacing = 2
collectionViewMonth.collectionViewLayout = flowLayout2 collectionViewMonth.collectionViewLayout = flowLayout2
@ -93,14 +93,14 @@ class Document: NSDocument {
let alert = NSAlert() let alert = NSAlert()
alert.messageText = "Warning" alert.messageText = "Warning"
alert.informativeText = "PDF export active. Please wait until completed." alert.informativeText = "PDF export active. Please wait until completed."
alert.alertStyle = NSAlertStyle.warning alert.alertStyle = NSAlert.Style.warning
alert.addButton(withTitle: "OK") alert.addButton(withTitle: "OK")
alert.runModal() alert.runModal()
} }
pthread_mutex_unlock(&(NSApp.delegate as! AppDelegate).lock) 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) let printOperation: NSPrintOperation = NSPrintOperation(view: collectionViewMonth)
printOperation.printInfo.orientation = .landscape printOperation.printInfo.orientation = .landscape
printOperation.printInfo.horizontalPagination = .fitPagination printOperation.printInfo.horizontalPagination = .fitPagination
@ -119,7 +119,7 @@ class Document: NSDocument {
savePanel.nameFieldStringValue = name savePanel.nameFieldStringValue = name
savePanel.canCreateDirectories = true savePanel.canCreateDirectories = true
savePanel.beginSheetModal(for: windowController.window!) { result in savePanel.beginSheetModal(for: windowController.window!) { result in
if result == NSFileHandlingPanelOKButton { if result.rawValue == NSFileHandlingPanelOKButton {
self.exportProgress.doubleValue = 0 self.exportProgress.doubleValue = 0
self.exportProgress.isHidden = false self.exportProgress.isHidden = false
let operationQueue: OperationQueue = OperationQueue() let operationQueue: OperationQueue = OperationQueue()

View File

@ -57,7 +57,7 @@ class FrequencyGraph: NSView {
override func draw(_ dirtyRect: NSRect) { override func draw(_ dirtyRect: NSRect) {
NSColor.white.setFill() NSColor.white.setFill()
NSRectFill(dirtyRect) __NSRectFill(dirtyRect)
threshold.lineWidth = 0.5 threshold.lineWidth = 0.5

View File

@ -23,8 +23,8 @@ class GraphWindow: NSWindowController {
let loadingQueue3: OperationQueue = OperationQueue() let loadingQueue3: OperationQueue = OperationQueue()
let loadingQueue4: OperationQueue = OperationQueue() let loadingQueue4: OperationQueue = OperationQueue()
override var windowNibName: String! { override var windowNibName: NSNib.Name? {
return "GraphWindow" return NSNib.Name(rawValue: "GraphWindow")
} }
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
@ -103,7 +103,7 @@ class GraphWindow: NSWindowController {
} }
extension GraphWindow: NSWindowDelegate { extension GraphWindow: NSWindowDelegate {
func windowShouldClose(_ sender: Any) -> Bool { func windowShouldClose(_ sender: NSWindow) -> Bool {
for op in loadingQueue1.operations { for op in loadingQueue1.operations {
if !op.isFinished { if !op.isFinished {
return false return false
@ -124,7 +124,7 @@ extension GraphWindow: NSWindowDelegate {
return false return false
} }
} }
collectionViewItem.collectionView.deselectAll(self) collectionViewItem.collectionView?.deselectAll(self)
return true return true
} }
} }

View File

@ -44,7 +44,7 @@
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>2.1</string> <string>2.1</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>481</string> <string>491</string>
<key>LSApplicationCategoryType</key> <key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string> <string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>

View File

@ -39,10 +39,10 @@ class LossDistributionPie: NSView {
arc.move(to: center) arc.move(to: center)
arc.addArc(center: center, radius: 18, startAngle: startAngle - CGFloat(i)*increment, endAngle: startAngle - CGFloat(i+1)*increment, clockwise: true) arc.addArc(center: center, radius: 18, startAngle: startAngle - CGFloat(i)*increment, endAngle: startAngle - CGFloat(i+1)*increment, clockwise: true)
arc.closeSubpath() arc.closeSubpath()
NSGraphicsContext.current()!.cgContext.addPath(arc) NSGraphicsContext.current!.cgContext.addPath(arc)
NSGraphicsContext.current()!.cgContext.setFillColor(CGColor(red: 1, green: 0, blue: 0, alpha: CGFloat(distribution[i]) / 60)) 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.setStrokeColor(NSColor.controlShadowColor.cgColor)
NSGraphicsContext.current()!.cgContext.drawPath(using: CGPathDrawingMode.fillStroke) NSGraphicsContext.current!.cgContext.drawPath(using: CGPathDrawingMode.fillStroke)
} }
} }
} }

View File

@ -46,8 +46,9 @@ class PDFDraw: NSWindowController {
var month: Int = 0 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] 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! { //override var windowNibName: NSNib.Name! {
return "PDFDraw" override var windowNibName: NSNib.Name? {
return NSNib.Name(rawValue: "PDFDraw")
} }
required init?(coder: NSCoder) required init?(coder: NSCoder)

View File

@ -25,14 +25,14 @@ class PDFItemViewController: NSViewController {
} }
init(dayFW: FileWrapper?, day: Int, monthName: String) { 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.dayFW = dayFW
self.dayI = day self.dayI = day
self.monthName = monthName self.monthName = monthName
} }
init(dayFW: FileWrapper?, day: Int) { 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.dayFW = dayFW
self.dayI = day self.dayI = day
} }

View File

@ -30,8 +30,8 @@ class PDFTitle: NSWindowController {
appName.stringValue = "Graphic Analysis 2 Version \(version())" appName.stringValue = "Graphic Analysis 2 Version \(version())"
} }
override var windowNibName: String! { override var windowNibName: NSNib.Name? {
return "PDFTitle" return NSNib.Name(rawValue: "PDFTitle")
} }
required init?(coder: NSCoder) required init?(coder: NSCoder)

View File

@ -1,2 +1,2 @@
version 2.1 version 2.1
build 481 build 491

View File

@ -24,7 +24,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// URL Session for DOCSIS data and Internet check // URL Session for DOCSIS data and Internet check
let urlSession: URLSession = URLSession(configuration: .default) let urlSession: URLSession = URLSession(configuration: .default)
// Preferences // Preferences
let pref: NSWindowController = NSWindowController(windowNibName: "SettingsWindowController") let pref: NSWindowController = NSWindowController(windowNibName: NSNib.Name(rawValue: "SettingsWindowController"))
// Timers // Timers
var timerFreqs: Timer = Timer() var timerFreqs: Timer = Timer()
var timerFails: Timer = Timer() var timerFails: Timer = Timer()
@ -52,7 +52,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
justTime.locale = Locale(identifier: "de_DE") justTime.locale = Locale(identifier: "de_DE")
// Set status item // Set status item
statusItem = NSStatusBar.system().statusItem(withLength: -2) statusItem = NSStatusBar.system.statusItem(withLength: -2)
statusItem.title = "AL" statusItem.title = "AL"
// Create status item menu // Create status item menu
let menu: NSMenu = NSMenu.init() 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 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 menuQuit: NSMenuItem = NSMenuItem.init(title: "Quit", action: #selector(NSApp.terminate(_:)), keyEquivalent: "q")
let menuPref: NSMenuItem = NSMenuItem(title: "Preferences", action: #selector(self.preferences(_:)), keyEquivalent: "") 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 // Layout menu
menu.addItem(menuAbout) menu.addItem(menuAbout)
menu.addItem(NSMenuItem.separator()) 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() urlSession.invalidateAndCancel()
return .terminateNow return .terminateNow
} }
// MARK: - Logging Functions // MARK: - Logging Functions
func logFreqs(_: Timer) { @objc func logFreqs(_: Timer) {
let frequencyOperation: FrequencyOperation = FrequencyOperation() let frequencyOperation: FrequencyOperation = FrequencyOperation()
OperationQueue.main.addOperation(frequencyOperation) OperationQueue.main.addOperation(frequencyOperation)
} }
func logFails(_: Timer) { @objc func logFails(_: Timer) {
let connectionLossOperation: ConnectionLossOperation = ConnectionLossOperation() let connectionLossOperation: ConnectionLossOperation = ConnectionLossOperation()
OperationQueue.main.addOperation(connectionLossOperation) OperationQueue.main.addOperation(connectionLossOperation)
} }
// MARK: - General functions // MARK: - General functions
func preferences(_ sender: NSMenuItem) { @objc func preferences(_ sender: NSMenuItem) {
timerFreqs.invalidate() timerFreqs.invalidate()
timerFails.invalidate() timerFails.invalidate()

View File

@ -17,7 +17,7 @@
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>4.2</string> <string>4.2</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>49</string> <string>50</string>
<key>LSApplicationCategoryType</key> <key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string> <string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>

View File

@ -1,2 +1,2 @@
version 4.2 version 4.2
build 49 build 50