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:
@@ -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);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "widgets/Window.hpp"
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "common/Args.hpp"
|
||||
#include "common/Credentials.hpp"
|
||||
#include "common/Modes.hpp"
|
||||
#include "common/QLogging.hpp"
|
||||
@@ -736,6 +737,11 @@ void Window::onAccountSelected()
|
||||
}
|
||||
#endif
|
||||
|
||||
if (getArgs().safeMode)
|
||||
{
|
||||
windowTitle += " (safe mode)";
|
||||
}
|
||||
|
||||
this->setWindowTitle(windowTitle);
|
||||
|
||||
// update user
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# include "widgets/settingspages/PluginsPage.hpp"
|
||||
|
||||
# include "Application.hpp"
|
||||
# include "common/Args.hpp"
|
||||
# include "controllers/plugins/PluginController.hpp"
|
||||
# include "singletons/Paths.hpp"
|
||||
# include "singletons/Settings.hpp"
|
||||
@@ -52,6 +53,15 @@ PluginsPage::PluginsPage()
|
||||
this->rebuildContent();
|
||||
});
|
||||
groupLayout->addRow(box);
|
||||
if (getArgs().safeMode)
|
||||
{
|
||||
box->setEnabled(false);
|
||||
auto *disabledLabel = new QLabel(this);
|
||||
disabledLabel->setText("Plugins will not be fully loaded because "
|
||||
"Chatterino is in safe mode. You can still "
|
||||
"enable and disable them.");
|
||||
groupLayout->addRow(disabledLabel);
|
||||
}
|
||||
}
|
||||
|
||||
this->rebuildContent();
|
||||
@@ -177,6 +187,10 @@ void PluginsPage::rebuildContent()
|
||||
this->rebuildContent();
|
||||
});
|
||||
pluginEntry->addRow(reloadButton);
|
||||
if (getArgs().safeMode)
|
||||
{
|
||||
reloadButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user