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
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
|
|
|
class Launcher {
|
|
|
|
public:
|
2018-06-03 19:52:23 +00:00
|
|
|
Launcher(
|
|
|
|
int argc,
|
|
|
|
char *argv[],
|
|
|
|
const QString &deviceModel,
|
|
|
|
const QString &systemVersion);
|
2017-12-11 14:45:29 +00:00
|
|
|
|
|
|
|
static std::unique_ptr<Launcher> Create(int argc, char *argv[]);
|
|
|
|
|
|
|
|
int exec();
|
|
|
|
|
|
|
|
QString argumentsString() const;
|
2018-06-03 19:52:23 +00:00
|
|
|
bool customWorkingDir() const;
|
|
|
|
|
|
|
|
QString deviceModel() const;
|
|
|
|
QString systemVersion() 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();
|
|
|
|
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;
|
|
|
|
|
2018-06-03 19:52:23 +00:00
|
|
|
const QString _deviceModel;
|
|
|
|
const QString _systemVersion;
|
|
|
|
|
2017-12-12 07:52:53 +00:00
|
|
|
bool _customWorkingDir = false;
|
|
|
|
|
2017-12-11 14:45:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Core
|