chore: remove Singleton & replace getIApp with getApp (#5514)
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ bool useKeyring()
|
||||
// Insecure storage:
|
||||
QString insecurePath()
|
||||
{
|
||||
return combinePath(getIApp()->getPaths().settingsDirectory,
|
||||
return combinePath(getApp()->getPaths().settingsDirectory,
|
||||
"credentials.json");
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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))
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user