diff --git a/LiquipediaMenu.xcodeproj/project.pbxproj b/LiquipediaMenu.xcodeproj/project.pbxproj index c065cee..9bbf559 100644 --- a/LiquipediaMenu.xcodeproj/project.pbxproj +++ b/LiquipediaMenu.xcodeproj/project.pbxproj @@ -88,6 +88,24 @@ path = LiquipediaMenuTests; sourceTree = ""; }; + 3F933FF721E3958000C0EEF3 /* Match */ = { + isa = PBXGroup; + children = ( + 3FF66CDE21DE80BA005A93D0 /* MatchMenuItem.swift */, + 3F563E06216E640D00AA3C06 /* MatchView.swift */, + 3F49E945216B86150047B0FE /* Match.swift */, + ); + path = Match; + sourceTree = ""; + }; + 3F933FF821E395AB00C0EEF3 /* API */ = { + isa = PBXGroup; + children = ( + 3F49E949216BE87B0047B0FE /* MatchesAPI.swift */, + ); + path = API; + sourceTree = ""; + }; 3FB6BB3B216B8594000BF5AA = { isa = PBXGroup; children = ( @@ -111,12 +129,10 @@ 3FB6BB46216B8594000BF5AA /* LiquipediaMenu */ = { isa = PBXGroup; children = ( + 3F933FF821E395AB00C0EEF3 /* API */, + 3F933FF721E3958000C0EEF3 /* Match */, 3FB6BB47216B8594000BF5AA /* AppDelegate.swift */, 3F49E947216B862B0047B0FE /* StatusBarController.swift */, - 3F49E949216BE87B0047B0FE /* MatchesAPI.swift */, - 3F49E945216B86150047B0FE /* Match.swift */, - 3FF66CDE21DE80BA005A93D0 /* MatchMenuItem.swift */, - 3F563E06216E640D00AA3C06 /* MatchView.swift */, 3FB6BB49216B8595000BF5AA /* Assets.xcassets */, 3FB6BB4B216B8595000BF5AA /* MainMenu.xib */, 3FB6BB4E216B8595000BF5AA /* Info.plist */, diff --git a/LiquipediaMenu/MatchesAPI.swift b/LiquipediaMenu/API/MatchesAPI.swift similarity index 100% rename from LiquipediaMenu/MatchesAPI.swift rename to LiquipediaMenu/API/MatchesAPI.swift diff --git a/LiquipediaMenu/Base.lproj/MainMenu.xib b/LiquipediaMenu/Base.lproj/MainMenu.xib index 4d20b4c..7e97479 100644 --- a/LiquipediaMenu/Base.lproj/MainMenu.xib +++ b/LiquipediaMenu/Base.lproj/MainMenu.xib @@ -15,7 +15,11 @@ - + + + + + @@ -774,7 +778,7 @@ - + diff --git a/LiquipediaMenu/Match.swift b/LiquipediaMenu/Match/Match.swift similarity index 100% rename from LiquipediaMenu/Match.swift rename to LiquipediaMenu/Match/Match.swift diff --git a/LiquipediaMenu/MatchMenuItem.swift b/LiquipediaMenu/Match/MatchMenuItem.swift similarity index 78% rename from LiquipediaMenu/MatchMenuItem.swift rename to LiquipediaMenu/Match/MatchMenuItem.swift index d2efc02..41402d2 100644 --- a/LiquipediaMenu/MatchMenuItem.swift +++ b/LiquipediaMenu/Match/MatchMenuItem.swift @@ -9,17 +9,17 @@ import Cocoa class MatchMenuItem: NSMenuItem { + + var streamLink = "" init(for match: Match, action selector: Selector?) { - // TODO: Add custom view to MatchMenuItem -// let customView = MatchView() -// customView.updateView(for: match) - super.init(title: match.league + match.team1name + match.team1score + ":" + match.team2score + match.team2name, action: selector, keyEquivalent: "") self.streamLink = match.streamLink -// self.view = customView - + } + + func setView(to customView: MatchView) { + self.view = customView } // TODO: find out what that means diff --git a/LiquipediaMenu/MatchView.swift b/LiquipediaMenu/Match/MatchView.swift similarity index 73% rename from LiquipediaMenu/MatchView.swift rename to LiquipediaMenu/Match/MatchView.swift index ba9cc41..20987e5 100644 --- a/LiquipediaMenu/MatchView.swift +++ b/LiquipediaMenu/Match/MatchView.swift @@ -22,10 +22,6 @@ class MatchView: NSView { self.league = NSTextField() 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 21168a9..5a475c8 100644 --- a/LiquipediaMenu/StatusBarController.swift +++ b/LiquipediaMenu/StatusBarController.swift @@ -10,6 +10,8 @@ import Cocoa class StatusBarController: NSObject, NSMenuItemValidation { + @IBOutlet weak var matchView: MatchView! + func validateMenuItem(_ menuItem: NSMenuItem) -> Bool { return true } @@ -59,6 +61,7 @@ class StatusBarController: NSObject, NSMenuItemValidation { let newItem = MatchMenuItem.init(for: match, action: #selector(self.openStreamLink)) newItem.tag = 1 newItem.target = self + newItem.view = matchView self.statusBar.addItem(newItem) } } else {