Port forgetten places to Core::Launcher::Instance()

This commit is contained in:
Ilya Fedin 2023-06-16 02:57:27 +04:00 committed by John Preston
parent 1d234ea990
commit 2c1a2088b7
6 changed files with 10 additions and 22 deletions

View File

@ -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());

View File

@ -313,7 +313,7 @@ QString PlatformString() {
Unexpected("Platform in CrashReports::PlatformString.");
}
void StartCatching(not_null<Core::Launcher*> 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<Core::Launcher*> 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);

View File

@ -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<Core::Launcher*> launcher);
void StartCatching();
void FinishCatching();
} // namespace CrashReports

View File

@ -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.

View File

@ -343,10 +343,10 @@ bool WritingEntry() {
return WritingEntryFlag;
}
void start(not_null<Core::Launcher*> launcher) {
void start() {
Assert(LogsData == nullptr);
if (!launcher->checkPortableVersionFolder()) {
if (!Core::Launcher::Instance().checkPortableVersionFolder()) {
return;
}
@ -414,8 +414,8 @@ void start(not_null<Core::Launcher*> 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<Core::Launcher*> 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!"

View File

@ -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<Core::Launcher*> launcher);
void start();
bool started();
void finish();