mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Remove getPaths() usage from UserDataController
This commit is contained in:
parent
4993a77b86
commit
695577120e
3 changed files with 9 additions and 8 deletions
|
@ -129,7 +129,7 @@ Application::Application(Settings &_settings, const Paths &paths,
|
|||
, chatterinoBadges(&this->emplace<ChatterinoBadges>())
|
||||
, ffzBadges(&this->emplace<FfzBadges>())
|
||||
, seventvBadges(&this->emplace<SeventvBadges>())
|
||||
, userData(&this->emplace<UserDataController>())
|
||||
, userData(&this->emplace(new UserDataController(paths)))
|
||||
, sound(&this->emplace<ISoundController>(makeSoundController(_settings)))
|
||||
, twitchLiveController(&this->emplace<TwitchLiveController>())
|
||||
, twitchPubSub(new PubSub(TWITCH_PUBSUB_URL))
|
||||
|
|
|
@ -8,13 +8,12 @@ namespace {
|
|||
|
||||
using namespace chatterino;
|
||||
|
||||
std::shared_ptr<pajlada::Settings::SettingManager> initSettingsInstance()
|
||||
std::shared_ptr<pajlada::Settings::SettingManager> initSettingsInstance(
|
||||
const Paths &paths)
|
||||
{
|
||||
auto sm = std::make_shared<pajlada::Settings::SettingManager>();
|
||||
|
||||
auto *paths = getPaths();
|
||||
|
||||
auto path = combinePath(paths->settingsDirectory, "user-data.json");
|
||||
auto path = combinePath(paths.settingsDirectory, "user-data.json");
|
||||
|
||||
sm->setPath(path.toUtf8().toStdString());
|
||||
|
||||
|
@ -30,8 +29,8 @@ std::shared_ptr<pajlada::Settings::SettingManager> initSettingsInstance()
|
|||
|
||||
namespace chatterino {
|
||||
|
||||
UserDataController::UserDataController()
|
||||
: sm(initSettingsInstance())
|
||||
UserDataController::UserDataController(const Paths &paths)
|
||||
: sm(initSettingsInstance(paths))
|
||||
, setting("/users", this->sm)
|
||||
{
|
||||
this->sm->load();
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
namespace chatterino {
|
||||
|
||||
class Paths;
|
||||
|
||||
class IUserDataController
|
||||
{
|
||||
public:
|
||||
|
@ -31,7 +33,7 @@ public:
|
|||
class UserDataController : public IUserDataController, public Singleton
|
||||
{
|
||||
public:
|
||||
UserDataController();
|
||||
explicit UserDataController(const Paths &paths);
|
||||
|
||||
// Get extra data about a user
|
||||
// If the user does not have any extra data, return none
|
||||
|
|
Loading…
Reference in a new issue