1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-07 03:50:08 +02:00

🔧 Make PHP Doctor optional (preference)

This commit is contained in:
2022-08-13 23:16:10 +02:00
parent cfbb83976d
commit 2ee0934080
5 changed files with 26 additions and 2 deletions

View File

@ -71,7 +71,7 @@
<EnvironmentVariable <EnvironmentVariable
key = "EXTREME_DOCTOR_MODE" key = "EXTREME_DOCTOR_MODE"
value = "" value = ""
isEnabled = "YES"> isEnabled = "NO">
</EnvironmentVariable> </EnvironmentVariable>
<EnvironmentVariable <EnvironmentVariable
key = "PAINT_PHPMON_SWIFTUI_VIEWS" key = "PAINT_PHPMON_SWIFTUI_VIEWS"

View File

@ -75,7 +75,8 @@ class StatusMenu: NSMenu {
} }
func addWarningsMenuItem() { func addWarningsMenuItem() {
if !WarningManager.shared.hasWarnings() { if !Preferences.isEnabled(.showPhpDoctorSuggestions) ||
!WarningManager.shared.hasWarnings() {
return return
} }

View File

@ -21,6 +21,7 @@ enum PreferenceName: String {
case allowProtocolForIntegrations = "allow_protocol_for_integrations" case allowProtocolForIntegrations = "allow_protocol_for_integrations"
case globalHotkey = "global_hotkey" case globalHotkey = "global_hotkey"
case automaticBackgroundUpdateCheck = "backgroundUpdateCheck" case automaticBackgroundUpdateCheck = "backgroundUpdateCheck"
case showPhpDoctorSuggestions = "show_php_doctor_suggestions"
// APPEARANCE // APPEARANCE
case shouldDisplayDynamicIcon = "use_dynamic_icon" case shouldDisplayDynamicIcon = "use_dynamic_icon"
@ -88,6 +89,7 @@ class Preferences {
PreferenceName.autoComposerGlobalUpdateAfterSwitch.rawValue: false, PreferenceName.autoComposerGlobalUpdateAfterSwitch.rawValue: false,
PreferenceName.allowProtocolForIntegrations.rawValue: true, PreferenceName.allowProtocolForIntegrations.rawValue: true,
PreferenceName.automaticBackgroundUpdateCheck.rawValue: true, PreferenceName.automaticBackgroundUpdateCheck.rawValue: true,
PreferenceName.showPhpDoctorSuggestions.rawValue: true,
/// Preferences: Appearance /// Preferences: Appearance
PreferenceName.shouldDisplayDynamicIcon.rawValue: true, PreferenceName.shouldDisplayDynamicIcon.rawValue: true,
@ -174,6 +176,8 @@ class Preferences {
forKey: PreferenceName.allowProtocolForIntegrations.rawValue) as Any, forKey: PreferenceName.allowProtocolForIntegrations.rawValue) as Any,
.automaticBackgroundUpdateCheck: UserDefaults.standard.bool( .automaticBackgroundUpdateCheck: UserDefaults.standard.bool(
forKey: PreferenceName.automaticBackgroundUpdateCheck.rawValue) as Any, forKey: PreferenceName.automaticBackgroundUpdateCheck.rawValue) as Any,
.showPhpDoctorSuggestions: UserDefaults.standard.bool(
forKey: PreferenceName.showPhpDoctorSuggestions.rawValue) as Any,
.notifyAboutVersionChange: UserDefaults.standard.bool( .notifyAboutVersionChange: UserDefaults.standard.bool(
forKey: PreferenceName.notifyAboutVersionChange.rawValue) as Any, forKey: PreferenceName.notifyAboutVersionChange.rawValue) as Any,

View File

@ -114,6 +114,20 @@ class GenericPreferenceVC: NSViewController {
) )
} }
func getShowPhpDoctorSuggestionsPV() -> NSView {
return CheckboxPreferenceView.make(
sectionText: "prefs.php_doctor".localized,
descriptionText: "prefs.php_doctor_suggestions_desc".localized,
checkboxText: "prefs.php_doctor_suggestions_title".localized,
preference: .showPhpDoctorSuggestions,
action: {
MainMenu.shared.refreshIcon()
MainMenu.shared.rebuild()
}
)
}
func getNotifyAboutVersionChangePV() -> NSView { func getNotifyAboutVersionChangePV() -> NSView {
return CheckboxPreferenceView.make( return CheckboxPreferenceView.make(
sectionText: "prefs.notifications".localized, sectionText: "prefs.notifications".localized,
@ -194,6 +208,7 @@ class GeneralPreferencesVC: GenericPreferenceVC {
.instantiateController(withIdentifier: "preferencesTemplateVC") as! GenericPreferenceVC .instantiateController(withIdentifier: "preferencesTemplateVC") as! GenericPreferenceVC
vc.views = [ vc.views = [
vc.getShowPhpDoctorSuggestionsPV(),
vc.getAutoRestartPV(), vc.getAutoRestartPV(),
vc.getAutomaticComposerUpdatePV(), vc.getAutomaticComposerUpdatePV(),
vc.getShortcutPV(), vc.getShortcutPV(),

View File

@ -212,6 +212,7 @@
"prefs.info_density" = "Info Density:"; "prefs.info_density" = "Info Density:";
"prefs.services" = "Services:"; "prefs.services" = "Services:";
"prefs.switcher" = "Switcher:"; "prefs.switcher" = "Switcher:";
"prefs.php_doctor" = "PHP Doctor:";
"prefs.integrations" = "Integrations:"; "prefs.integrations" = "Integrations:";
"prefs.updates" = "Updates:"; "prefs.updates" = "Updates:";
"prefs.notifications" = "Notifications:"; "prefs.notifications" = "Notifications:";
@ -239,6 +240,9 @@
"prefs.automatic_update_check_title" = "Automatically check for updates"; "prefs.automatic_update_check_title" = "Automatically check for updates";
"prefs.automatic_update_check_desc" = "When checked, PHP Monitor will automatically check if there is a newer version available, and notify you if that is the case."; "prefs.automatic_update_check_desc" = "When checked, PHP Monitor will automatically check if there is a newer version available, and notify you if that is the case.";
"prefs.php_doctor_suggestions_title" = "Show suggestions (if applicable)";
"prefs.php_doctor_suggestions_desc" = "If you uncheck this item, no PHP Doctor suggestions will appear in PHP Monitor's menu. Keep in mind that PHP Doctor will not appear if there are no recommendations.";
"prefs.shortcut_set" = "Set global shortcut"; "prefs.shortcut_set" = "Set global shortcut";
"prefs.shortcut_listening" = "<listening for keypress>"; "prefs.shortcut_listening" = "<listening for keypress>";