refactor: Make Args less of a singleton (#5041)
This means it's no longer a singleton, and its lifetime is bound to our application. This felt like a good small experiment to see how its changes would look if we did this. As a shortcut, `getApp` that is already a mega singleton keeps a reference to Args, this means places that are a bit more difficult to inject into call `getApp()->getArgs()` just like other things are accessed.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "common/Args.hpp"
|
||||
|
||||
namespace chatterino::mock {
|
||||
|
||||
@@ -9,6 +10,11 @@ class EmptyApplication : public IApplication
|
||||
public:
|
||||
virtual ~EmptyApplication() = default;
|
||||
|
||||
const Args &getArgs() override
|
||||
{
|
||||
return this->args_;
|
||||
}
|
||||
|
||||
Theme *getThemes() override
|
||||
{
|
||||
return nullptr;
|
||||
@@ -110,6 +116,9 @@ public:
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
Args args_;
|
||||
};
|
||||
|
||||
} // namespace chatterino::mock
|
||||
|
||||
Reference in New Issue
Block a user