Fix build with TDESKTOP_DISABLE_AUTOUPDATE.

Fixes #4655.
This commit is contained in:
John Preston 2018-05-07 00:34:58 +03:00
parent 48c1576d7f
commit cc2c13d018
3 changed files with 10 additions and 0 deletions

View File

@ -48,9 +48,11 @@ void fillCodes() {
Messenger::Instance().onSwitchTestMode();
}));
});
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
Codes.insert(qsl("testupdate"), [] {
Core::UpdateChecker().test();
});
#endif // TDESKTOP_DISABLE_AUTOUPDATE
Codes.insert(qsl("loadlang"), [] {
Lang::CurrentCloudManager().switchToLanguage(qsl("custom"));
});

View File

@ -2526,6 +2526,7 @@ void writeMtpData() {
_writeMtpData();
}
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
const QString &AutoupdatePrefix(const QString &replaceWith = {}) {
static auto value = QString();
if (!replaceWith.isEmpty()) {
@ -2552,8 +2553,10 @@ const QString &readAutoupdatePrefixRaw() {
}
return AutoupdatePrefix("http://updates.tdesktop.com");
}
#endif // TDESKTOP_DISABLE_AUTOUPDATE
void writeAutoupdatePrefix(const QString &prefix) {
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
const auto current = readAutoupdatePrefixRaw();
if (current != prefix) {
AutoupdatePrefix(prefix);
@ -2567,12 +2570,15 @@ void writeAutoupdatePrefix(const QString &prefix) {
checker.start();
}
}
#endif // TDESKTOP_DISABLE_AUTOUPDATE
}
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
QString readAutoupdatePrefix() {
auto result = readAutoupdatePrefixRaw();
return result.replace(QRegularExpression("/+$"), QString());
}
#endif // TDESKTOP_DISABLE_AUTOUPDATE
void reset() {
if (_localLoader) {

View File

@ -28,7 +28,9 @@ void writeUserSettings();
void writeMtpData();
void writeAutoupdatePrefix(const QString &prefix);
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
QString readAutoupdatePrefix();
#endif // TDESKTOP_DISABLE_AUTOUPDATE
void reset();