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: public:
virtual ~EmptyApplication() = default; virtual ~EmptyApplication() = default;
const Paths &getPaths() override
{
return this->paths_;
}
const Args &getArgs() override const Args &getArgs() override
{ {
return this->args_; return this->args_;
@ -169,6 +174,7 @@ public:
} }
private: private:
Paths paths_;
Args args_; Args args_;
}; };

View file

@ -107,9 +107,10 @@ 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, const Paths &_paths, Application::Application(Settings &_settings, const Paths &paths,
const Args &_args) const Args &_args)
: args_(_args) : paths_(paths)
, args_(_args)
, themes(&this->emplace<Theme>()) , themes(&this->emplace<Theme>())
, fonts(&this->emplace<Fonts>()) , fonts(&this->emplace<Fonts>())
, emotes(&this->emplace<Emotes>()) , emotes(&this->emplace<Emotes>())

View file

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