Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added quick start 25 minutes menu item #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions MenubarCountdown/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent
timerExpiredAlertController?.showAlert()
}


// MARK: Menu item and button event handlers

/**
Expand Down Expand Up @@ -359,8 +358,11 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent
if let startTimerDialogController = startTimerDialogController {
startTimerDialogController.dismissDialog(sender)
}

timerSettingSeconds = (startHours * 3600) + (startMinutes * 60) + startSeconds
internalStart()
}

func internalStart() {
secondsRemaining = timerSettingSeconds

isTimerRunning = true
Expand All @@ -373,6 +375,18 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent
waitForNextSecond()
}

/**
Quick start a 25 minute timer

Called when the user clicks the Start 25 menu item.
*/

@IBAction func start25(_ sender: AnyObject) {
Log.debug("start25 timer")
timerSettingSeconds = 25 * 60
internalStart()
}

/**
Reset everything to a not-running state.

Expand Down
6 changes: 6 additions & 0 deletions MenubarCountdown/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
<customObject id="420" customClass="NSFontManager"/>
<menu title="Menubar Countdown" id="450">
<items>
<menuItem title="Start 25m" toolTip="Start a 25 minute countdown" id="Gxq-Wq-YcP">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="start25:" target="458" id="ZUc-jj-hH9"/>
</connections>
</menuItem>
<menuItem title="Start…" toolTip="Start a countdown" id="451">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
Expand Down