From 1621d8b3a04f1fcb6bd5dbf68dfb8b85049b8d54 Mon Sep 17 00:00:00 2001 From: Serhiy Mytrovtsiy Date: Sat, 11 Jul 2020 20:25:03 +0200 Subject: [PATCH] - add tooltip to settings menu --- Modules/Sensors/main.swift | 2 +- Stats/Views/Settings.swift | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Modules/Sensors/main.swift b/Modules/Sensors/main.swift index a9b0a33d..72726ddd 100644 --- a/Modules/Sensors/main.swift +++ b/Modules/Sensors/main.swift @@ -28,7 +28,7 @@ public class Sensors: Module { settings: self.settingsView ) guard self.available else { return } - + self.checkIfNoSensorsEnabled() self.popupView.setup(self.sensorsReader.list) diff --git a/Stats/Views/Settings.swift b/Stats/Views/Settings.swift index 692e3538..3ed7a507 100644 --- a/Stats/Views/Settings.swift +++ b/Stats/Views/Settings.swift @@ -205,6 +205,7 @@ private class SettingsView: NSView { button.verticalPadding = 20 button.horizontalPadding = 20 button.title = title + button.toolTip = title button.bezelStyle = .regularSquare button.translatesAutoresizingMaskIntoConstraints = false button.imageScaling = .scaleNone @@ -248,7 +249,7 @@ private class SettingsView: NSView { } } - @objc public func openActivityMonitor(_ sender: Any) { + @objc private func openActivityMonitor(_ sender: Any) { NSWorkspace.shared.launchApplication( withBundleIdentifier: "com.apple.ActivityMonitor", options: [.default], @@ -258,11 +259,11 @@ private class SettingsView: NSView { self.window?.setIsVisible(false) } - @objc public func reportBug(_ sender: Any) { + @objc private func reportBug(_ sender: Any) { NSWorkspace.shared.open(URL(string: "https://github.com/exelban/stats/issues/new")!) } - @objc public func closeApp(_ sender: Any) { + @objc private func closeApp(_ sender: Any) { NSApp.terminate(sender) } } @@ -282,6 +283,7 @@ private class MenuView: NSView { super.init(frame: NSRect(x: 0, y: self.height*CGFloat(n), width: width, height: self.height)) self.wantsLayer = true self.layer?.backgroundColor = .clear + self.toolTip = "Open \(title == "Stats" ? "application" : title) settings" let rect = NSRect(x: 0, y: 0, width: self.frame.width, height: self.frame.height) let trackingArea = NSTrackingArea(rect: rect, options: [NSTrackingArea.Options.activeAlways, NSTrackingArea.Options.mouseEnteredAndExited, NSTrackingArea.Options.activeInActiveApp], owner: self, userInfo: ["menu": title])