2017-12-11 14:45:29 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2017-12-11 14:45:29 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2017-12-11 14:45:29 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2019-11-02 17:06:47 +00:00
|
|
|
#include "core/base_integration.h"
|
|
|
|
|
2017-12-11 14:45:29 +00:00
|
|
|
namespace Core {
|
|
|
|
|
|
|
|
class Launcher {
|
|
|
|
public:
|
2021-08-24 14:43:31 +00:00
|
|
|
Launcher(int argc, char *argv[]);
|
2017-12-11 14:45:29 +00:00
|
|
|
|
|
|
|
static std::unique_ptr<Launcher> Create(int argc, char *argv[]);
|
|
|
|
|
2021-06-22 23:20:40 +00:00
|
|
|
virtual int exec();
|
2017-12-11 14:45:29 +00:00
|
|
|
|
|
|
|
QString argumentsString() const;
|
2018-06-03 19:52:23 +00:00
|
|
|
bool customWorkingDir() const;
|
|
|
|
|
2019-01-21 13:42:21 +00:00
|
|
|
uint64 installationTag() const;
|
|
|
|
|
|
|
|
bool checkPortableVersionFolder();
|
|
|
|
void workingFolderReady();
|
|
|
|
void writeDebugModeSetting();
|
|
|
|
void writeInstallBetaVersionsSetting();
|
2017-12-12 07:52:53 +00:00
|
|
|
|
2018-04-08 17:32:48 +00:00
|
|
|
virtual ~Launcher() = default;
|
|
|
|
|
2017-12-12 07:52:53 +00:00
|
|
|
protected:
|
|
|
|
enum class UpdaterLaunch {
|
|
|
|
PerformUpdate,
|
|
|
|
JustRelaunch,
|
|
|
|
};
|
2017-12-11 14:45:29 +00:00
|
|
|
|
|
|
|
private:
|
2017-12-12 07:52:53 +00:00
|
|
|
void prepareSettings();
|
2021-04-20 12:40:54 +00:00
|
|
|
void initQtMessageLogging();
|
2017-12-12 07:52:53 +00:00
|
|
|
void processArguments();
|
|
|
|
|
2017-12-12 08:15:33 +00:00
|
|
|
QStringList readArguments(int argc, char *argv[]) const;
|
2018-09-21 16:28:46 +00:00
|
|
|
virtual std::optional<QStringList> readArgumentsHook(
|
2017-12-12 08:15:33 +00:00
|
|
|
int argc,
|
|
|
|
char *argv[]) const {
|
2018-09-21 16:28:46 +00:00
|
|
|
return std::nullopt;
|
2017-12-12 08:15:33 +00:00
|
|
|
}
|
|
|
|
|
2017-12-11 14:45:29 +00:00
|
|
|
void init();
|
2017-12-12 07:52:53 +00:00
|
|
|
virtual void initHook() {
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool launchUpdater(UpdaterLaunch action) = 0;
|
2017-12-11 14:45:29 +00:00
|
|
|
|
2017-12-17 18:41:34 +00:00
|
|
|
int executeApplication();
|
2017-12-12 08:15:33 +00:00
|
|
|
|
2017-12-11 14:45:29 +00:00
|
|
|
int _argc;
|
|
|
|
char **_argv;
|
|
|
|
QStringList _arguments;
|
2019-11-02 17:06:47 +00:00
|
|
|
BaseIntegration _baseIntegration;
|
2017-12-11 14:45:29 +00:00
|
|
|
|
2017-12-12 07:52:53 +00:00
|
|
|
bool _customWorkingDir = false;
|
|
|
|
|
2017-12-11 14:45:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Core
|