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:
@ -71,7 +71,7 @@
|
||||
<EnvironmentVariable
|
||||
key = "EXTREME_DOCTOR_MODE"
|
||||
value = ""
|
||||
isEnabled = "YES">
|
||||
isEnabled = "NO">
|
||||
</EnvironmentVariable>
|
||||
<EnvironmentVariable
|
||||
key = "PAINT_PHPMON_SWIFTUI_VIEWS"
|
||||
|
@ -75,7 +75,8 @@ class StatusMenu: NSMenu {
|
||||
}
|
||||
|
||||
func addWarningsMenuItem() {
|
||||
if !WarningManager.shared.hasWarnings() {
|
||||
if !Preferences.isEnabled(.showPhpDoctorSuggestions) ||
|
||||
!WarningManager.shared.hasWarnings() {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ enum PreferenceName: String {
|
||||
case allowProtocolForIntegrations = "allow_protocol_for_integrations"
|
||||
case globalHotkey = "global_hotkey"
|
||||
case automaticBackgroundUpdateCheck = "backgroundUpdateCheck"
|
||||
case showPhpDoctorSuggestions = "show_php_doctor_suggestions"
|
||||
|
||||
// APPEARANCE
|
||||
case shouldDisplayDynamicIcon = "use_dynamic_icon"
|
||||
@ -88,6 +89,7 @@ class Preferences {
|
||||
PreferenceName.autoComposerGlobalUpdateAfterSwitch.rawValue: false,
|
||||
PreferenceName.allowProtocolForIntegrations.rawValue: true,
|
||||
PreferenceName.automaticBackgroundUpdateCheck.rawValue: true,
|
||||
PreferenceName.showPhpDoctorSuggestions.rawValue: true,
|
||||
|
||||
/// Preferences: Appearance
|
||||
PreferenceName.shouldDisplayDynamicIcon.rawValue: true,
|
||||
@ -174,6 +176,8 @@ class Preferences {
|
||||
forKey: PreferenceName.allowProtocolForIntegrations.rawValue) as Any,
|
||||
.automaticBackgroundUpdateCheck: UserDefaults.standard.bool(
|
||||
forKey: PreferenceName.automaticBackgroundUpdateCheck.rawValue) as Any,
|
||||
.showPhpDoctorSuggestions: UserDefaults.standard.bool(
|
||||
forKey: PreferenceName.showPhpDoctorSuggestions.rawValue) as Any,
|
||||
|
||||
.notifyAboutVersionChange: UserDefaults.standard.bool(
|
||||
forKey: PreferenceName.notifyAboutVersionChange.rawValue) as Any,
|
||||
|
@ -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 {
|
||||
return CheckboxPreferenceView.make(
|
||||
sectionText: "prefs.notifications".localized,
|
||||
@ -194,6 +208,7 @@ class GeneralPreferencesVC: GenericPreferenceVC {
|
||||
.instantiateController(withIdentifier: "preferencesTemplateVC") as! GenericPreferenceVC
|
||||
|
||||
vc.views = [
|
||||
vc.getShowPhpDoctorSuggestionsPV(),
|
||||
vc.getAutoRestartPV(),
|
||||
vc.getAutomaticComposerUpdatePV(),
|
||||
vc.getShortcutPV(),
|
||||
|
@ -212,6 +212,7 @@
|
||||
"prefs.info_density" = "Info Density:";
|
||||
"prefs.services" = "Services:";
|
||||
"prefs.switcher" = "Switcher:";
|
||||
"prefs.php_doctor" = "PHP Doctor:";
|
||||
"prefs.integrations" = "Integrations:";
|
||||
"prefs.updates" = "Updates:";
|
||||
"prefs.notifications" = "Notifications:";
|
||||
@ -240,6 +241,9 @@
|
||||
"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.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_listening" = "<listening for keypress>";
|
||||
"prefs.shortcut_clear" = "Clear";
|
||||
|
Reference in New Issue
Block a user