chore: remove Singleton & replace getIApp with getApp (#5514)

This commit is contained in:
pajlada
2024-07-21 15:09:59 +02:00
committed by GitHub
parent 21186df058
commit 5deec1f02f
145 changed files with 802 additions and 856 deletions
+3 -3
View File
@@ -100,9 +100,9 @@ void Channel::addMessage(MessagePtr message, MessageContext context,
if (!isDoNotLogSet)
{
// Only log messages where the `DoNotLog` flag is not set
getIApp()->getChatLogger()->addMessage(this->name_, message,
this->platform_,
this->getCurrentStreamID());
getApp()->getChatLogger()->addMessage(this->name_, message,
this->platform_,
this->getCurrentStreamID());
}
}
+1 -1
View File
@@ -56,7 +56,7 @@ bool useKeyring()
// Insecure storage:
QString insecurePath()
{
return combinePath(getIApp()->getPaths().settingsDirectory,
return combinePath(getApp()->getPaths().settingsDirectory,
"credentials.json");
}
-31
View File
@@ -1,31 +0,0 @@
#pragma once
namespace chatterino {
class Settings;
class Paths;
class Singleton
{
public:
Singleton() = default;
virtual ~Singleton() = default;
Singleton(const Singleton &) = delete;
Singleton &operator=(const Singleton &) = delete;
Singleton(Singleton &&) = delete;
Singleton &operator=(Singleton &&) = delete;
virtual void initialize(Settings &settings, const Paths &paths)
{
(void)(settings);
(void)(paths);
}
virtual void save()
{
}
};
} // namespace chatterino
+1 -1
View File
@@ -59,7 +59,7 @@ void loadUncached(std::shared_ptr<NetworkData> &&data)
void loadCached(std::shared_ptr<NetworkData> &&data)
{
QFile cachedFile(getIApp()->getPaths().cacheDirectory() + "/" +
QFile cachedFile(getApp()->getPaths().cacheDirectory() + "/" +
data->getHash());
if (!cachedFile.exists() || !cachedFile.open(QIODevice::ReadOnly))
+1 -1
View File
@@ -118,7 +118,7 @@ void NetworkTask::logReply()
void NetworkTask::writeToCache(const QByteArray &bytes) const
{
std::ignore = QtConcurrent::run([data = this->data_, bytes] {
QFile cachedFile(getIApp()->getPaths().cacheDirectory() + "/" +
QFile cachedFile(getApp()->getPaths().cacheDirectory() + "/" +
data->getHash());
if (cachedFile.open(QIODevice::WriteOnly))