mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Use DeviceModelPretty/SystemVersionPretty directly
This allows using methods that require a running QGuiApplication instance to detect system
This commit is contained in:
parent
f66cfb5684
commit
8da33113a2
6 changed files with 11 additions and 33 deletions
|
@ -270,14 +270,10 @@ std::unique_ptr<Launcher> Launcher::Create(int argc, char *argv[]) {
|
||||||
|
|
||||||
Launcher::Launcher(
|
Launcher::Launcher(
|
||||||
int argc,
|
int argc,
|
||||||
char *argv[],
|
char *argv[])
|
||||||
const QString &deviceModel,
|
|
||||||
const QString &systemVersion)
|
|
||||||
: _argc(argc)
|
: _argc(argc)
|
||||||
, _argv(argv)
|
, _argv(argv)
|
||||||
, _baseIntegration(_argc, _argv)
|
, _baseIntegration(_argc, _argv) {
|
||||||
, _deviceModel(deviceModel)
|
|
||||||
, _systemVersion(systemVersion) {
|
|
||||||
base::Integration::Set(&_baseIntegration);
|
base::Integration::Set(&_baseIntegration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,14 +415,6 @@ void Launcher::prepareSettings() {
|
||||||
processArguments();
|
processArguments();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Launcher::deviceModel() const {
|
|
||||||
return _deviceModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Launcher::systemVersion() const {
|
|
||||||
return _systemVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64 Launcher::installationTag() const {
|
uint64 Launcher::installationTag() const {
|
||||||
return InstallationTag;
|
return InstallationTag;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,7 @@ class Launcher {
|
||||||
public:
|
public:
|
||||||
Launcher(
|
Launcher(
|
||||||
int argc,
|
int argc,
|
||||||
char *argv[],
|
char *argv[]);
|
||||||
const QString &deviceModel,
|
|
||||||
const QString &systemVersion);
|
|
||||||
|
|
||||||
static std::unique_ptr<Launcher> Create(int argc, char *argv[]);
|
static std::unique_ptr<Launcher> Create(int argc, char *argv[]);
|
||||||
|
|
||||||
|
@ -26,8 +24,6 @@ public:
|
||||||
QString argumentsString() const;
|
QString argumentsString() const;
|
||||||
bool customWorkingDir() const;
|
bool customWorkingDir() const;
|
||||||
|
|
||||||
QString deviceModel() const;
|
|
||||||
QString systemVersion() const;
|
|
||||||
uint64 installationTag() const;
|
uint64 installationTag() const;
|
||||||
|
|
||||||
bool checkPortableVersionFolder();
|
bool checkPortableVersionFolder();
|
||||||
|
@ -67,9 +63,6 @@ private:
|
||||||
QStringList _arguments;
|
QStringList _arguments;
|
||||||
BaseIntegration _baseIntegration;
|
BaseIntegration _baseIntegration;
|
||||||
|
|
||||||
const QString _deviceModel;
|
|
||||||
const QString _systemVersion;
|
|
||||||
|
|
||||||
bool _customWorkingDir = false;
|
bool _customWorkingDir = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,8 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "main/main_account.h"
|
#include "main/main_account.h"
|
||||||
|
|
||||||
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "core/launcher.h"
|
|
||||||
#include "core/shortcuts.h"
|
#include "core/shortcuts.h"
|
||||||
#include "storage/storage_account.h"
|
#include "storage/storage_account.h"
|
||||||
#include "storage/storage_domain.h" // Storage::StartResult.
|
#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);
|
auto fields = base::take(_mtpFields);
|
||||||
fields.config = std::move(config);
|
fields.config = std::move(config);
|
||||||
fields.deviceModel = Core::App().launcher()->deviceModel();
|
fields.deviceModel = Platform::DeviceModelPretty();
|
||||||
fields.systemVersion = Core::App().launcher()->systemVersion();
|
fields.systemVersion = Platform::SystemVersionPretty();
|
||||||
_mtp = std::make_unique<MTP::Instance>(
|
_mtp = std::make_unique<MTP::Instance>(
|
||||||
MTP::Instance::Mode::Normal,
|
MTP::Instance::Mode::Normal,
|
||||||
std::move(fields));
|
std::move(fields));
|
||||||
|
@ -534,8 +534,8 @@ void Account::destroyMtpKeys(MTP::AuthKeysList &&keys) {
|
||||||
destroyFields.mainDcId = MTP::Instance::Fields::kNoneMainDc;
|
destroyFields.mainDcId = MTP::Instance::Fields::kNoneMainDc;
|
||||||
destroyFields.config = std::make_unique<MTP::Config>(_mtp->config());
|
destroyFields.config = std::make_unique<MTP::Config>(_mtp->config());
|
||||||
destroyFields.keys = std::move(keys);
|
destroyFields.keys = std::move(keys);
|
||||||
destroyFields.deviceModel = Core::App().launcher()->deviceModel();
|
destroyFields.deviceModel = Platform::DeviceModelPretty();
|
||||||
destroyFields.systemVersion = Core::App().launcher()->systemVersion();
|
destroyFields.systemVersion = Platform::SystemVersionPretty();
|
||||||
_mtpForKeysDestroy = std::make_unique<MTP::Instance>(
|
_mtpForKeysDestroy = std::make_unique<MTP::Instance>(
|
||||||
MTP::Instance::Mode::KeysDestroyer,
|
MTP::Instance::Mode::KeysDestroyer,
|
||||||
std::move(destroyFields));
|
std::move(destroyFields));
|
||||||
|
|
|
@ -7,7 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "platform/linux/launcher_linux.h"
|
#include "platform/linux/launcher_linux.h"
|
||||||
|
|
||||||
#include "base/platform/base_platform_info.h"
|
|
||||||
#include "platform/linux/specific_linux.h"
|
#include "platform/linux/specific_linux.h"
|
||||||
#include "core/crash_reports.h"
|
#include "core/crash_reports.h"
|
||||||
#include "core/update_checker.h"
|
#include "core/update_checker.h"
|
||||||
|
@ -46,7 +45,7 @@ private:
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Launcher::Launcher(int argc, char *argv[])
|
Launcher::Launcher(int argc, char *argv[])
|
||||||
: Core::Launcher(argc, argv, DeviceModelPretty(), SystemVersionPretty()) {
|
: Core::Launcher(argc, argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Launcher::initHook() {
|
void Launcher::initHook() {
|
||||||
|
|
|
@ -9,7 +9,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "core/crash_reports.h"
|
#include "core/crash_reports.h"
|
||||||
#include "core/update_checker.h"
|
#include "core/update_checker.h"
|
||||||
#include "base/platform/base_platform_info.h"
|
|
||||||
#include "base/platform/base_platform_file_utilities.h"
|
#include "base/platform/base_platform_file_utilities.h"
|
||||||
#include "base/platform/mac/base_utilities_mac.h"
|
#include "base/platform/mac/base_utilities_mac.h"
|
||||||
|
|
||||||
|
@ -20,7 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
|
|
||||||
Launcher::Launcher(int argc, char *argv[])
|
Launcher::Launcher(int argc, char *argv[])
|
||||||
: Core::Launcher(argc, argv, DeviceModelPretty(), SystemVersionPretty()) {
|
: Core::Launcher(argc, argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Launcher::initHook() {
|
void Launcher::initHook() {
|
||||||
|
|
|
@ -9,7 +9,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "core/crash_reports.h"
|
#include "core/crash_reports.h"
|
||||||
#include "core/update_checker.h"
|
#include "core/update_checker.h"
|
||||||
#include "base/platform/base_platform_info.h"
|
|
||||||
#include "base/platform/win/base_windows_h.h"
|
#include "base/platform/win/base_windows_h.h"
|
||||||
|
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
|
@ -18,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
|
|
||||||
Launcher::Launcher(int argc, char *argv[])
|
Launcher::Launcher(int argc, char *argv[])
|
||||||
: Core::Launcher(argc, argv, DeviceModelPretty(), SystemVersionPretty()) {
|
: Core::Launcher(argc, argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<QStringList> Launcher::readArgumentsHook(
|
std::optional<QStringList> Launcher::readArgumentsHook(
|
||||||
|
|
Loading…
Add table
Reference in a new issue