Add command to automatically reload your theme (#4718)

This commit is contained in:
nerix
2023-07-23 14:13:21 +02:00
committed by GitHub
parent fca57696bb
commit 9f8a1d8823
7 changed files with 150 additions and 40 deletions
@@ -1,14 +1,18 @@
#include "controllers/commands/builtin/chatterino/Debugging.hpp"
#include "common/Channel.hpp"
#include "common/Literals.hpp"
#include "controllers/commands/CommandContext.hpp"
#include "messages/MessageBuilder.hpp"
#include "singletons/Theme.hpp"
#include <QLoggingCategory>
#include <QString>
namespace chatterino::commands {
using namespace literals;
QString setLoggingRules(const CommandContext &ctx)
{
if (ctx.words.size() < 2)
@@ -42,4 +46,21 @@ QString setLoggingRules(const CommandContext &ctx)
return {};
}
QString toggleThemeReload(const CommandContext &ctx)
{
if (getTheme()->isAutoReloading())
{
getTheme()->setAutoReload(false);
ctx.channel->addMessage(
makeSystemMessage(u"Disabled theme auto reloading."_s));
return {};
}
getTheme()->setAutoReload(true);
ctx.channel->addMessage(
makeSystemMessage(u"Auto reloading theme every %1 ms."_s.arg(
Theme::AUTO_RELOAD_INTERVAL_MS)));
return {};
}
} // namespace chatterino::commands