mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Make all uses/storages of Paths const
This commit is contained in:
parent
7f935665f9
commit
0dcd189331
33 changed files with 40 additions and 37 deletions
|
@ -107,7 +107,8 @@ IApplication::IApplication()
|
||||||
// It will create the instances of the major classes, and connect their signals
|
// It will create the instances of the major classes, and connect their signals
|
||||||
// to each other
|
// to each other
|
||||||
|
|
||||||
Application::Application(Settings &_settings, Paths &_paths, const Args &_args)
|
Application::Application(Settings &_settings, const Paths &_paths,
|
||||||
|
const Args &_args)
|
||||||
: args_(_args)
|
: args_(_args)
|
||||||
, themes(&this->emplace<Theme>())
|
, themes(&this->emplace<Theme>())
|
||||||
, fonts(&this->emplace<Fonts>())
|
, fonts(&this->emplace<Fonts>())
|
||||||
|
@ -152,7 +153,7 @@ void Application::fakeDtor()
|
||||||
this->twitchPubSub.reset();
|
this->twitchPubSub.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::initialize(Settings &settings, Paths &paths)
|
void Application::initialize(Settings &settings, const Paths &paths)
|
||||||
{
|
{
|
||||||
assert(isAppInitialized == false);
|
assert(isAppInitialized == false);
|
||||||
isAppInitialized = true;
|
isAppInitialized = true;
|
||||||
|
@ -340,7 +341,7 @@ void Application::save()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::initNm(Paths &paths)
|
void Application::initNm(const Paths &paths)
|
||||||
{
|
{
|
||||||
(void)paths;
|
(void)paths;
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ class Application : public IApplication
|
||||||
public:
|
public:
|
||||||
static Application *instance;
|
static Application *instance;
|
||||||
|
|
||||||
Application(Settings &_settings, Paths &_paths, const Args &_args);
|
Application(Settings &_settings, const Paths &_paths, const Args &_args);
|
||||||
~Application() override;
|
~Application() override;
|
||||||
|
|
||||||
Application(const Application &) = delete;
|
Application(const Application &) = delete;
|
||||||
|
@ -104,7 +104,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void fakeDtor();
|
void fakeDtor();
|
||||||
|
|
||||||
void initialize(Settings &settings, Paths &paths);
|
void initialize(Settings &settings, const Paths &paths);
|
||||||
void load();
|
void load();
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ private:
|
||||||
void initPubSub();
|
void initPubSub();
|
||||||
void initBttvLiveUpdates();
|
void initBttvLiveUpdates();
|
||||||
void initSeventvEventAPI();
|
void initSeventvEventAPI();
|
||||||
void initNm(Paths &paths);
|
void initNm(const Paths &paths);
|
||||||
|
|
||||||
template <typename T,
|
template <typename T,
|
||||||
typename = std::enable_if_t<std::is_base_of<Singleton, T>::value>>
|
typename = std::enable_if_t<std::is_base_of<Singleton, T>::value>>
|
||||||
|
|
|
@ -223,7 +223,8 @@ namespace {
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void runGui(QApplication &a, Paths &paths, Settings &settings, const Args &args)
|
void runGui(QApplication &a, const Paths &paths, Settings &settings,
|
||||||
|
const Args &args)
|
||||||
{
|
{
|
||||||
initQt();
|
initQt();
|
||||||
initResources();
|
initResources();
|
||||||
|
|
|
@ -8,7 +8,7 @@ class Args;
|
||||||
class Paths;
|
class Paths;
|
||||||
class Settings;
|
class Settings;
|
||||||
|
|
||||||
void runGui(QApplication &a, Paths &paths, Settings &settings,
|
void runGui(QApplication &a, const Paths &paths, Settings &settings,
|
||||||
const Args &args);
|
const Args &args);
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
|
@ -17,7 +17,7 @@ public:
|
||||||
Singleton(Singleton &&) = delete;
|
Singleton(Singleton &&) = delete;
|
||||||
Singleton &operator=(Singleton &&) = delete;
|
Singleton &operator=(Singleton &&) = delete;
|
||||||
|
|
||||||
virtual void initialize(Settings &settings, Paths &paths)
|
virtual void initialize(Settings &settings, const Paths &paths)
|
||||||
{
|
{
|
||||||
(void)(settings);
|
(void)(settings);
|
||||||
(void)(paths);
|
(void)(paths);
|
||||||
|
|
|
@ -47,7 +47,7 @@ AccountController::AccountController()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccountController::initialize(Settings &settings, Paths &paths)
|
void AccountController::initialize(Settings &settings, const Paths &paths)
|
||||||
{
|
{
|
||||||
this->twitch.load();
|
this->twitch.load();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ public:
|
||||||
|
|
||||||
AccountModel *createModel(QObject *parent);
|
AccountModel *createModel(QObject *parent);
|
||||||
|
|
||||||
void initialize(Settings &settings, Paths &paths) override;
|
void initialize(Settings &settings, const Paths &paths) override;
|
||||||
|
|
||||||
TwitchAccountManager twitch;
|
TwitchAccountManager twitch;
|
||||||
|
|
||||||
|
|
|
@ -261,7 +261,7 @@ const std::unordered_map<QString, VariableReplacer> COMMAND_VARS{
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
void CommandController::initialize(Settings &, Paths &paths)
|
void CommandController::initialize(Settings &, const Paths &paths)
|
||||||
{
|
{
|
||||||
// Update commands map when the vector of commands has been updated
|
// Update commands map when the vector of commands has been updated
|
||||||
auto addFirstMatchToMap = [this](auto args) {
|
auto addFirstMatchToMap = [this](auto args) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
bool dryRun);
|
bool dryRun);
|
||||||
QStringList getDefaultChatterinoCommandList();
|
QStringList getDefaultChatterinoCommandList();
|
||||||
|
|
||||||
void initialize(Settings &, Paths &paths) override;
|
void initialize(Settings &, const Paths &paths) override;
|
||||||
void save() override;
|
void save() override;
|
||||||
|
|
||||||
CommandModel *createModel(QObject *parent);
|
CommandModel *createModel(QObject *parent);
|
||||||
|
|
|
@ -440,7 +440,8 @@ std::ostream &operator<<(std::ostream &os, const HighlightResult &result)
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HighlightController::initialize(Settings &settings, Paths & /*paths*/)
|
void HighlightController::initialize(Settings &settings,
|
||||||
|
const Paths & /*paths*/)
|
||||||
{
|
{
|
||||||
this->rebuildListener_.addSetting(settings.enableSelfHighlight);
|
this->rebuildListener_.addSetting(settings.enableSelfHighlight);
|
||||||
this->rebuildListener_.addSetting(settings.enableSelfHighlightSound);
|
this->rebuildListener_.addSetting(settings.enableSelfHighlightSound);
|
||||||
|
|
|
@ -86,7 +86,7 @@ struct HighlightCheck {
|
||||||
class HighlightController final : public Singleton
|
class HighlightController final : public Singleton
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void initialize(Settings &settings, Paths &paths) override;
|
void initialize(Settings &settings, const Paths &paths) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Checks the given message parameters if it matches our internal checks, and returns a result
|
* @brief Checks the given message parameters if it matches our internal checks, and returns a result
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
void NotificationController::initialize(Settings &settings, Paths &paths)
|
void NotificationController::initialize(Settings &settings, const Paths &paths)
|
||||||
{
|
{
|
||||||
this->initialized_ = true;
|
this->initialized_ = true;
|
||||||
for (const QString &channelName : this->twitchSetting_.getValue())
|
for (const QString &channelName : this->twitchSetting_.getValue())
|
||||||
|
|
|
@ -20,7 +20,7 @@ enum class Platform : uint8_t {
|
||||||
class NotificationController final : public Singleton, private QObject
|
class NotificationController final : public Singleton, private QObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void initialize(Settings &settings, Paths &paths) override;
|
void initialize(Settings &settings, const Paths &paths) override;
|
||||||
|
|
||||||
bool isChannelNotified(const QString &channelName, Platform p);
|
bool isChannelNotified(const QString &channelName, Platform p);
|
||||||
void updateChannelNotification(const QString &channelName, Platform p);
|
void updateChannelNotification(const QString &channelName, Platform p);
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace chatterino {
|
||||||
// NUM_SOUNDS specifies how many simultaneous default ping sounds & decoders to create
|
// NUM_SOUNDS specifies how many simultaneous default ping sounds & decoders to create
|
||||||
constexpr const auto NUM_SOUNDS = 4;
|
constexpr const auto NUM_SOUNDS = 4;
|
||||||
|
|
||||||
void MiniaudioBackend::initialize(Settings &settings, Paths &paths)
|
void MiniaudioBackend::initialize(Settings &settings, const Paths &paths)
|
||||||
{
|
{
|
||||||
(void)(settings);
|
(void)(settings);
|
||||||
(void)(paths);
|
(void)(paths);
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace chatterino {
|
||||||
**/
|
**/
|
||||||
class MiniaudioBackend : public ISoundController
|
class MiniaudioBackend : public ISoundController
|
||||||
{
|
{
|
||||||
void initialize(Settings &settings, Paths &paths) override;
|
void initialize(Settings &settings, const Paths &paths) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MiniaudioBackend();
|
MiniaudioBackend();
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
void ChatterinoBadges::initialize(Settings &settings, Paths &paths)
|
void ChatterinoBadges::initialize(Settings &settings, const Paths &paths)
|
||||||
{
|
{
|
||||||
this->loadChatterinoBadges();
|
this->loadChatterinoBadges();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ using EmotePtr = std::shared_ptr<const Emote>;
|
||||||
class ChatterinoBadges : public Singleton
|
class ChatterinoBadges : public Singleton
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void initialize(Settings &settings, Paths &paths) override;
|
void initialize(Settings &settings, const Paths &paths) override;
|
||||||
ChatterinoBadges();
|
ChatterinoBadges();
|
||||||
|
|
||||||
std::optional<EmotePtr> getBadge(const UserId &id);
|
std::optional<EmotePtr> getBadge(const UserId &id);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
void FfzBadges::initialize(Settings &settings, Paths &paths)
|
void FfzBadges::initialize(Settings &settings, const Paths &paths)
|
||||||
{
|
{
|
||||||
this->load();
|
this->load();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ using EmotePtr = std::shared_ptr<const Emote>;
|
||||||
class FfzBadges : public Singleton
|
class FfzBadges : public Singleton
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void initialize(Settings &settings, Paths &paths) override;
|
void initialize(Settings &settings, const Paths &paths) override;
|
||||||
FfzBadges() = default;
|
FfzBadges() = default;
|
||||||
|
|
||||||
struct Badge {
|
struct Badge {
|
||||||
|
|
|
@ -64,7 +64,7 @@ TwitchIrcServer::TwitchIrcServer()
|
||||||
// false);
|
// false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TwitchIrcServer::initialize(Settings &settings, Paths &paths)
|
void TwitchIrcServer::initialize(Settings &settings, const Paths &paths)
|
||||||
{
|
{
|
||||||
getApp()->accounts->twitch.currentUserChanged.connect([this]() {
|
getApp()->accounts->twitch.currentUserChanged.connect([this]() {
|
||||||
postToThread([this] {
|
postToThread([this] {
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
TwitchIrcServer();
|
TwitchIrcServer();
|
||||||
~TwitchIrcServer() override = default;
|
~TwitchIrcServer() override = default;
|
||||||
|
|
||||||
void initialize(Settings &settings, Paths &paths) override;
|
void initialize(Settings &settings, const Paths &paths) override;
|
||||||
|
|
||||||
void forEachChannelAndSpecialChannels(std::function<void(ChannelPtr)> func);
|
void forEachChannelAndSpecialChannels(std::function<void(ChannelPtr)> func);
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ namespace chatterino {
|
||||||
|
|
||||||
using namespace std::string_literals;
|
using namespace std::string_literals;
|
||||||
|
|
||||||
void CrashHandler::initialize(Settings & /*settings*/, Paths &paths)
|
void CrashHandler::initialize(Settings & /*settings*/, const Paths &paths)
|
||||||
{
|
{
|
||||||
auto optSettings = readRecoverySettings(paths);
|
auto optSettings = readRecoverySettings(paths);
|
||||||
if (optSettings)
|
if (optSettings)
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
/// Sets and saves whether Chatterino should restart on a crash
|
/// Sets and saves whether Chatterino should restart on a crash
|
||||||
void saveShouldRecover(bool value);
|
void saveShouldRecover(bool value);
|
||||||
|
|
||||||
void initialize(Settings &settings, Paths &paths) override;
|
void initialize(Settings &settings, const Paths &paths) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool shouldRecover_ = false;
|
bool shouldRecover_ = false;
|
||||||
|
|
|
@ -6,7 +6,7 @@ Emotes::Emotes()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Emotes::initialize(Settings &settings, Paths &paths)
|
void Emotes::initialize(Settings &settings, const Paths &paths)
|
||||||
{
|
{
|
||||||
this->emojis.load();
|
this->emojis.load();
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ class Emotes final : public IEmotes, public Singleton
|
||||||
public:
|
public:
|
||||||
Emotes();
|
Emotes();
|
||||||
|
|
||||||
void initialize(Settings &settings, Paths &paths) override;
|
void initialize(Settings &settings, const Paths &paths) override;
|
||||||
|
|
||||||
bool isIgnoredEmote(const QString &emote);
|
bool isIgnoredEmote(const QString &emote);
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ Fonts::Fonts()
|
||||||
this->fontsByType_.resize(size_t(FontStyle::EndType));
|
this->fontsByType_.resize(size_t(FontStyle::EndType));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fonts::initialize(Settings &, Paths &)
|
void Fonts::initialize(Settings &, const Paths &)
|
||||||
{
|
{
|
||||||
this->chatFontFamily.connect(
|
this->chatFontFamily.connect(
|
||||||
[this]() {
|
[this]() {
|
||||||
|
|
|
@ -43,7 +43,7 @@ class Fonts final : public Singleton
|
||||||
public:
|
public:
|
||||||
Fonts();
|
Fonts();
|
||||||
|
|
||||||
void initialize(Settings &settings, Paths &paths) override;
|
void initialize(Settings &settings, const Paths &paths) override;
|
||||||
|
|
||||||
// font data gets set in createFontData(...)
|
// font data gets set in createFontData(...)
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ bool Paths::isPortable()
|
||||||
return Modes::instance().isPortable;
|
return Modes::instance().isPortable;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::cacheDirectory()
|
QString Paths::cacheDirectory() const
|
||||||
{
|
{
|
||||||
static const auto pathSetting = [] {
|
static const auto pathSetting = [] {
|
||||||
QStringSetting cachePathSetting("/cache/path");
|
QStringSetting cachePathSetting("/cache/path");
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
bool createFolder(const QString &folderPath);
|
bool createFolder(const QString &folderPath);
|
||||||
bool isPortable();
|
bool isPortable();
|
||||||
|
|
||||||
QString cacheDirectory();
|
QString cacheDirectory() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initAppFilePathHash();
|
void initAppFilePathHash();
|
||||||
|
|
|
@ -219,7 +219,7 @@ bool Theme::isLightTheme() const
|
||||||
return this->isLight_;
|
return this->isLight_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Theme::initialize(Settings &settings, Paths &paths)
|
void Theme::initialize(Settings &settings, const Paths &paths)
|
||||||
{
|
{
|
||||||
this->themeName.connect(
|
this->themeName.connect(
|
||||||
[this](auto themeName) {
|
[this](auto themeName) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
|
|
||||||
static const int AUTO_RELOAD_INTERVAL_MS = 500;
|
static const int AUTO_RELOAD_INTERVAL_MS = 500;
|
||||||
|
|
||||||
void initialize(Settings &settings, Paths &paths) final;
|
void initialize(Settings &settings, const Paths &paths) final;
|
||||||
|
|
||||||
bool isLightTheme() const;
|
bool isLightTheme() const;
|
||||||
|
|
||||||
|
|
|
@ -338,7 +338,7 @@ void WindowManager::setEmotePopupPos(QPoint pos)
|
||||||
this->emotePopupPos_ = pos;
|
this->emotePopupPos_ = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::initialize(Settings &settings, Paths &paths)
|
void WindowManager::initialize(Settings &settings, const Paths &paths)
|
||||||
{
|
{
|
||||||
(void)paths;
|
(void)paths;
|
||||||
assertInGuiThread();
|
assertInGuiThread();
|
||||||
|
|
|
@ -93,7 +93,7 @@ public:
|
||||||
QPoint emotePopupPos();
|
QPoint emotePopupPos();
|
||||||
void setEmotePopupPos(QPoint pos);
|
void setEmotePopupPos(QPoint pos);
|
||||||
|
|
||||||
void initialize(Settings &settings, Paths &paths) override;
|
void initialize(Settings &settings, const Paths &paths) override;
|
||||||
void save() override;
|
void save() override;
|
||||||
void closeAll();
|
void closeAll();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue