mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Have a global Core::Launcher accessor
This allows to use Launcher in code executing before Sandbox is created
This commit is contained in:
@@ -20,6 +20,12 @@ public:
|
||||
|
||||
static std::unique_ptr<Launcher> Create(int argc, char *argv[]);
|
||||
|
||||
static Launcher &Instance() {
|
||||
Expects(InstanceSetter::Instance != nullptr);
|
||||
|
||||
return *InstanceSetter::Instance;
|
||||
}
|
||||
|
||||
virtual int exec();
|
||||
|
||||
QString argumentsString() const;
|
||||
@@ -32,7 +38,7 @@ public:
|
||||
void writeDebugModeSetting();
|
||||
void writeInstallBetaVersionsSetting();
|
||||
|
||||
virtual ~Launcher() = default;
|
||||
virtual ~Launcher();
|
||||
|
||||
protected:
|
||||
enum class UpdaterLaunch {
|
||||
@@ -61,6 +67,17 @@ private:
|
||||
|
||||
int executeApplication();
|
||||
|
||||
struct InstanceSetter {
|
||||
InstanceSetter(not_null<Launcher*> instance) {
|
||||
Expects(Instance == nullptr);
|
||||
|
||||
Instance = instance;
|
||||
}
|
||||
|
||||
static Launcher *Instance;
|
||||
};
|
||||
InstanceSetter _setter = { this };
|
||||
|
||||
int _argc;
|
||||
char **_argv;
|
||||
QStringList _arguments;
|
||||
|
Reference in New Issue
Block a user