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; struct ProxyData;
} // namespace MTP } // namespace MTP
namespace Core {
class Launcher;
} // namespace Core
class PreLaunchWindow : public QWidget { class PreLaunchWindow : public QWidget {
public: public:
PreLaunchWindow(QString title = QString()); PreLaunchWindow(QString title = QString());

View file

@ -313,7 +313,7 @@ QString PlatformString() {
Unexpected("Platform in CrashReports::PlatformString."); Unexpected("Platform in CrashReports::PlatformString.");
} }
void StartCatching(not_null<Core::Launcher*> launcher) { void StartCatching() {
#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS #ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS
ProcessAnnotations["Binary"] = cExeName().toUtf8().constData(); ProcessAnnotations["Binary"] = cExeName().toUtf8().constData();
ProcessAnnotations["ApiId"] = QString::number(ApiId).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(); : u"%1"_q).arg(AppVersion)).toUtf8().constData();
ProcessAnnotations["Launched"] = QDateTime::currentDateTime().toString("dd.MM.yyyy hh:mm:ss").toUtf8().constData(); ProcessAnnotations["Launched"] = QDateTime::currentDateTime().toString("dd.MM.yyyy hh:mm:ss").toUtf8().constData();
ProcessAnnotations["Platform"] = PlatformString().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; QString dumpspath = cWorkingDir() + u"tdata/dumps"_q;
QDir().mkpath(dumpspath); QDir().mkpath(dumpspath);

View file

@ -7,10 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#pragma once #pragma once
namespace Core {
class Launcher;
} // namespace Core
namespace CrashReports { namespace CrashReports {
QString PlatformString(); QString PlatformString();
@ -53,7 +49,7 @@ inline void ClearAnnotationRef(const std::string &key) {
SetAnnotationRef(key, nullptr); SetAnnotationRef(key, nullptr);
} }
void StartCatching(not_null<Core::Launcher*> launcher); void StartCatching();
void FinishCatching(); void FinishCatching();
} // namespace CrashReports } // namespace CrashReports

View file

@ -348,7 +348,7 @@ int Launcher::exec() {
} }
// Must be started before Platform is started. // Must be started before Platform is started.
Logs::start(this); Logs::start();
base::options::init(cWorkingDir() + "tdata/experimental_options.json"); base::options::init(cWorkingDir() + "tdata/experimental_options.json");
// Must be called after options are inited. // Must be called after options are inited.

View file

@ -343,10 +343,10 @@ bool WritingEntry() {
return WritingEntryFlag; return WritingEntryFlag;
} }
void start(not_null<Core::Launcher*> launcher) { void start() {
Assert(LogsData == nullptr); Assert(LogsData == nullptr);
if (!launcher->checkPortableVersionFolder()) { if (!Core::Launcher::Instance().checkPortableVersionFolder()) {
return; return;
} }
@ -414,8 +414,8 @@ void start(not_null<Core::Launcher*> launcher) {
QDir().mkpath(cWorkingDir() + u"tdata"_q); QDir().mkpath(cWorkingDir() + u"tdata"_q);
launcher->workingFolderReady(); Core::Launcher::Instance().workingFolderReady();
CrashReports::StartCatching(launcher); CrashReports::StartCatching();
if (!LogsData->openMain()) { if (!LogsData->openMain()) {
delete LogsData; delete LogsData;
@ -430,7 +430,7 @@ void start(not_null<Core::Launcher*> launcher) {
LOG(("Executable dir: %1, name: %2").arg(cExeDir(), cExeName())); LOG(("Executable dir: %1, name: %2").arg(cExeDir(), cExeName()));
LOG(("Initial working dir: %1").arg(initialWorkingDir)); LOG(("Initial working dir: %1").arg(initialWorkingDir));
LOG(("Working dir: %1").arg(cWorkingDir())); 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) { if (!LogsData) {
LOG(("FATAL: Could not open '%1' for writing log!" 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/assertion.h"
#include "base/debug_log.h" #include "base/debug_log.h"
namespace Core {
class Launcher;
} // namespace Core
namespace Logs { namespace Logs {
void SetDebugEnabled(bool enabled); void SetDebugEnabled(bool enabled);
bool DebugEnabled(); bool DebugEnabled();
[[nodiscard]] bool WritingEntry(); [[nodiscard]] bool WritingEntry();
void start(not_null<Core::Launcher*> launcher); void start();
bool started(); bool started();
void finish(); void finish();