Use DeviceModelPretty/SystemVersionPretty directly

This allows using methods that require a running QGuiApplication instance to detect system
This commit is contained in:
Ilya Fedin 2020-12-29 11:17:43 +04:00 committed by John Preston
parent f66cfb5684
commit 8da33113a2
6 changed files with 11 additions and 33 deletions

View file

@ -270,14 +270,10 @@ std::unique_ptr<Launcher> Launcher::Create(int argc, char *argv[]) {
Launcher::Launcher(
int argc,
char *argv[],
const QString &deviceModel,
const QString &systemVersion)
char *argv[])
: _argc(argc)
, _argv(argv)
, _baseIntegration(_argc, _argv)
, _deviceModel(deviceModel)
, _systemVersion(systemVersion) {
, _baseIntegration(_argc, _argv) {
base::Integration::Set(&_baseIntegration);
}
@ -419,14 +415,6 @@ void Launcher::prepareSettings() {
processArguments();
}
QString Launcher::deviceModel() const {
return _deviceModel;
}
QString Launcher::systemVersion() const {
return _systemVersion;
}
uint64 Launcher::installationTag() const {
return InstallationTag;
}

View file

@ -15,9 +15,7 @@ class Launcher {
public:
Launcher(
int argc,
char *argv[],
const QString &deviceModel,
const QString &systemVersion);
char *argv[]);
static std::unique_ptr<Launcher> Create(int argc, char *argv[]);
@ -26,8 +24,6 @@ public:
QString argumentsString() const;
bool customWorkingDir() const;
QString deviceModel() const;
QString systemVersion() const;
uint64 installationTag() const;
bool checkPortableVersionFolder();
@ -67,9 +63,6 @@ private:
QStringList _arguments;
BaseIntegration _baseIntegration;
const QString _deviceModel;
const QString _systemVersion;
bool _customWorkingDir = false;
};

View file

@ -7,8 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "main/main_account.h"
#include "base/platform/base_platform_info.h"
#include "core/application.h"
#include "core/launcher.h"
#include "core/shortcuts.h"
#include "storage/storage_account.h"
#include "storage/storage_domain.h" // Storage::StartResult.
@ -386,8 +386,8 @@ void Account::startMtp(std::unique_ptr<MTP::Config> config) {
auto fields = base::take(_mtpFields);
fields.config = std::move(config);
fields.deviceModel = Core::App().launcher()->deviceModel();
fields.systemVersion = Core::App().launcher()->systemVersion();
fields.deviceModel = Platform::DeviceModelPretty();
fields.systemVersion = Platform::SystemVersionPretty();
_mtp = std::make_unique<MTP::Instance>(
MTP::Instance::Mode::Normal,
std::move(fields));
@ -534,8 +534,8 @@ void Account::destroyMtpKeys(MTP::AuthKeysList &&keys) {
destroyFields.mainDcId = MTP::Instance::Fields::kNoneMainDc;
destroyFields.config = std::make_unique<MTP::Config>(_mtp->config());
destroyFields.keys = std::move(keys);
destroyFields.deviceModel = Core::App().launcher()->deviceModel();
destroyFields.systemVersion = Core::App().launcher()->systemVersion();
destroyFields.deviceModel = Platform::DeviceModelPretty();
destroyFields.systemVersion = Platform::SystemVersionPretty();
_mtpForKeysDestroy = std::make_unique<MTP::Instance>(
MTP::Instance::Mode::KeysDestroyer,
std::move(destroyFields));

View file

@ -7,7 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "platform/linux/launcher_linux.h"
#include "base/platform/base_platform_info.h"
#include "platform/linux/specific_linux.h"
#include "core/crash_reports.h"
#include "core/update_checker.h"
@ -46,7 +45,7 @@ private:
} // namespace
Launcher::Launcher(int argc, char *argv[])
: Core::Launcher(argc, argv, DeviceModelPretty(), SystemVersionPretty()) {
: Core::Launcher(argc, argv) {
}
void Launcher::initHook() {

View file

@ -9,7 +9,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/crash_reports.h"
#include "core/update_checker.h"
#include "base/platform/base_platform_info.h"
#include "base/platform/base_platform_file_utilities.h"
#include "base/platform/mac/base_utilities_mac.h"
@ -20,7 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Platform {
Launcher::Launcher(int argc, char *argv[])
: Core::Launcher(argc, argv, DeviceModelPretty(), SystemVersionPretty()) {
: Core::Launcher(argc, argv) {
}
void Launcher::initHook() {

View file

@ -9,7 +9,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/crash_reports.h"
#include "core/update_checker.h"
#include "base/platform/base_platform_info.h"
#include "base/platform/win/base_windows_h.h"
#include <shellapi.h>
@ -18,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Platform {
Launcher::Launcher(int argc, char *argv[])
: Core::Launcher(argc, argv, DeviceModelPretty(), SystemVersionPretty()) {
: Core::Launcher(argc, argv) {
}
std::optional<QStringList> Launcher::readArgumentsHook(