2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Have a global Core::Launcher accessor

This allows to use Launcher in code executing before Sandbox is created
This commit is contained in:
Ilya Fedin
2023-06-13 04:34:27 +04:00
committed by John Preston
parent 63ccf1bed4
commit a7bd097b2f
13 changed files with 50 additions and 70 deletions

View File

@@ -143,9 +143,8 @@ struct Application::Private {
Settings settings;
};
Application::Application(not_null<Launcher*> launcher)
Application::Application()
: QObject()
, _launcher(launcher)
, _private(std::make_unique<Private>())
, _platformIntegration(Platform::Integration::Create())
, _batterySaving(std::make_unique<base::BatterySaving>())
@@ -945,11 +944,11 @@ rpl::producer<> Application::materializeLocalDraftsRequests() const {
void Application::switchDebugMode() {
if (Logs::DebugEnabled()) {
Logs::SetDebugEnabled(false);
_launcher->writeDebugModeSetting();
Launcher::Instance().writeDebugModeSetting();
Restart();
} else {
Logs::SetDebugEnabled(true);
_launcher->writeDebugModeSetting();
Launcher::Instance().writeDebugModeSetting();
DEBUG_LOG(("Debug logs started."));
if (_lastActivePrimaryWindow) {
_lastActivePrimaryWindow->hideLayer();
@@ -957,10 +956,6 @@ void Application::switchDebugMode() {
}
}
void Application::writeInstallBetaVersionsSetting() {
_launcher->writeInstallBetaVersionsSetting();
}
Main::Account &Application::activeAccount() const {
return _domain->active();
}
@@ -1770,7 +1765,7 @@ void Application::RegisterUrlScheme() {
.executable = (!Platform::IsLinux() || !Core::UpdaterDisabled())
? (cExeDir() + cExeName())
: cExeName(),
.arguments = Sandbox::Instance().customWorkingDir()
.arguments = Launcher::Instance().customWorkingDir()
? u"-workdir \"%1\""_q.arg(cWorkingDir())
: QString(),
.protocol = u"tg"_q,