Menu Items and Hotkeys
This commit is contained in:
1 parent
13f1f301e3
commit
20a8714974
2 files changed
+52
-15
No files matched your search
@@ -62,7 +62,7 @@ final class DocumentController : NSDocumentController {
|
||||
}
|
||||
|
||||
@NSApplicationMain
|
||||
final class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {
|
||||
|
||||
@IBOutlet weak var sendToExternalApp: NSMenuItem!
|
||||
|
||||
@@ -213,6 +213,25 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
return false
|
||||
}
|
||||
|
||||
@IBAction func toggleStartStop(_ sender: Any?) {
|
||||
QueueController.shared.toggleStartStop(sender)
|
||||
}
|
||||
|
||||
func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
|
||||
let action = menuItem.action
|
||||
|
||||
if action == #selector(toggleStartStop(_:)) {
|
||||
let state = QueueController.shared.status
|
||||
if state == .working {
|
||||
menuItem.title = NSLocalizedString("Stop Queue", comment: "Main Menu -> Stop Queue")
|
||||
} else {
|
||||
menuItem.title = NSLocalizedString("Start Queue", comment: "Main Menu -> Start Queue")
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// MARK: actions
|
||||
|
||||
@IBAction func openInQueue(_ sender: Any) {
|
||||
|
||||
Reference in new issue
Block a user