From 53b0bc9e0641575c34fbb6e14331a346a8885f0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20F=C3=B6rtsch?= Date: Wed, 10 Oct 2018 19:18:11 +0200 Subject: [PATCH] add MatchView --- LiquipediaMenu.xcodeproj/project.pbxproj | 4 + LiquipediaMenu/Base.lproj/MainMenu.xib | 99 +++++++++++++++++++ LiquipediaMenu/MatchView.swift | 34 +++++++ LiquipediaMenu/StatusBarController.swift | 7 +- Pods/Pods.xcodeproj/project.pbxproj | 36 ++----- .../xcschemes/Pods-LiquipediaMenu.xcscheme | 2 +- .../xcschemes/SwiftSoup.xcscheme | 33 ++++--- 7 files changed, 174 insertions(+), 41 deletions(-) create mode 100644 LiquipediaMenu/MatchView.swift diff --git a/LiquipediaMenu.xcodeproj/project.pbxproj b/LiquipediaMenu.xcodeproj/project.pbxproj index d330b18..7efa258 100644 --- a/LiquipediaMenu.xcodeproj/project.pbxproj +++ b/LiquipediaMenu.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 3F49E946216B86150047B0FE /* Match.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F49E945216B86150047B0FE /* Match.swift */; }; 3F49E948216B862B0047B0FE /* StatusBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F49E947216B862B0047B0FE /* StatusBarController.swift */; }; 3F49E94A216BE87B0047B0FE /* MatchesAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F49E949216BE87B0047B0FE /* MatchesAPI.swift */; }; + 3F563E07216E640D00AA3C06 /* MatchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F563E06216E640D00AA3C06 /* MatchView.swift */; }; 3FB6BB48216B8594000BF5AA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FB6BB47216B8594000BF5AA /* AppDelegate.swift */; }; 3FB6BB4A216B8595000BF5AA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3FB6BB49216B8595000BF5AA /* Assets.xcassets */; }; 3FB6BB4D216B8595000BF5AA /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3FB6BB4B216B8595000BF5AA /* MainMenu.xib */; }; @@ -22,6 +23,7 @@ 3F49E945216B86150047B0FE /* Match.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Match.swift; sourceTree = ""; }; 3F49E947216B862B0047B0FE /* StatusBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusBarController.swift; sourceTree = ""; }; 3F49E949216BE87B0047B0FE /* MatchesAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MatchesAPI.swift; sourceTree = ""; }; + 3F563E06216E640D00AA3C06 /* MatchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MatchView.swift; sourceTree = ""; }; 3FB6BB44216B8594000BF5AA /* LiquipediaMenu.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LiquipediaMenu.app; sourceTree = BUILT_PRODUCTS_DIR; }; 3FB6BB47216B8594000BF5AA /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 3FB6BB49216B8595000BF5AA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -74,6 +76,7 @@ children = ( 3FB6BB47216B8594000BF5AA /* AppDelegate.swift */, 3F49E945216B86150047B0FE /* Match.swift */, + 3F563E06216E640D00AA3C06 /* MatchView.swift */, 3F49E947216B862B0047B0FE /* StatusBarController.swift */, 3F49E949216BE87B0047B0FE /* MatchesAPI.swift */, 3FB6BB49216B8595000BF5AA /* Assets.xcassets */, @@ -210,6 +213,7 @@ buildActionMask = 2147483647; files = ( 3FB6BB48216B8594000BF5AA /* AppDelegate.swift in Sources */, + 3F563E07216E640D00AA3C06 /* MatchView.swift in Sources */, 3F49E948216B862B0047B0FE /* StatusBarController.swift in Sources */, 3F49E94A216BE87B0047B0FE /* MatchesAPI.swift in Sources */, 3F49E946216B86150047B0FE /* Match.swift in Sources */, diff --git a/LiquipediaMenu/Base.lproj/MainMenu.xib b/LiquipediaMenu/Base.lproj/MainMenu.xib index 37ce54e..4ff0733 100644 --- a/LiquipediaMenu/Base.lproj/MainMenu.xib +++ b/LiquipediaMenu/Base.lproj/MainMenu.xib @@ -3,6 +3,7 @@ + @@ -684,5 +685,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/LiquipediaMenu/MatchView.swift b/LiquipediaMenu/MatchView.swift new file mode 100644 index 0000000..8f2b31a --- /dev/null +++ b/LiquipediaMenu/MatchView.swift @@ -0,0 +1,34 @@ +// +// MatchView.swift +// LiquipediaMenu +// +// Created by Felix Förtsch on 10.10.18. +// Copyright © 2018 Felix Förtsch. All rights reserved. +// + +import Cocoa + +class MatchView: NSView { + @IBOutlet weak var league: NSTextField! + @IBOutlet weak var ongoing: NSTextField! + @IBOutlet weak var team1name: NSTextField! + @IBOutlet weak var team1score: NSTextField! + @IBOutlet weak var team2name: NSTextField! + @IBOutlet weak var team2score: NSTextField! + + override func draw(_ dirtyRect: NSRect) { + super.draw(dirtyRect) + // Drawing code here. + } + + func updateView(with match: Match) { + if !match.ongoing { + self.ongoing.isHidden = true + } + self.league.stringValue = match.league + self.team1name.stringValue = match.team1name + self.team1score.stringValue = match.team1score + self.team2name.stringValue = match.team2name + self.team2score.stringValue = match.team2score + } +} diff --git a/LiquipediaMenu/StatusBarController.swift b/LiquipediaMenu/StatusBarController.swift index 51075ee..b689266 100644 --- a/LiquipediaMenu/StatusBarController.swift +++ b/LiquipediaMenu/StatusBarController.swift @@ -13,7 +13,7 @@ class StatusBarController: NSObject { let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength) let matchesAPI = MatchesAPI() var matches = [Match]() - + override func awakeFromNib() { // Set the icon of the statusbar item and put it into the statusbar let icon = NSImage(named: "statusBarIcon") @@ -25,15 +25,16 @@ class StatusBarController: NSObject { @objc func generateMenu() { statusBar.addItem(withTitle: "Refresh", action: #selector(generateMenu), keyEquivalent: "") + statusBar.addItem(NSMenuItem.separator()) matches = matchesAPI.fetchMatches(for: "dota2") for match in matches { - let myItem = NSMenuItem(title: match.league, action: #selector(quitClicked), keyEquivalent: "") + let myItem = NSMenuItem(title: match.league, action: nil, keyEquivalent: "") statusBar.addItem(myItem) } + statusBar.addItem(NSMenuItem.separator()) statusBar.addItem(withTitle: "Quit", action: #selector(quitClicked), keyEquivalent: "") - } @objc func quitClicked() { diff --git a/Pods/Pods.xcodeproj/project.pbxproj b/Pods/Pods.xcodeproj/project.pbxproj index e16003d..1ae5c69 100644 --- a/Pods/Pods.xcodeproj/project.pbxproj +++ b/Pods/Pods.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 46; objects = { /* Begin PBXBuildFile section */ @@ -84,7 +84,7 @@ /* Begin PBXFileReference section */ 007D3C79D0CF0BE6FF2556B8846850EA /* ArrayExt.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ArrayExt.swift; path = Sources/ArrayExt.swift; sourceTree = ""; }; 0AEE3159671F061357B3988820992AB3 /* DataUtil.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DataUtil.swift; path = Sources/DataUtil.swift; sourceTree = ""; }; - 0BCEAB189E2E70EA4D235E29DE325877 /* Pods_LiquipediaMenu.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_LiquipediaMenu.framework; path = "Pods-LiquipediaMenu.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + 0BCEAB189E2E70EA4D235E29DE325877 /* Pods_LiquipediaMenu.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_LiquipediaMenu.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 0D016381C9FBB25D558EF8C55592E6D7 /* Pods-LiquipediaMenu.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-LiquipediaMenu.release.xcconfig"; sourceTree = ""; }; 0FD1D556718F7F72612DBB852C53A11A /* Pods-LiquipediaMenu-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-LiquipediaMenu-acknowledgements.plist"; sourceTree = ""; }; 1105B1B4BC31DB983BC3200EE5BC75E4 /* Pods-LiquipediaMenu-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-LiquipediaMenu-resources.sh"; sourceTree = ""; }; @@ -124,7 +124,7 @@ 8DC8E1146AEDC184675DE3BFD3225260 /* Pods-LiquipediaMenu-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-LiquipediaMenu-umbrella.h"; sourceTree = ""; }; 9161B06CA12DCBC5B4DD06E44D91CB1E /* SwiftSoup.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = SwiftSoup.modulemap; sourceTree = ""; }; 91F70944F55E23CA9F1AA9C3F5E543E6 /* Attribute.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Attribute.swift; path = Sources/Attribute.swift; sourceTree = ""; }; - 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 97B9BE6A120CF124AC947FD213458C40 /* TextNode.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TextNode.swift; path = Sources/TextNode.swift; sourceTree = ""; }; 9A1C5C6357B71AF5FED442F9E3F6C77C /* XmlDeclaration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = XmlDeclaration.swift; path = Sources/XmlDeclaration.swift; sourceTree = ""; }; 9CF8CDB58FEC3DF8E9E9C788D7986C1A /* Evaluator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Evaluator.swift; path = Sources/Evaluator.swift; sourceTree = ""; }; @@ -151,7 +151,7 @@ DF0F2496EE4A25ED1BC61246533BA9DB /* Exception.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Exception.swift; path = Sources/Exception.swift; sourceTree = ""; }; DF428FC7C7A6555B2B02D8E238C8D8F2 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; }; E06D59F71CA62BD4EDB256AE1B680688 /* Pods-LiquipediaMenu.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-LiquipediaMenu.modulemap"; sourceTree = ""; }; - E11AE56DD631B971DAE87B4973B29116 /* SwiftSoup.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = SwiftSoup.framework; path = SwiftSoup.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E11AE56DD631B971DAE87B4973B29116 /* SwiftSoup.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftSoup.framework; sourceTree = BUILT_PRODUCTS_DIR; }; E206093B8CFA7D169994473FF3E06161 /* TokeniserState.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TokeniserState.swift; path = Sources/TokeniserState.swift; sourceTree = ""; }; E7E9CAE847A747B6035DD7897522E6B3 /* StructuralEvaluator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StructuralEvaluator.swift; path = Sources/StructuralEvaluator.swift; sourceTree = ""; }; F2005E18A17D8432D600D482946D4853 /* TreeBuilder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TreeBuilder.swift; path = Sources/TreeBuilder.swift; sourceTree = ""; }; @@ -289,7 +289,6 @@ 579FD986C85730D8DF75FB2A4152B0BD /* XmlTreeBuilder.swift */, 2585406248F42708599608914EA31A98 /* Support Files */, ); - name = SwiftSoup; path = SwiftSoup; sourceTree = ""; }; @@ -393,7 +392,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0930; - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1000; }; buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; compatibilityVersion = "Xcode 3.2"; @@ -517,11 +516,7 @@ FRAMEWORK_VERSION = A; INFOPLIST_FILE = "Target Support Files/Pods-LiquipediaMenu/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - "@loader_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; MACH_O_TYPE = staticlib; MACOSX_DEPLOYMENT_TARGET = 10.13; MODULEMAP_FILE = "Target Support Files/Pods-LiquipediaMenu/Pods-LiquipediaMenu.modulemap"; @@ -558,11 +553,7 @@ FRAMEWORK_VERSION = A; INFOPLIST_FILE = "Target Support Files/Pods-LiquipediaMenu/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - "@loader_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; MACH_O_TYPE = staticlib; MACOSX_DEPLOYMENT_TARGET = 10.13; MODULEMAP_FILE = "Target Support Files/Pods-LiquipediaMenu/Pods-LiquipediaMenu.modulemap"; @@ -598,11 +589,7 @@ GCC_PREFIX_HEADER = "Target Support Files/SwiftSoup/SwiftSoup-prefix.pch"; INFOPLIST_FILE = "Target Support Files/SwiftSoup/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - "@loader_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.10; MODULEMAP_FILE = "Target Support Files/SwiftSoup/SwiftSoup.modulemap"; PRODUCT_MODULE_NAME = SwiftSoup; @@ -636,11 +623,7 @@ GCC_PREFIX_HEADER = "Target Support Files/SwiftSoup/SwiftSoup-prefix.pch"; INFOPLIST_FILE = "Target Support Files/SwiftSoup/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - "@loader_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.10; MODULEMAP_FILE = "Target Support Files/SwiftSoup/SwiftSoup.modulemap"; PRODUCT_MODULE_NAME = SwiftSoup; @@ -772,6 +755,7 @@ MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_NAME = "$(TARGET_NAME)"; STRIP_INSTALLED_PRODUCT = NO; + SWIFT_COMPILATION_MODE = wholemodule; SYMROOT = "${SRCROOT}/../build"; }; name = Release; diff --git a/Pods/Pods.xcodeproj/xcuserdata/felixfoertsch.xcuserdatad/xcschemes/Pods-LiquipediaMenu.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/felixfoertsch.xcuserdatad/xcschemes/Pods-LiquipediaMenu.xcscheme index b6920db..5d2c482 100644 --- a/Pods/Pods.xcodeproj/xcuserdata/felixfoertsch.xcuserdatad/xcschemes/Pods-LiquipediaMenu.xcscheme +++ b/Pods/Pods.xcodeproj/xcuserdata/felixfoertsch.xcuserdatad/xcschemes/Pods-LiquipediaMenu.xcscheme @@ -1,6 +1,6 @@ + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + ReferencedContainer = "container:Pods.xcodeproj"> + shouldUseLaunchSchemeArgsEnv = "YES"> + + + + + + + debugDocumentVersioning = "YES">