refactor: Un-singletonize Paths & Updates (#5092)

This commit is contained in:
pajlada
2024-01-16 21:56:43 +01:00
committed by GitHub
parent 7f935665f9
commit 718696db53
60 changed files with 237 additions and 165 deletions
+8 -5
View File
@@ -11,6 +11,7 @@
#include "singletons/CrashHandler.hpp"
#include "singletons/Paths.hpp"
#include "singletons/Settings.hpp"
#include "singletons/Updates.hpp"
#include "util/AttachToConsole.hpp"
#include <QApplication>
@@ -35,11 +36,11 @@ int main(int argc, char **argv)
QCoreApplication::setApplicationVersion(CHATTERINO_VERSION);
QCoreApplication::setOrganizationDomain("chatterino.com");
Paths *paths{};
std::unique_ptr<Paths> paths;
try
{
paths = new Paths;
paths = std::make_unique<Paths>();
}
catch (std::runtime_error &error)
{
@@ -62,10 +63,10 @@ int main(int argc, char **argv)
return 1;
}
const Args args(a);
const Args args(a, *paths);
#ifdef CHATTERINO_WITH_CRASHPAD
const auto crashpadHandler = installCrashHandler(args);
const auto crashpadHandler = installCrashHandler(args, *paths);
#endif
// run in gui mode or browser extension host mode
@@ -92,6 +93,8 @@ int main(int argc, char **argv)
attachToConsole();
}
Updates updates(*paths);
NetworkConfigurationProvider::applyFromEnv(Env::get());
IvrApi::initialize();
@@ -99,7 +102,7 @@ int main(int argc, char **argv)
Settings settings(paths->settingsDirectory);
runGui(a, *paths, settings, args);
runGui(a, *paths, settings, args, updates);
}
return 0;
}