feat: add --safe-mode command line option (#4985)

This ensures the settings button isn't hidden, and disables plugins from being loaded to make sure the user can always recover from messing things up
This commit is contained in:
Mm2PL
2023-12-05 18:37:42 +01:00
committed by GitHub
parent 44abe6b487
commit c3d3903b6f
7 changed files with 58 additions and 9 deletions
+16 -6
View File
@@ -1,6 +1,7 @@
#include "widgets/Notebook.hpp"
#include "Application.hpp"
#include "common/Args.hpp"
#include "common/QLogging.hpp"
#include "controllers/hotkeys/HotkeyCategory.hpp"
#include "controllers/hotkeys/HotkeyController.hpp"
@@ -1345,13 +1346,22 @@ void SplitNotebook::addCustomButtons()
// settings
auto settingsBtn = this->addCustomButton();
settingsBtn->setVisible(!getSettings()->hidePreferencesButton.getValue());
// This is to ensure you can't lock yourself out of the settings
if (getArgs().safeMode)
{
settingsBtn->setVisible(true);
}
else
{
settingsBtn->setVisible(
!getSettings()->hidePreferencesButton.getValue());
getSettings()->hidePreferencesButton.connect(
[settingsBtn](bool hide, auto) {
settingsBtn->setVisible(!hide);
},
this->signalHolder_);
getSettings()->hidePreferencesButton.connect(
[settingsBtn](bool hide, auto) {
settingsBtn->setVisible(!hide);
},
this->signalHolder_);
}
settingsBtn->setIcon(NotebookButton::Settings);