From 2c1a2088b7b27e53fdcf4cf31576a9fe01d269dd Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 16 Jun 2023 02:57:27 +0400 Subject: [PATCH] Port forgetten places to Core::Launcher::Instance() --- Telegram/SourceFiles/core/crash_report_window.h | 4 ---- Telegram/SourceFiles/core/crash_reports.cpp | 4 ++-- Telegram/SourceFiles/core/crash_reports.h | 6 +----- Telegram/SourceFiles/core/launcher.cpp | 2 +- Telegram/SourceFiles/logs.cpp | 10 +++++----- Telegram/SourceFiles/logs.h | 6 +----- 6 files changed, 10 insertions(+), 22 deletions(-) diff --git a/Telegram/SourceFiles/core/crash_report_window.h b/Telegram/SourceFiles/core/crash_report_window.h index 5c20c26c8..f0c438119 100644 --- a/Telegram/SourceFiles/core/crash_report_window.h +++ b/Telegram/SourceFiles/core/crash_report_window.h @@ -20,10 +20,6 @@ namespace MTP { struct ProxyData; } // namespace MTP -namespace Core { -class Launcher; -} // namespace Core - class PreLaunchWindow : public QWidget { public: PreLaunchWindow(QString title = QString()); diff --git a/Telegram/SourceFiles/core/crash_reports.cpp b/Telegram/SourceFiles/core/crash_reports.cpp index 9419e9c89..be7e77cdd 100644 --- a/Telegram/SourceFiles/core/crash_reports.cpp +++ b/Telegram/SourceFiles/core/crash_reports.cpp @@ -313,7 +313,7 @@ QString PlatformString() { Unexpected("Platform in CrashReports::PlatformString."); } -void StartCatching(not_null launcher) { +void StartCatching() { #ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS ProcessAnnotations["Binary"] = cExeName().toUtf8().constData(); ProcessAnnotations["ApiId"] = QString::number(ApiId).toUtf8().constData(); @@ -324,7 +324,7 @@ void StartCatching(not_null launcher) { : u"%1"_q).arg(AppVersion)).toUtf8().constData(); ProcessAnnotations["Launched"] = QDateTime::currentDateTime().toString("dd.MM.yyyy hh:mm:ss").toUtf8().constData(); ProcessAnnotations["Platform"] = PlatformString().toUtf8().constData(); - ProcessAnnotations["UserTag"] = QString::number(launcher->installationTag(), 16).toUtf8().constData(); + ProcessAnnotations["UserTag"] = QString::number(Core::Launcher::Instance().installationTag(), 16).toUtf8().constData(); QString dumpspath = cWorkingDir() + u"tdata/dumps"_q; QDir().mkpath(dumpspath); diff --git a/Telegram/SourceFiles/core/crash_reports.h b/Telegram/SourceFiles/core/crash_reports.h index b60941642..6a1f0e1d4 100644 --- a/Telegram/SourceFiles/core/crash_reports.h +++ b/Telegram/SourceFiles/core/crash_reports.h @@ -7,10 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once -namespace Core { -class Launcher; -} // namespace Core - namespace CrashReports { QString PlatformString(); @@ -53,7 +49,7 @@ inline void ClearAnnotationRef(const std::string &key) { SetAnnotationRef(key, nullptr); } -void StartCatching(not_null launcher); +void StartCatching(); void FinishCatching(); } // namespace CrashReports diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp index bf5de7ac6..52ebbd7c7 100644 --- a/Telegram/SourceFiles/core/launcher.cpp +++ b/Telegram/SourceFiles/core/launcher.cpp @@ -348,7 +348,7 @@ int Launcher::exec() { } // Must be started before Platform is started. - Logs::start(this); + Logs::start(); base::options::init(cWorkingDir() + "tdata/experimental_options.json"); // Must be called after options are inited. diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp index 443e26049..03cfe4c49 100644 --- a/Telegram/SourceFiles/logs.cpp +++ b/Telegram/SourceFiles/logs.cpp @@ -343,10 +343,10 @@ bool WritingEntry() { return WritingEntryFlag; } -void start(not_null launcher) { +void start() { Assert(LogsData == nullptr); - if (!launcher->checkPortableVersionFolder()) { + if (!Core::Launcher::Instance().checkPortableVersionFolder()) { return; } @@ -414,8 +414,8 @@ void start(not_null launcher) { QDir().mkpath(cWorkingDir() + u"tdata"_q); - launcher->workingFolderReady(); - CrashReports::StartCatching(launcher); + Core::Launcher::Instance().workingFolderReady(); + CrashReports::StartCatching(); if (!LogsData->openMain()) { delete LogsData; @@ -430,7 +430,7 @@ void start(not_null launcher) { LOG(("Executable dir: %1, name: %2").arg(cExeDir(), cExeName())); LOG(("Initial working dir: %1").arg(initialWorkingDir)); LOG(("Working dir: %1").arg(cWorkingDir())); - LOG(("Command line: %1").arg(launcher->arguments().join(' '))); + LOG(("Command line: %1").arg(Core::Launcher::Instance().arguments().join(' '))); if (!LogsData) { LOG(("FATAL: Could not open '%1' for writing log!" diff --git a/Telegram/SourceFiles/logs.h b/Telegram/SourceFiles/logs.h index f45b07658..b9de4401f 100644 --- a/Telegram/SourceFiles/logs.h +++ b/Telegram/SourceFiles/logs.h @@ -11,17 +11,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/assertion.h" #include "base/debug_log.h" -namespace Core { -class Launcher; -} // namespace Core - namespace Logs { void SetDebugEnabled(bool enabled); bool DebugEnabled(); [[nodiscard]] bool WritingEntry(); -void start(not_null launcher); +void start(); bool started(); void finish();