2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Decouple MTP::Instance from Core::App.

This commit is contained in:
John Preston
2019-02-01 10:48:31 +03:00
parent 4f3263d979
commit f5cc93ec64
5 changed files with 44 additions and 5 deletions

View File

@@ -50,6 +50,10 @@ public:
not_null<DcOptions*> dcOptions();
// Thread safe.
QString deviceModel() const;
QString systemVersion() const;
void requestConfig();
void requestConfigIfOld();
void requestCDNConfig();
@@ -171,6 +175,9 @@ private:
bool _mainDcIdForced = false;
std::map<DcId, std::shared_ptr<internal::Dcenter>> _dcenters;
QString _deviceModel;
QString _systemVersion;
internal::Session *_mainSession = nullptr;
std::map<ShiftedDcId, std::unique_ptr<internal::Session>> _sessions;
std::vector<std::unique_ptr<internal::Session>> _killedSessions; // delayed delete
@@ -232,6 +239,9 @@ Instance::Private::Private(
}
void Instance::Private::start(Config &&config) {
_deviceModel = std::move(config.deviceModel);
_systemVersion = std::move(config.systemVersion);
if (isKeysDestroyer()) {
_instance->connect(_instance, SIGNAL(keyDestroyed(qint32)), _instance, SLOT(onKeyDestroyed(qint32)), Qt::QueuedConnection);
} else if (isNormal()) {
@@ -705,6 +715,14 @@ not_null<DcOptions*> Instance::Private::dcOptions() {
return _dcOptions;
}
QString Instance::Private::deviceModel() const {
return _deviceModel;
}
QString Instance::Private::systemVersion() const {
return _systemVersion;
}
void Instance::Private::unpaused() {
for (auto &session : _sessions) {
session.second->unpaused();
@@ -1638,6 +1656,14 @@ not_null<DcOptions*> Instance::dcOptions() {
return _private->dcOptions();
}
QString Instance::deviceModel() const {
return _private->deviceModel();
}
QString Instance::systemVersion() const {
return _private->systemVersion();
}
void Instance::unpaused() {
_private->unpaused();
}