From 4c32730891ffb5bc4ef7eea6798dedc01017e01c Mon Sep 17 00:00:00 2001 From: Christopher Eklund Date: Mon, 3 Jul 2017 16:25:20 +0200 Subject: [PATCH] Action controls & beginning of preferences --- .../xcschemes/SleepWell.xcscheme | 6 +- SleepWell/Assets.xcassets/Contents.json | 6 + .../PlayButton.imageset/Contents.json | 23 ++++ .../icons8-Play Filled-16.png | Bin 0 -> 214 bytes .../icons8-Play Filled-32.png | Bin 0 -> 341 bytes .../icons8-Play Filled-64.png | Bin 0 -> 589 bytes .../RestartButton.imageset/Contents.json | 23 ++++ .../RestartButton.imageset/restart16.png | Bin 0 -> 1749 bytes .../RestartButton.imageset/restart32.png | Bin 0 -> 3018 bytes .../RestartButton.imageset/restart64.png | Bin 0 -> 5510 bytes .../StopButton.imageset/Contents.json | 23 ++++ .../icons8-Stop Filled-16.png | Bin 0 -> 132 bytes .../icons8-Stop Filled-32.png | Bin 0 -> 126 bytes .../icons8-Stop Filled-64.png | Bin 0 -> 292 bytes SleepWell/Base.lproj/Main.storyboard | 108 +++++++++++++++--- SleepWell/MenubarController.swift | 43 +++++-- 16 files changed, 207 insertions(+), 25 deletions(-) create mode 100644 SleepWell/Assets.xcassets/Contents.json create mode 100644 SleepWell/Assets.xcassets/PlayButton.imageset/Contents.json create mode 100644 SleepWell/Assets.xcassets/PlayButton.imageset/icons8-Play Filled-16.png create mode 100644 SleepWell/Assets.xcassets/PlayButton.imageset/icons8-Play Filled-32.png create mode 100644 SleepWell/Assets.xcassets/PlayButton.imageset/icons8-Play Filled-64.png create mode 100644 SleepWell/Assets.xcassets/RestartButton.imageset/Contents.json create mode 100644 SleepWell/Assets.xcassets/RestartButton.imageset/restart16.png create mode 100644 SleepWell/Assets.xcassets/RestartButton.imageset/restart32.png create mode 100644 SleepWell/Assets.xcassets/RestartButton.imageset/restart64.png create mode 100644 SleepWell/Assets.xcassets/StopButton.imageset/Contents.json create mode 100644 SleepWell/Assets.xcassets/StopButton.imageset/icons8-Stop Filled-16.png create mode 100644 SleepWell/Assets.xcassets/StopButton.imageset/icons8-Stop Filled-32.png create mode 100644 SleepWell/Assets.xcassets/StopButton.imageset/icons8-Stop Filled-64.png diff --git a/SleepWell.xcodeproj/xcuserdata/eklundchristopher.xcuserdatad/xcschemes/SleepWell.xcscheme b/SleepWell.xcodeproj/xcuserdata/eklundchristopher.xcuserdatad/xcschemes/SleepWell.xcscheme index 5a1536c..a9ff54f 100644 --- a/SleepWell.xcodeproj/xcuserdata/eklundchristopher.xcuserdatad/xcschemes/SleepWell.xcscheme +++ b/SleepWell.xcodeproj/xcuserdata/eklundchristopher.xcuserdatad/xcschemes/SleepWell.xcscheme @@ -42,9 +42,9 @@ TDbsB)ZEf(+uQ(V z+s-sC0bt!|P1BM9x3E_};=BaFD+nvbzbZF?azXh}{1RTmsf*k25rnG*k+!3JpR}qy z?!YOWy7)3uyQekQv23MQ>voT>)Dh^Cd&8_&-u00000NkvXXu0mjfMbnb3 literal 0 HcmV?d00001 diff --git a/SleepWell/Assets.xcassets/PlayButton.imageset/icons8-Play Filled-64.png b/SleepWell/Assets.xcassets/PlayButton.imageset/icons8-Play Filled-64.png new file mode 100644 index 0000000000000000000000000000000000000000..02f35ca25260a6e4860fc3f3f5902a8993692ddc GIT binary patch literal 589 zcmV-T0o74M1`?*(!i!ZnAX% zlWuYqkginF)fWIFTKbW@z*dNx>=S?}H`zx3L2hyY5VT_a-7Gspeq$u!@$8QT6;yqS z0Mm=0G*wLg4R&s;wVDFbSltBnyEax^10coFnd=&vD~6;DHdzj5-Con20!21hwE{5P z6n$`K3of(!MK^$!2&i_q=h$D&t1S>m1MH!NiO#&n&K%RmSN+BSiJYurIR+3G#iwPp>C=W$I z5Rr#QM1g|S!P3e20E$);0gGa-r4$@zTD1xaG98BsDAElI_J?+7ckjJt&i9?~o^$Tp zf{5^KD{WnD2?WB*kYHgXKH6KpWj6TV?d7ZtAJ$=_SS$)j!L%|BMBpiq-4GC>l%+zE zkW7*J)lG;)AT0KTrLkD7B#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Y@ZLRi zv8H?WnmCaotm;{9cQ<=&Vc2Geyu7@v&z?OqB-aMeDGf~;;qR5 literal 0 HcmV?d00001 diff --git a/SleepWell/Assets.xcassets/RestartButton.imageset/restart32.png b/SleepWell/Assets.xcassets/RestartButton.imageset/restart32.png new file mode 100644 index 0000000000000000000000000000000000000000..ccfdc1b7c900f7f692445e59497c990ced390bda GIT binary patch literal 3018 zcmaJ@c{r47A0CoODLJy8m_~!t%ovPi#%`1;hU_9W%ZtG*W(G5gtQ8G$42tSh8bzj( zA}L!@ak4c|=p_4A>65L};d^ze@B8EHd#?9=pXK`9_iuUb=egcgH{$N~Yc|9!B|&-ga0Umn1^Xu` zUl%v11CtFvF-TJc1#N5uHM2mXF&0MVCOe@h`1dNhg)q5HP6(3)b#Pdz z8U~4h>bsCAG{(yE_OCb>7c7Cn;gT2>fPlAxflNpmjf%CiFgI~9v^T<-qwUdXM>BIH zI}^N_IoiV9bQjtlWBMJ7XHp{R0E7D-OZ^Yl_@~$vNzhrKXFR~BMFG@ZY$hH0HFYfQ z=dl?6lwWjwwPfykK> z@OGZOUZD@oIcN7TTeLR#;r;No#TrryCvsm&RR- zWdB|hlg$DpgedXQ?W^^&b~{cK`>MFvWw~t3bg@06KYvzU`%~TSFg-s1eJp3J54Uih z6J(uqcwtH&2r5;gSn@SR;X4~ z-5nf~;4du9&A9?iv+EsweM^0%e&xuFEjZK4l9D}RBO~xqvAA)hC9m=G+?$kwf&$*+ zyjTrvX~imq>oj`0yHC{A)Rd*Cryr~*1Ox|PNwN0dMovdPUR-$JR?8mQBS=Ycyi#3# zxbw@Wnc9?7T9I{GL+4~pU-Z7FlC9^u84ibsbv}Q7YHR$NkJ?G8fwgf~7mJE?tqlx9 zjgJ8BdarYh^D;i9L0t%-Wq8~j;XO;b}rN2hQJO=*(M)Do{OUZ|~o zJ>GTAM`s5ms=qGbpz2QF{#w$*W4?R$?(OL6g7@9$>-ZyHURRruveB>Vu8w9NtLcA! z#q~zM)#3RU1*Y`;=+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meU-i$LROOt~Ve*H6g<)X1+vAzrae*n@76HWjC literal 0 HcmV?d00001 diff --git a/SleepWell/Assets.xcassets/StopButton.imageset/Contents.json b/SleepWell/Assets.xcassets/StopButton.imageset/Contents.json new file mode 100644 index 0000000..588bfe8 --- /dev/null +++ b/SleepWell/Assets.xcassets/StopButton.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "icons8-Stop Filled-16.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "icons8-Stop Filled-32.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "icons8-Stop Filled-64.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/SleepWell/Assets.xcassets/StopButton.imageset/icons8-Stop Filled-16.png b/SleepWell/Assets.xcassets/StopButton.imageset/icons8-Stop Filled-16.png new file mode 100644 index 0000000000000000000000000000000000000000..2399870c7e1b0ef93004f2e15dda690e546f7b44 GIT binary patch literal 132 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`-kvUwAr}70DGLM)f>z9Dyve}M z#>Q5y#A|cnz<~mWC1N)lfc&;9CEkpbgan3_@}>zUJS*n&Ie1F8bTTeT>6tjC^J2%s dwnuk37}7UL2)Zrk;Q<=U;OXk;vd$@?2>^2ZCHVjV literal 0 HcmV?d00001 diff --git a/SleepWell/Assets.xcassets/StopButton.imageset/icons8-Stop Filled-32.png b/SleepWell/Assets.xcassets/StopButton.imageset/icons8-Stop Filled-32.png new file mode 100644 index 0000000000000000000000000000000000000000..dc5eecac90b505ddcab3cd35b2f877807f2f8c0e GIT binary patch literal 126 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzS5FtmkO=p;*G~#E7_cxn{L;75 zJn%%*CXBI9mfxsNx&3uJ+cmB^%kFA0?`JV_XkcJuV&M=_a7c(*@KR%4=JkK9Ec-ZP Yeprhs?sdF-4`?8Rr>mdKI;Vst0PoKw82|tP literal 0 HcmV?d00001 diff --git a/SleepWell/Assets.xcassets/StopButton.imageset/icons8-Stop Filled-64.png b/SleepWell/Assets.xcassets/StopButton.imageset/icons8-Stop Filled-64.png new file mode 100644 index 0000000000000000000000000000000000000000..6209bad7fffaca326f194b86e688c319c37df680 GIT binary patch literal 292 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=uRUEHLn`9l-U{SBY{1jARz4pXOJke13l8&u?c2(G5G9q7ptc8L(_^5L==B z!SmCK_U&$UllN##_G~#Y^GRgoOD4neb?d$4SXQj~(jUkeb%4i!WiAu5^Je2KhA-qE zC_Pbop%pXpP{e{oLSjEO8QKmANH94kWIVX?f``>PfrF<}(I8~zp@bESgn;510(_sD zC6r_or%8DCs2&qa?&RIzoUQ?6n;jIo{V)9Hxq0)ped|y*(d|4ZF1#T4ujsWfM(sCF e>3mwq9PtD5A{>vtt^5J>HiM_DpUXO@geCy=1aor$ literal 0 HcmV?d00001 diff --git a/SleepWell/Base.lproj/Main.storyboard b/SleepWell/Base.lproj/Main.storyboard index 7e7862d..1cae879 100644 --- a/SleepWell/Base.lproj/Main.storyboard +++ b/SleepWell/Base.lproj/Main.storyboard @@ -42,32 +42,41 @@ + + + - - + - - + - + - + + - + - + + + + + + + + @@ -80,11 +89,11 @@ - + - + @@ -93,13 +102,58 @@ - + + + + + + + + + + - + @@ -112,7 +166,7 @@ - + @@ -121,9 +175,35 @@ - + + + + + + + + + + + + + diff --git a/SleepWell/MenubarController.swift b/SleepWell/MenubarController.swift index 22df536..fa118d5 100644 --- a/SleepWell/MenubarController.swift +++ b/SleepWell/MenubarController.swift @@ -13,27 +13,35 @@ class MenubarController: NSObject { @IBOutlet weak var menubar: NSMenu! @IBOutlet weak var timerLabel: NSTextField! @IBOutlet weak var progressbar: NSProgressIndicator! - @IBOutlet weak var toggleButton: NSMenuItem! @IBOutlet weak var intervalLabel: NSTextField! @IBOutlet weak var intervalStepper: NSStepper! + @IBOutlet weak var startButton: NSButton! + @IBOutlet weak var stopButton: NSButton! + @IBOutlet weak var restartButton: NSButton! var interval = 0 - var enabled = false + dynamic var enabled: NSNumber? = false + dynamic var disabled: NSNumber? = true var timeRemaining = 0 var timer = Timer() let menubarIcon = NSStatusBar.system().statusItem(withLength: NSVariableStatusItemLength) - @IBAction func toggleTimer(_ sender: NSMenuItem) { + @IBAction func toggleTimer(_ sender: NSButton) { progressbar.doubleValue = Double(0) timeRemaining = interval - if enabled == false { + if isEnabled() == false { startTimer() } else { stopTimer() } } + @IBAction func resetTimer(_ sender: NSButton) { + progressbar.doubleValue = Double(0) + timeRemaining = interval + } + @IBAction func setTimeInterval(_ sender: NSStepper) { setTime(minutes: sender.integerValue) } @@ -47,12 +55,32 @@ class MenubarController: NSObject { menubarIcon.menu = menubar setTime(minutes: 60) + setControlButtonStates() + } + + func isEnabled() -> Bool { + return (enabled?.boolValue)! + } + + func enable() { + enabled = NSNumber?.init(true) + disabled = NSNumber?.init(false) + } + + func disable() { + enabled = NSNumber?.init(false) + disabled = NSNumber?.init(true) } func getTime() -> Int { return interval / 60 } + func setControlButtonStates() { + startButton.image?.isTemplate = true + stopButton.image?.isTemplate = true + restartButton.image?.isTemplate = true + } func setTime(minutes : Int) { interval = minutes * 60 @@ -63,8 +91,7 @@ class MenubarController: NSObject { } func startTimer() { - enabled = true - toggleButton.title = "Stop" + enable() DispatchQueue.main.async { self.timer = Timer(timeInterval: 1.0, target: self, selector: #selector(self.timerRunning), userInfo: nil, repeats: true) @@ -73,9 +100,9 @@ class MenubarController: NSObject { } func stopTimer() { + disable() + timer.invalidate() - enabled = false - toggleButton.title = "Start" timerLabel.stringValue = "" progressbar.doubleValue = Double(0) }