Prompt to resume pomodoro timer

This commit is contained in:
2023-02-25 12:54:53 -07:00
parent 39993a7713
commit 8e443056a1

View File

@@ -71,6 +71,23 @@
(when entryNameText (set entryNameText.hasFocus true)) (when entryNameText (set entryNameText.hasFocus true))
(super.update elapsed) (super.update elapsed)
(when (and pomWasRunning !pomResumeWindow)
(entryWindow.hide)
(set pomResumeWindow
(SimpleWindow.promptForChoice "A pomodoro timer was interrupted. Resume it now?"
[
"Yes"
"No"
]
->:Void [:String choice]
(case choice
("Yes" (startPomodoros)(backToEntryWindow))
("No"
(set pomWasRunning false)
(backToEntryWindow))
(never otherwise))
null null FlxColor.LIME 0.9 0.9 true xKey null null ->[] {(set pomWasRunning false)(backToEntryWindow)})))
(if (windowIsShown) (if (windowIsShown)
{ {
(set FlxMouseControl.mouseZone disableMouse) (set FlxMouseControl.mouseZone disableMouse)
@@ -211,12 +228,13 @@
(prop &mut :SimpleWindow entryEditWindow null) (prop &mut :SimpleWindow entryEditWindow null)
(prop &mut :SimpleWindow entryCreationWindow null) (prop &mut :SimpleWindow entryCreationWindow null)
(prop &mut :SimpleWindow priorityWindow null) (prop &mut :SimpleWindow priorityWindow null)
(prop &mut :SimpleWindow pomResumeWindow null)
(method windowIsShown [] (method windowIsShown []
(or (tempWindowIsShown) (and entryWindow (entryWindow.isShown)))) (or (tempWindowIsShown) (and entryWindow (entryWindow.isShown))))
(method tempWindowIsShown [] (method tempWindowIsShown []
(doFor window [puzzlePackChoiceWindow entryDeletionWindow entryCreationWindow priorityWindow entryEditWindow] (doFor window [puzzlePackChoiceWindow entryDeletionWindow entryCreationWindow priorityWindow entryEditWindow pomResumeWindow]
(when (and window (window.isShown)) (when (and window (window.isShown))
(return true))) (return true)))
false) false)
@@ -383,20 +401,22 @@
(set model.showLowerPriority !model.showLowerPriority) (set model.showLowerPriority !model.showLowerPriority)
(refreshModel)))) (refreshModel))))
(prop &mut pomRunning false) (prop &mut pomRunning false)
(savedVar :Bool pomWasRunning false)
(if pomRunning (if pomRunning
(_makeText "Stop Pomodoro Timer Mode" m.pomodoroPoints (_makeText "Stop Pomodoro Timer Mode" m.pomodoroPoints
->_ { ->_ {
(set pomRunning false) (set pomRunning false)
(set pomWasRunning false)
(remove pomTimer) (remove pomTimer)
(refreshModel) (refreshModel)
}) })
(_makeText "Start Pomodoro Timer Mode" m.pomodoroPoints (_makeText "Start Pomodoro Timer Mode" m.pomodoroPoints
->_ { ->_
// TODO hide puzzle pieces until the pom is over or the mode is stopped (defAndCall method startPomodoros
(set pomRunning true) (set pomRunning true)
(set pomWasRunning true)
(add pomTimer) (add pomTimer)
(refreshModel) (refreshModel))) )
}) )
(set entryWindow.textColor (FlxColor.RED.getDarkened)) (set entryWindow.textColor (FlxColor.RED.getDarkened))
(_makeText "Delete a habit or task" 0 (_makeText "Delete a habit or task" 0
->_ ->_