Make Paths accessible from Application

This commit is contained in:
Rasmus Karlsson 2024-01-15 22:56:32 +01:00
parent ff87089f0e
commit 8d24a2bcaf
3 changed files with 16 additions and 3 deletions

View file

@ -10,6 +10,11 @@ class EmptyApplication : public IApplication
public:
virtual ~EmptyApplication() = default;
const Paths &getPaths() override
{
return this->paths_;
}
const Args &getArgs() override
{
return this->args_;
@ -169,6 +174,7 @@ public:
}
private:
Paths paths_;
Args args_;
};

View file

@ -107,9 +107,10 @@ IApplication::IApplication()
// It will create the instances of the major classes, and connect their signals
// to each other
Application::Application(Settings &_settings, const Paths &_paths,
Application::Application(Settings &_settings, const Paths &paths,
const Args &_args)
: args_(_args)
: paths_(paths)
, args_(_args)
, themes(&this->emplace<Theme>())
, fonts(&this->emplace<Fonts>())
, emotes(&this->emplace<Emotes>())

View file

@ -55,6 +55,7 @@ public:
static IApplication *instance;
virtual const Paths &getPaths() = 0;
virtual const Args &getArgs() = 0;
virtual Theme *getThemes() = 0;
virtual Fonts *getFonts() = 0;
@ -82,6 +83,7 @@ public:
class Application : public IApplication
{
const Paths &paths_;
const Args &args_;
std::vector<std::unique_ptr<Singleton>> singletons_;
int argc_{};
@ -90,7 +92,7 @@ class Application : public IApplication
public:
static Application *instance;
Application(Settings &_settings, const Paths &_paths, const Args &_args);
Application(Settings &_settings, const Paths &paths, const Args &_args);
~Application() override;
Application(const Application &) = delete;
@ -143,6 +145,10 @@ public:
PluginController *const plugins{};
#endif
const Paths &getPaths() override
{
return this->paths_;
}
const Args &getArgs() override
{
return this->args_;