fix: save settings less often (#6620)

Reviewed-by: James Upjohn <jupjohn@jammeh.co.nz>
This commit is contained in:
pajlada
2025-12-11 17:42:23 +01:00
committed by GitHub
parent ccb8ad8ffc
commit 99f2b5b435
5 changed files with 36 additions and 10 deletions
@@ -3,7 +3,6 @@
#include "Application.hpp"
#include "common/Channel.hpp"
#include "common/Env.hpp"
#include "common/Literals.hpp"
#include "controllers/commands/CommandContext.hpp"
#include "controllers/notifications/NotificationController.hpp"
#include "messages/Image.hpp"
@@ -13,6 +12,7 @@
#include "providers/twitch/eventsub/Controller.hpp"
#include "providers/twitch/TwitchChannel.hpp"
#include "providers/twitch/TwitchIrcServer.hpp"
#include "singletons/Settings.hpp"
#include "singletons/Theme.hpp"
#include "singletons/Toasts.hpp"
#include "singletons/Updates.hpp"
@@ -23,9 +23,9 @@
#include <QLoggingCategory>
#include <QString>
namespace chatterino::commands {
using namespace Qt::StringLiterals;
using namespace literals;
namespace chatterino::commands {
QString setLoggingRules(const CommandContext &ctx)
{
@@ -202,6 +202,23 @@ QString debugTest(const CommandContext &ctx)
getApp()->getUpdates().checkForUpdates();
ctx.channel->addSystemMessage(QString("checking for updates"));
}
else if (command == "save-settings")
{
ctx.channel->addSystemMessage(u"requesting settings save"_s);
auto res = getSettings()->requestSave();
switch (res)
{
case pajlada::Settings::SettingManager::SaveResult::Failed:
ctx.channel->addSystemMessage(u"setting save failed"_s);
break;
case pajlada::Settings::SettingManager::SaveResult::Success:
ctx.channel->addSystemMessage(u"setting save success"_s);
break;
case pajlada::Settings::SettingManager::SaveResult::Skipped:
ctx.channel->addSystemMessage(u"setting save skipped"_s);
break;
}
}
else
{
ctx.channel->addSystemMessage(