mirror of
https://github.com/vale981/tdesktop
synced 2025-03-05 09:41:41 -05:00
Add '-externalupdater' command-line argument.
Now no-autoupdater mode can be switched on in runtime. Also TDESKTOP_DISABLE_AUTOUPDATE build is disabled in CI (trivial). Fixes #4895.
This commit is contained in:
parent
e2bc6990c7
commit
52e7ddf079
29 changed files with 449 additions and 420 deletions
|
@ -56,10 +56,6 @@ GOTO:EOF
|
||||||
call:logInfo "Build version: %BUILD_VERSION%"
|
call:logInfo "Build version: %BUILD_VERSION%"
|
||||||
set TDESKTOP_BUILD_DEFINES=
|
set TDESKTOP_BUILD_DEFINES=
|
||||||
|
|
||||||
echo %BUILD_VERSION% | findstr /C:"disable_autoupdate">nul && (
|
|
||||||
set TDESKTOP_BUILD_DEFINES=%TDESKTOP_BUILD_DEFINES%,TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
)
|
|
||||||
|
|
||||||
echo %BUILD_VERSION% | findstr /C:"disable_register_custom_scheme">nul && (
|
echo %BUILD_VERSION% | findstr /C:"disable_register_custom_scheme">nul && (
|
||||||
set TDESKTOP_BUILD_DEFINES=%TDESKTOP_BUILD_DEFINES%,TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
|
set TDESKTOP_BUILD_DEFINES=%TDESKTOP_BUILD_DEFINES%,TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
|
||||||
)
|
)
|
||||||
|
|
|
@ -10,7 +10,6 @@ cache:
|
||||||
env:
|
env:
|
||||||
matrix:
|
matrix:
|
||||||
- BUILD_VERSION=""
|
- BUILD_VERSION=""
|
||||||
- BUILD_VERSION="disable_autoupdate"
|
|
||||||
- BUILD_VERSION="disable_register_custom_scheme"
|
- BUILD_VERSION="disable_register_custom_scheme"
|
||||||
- BUILD_VERSION="disable_crash_reports"
|
- BUILD_VERSION="disable_crash_reports"
|
||||||
- BUILD_VERSION="disable_network_proxy"
|
- BUILD_VERSION="disable_network_proxy"
|
||||||
|
|
|
@ -100,10 +100,6 @@ build() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Configure the build
|
# Configure the build
|
||||||
if [[ $BUILD_VERSION == *"disable_autoupdate"* ]]; then
|
|
||||||
GYP_DEFINES+=",TDESKTOP_DISABLE_AUTOUPDATE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $BUILD_VERSION == *"disable_register_custom_scheme"* ]]; then
|
if [[ $BUILD_VERSION == *"disable_register_custom_scheme"* ]]; then
|
||||||
GYP_DEFINES+=",TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME"
|
GYP_DEFINES+=",TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -339,7 +339,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR cmdPara
|
||||||
LPWSTR *args;
|
LPWSTR *args;
|
||||||
int argsCount;
|
int argsCount;
|
||||||
|
|
||||||
bool needupdate = false, autostart = false, debug = false, writeprotected = false, startintray = false, testmode = false;
|
bool needupdate = false, autostart = false, debug = false, writeprotected = false, startintray = false, testmode = false, externalupdater = false;
|
||||||
args = CommandLineToArgvW(GetCommandLine(), &argsCount);
|
args = CommandLineToArgvW(GetCommandLine(), &argsCount);
|
||||||
if (args) {
|
if (args) {
|
||||||
for (int i = 1; i < argsCount; ++i) {
|
for (int i = 1; i < argsCount; ++i) {
|
||||||
|
@ -355,6 +355,8 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR cmdPara
|
||||||
startintray = true;
|
startintray = true;
|
||||||
} else if (equal(args[i], L"-testmode")) {
|
} else if (equal(args[i], L"-testmode")) {
|
||||||
testmode = true;
|
testmode = true;
|
||||||
|
} else if (equal(args[i], L"-externalupdater")) {
|
||||||
|
externalupdater = true;
|
||||||
} else if (equal(args[i], L"-writeprotected") && ++i < argsCount) {
|
} else if (equal(args[i], L"-writeprotected") && ++i < argsCount) {
|
||||||
writeLog(std::wstring(L"Argument: ") + args[i]);
|
writeLog(std::wstring(L"Argument: ") + args[i]);
|
||||||
writeprotected = true;
|
writeprotected = true;
|
||||||
|
@ -425,6 +427,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR cmdPara
|
||||||
if (debug) targs += L" -debug";
|
if (debug) targs += L" -debug";
|
||||||
if (startintray) targs += L" -startintray";
|
if (startintray) targs += L" -startintray";
|
||||||
if (testmode) targs += L" -testmode";
|
if (testmode) targs += L" -testmode";
|
||||||
|
if (externalupdater) targs += L" -externalupdater";
|
||||||
if (!customWorkingDir.empty()) {
|
if (!customWorkingDir.empty()) {
|
||||||
targs += L" -workdir \"" + customWorkingDir + L"\"";
|
targs += L" -workdir \"" + customWorkingDir + L"\"";
|
||||||
}
|
}
|
||||||
|
|
|
@ -337,6 +337,7 @@ int main(int argc, char *argv[]) {
|
||||||
bool tosettings = false;
|
bool tosettings = false;
|
||||||
bool startintray = false;
|
bool startintray = false;
|
||||||
bool testmode = false;
|
bool testmode = false;
|
||||||
|
bool externalupdater = false;
|
||||||
bool customWorkingDir = false;
|
bool customWorkingDir = false;
|
||||||
|
|
||||||
char *key = 0;
|
char *key = 0;
|
||||||
|
@ -352,6 +353,8 @@ int main(int argc, char *argv[]) {
|
||||||
startintray = true;
|
startintray = true;
|
||||||
} else if (equal(argv[i], "-testmode")) {
|
} else if (equal(argv[i], "-testmode")) {
|
||||||
testmode = true;
|
testmode = true;
|
||||||
|
} else if (equal(argv[i], "-externalupdater")) {
|
||||||
|
externalupdater = true;
|
||||||
} else if (equal(argv[i], "-tosettings")) {
|
} else if (equal(argv[i], "-tosettings")) {
|
||||||
tosettings = true;
|
tosettings = true;
|
||||||
} else if (equal(argv[i], "-workdir_custom")) {
|
} else if (equal(argv[i], "-workdir_custom")) {
|
||||||
|
@ -450,6 +453,7 @@ int main(int argc, char *argv[]) {
|
||||||
char p_key[] = "-key";
|
char p_key[] = "-key";
|
||||||
char p_startintray[] = "-startintray";
|
char p_startintray[] = "-startintray";
|
||||||
char p_testmode[] = "-testmode";
|
char p_testmode[] = "-testmode";
|
||||||
|
char p_externalupdater[] = "-externalupdater";
|
||||||
char p_workdir[] = "-workdir";
|
char p_workdir[] = "-workdir";
|
||||||
int argIndex = 0;
|
int argIndex = 0;
|
||||||
args[argIndex++] = path;
|
args[argIndex++] = path;
|
||||||
|
@ -458,6 +462,7 @@ int main(int argc, char *argv[]) {
|
||||||
if (debug) args[argIndex++] = p_debug;
|
if (debug) args[argIndex++] = p_debug;
|
||||||
if (startintray) args[argIndex++] = p_startintray;
|
if (startintray) args[argIndex++] = p_startintray;
|
||||||
if (testmode) args[argIndex++] = p_testmode;
|
if (testmode) args[argIndex++] = p_testmode;
|
||||||
|
if (externalupdater) args[argIndex++] = p_externalupdater;
|
||||||
if (tosettings) args[argIndex++] = p_tosettings;
|
if (tosettings) args[argIndex++] = p_tosettings;
|
||||||
if (key) {
|
if (key) {
|
||||||
args[argIndex++] = p_key;
|
args[argIndex++] = p_key;
|
||||||
|
|
|
@ -75,7 +75,7 @@ int main(int argc, const char * argv[]) {
|
||||||
|
|
||||||
openLog();
|
openLog();
|
||||||
pid_t procId = 0;
|
pid_t procId = 0;
|
||||||
BOOL update = YES, toSettings = NO, autoStart = NO, startInTray = NO, testMode = NO;
|
BOOL update = YES, toSettings = NO, autoStart = NO, startInTray = NO, testMode = NO, externalUpdater = NO;
|
||||||
BOOL customWorkingDir = NO;
|
BOOL customWorkingDir = NO;
|
||||||
NSString *key = nil;
|
NSString *key = nil;
|
||||||
for (int i = 0; i < argc; ++i) {
|
for (int i = 0; i < argc; ++i) {
|
||||||
|
@ -101,6 +101,8 @@ int main(int argc, const char * argv[]) {
|
||||||
startInTray = YES;
|
startInTray = YES;
|
||||||
} else if ([@"-testmode" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
|
} else if ([@"-testmode" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
|
||||||
testMode = YES;
|
testMode = YES;
|
||||||
|
} else if ([@"-externalupdater" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
|
||||||
|
externalUpdater = YES;
|
||||||
} else if ([@"-workdir_custom" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
|
} else if ([@"-workdir_custom" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
|
||||||
customWorkingDir = YES;
|
customWorkingDir = YES;
|
||||||
} else if ([@"-key" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
|
} else if ([@"-key" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
|
||||||
|
@ -235,6 +237,7 @@ int main(int argc, const char * argv[]) {
|
||||||
if (_debug) [args addObject:@"-debug"];
|
if (_debug) [args addObject:@"-debug"];
|
||||||
if (startInTray) [args addObject:@"-startintray"];
|
if (startInTray) [args addObject:@"-startintray"];
|
||||||
if (testMode) [args addObject:@"-testmode"];
|
if (testMode) [args addObject:@"-testmode"];
|
||||||
|
if (externalUpdater) [args addObject:@"-externalupdater"];
|
||||||
if (autoStart) [args addObject:@"-autostart"];
|
if (autoStart) [args addObject:@"-autostart"];
|
||||||
if (key) {
|
if (key) {
|
||||||
[args addObject:@"-key"];
|
[args addObject:@"-key"];
|
||||||
|
|
|
@ -1623,11 +1623,9 @@ namespace App {
|
||||||
}
|
}
|
||||||
|
|
||||||
void restart() {
|
void restart() {
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
using namespace Core;
|
||||||
bool updateReady = (Core::UpdateChecker().state() == Core::UpdateChecker::State::Ready);
|
const auto updateReady = !UpdaterDisabled()
|
||||||
#else // !TDESKTOP_DISABLE_AUTOUPDATE
|
&& (UpdateChecker().state() == UpdateChecker::State::Ready);
|
||||||
bool updateReady = false;
|
|
||||||
#endif // else for !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
if (updateReady) {
|
if (updateReady) {
|
||||||
cSetRestartingUpdate(true);
|
cSetRestartingUpdate(true);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -91,10 +91,9 @@ Application::Application(
|
||||||
char **argv)
|
char **argv)
|
||||||
: QApplication(argc, argv)
|
: QApplication(argc, argv)
|
||||||
, _launcher(launcher)
|
, _launcher(launcher)
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
, _updateChecker(Core::UpdaterDisabled()
|
||||||
, _updateChecker(std::make_unique<Core::UpdateChecker>())
|
? nullptr
|
||||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
: std::make_unique<Core::UpdateChecker>()) {
|
||||||
{
|
|
||||||
const auto d = QFile::encodeName(QDir(cWorkingDir()).absolutePath());
|
const auto d = QFile::encodeName(QDir(cWorkingDir()).absolutePath());
|
||||||
char h[33] = { 0 };
|
char h[33] = { 0 };
|
||||||
hashMd5Hex(d.constData(), d.size(), h);
|
hashMd5Hex(d.constData(), d.size(), h);
|
||||||
|
@ -204,13 +203,13 @@ void Application::socketError(QLocalSocket::LocalSocketError e) {
|
||||||
}
|
}
|
||||||
#endif // !Q_OS_WINRT
|
#endif // !Q_OS_WINRT
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
if (!Core::UpdaterDisabled()
|
||||||
if (!cNoStartUpdate() && Core::checkReadyUpdate()) {
|
&& !cNoStartUpdate()
|
||||||
|
&& Core::checkReadyUpdate()) {
|
||||||
cSetRestartingUpdate(true);
|
cSetRestartingUpdate(true);
|
||||||
DEBUG_LOG(("Application Info: installing update instead of starting app..."));
|
DEBUG_LOG(("Application Info: installing update instead of starting app..."));
|
||||||
return App::quit();
|
return App::quit();
|
||||||
}
|
}
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
singleInstanceChecked();
|
singleInstanceChecked();
|
||||||
}
|
}
|
||||||
|
@ -384,9 +383,7 @@ void Application::closeApplication() {
|
||||||
|
|
||||||
_localSocket.close();
|
_localSocket.close();
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
_updateChecker = nullptr;
|
_updateChecker = nullptr;
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Application *application() {
|
inline Application *application() {
|
||||||
|
|
|
@ -61,9 +61,7 @@ private:
|
||||||
void singleInstanceChecked();
|
void singleInstanceChecked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
std::unique_ptr<Core::UpdateChecker> _updateChecker;
|
std::unique_ptr<Core::UpdateChecker> _updateChecker;
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -194,6 +194,11 @@ void NotStartedWindow::resizeEvent(QResizeEvent *e) {
|
||||||
_close.setGeometry(width() - padding - _close.width(), height() - padding - _close.height(), _close.width(), _close.height());
|
_close.setGeometry(width() - padding - _close.width(), height() - padding - _close.height(), _close.width(), _close.height());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LastCrashedWindow::UpdaterData::UpdaterData(QWidget *buttonParent)
|
||||||
|
: check(buttonParent)
|
||||||
|
, skip(buttonParent, false) {
|
||||||
|
}
|
||||||
|
|
||||||
LastCrashedWindow::LastCrashedWindow()
|
LastCrashedWindow::LastCrashedWindow()
|
||||||
: _port(80)
|
: _port(80)
|
||||||
, _label(this)
|
, _label(this)
|
||||||
|
@ -218,11 +223,9 @@ LastCrashedWindow::LastCrashedWindow()
|
||||||
, _sendingTotal(0)
|
, _sendingTotal(0)
|
||||||
, _checkReply(0)
|
, _checkReply(0)
|
||||||
, _sendReply(0)
|
, _sendReply(0)
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
, _updaterData(Core::UpdaterDisabled()
|
||||||
, _updatingCheck(this)
|
? nullptr
|
||||||
, _updatingSkip(this, false)
|
: std::make_unique<UpdaterData>(this)) {
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
{
|
|
||||||
excludeReportUsername();
|
excludeReportUsername();
|
||||||
|
|
||||||
if (!cAlphaVersion() && !cBetaVersion()) { // currently accept crash reports only from testers
|
if (!cAlphaVersion() && !cBetaVersion()) { // currently accept crash reports only from testers
|
||||||
|
@ -293,49 +296,49 @@ LastCrashedWindow::LastCrashedWindow()
|
||||||
_label.setText(qsl("Last time Telegram Desktop crashed :("));
|
_label.setText(qsl("Last time Telegram Desktop crashed :("));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
if (_updaterData) {
|
||||||
_updatingCheck.setText(qsl("TRY AGAIN"));
|
_updaterData->check.setText(qsl("TRY AGAIN"));
|
||||||
connect(&_updatingCheck, SIGNAL(clicked()), this, SLOT(onUpdateRetry()));
|
connect(&_updaterData->check, SIGNAL(clicked()), this, SLOT(onUpdateRetry()));
|
||||||
_updatingSkip.setText(qsl("SKIP"));
|
_updaterData->skip.setText(qsl("SKIP"));
|
||||||
connect(&_updatingSkip, SIGNAL(clicked()), this, SLOT(onUpdateSkip()));
|
connect(&_updaterData->skip, SIGNAL(clicked()), this, SLOT(onUpdateSkip()));
|
||||||
|
|
||||||
Core::UpdateChecker checker;
|
Core::UpdateChecker checker;
|
||||||
using Progress = Core::UpdateChecker::Progress;
|
using Progress = Core::UpdateChecker::Progress;
|
||||||
checker.checking(
|
checker.checking(
|
||||||
) | rpl::start_with_next([=] { onUpdateChecking(); }, _lifetime);
|
) | rpl::start_with_next([=] { onUpdateChecking(); }, _lifetime);
|
||||||
checker.isLatest(
|
checker.isLatest(
|
||||||
) | rpl::start_with_next([=] { onUpdateLatest(); }, _lifetime);
|
) | rpl::start_with_next([=] { onUpdateLatest(); }, _lifetime);
|
||||||
checker.progress(
|
checker.progress(
|
||||||
) | rpl::start_with_next([=](const Progress &result) {
|
) | rpl::start_with_next([=](const Progress &result) {
|
||||||
onUpdateDownloading(result.already, result.size);
|
onUpdateDownloading(result.already, result.size);
|
||||||
}, _lifetime);
|
}, _lifetime);
|
||||||
checker.failed(
|
checker.failed(
|
||||||
) | rpl::start_with_next([=] { onUpdateFailed(); }, _lifetime);
|
) | rpl::start_with_next([=] { onUpdateFailed(); }, _lifetime);
|
||||||
checker.ready(
|
checker.ready(
|
||||||
) | rpl::start_with_next([=] { onUpdateReady(); }, _lifetime);
|
) | rpl::start_with_next([=] { onUpdateReady(); }, _lifetime);
|
||||||
|
|
||||||
switch (checker.state()) {
|
switch (checker.state()) {
|
||||||
case Core::UpdateChecker::State::Download:
|
case Core::UpdateChecker::State::Download:
|
||||||
setUpdatingState(UpdatingDownload, true);
|
setUpdatingState(UpdatingDownload, true);
|
||||||
setDownloadProgress(checker.already(), checker.size());
|
setDownloadProgress(checker.already(), checker.size());
|
||||||
break;
|
break;
|
||||||
case Core::UpdateChecker::State::Ready:
|
case Core::UpdateChecker::State::Ready:
|
||||||
setUpdatingState(UpdatingReady, true);
|
setUpdatingState(UpdatingReady, true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
setUpdatingState(UpdatingCheck, true);
|
setUpdatingState(UpdatingCheck, true);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
cSetLastUpdateCheck(0);
|
||||||
|
checker.start();
|
||||||
|
} else {
|
||||||
|
_updating.setText(qsl("Please check if there is a new version available."));
|
||||||
|
if (_sendingState != SendingNoReport) {
|
||||||
|
_sendingState = SendingNone;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cSetLastUpdateCheck(0);
|
|
||||||
checker.start();
|
|
||||||
#else // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
_updating.setText(qsl("Please check if there is a new version available."));
|
|
||||||
if (_sendingState != SendingNoReport) {
|
|
||||||
_sendingState = SendingNone;
|
|
||||||
}
|
|
||||||
#endif // else for !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
_pleaseSendReport.setText(qsl("Please send us a crash report."));
|
_pleaseSendReport.setText(qsl("Please send us a crash report."));
|
||||||
_yourReportName.setText(qsl("Your Report Tag: %1\nYour User Tag: %2").arg(QString(_minidumpName).replace(".dmp", "")).arg(Sandbox::UserTag(), 0, 16));
|
_yourReportName.setText(qsl("Your Report Tag: %1\nYour User Tag: %2").arg(QString(_minidumpName).replace(".dmp", "")).arg(Sandbox::UserTag(), 0, 16));
|
||||||
_yourReportName.setCursor(style::cur_text);
|
_yourReportName.setCursor(style::cur_text);
|
||||||
|
@ -552,69 +555,41 @@ void LastCrashedWindow::updateControls() {
|
||||||
int padding = _size, h = padding + _networkSettings.height() + padding;
|
int padding = _size, h = padding + _networkSettings.height() + padding;
|
||||||
|
|
||||||
_label.show();
|
_label.show();
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
if (_updaterData) {
|
||||||
h += _networkSettings.height() + padding;
|
h += _networkSettings.height() + padding;
|
||||||
if (_updatingState == UpdatingFail && (_sendingState == SendingNoReport || _sendingState == SendingUpdateCheck)) {
|
if (_updaterData->state == UpdatingFail && (_sendingState == SendingNoReport || _sendingState == SendingUpdateCheck)) {
|
||||||
_networkSettings.show();
|
|
||||||
_updatingCheck.show();
|
|
||||||
_updatingSkip.show();
|
|
||||||
_send.hide();
|
|
||||||
_sendSkip.hide();
|
|
||||||
_continue.hide();
|
|
||||||
_pleaseSendReport.hide();
|
|
||||||
_yourReportName.hide();
|
|
||||||
_includeUsername.hide();
|
|
||||||
_getApp.hide();
|
|
||||||
_showReport.hide();
|
|
||||||
_report.hide();
|
|
||||||
_minidump.hide();
|
|
||||||
_saveReport.hide();
|
|
||||||
h += padding + _updatingCheck.height() + padding;
|
|
||||||
} else {
|
|
||||||
if (_updatingState == UpdatingCheck || _sendingState == SendingFail || _sendingState == SendingProgress) {
|
|
||||||
_networkSettings.show();
|
_networkSettings.show();
|
||||||
|
_updaterData->check.show();
|
||||||
|
_updaterData->skip.show();
|
||||||
|
_send.hide();
|
||||||
|
_sendSkip.hide();
|
||||||
|
_continue.hide();
|
||||||
|
_pleaseSendReport.hide();
|
||||||
|
_yourReportName.hide();
|
||||||
|
_includeUsername.hide();
|
||||||
|
_getApp.hide();
|
||||||
|
_showReport.hide();
|
||||||
|
_report.hide();
|
||||||
|
_minidump.hide();
|
||||||
|
_saveReport.hide();
|
||||||
|
h += padding + _updaterData->check.height() + padding;
|
||||||
} else {
|
} else {
|
||||||
_networkSettings.hide();
|
if (_updaterData->state == UpdatingCheck
|
||||||
}
|
|| _sendingState == SendingFail
|
||||||
if (_updatingState == UpdatingNone || _updatingState == UpdatingLatest || _updatingState == UpdatingFail) {
|
|| _sendingState == SendingProgress) {
|
||||||
h += padding + _updatingCheck.height() + padding;
|
_networkSettings.show();
|
||||||
if (_sendingState == SendingNoReport) {
|
|
||||||
_pleaseSendReport.hide();
|
|
||||||
_yourReportName.hide();
|
|
||||||
_includeUsername.hide();
|
|
||||||
_getApp.hide();
|
|
||||||
_showReport.hide();
|
|
||||||
_report.hide();
|
|
||||||
_minidump.hide();
|
|
||||||
_saveReport.hide();
|
|
||||||
_send.hide();
|
|
||||||
_sendSkip.hide();
|
|
||||||
_continue.show();
|
|
||||||
} else {
|
} else {
|
||||||
h += _showReport.height() + padding + _yourReportName.height() + padding;
|
_networkSettings.hide();
|
||||||
_pleaseSendReport.show();
|
}
|
||||||
_yourReportName.show();
|
if (_updaterData->state == UpdatingNone
|
||||||
if (_reportUsername.isEmpty()) {
|
|| _updaterData->state == UpdatingLatest
|
||||||
|
|| _updaterData->state == UpdatingFail) {
|
||||||
|
h += padding + _updaterData->check.height() + padding;
|
||||||
|
if (_sendingState == SendingNoReport) {
|
||||||
|
_pleaseSendReport.hide();
|
||||||
|
_yourReportName.hide();
|
||||||
_includeUsername.hide();
|
_includeUsername.hide();
|
||||||
} else {
|
_getApp.hide();
|
||||||
h += _includeUsername.height() + padding;
|
|
||||||
_includeUsername.show();
|
|
||||||
}
|
|
||||||
if (_sendingState == SendingTooOld || _sendingState == SendingUnofficial) {
|
|
||||||
QString verStr = getReportField(qstr("version"), qstr("Version:"));
|
|
||||||
qint64 ver = verStr.isEmpty() ? 0 : verStr.toLongLong();
|
|
||||||
if (!ver || (ver == AppVersion) || (ver < 0 && (-ver / 1000) == AppVersion)) {
|
|
||||||
h += _getApp.height() + padding;
|
|
||||||
_getApp.show();
|
|
||||||
h -= _yourReportName.height() + padding; // hide report name
|
|
||||||
_yourReportName.hide();
|
|
||||||
if (!_reportUsername.isEmpty()) {
|
|
||||||
h -= _includeUsername.height() + padding;
|
|
||||||
_includeUsername.hide();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
_getApp.hide();
|
|
||||||
}
|
|
||||||
_showReport.hide();
|
_showReport.hide();
|
||||||
_report.hide();
|
_report.hide();
|
||||||
_minidump.hide();
|
_minidump.hide();
|
||||||
|
@ -623,48 +598,104 @@ void LastCrashedWindow::updateControls() {
|
||||||
_sendSkip.hide();
|
_sendSkip.hide();
|
||||||
_continue.show();
|
_continue.show();
|
||||||
} else {
|
} else {
|
||||||
_getApp.hide();
|
h += _showReport.height() + padding + _yourReportName.height() + padding;
|
||||||
if (_reportShown) {
|
_pleaseSendReport.show();
|
||||||
h += (_pleaseSendReport.height() * 12.5) + padding + (_minidumpName.isEmpty() ? 0 : (_minidump.height() + padding));
|
_yourReportName.show();
|
||||||
_report.show();
|
if (_reportUsername.isEmpty()) {
|
||||||
if (_minidumpName.isEmpty()) {
|
_includeUsername.hide();
|
||||||
_minidump.hide();
|
} else {
|
||||||
|
h += _includeUsername.height() + padding;
|
||||||
|
_includeUsername.show();
|
||||||
|
}
|
||||||
|
if (_sendingState == SendingTooOld || _sendingState == SendingUnofficial) {
|
||||||
|
QString verStr = getReportField(qstr("version"), qstr("Version:"));
|
||||||
|
qint64 ver = verStr.isEmpty() ? 0 : verStr.toLongLong();
|
||||||
|
if (!ver || (ver == AppVersion) || (ver < 0 && (-ver / 1000) == AppVersion)) {
|
||||||
|
h += _getApp.height() + padding;
|
||||||
|
_getApp.show();
|
||||||
|
h -= _yourReportName.height() + padding; // hide report name
|
||||||
|
_yourReportName.hide();
|
||||||
|
if (!_reportUsername.isEmpty()) {
|
||||||
|
h -= _includeUsername.height() + padding;
|
||||||
|
_includeUsername.hide();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
_minidump.show();
|
_getApp.hide();
|
||||||
}
|
|
||||||
if (_reportSaved || _sendingState == SendingFail || _sendingState == SendingProgress || _sendingState == SendingUploading) {
|
|
||||||
_saveReport.hide();
|
|
||||||
} else {
|
|
||||||
_saveReport.show();
|
|
||||||
}
|
}
|
||||||
_showReport.hide();
|
_showReport.hide();
|
||||||
} else {
|
|
||||||
_report.hide();
|
_report.hide();
|
||||||
_minidump.hide();
|
_minidump.hide();
|
||||||
_saveReport.hide();
|
_saveReport.hide();
|
||||||
if (_sendingState == SendingFail || _sendingState == SendingProgress || _sendingState == SendingUploading) {
|
|
||||||
_showReport.hide();
|
|
||||||
} else {
|
|
||||||
_showReport.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (_sendingState == SendingTooMany || _sendingState == SendingDone) {
|
|
||||||
_send.hide();
|
_send.hide();
|
||||||
_sendSkip.hide();
|
_sendSkip.hide();
|
||||||
_continue.show();
|
_continue.show();
|
||||||
} else {
|
} else {
|
||||||
if (_sendingState == SendingProgress || _sendingState == SendingUploading) {
|
_getApp.hide();
|
||||||
_send.hide();
|
if (_reportShown) {
|
||||||
|
h += (_pleaseSendReport.height() * 12.5) + padding + (_minidumpName.isEmpty() ? 0 : (_minidump.height() + padding));
|
||||||
|
_report.show();
|
||||||
|
if (_minidumpName.isEmpty()) {
|
||||||
|
_minidump.hide();
|
||||||
|
} else {
|
||||||
|
_minidump.show();
|
||||||
|
}
|
||||||
|
if (_reportSaved || _sendingState == SendingFail || _sendingState == SendingProgress || _sendingState == SendingUploading) {
|
||||||
|
_saveReport.hide();
|
||||||
|
} else {
|
||||||
|
_saveReport.show();
|
||||||
|
}
|
||||||
|
_showReport.hide();
|
||||||
} else {
|
} else {
|
||||||
_send.show();
|
_report.hide();
|
||||||
|
_minidump.hide();
|
||||||
|
_saveReport.hide();
|
||||||
|
if (_sendingState == SendingFail || _sendingState == SendingProgress || _sendingState == SendingUploading) {
|
||||||
|
_showReport.hide();
|
||||||
|
} else {
|
||||||
|
_showReport.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_sendingState == SendingTooMany || _sendingState == SendingDone) {
|
||||||
|
_send.hide();
|
||||||
|
_sendSkip.hide();
|
||||||
|
_continue.show();
|
||||||
|
} else {
|
||||||
|
if (_sendingState == SendingProgress || _sendingState == SendingUploading) {
|
||||||
|
_send.hide();
|
||||||
|
} else {
|
||||||
|
_send.show();
|
||||||
|
}
|
||||||
|
_sendSkip.show();
|
||||||
|
_continue.hide();
|
||||||
}
|
}
|
||||||
_sendSkip.show();
|
|
||||||
_continue.hide();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
_getApp.hide();
|
||||||
|
_pleaseSendReport.hide();
|
||||||
|
_yourReportName.hide();
|
||||||
|
_includeUsername.hide();
|
||||||
|
_showReport.hide();
|
||||||
|
_report.hide();
|
||||||
|
_minidump.hide();
|
||||||
|
_saveReport.hide();
|
||||||
|
_send.hide();
|
||||||
|
_sendSkip.hide();
|
||||||
|
_continue.hide();
|
||||||
}
|
}
|
||||||
} else {
|
_updaterData->check.hide();
|
||||||
_getApp.hide();
|
if (_updaterData->state == UpdatingCheck
|
||||||
|
|| _updaterData->state == UpdatingDownload) {
|
||||||
|
h += padding + _updaterData->skip.height() + padding;
|
||||||
|
_updaterData->skip.show();
|
||||||
|
} else {
|
||||||
|
_updaterData->skip.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
h += _networkSettings.height() + padding;
|
||||||
|
h += padding + _send.height() + padding;
|
||||||
|
if (_sendingState == SendingNoReport) {
|
||||||
_pleaseSendReport.hide();
|
_pleaseSendReport.hide();
|
||||||
_yourReportName.hide();
|
_yourReportName.hide();
|
||||||
_includeUsername.hide();
|
_includeUsername.hide();
|
||||||
|
@ -672,91 +703,68 @@ void LastCrashedWindow::updateControls() {
|
||||||
_report.hide();
|
_report.hide();
|
||||||
_minidump.hide();
|
_minidump.hide();
|
||||||
_saveReport.hide();
|
_saveReport.hide();
|
||||||
_send.hide();
|
|
||||||
_sendSkip.hide();
|
|
||||||
_continue.hide();
|
|
||||||
}
|
|
||||||
_updatingCheck.hide();
|
|
||||||
if (_updatingState == UpdatingCheck || _updatingState == UpdatingDownload) {
|
|
||||||
h += padding + _updatingSkip.height() + padding;
|
|
||||||
_updatingSkip.show();
|
|
||||||
} else {
|
|
||||||
_updatingSkip.hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
h += _networkSettings.height() + padding;
|
|
||||||
h += padding + _send.height() + padding;
|
|
||||||
if (_sendingState == SendingNoReport) {
|
|
||||||
_pleaseSendReport.hide();
|
|
||||||
_yourReportName.hide();
|
|
||||||
_includeUsername.hide();
|
|
||||||
_showReport.hide();
|
|
||||||
_report.hide();
|
|
||||||
_minidump.hide();
|
|
||||||
_saveReport.hide();
|
|
||||||
_send.hide();
|
|
||||||
_sendSkip.hide();
|
|
||||||
_continue.show();
|
|
||||||
_networkSettings.hide();
|
|
||||||
} else {
|
|
||||||
h += _showReport.height() + padding + _yourReportName.height() + padding;
|
|
||||||
_pleaseSendReport.show();
|
|
||||||
_yourReportName.show();
|
|
||||||
if (_reportUsername.isEmpty()) {
|
|
||||||
_includeUsername.hide();
|
|
||||||
} else {
|
|
||||||
h += _includeUsername.height() + padding;
|
|
||||||
_includeUsername.show();
|
|
||||||
}
|
|
||||||
if (_reportShown) {
|
|
||||||
h += (_pleaseSendReport.height() * 12.5) + padding + (_minidumpName.isEmpty() ? 0 : (_minidump.height() + padding));
|
|
||||||
_report.show();
|
|
||||||
if (_minidumpName.isEmpty()) {
|
|
||||||
_minidump.hide();
|
|
||||||
} else {
|
|
||||||
_minidump.show();
|
|
||||||
}
|
|
||||||
_showReport.hide();
|
|
||||||
if (_reportSaved || _sendingState == SendingFail || _sendingState == SendingProgress || _sendingState == SendingUploading) {
|
|
||||||
_saveReport.hide();
|
|
||||||
} else {
|
|
||||||
_saveReport.show();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
_report.hide();
|
|
||||||
_minidump.hide();
|
|
||||||
_saveReport.hide();
|
|
||||||
if (_sendingState == SendingFail || _sendingState == SendingProgress || _sendingState == SendingUploading) {
|
|
||||||
_showReport.hide();
|
|
||||||
} else {
|
|
||||||
_showReport.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (_sendingState == SendingDone) {
|
|
||||||
_send.hide();
|
_send.hide();
|
||||||
_sendSkip.hide();
|
_sendSkip.hide();
|
||||||
_continue.show();
|
_continue.show();
|
||||||
_networkSettings.hide();
|
_networkSettings.hide();
|
||||||
} else {
|
} else {
|
||||||
if (_sendingState == SendingProgress || _sendingState == SendingUploading) {
|
h += _showReport.height() + padding + _yourReportName.height() + padding;
|
||||||
|
_pleaseSendReport.show();
|
||||||
|
_yourReportName.show();
|
||||||
|
if (_reportUsername.isEmpty()) {
|
||||||
|
_includeUsername.hide();
|
||||||
|
} else {
|
||||||
|
h += _includeUsername.height() + padding;
|
||||||
|
_includeUsername.show();
|
||||||
|
}
|
||||||
|
if (_reportShown) {
|
||||||
|
h += (_pleaseSendReport.height() * 12.5) + padding + (_minidumpName.isEmpty() ? 0 : (_minidump.height() + padding));
|
||||||
|
_report.show();
|
||||||
|
if (_minidumpName.isEmpty()) {
|
||||||
|
_minidump.hide();
|
||||||
|
} else {
|
||||||
|
_minidump.show();
|
||||||
|
}
|
||||||
|
_showReport.hide();
|
||||||
|
if (_reportSaved || _sendingState == SendingFail || _sendingState == SendingProgress || _sendingState == SendingUploading) {
|
||||||
|
_saveReport.hide();
|
||||||
|
} else {
|
||||||
|
_saveReport.show();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_report.hide();
|
||||||
|
_minidump.hide();
|
||||||
|
_saveReport.hide();
|
||||||
|
if (_sendingState == SendingFail || _sendingState == SendingProgress || _sendingState == SendingUploading) {
|
||||||
|
_showReport.hide();
|
||||||
|
} else {
|
||||||
|
_showReport.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_sendingState == SendingDone) {
|
||||||
_send.hide();
|
_send.hide();
|
||||||
} else {
|
_sendSkip.hide();
|
||||||
_send.show();
|
_continue.show();
|
||||||
}
|
|
||||||
_sendSkip.show();
|
|
||||||
if (_sendingState == SendingFail) {
|
|
||||||
_networkSettings.show();
|
|
||||||
} else {
|
|
||||||
_networkSettings.hide();
|
_networkSettings.hide();
|
||||||
|
} else {
|
||||||
|
if (_sendingState == SendingProgress || _sendingState == SendingUploading) {
|
||||||
|
_send.hide();
|
||||||
|
} else {
|
||||||
|
_send.show();
|
||||||
|
}
|
||||||
|
_sendSkip.show();
|
||||||
|
if (_sendingState == SendingFail) {
|
||||||
|
_networkSettings.show();
|
||||||
|
} else {
|
||||||
|
_networkSettings.hide();
|
||||||
|
}
|
||||||
|
_continue.hide();
|
||||||
}
|
}
|
||||||
_continue.hide();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
_getApp.show();
|
_getApp.show();
|
||||||
h += _networkSettings.height() + padding;
|
h += _networkSettings.height() + padding;
|
||||||
#endif // else for !TDESKTOP_DISABLE_AUTOUPDATE
|
}
|
||||||
|
|
||||||
QRect scr(QApplication::primaryScreen()->availableGeometry());
|
QRect scr(QApplication::primaryScreen()->availableGeometry());
|
||||||
QSize s(2 * padding + QFontMetrics(_label.font()).width(qsl("Last time Telegram Desktop was not closed properly.")) + padding + _networkSettings.width(), h);
|
QSize s(2 * padding + QFontMetrics(_label.font()).width(qsl("Last time Telegram Desktop was not closed properly.")) + padding + _networkSettings.width(), h);
|
||||||
|
@ -801,24 +809,27 @@ void LastCrashedWindow::onNetworkSettingsSaved(
|
||||||
|
|
||||||
Sandbox::refreshGlobalProxy();
|
Sandbox::refreshGlobalProxy();
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
if (_updaterData
|
||||||
if ((_updatingState == UpdatingFail && (_sendingState == SendingNoReport || _sendingState == SendingUpdateCheck)) || (_updatingState == UpdatingCheck)) {
|
&& ((_updaterData->state == UpdatingCheck)
|
||||||
|
|| (_updaterData->state == UpdatingFail
|
||||||
|
&& (_sendingState == SendingNoReport
|
||||||
|
|| _sendingState == SendingUpdateCheck)))) {
|
||||||
Core::UpdateChecker checker;
|
Core::UpdateChecker checker;
|
||||||
checker.stop();
|
checker.stop();
|
||||||
cSetLastUpdateCheck(0);
|
cSetLastUpdateCheck(0);
|
||||||
checker.start();
|
checker.start();
|
||||||
} else
|
} else if (_sendingState == SendingFail
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|| _sendingState == SendingProgress) {
|
||||||
if (_sendingState == SendingFail || _sendingState == SendingProgress) {
|
|
||||||
onSendReport();
|
onSendReport();
|
||||||
}
|
}
|
||||||
activate();
|
activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
void LastCrashedWindow::setUpdatingState(UpdatingState state, bool force) {
|
void LastCrashedWindow::setUpdatingState(UpdatingState state, bool force) {
|
||||||
if (_updatingState != state || force) {
|
Expects(_updaterData != nullptr);
|
||||||
_updatingState = state;
|
|
||||||
|
if (_updaterData->state != state || force) {
|
||||||
|
_updaterData->state = state;
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case UpdatingLatest:
|
case UpdatingLatest:
|
||||||
_updating.setText(qsl("Latest version is installed."));
|
_updating.setText(qsl("Latest version is installed."));
|
||||||
|
@ -850,29 +861,35 @@ void LastCrashedWindow::setUpdatingState(UpdatingState state, bool force) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LastCrashedWindow::setDownloadProgress(qint64 ready, qint64 total) {
|
void LastCrashedWindow::setDownloadProgress(qint64 ready, qint64 total) {
|
||||||
|
Expects(_updaterData != nullptr);
|
||||||
|
|
||||||
qint64 readyTenthMb = (ready * 10 / (1024 * 1024)), totalTenthMb = (total * 10 / (1024 * 1024));
|
qint64 readyTenthMb = (ready * 10 / (1024 * 1024)), totalTenthMb = (total * 10 / (1024 * 1024));
|
||||||
QString readyStr = QString::number(readyTenthMb / 10) + '.' + QString::number(readyTenthMb % 10);
|
QString readyStr = QString::number(readyTenthMb / 10) + '.' + QString::number(readyTenthMb % 10);
|
||||||
QString totalStr = QString::number(totalTenthMb / 10) + '.' + QString::number(totalTenthMb % 10);
|
QString totalStr = QString::number(totalTenthMb / 10) + '.' + QString::number(totalTenthMb % 10);
|
||||||
QString res = qsl("Downloading update {ready} / {total} MB..").replace(qstr("{ready}"), readyStr).replace(qstr("{total}"), totalStr);
|
QString res = qsl("Downloading update {ready} / {total} MB..").replace(qstr("{ready}"), readyStr).replace(qstr("{total}"), totalStr);
|
||||||
if (_newVersionDownload != res) {
|
if (_updaterData->newVersionDownload != res) {
|
||||||
_newVersionDownload = res;
|
_updaterData->newVersionDownload = res;
|
||||||
_updating.setText(_newVersionDownload);
|
_updating.setText(_updaterData->newVersionDownload);
|
||||||
updateControls();
|
updateControls();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LastCrashedWindow::onUpdateRetry() {
|
void LastCrashedWindow::onUpdateRetry() {
|
||||||
|
Expects(_updaterData != nullptr);
|
||||||
|
|
||||||
cSetLastUpdateCheck(0);
|
cSetLastUpdateCheck(0);
|
||||||
Core::UpdateChecker checker;
|
Core::UpdateChecker checker;
|
||||||
checker.start();
|
checker.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LastCrashedWindow::onUpdateSkip() {
|
void LastCrashedWindow::onUpdateSkip() {
|
||||||
|
Expects(_updaterData != nullptr);
|
||||||
|
|
||||||
if (_sendingState == SendingNoReport) {
|
if (_sendingState == SendingNoReport) {
|
||||||
onContinue();
|
onContinue();
|
||||||
} else {
|
} else {
|
||||||
if (_updatingState == UpdatingCheck
|
if (_updaterData->state == UpdatingCheck
|
||||||
|| _updatingState == UpdatingDownload) {
|
|| _updaterData->state == UpdatingDownload) {
|
||||||
Core::UpdateChecker checker;
|
Core::UpdateChecker checker;
|
||||||
checker.stop();
|
checker.stop();
|
||||||
setUpdatingState(UpdatingFail);
|
setUpdatingState(UpdatingFail);
|
||||||
|
@ -883,26 +900,35 @@ void LastCrashedWindow::onUpdateSkip() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LastCrashedWindow::onUpdateChecking() {
|
void LastCrashedWindow::onUpdateChecking() {
|
||||||
|
Expects(_updaterData != nullptr);
|
||||||
|
|
||||||
setUpdatingState(UpdatingCheck);
|
setUpdatingState(UpdatingCheck);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LastCrashedWindow::onUpdateLatest() {
|
void LastCrashedWindow::onUpdateLatest() {
|
||||||
|
Expects(_updaterData != nullptr);
|
||||||
|
|
||||||
setUpdatingState(UpdatingLatest);
|
setUpdatingState(UpdatingLatest);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LastCrashedWindow::onUpdateDownloading(qint64 ready, qint64 total) {
|
void LastCrashedWindow::onUpdateDownloading(qint64 ready, qint64 total) {
|
||||||
|
Expects(_updaterData != nullptr);
|
||||||
|
|
||||||
setUpdatingState(UpdatingDownload);
|
setUpdatingState(UpdatingDownload);
|
||||||
setDownloadProgress(ready, total);
|
setDownloadProgress(ready, total);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LastCrashedWindow::onUpdateReady() {
|
void LastCrashedWindow::onUpdateReady() {
|
||||||
|
Expects(_updaterData != nullptr);
|
||||||
|
|
||||||
setUpdatingState(UpdatingReady);
|
setUpdatingState(UpdatingReady);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LastCrashedWindow::onUpdateFailed() {
|
void LastCrashedWindow::onUpdateFailed() {
|
||||||
|
Expects(_updaterData != nullptr);
|
||||||
|
|
||||||
setUpdatingState(UpdatingFail);
|
setUpdatingState(UpdatingFail);
|
||||||
}
|
}
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
void LastCrashedWindow::onContinue() {
|
void LastCrashedWindow::onContinue() {
|
||||||
if (CrashReports::Restart() == CrashReports::CantOpen) {
|
if (CrashReports::Restart() == CrashReports::CantOpen) {
|
||||||
|
@ -973,36 +999,37 @@ void LastCrashedWindow::resizeEvent(QResizeEvent *e) {
|
||||||
|
|
||||||
_updating.move(padding, padding * 2 + _networkSettings.height() + (_networkSettings.height() - _updating.height()) / 2);
|
_updating.move(padding, padding * 2 + _networkSettings.height() + (_networkSettings.height() - _updating.height()) / 2);
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
if (_updaterData) {
|
||||||
_pleaseSendReport.move(padding, padding * 2 + _networkSettings.height() + _networkSettings.height() + padding + (_showReport.height() - _pleaseSendReport.height()) / 2);
|
_pleaseSendReport.move(padding, padding * 2 + _networkSettings.height() + _networkSettings.height() + padding + (_showReport.height() - _pleaseSendReport.height()) / 2);
|
||||||
_showReport.move(padding * 2 + _pleaseSendReport.width(), padding * 2 + _networkSettings.height() + _networkSettings.height() + padding);
|
_showReport.move(padding * 2 + _pleaseSendReport.width(), padding * 2 + _networkSettings.height() + _networkSettings.height() + padding);
|
||||||
_yourReportName.move(padding, _showReport.y() + _showReport.height() + padding);
|
_yourReportName.move(padding, _showReport.y() + _showReport.height() + padding);
|
||||||
_includeUsername.move(padding, _yourReportName.y() + _yourReportName.height() + padding);
|
_includeUsername.move(padding, _yourReportName.y() + _yourReportName.height() + padding);
|
||||||
_getApp.move((width() - _getApp.width()) / 2, _showReport.y() + _showReport.height() + padding);
|
_getApp.move((width() - _getApp.width()) / 2, _showReport.y() + _showReport.height() + padding);
|
||||||
|
|
||||||
if (_sendingState == SendingFail || _sendingState == SendingProgress) {
|
if (_sendingState == SendingFail || _sendingState == SendingProgress) {
|
||||||
_networkSettings.move(padding * 2 + _pleaseSendReport.width(), padding * 2 + _networkSettings.height() + _networkSettings.height() + padding);
|
_networkSettings.move(padding * 2 + _pleaseSendReport.width(), padding * 2 + _networkSettings.height() + _networkSettings.height() + padding);
|
||||||
|
} else {
|
||||||
|
_networkSettings.move(padding * 2 + _updating.width(), padding * 2 + _networkSettings.height());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_updaterData->state == UpdatingCheck
|
||||||
|
|| _updaterData->state == UpdatingDownload) {
|
||||||
|
_updaterData->check.move(width() - padding - _updaterData->check.width(), height() - padding - _updaterData->check.height());
|
||||||
|
_updaterData->skip.move(width() - padding - _updaterData->skip.width(), height() - padding - _updaterData->skip.height());
|
||||||
|
} else {
|
||||||
|
_updaterData->check.move(width() - padding - _updaterData->check.width(), height() - padding - _updaterData->check.height());
|
||||||
|
_updaterData->skip.move(width() - padding - _updaterData->check.width() - padding - _updaterData->skip.width(), height() - padding - _updaterData->skip.height());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
_networkSettings.move(padding * 2 + _updating.width(), padding * 2 + _networkSettings.height());
|
_getApp.move((width() - _getApp.width()) / 2, _updating.y() + _updating.height() + padding);
|
||||||
|
|
||||||
|
_pleaseSendReport.move(padding, padding * 2 + _networkSettings.height() + _networkSettings.height() + padding + _getApp.height() + padding + (_showReport.height() - _pleaseSendReport.height()) / 2);
|
||||||
|
_showReport.move(padding * 2 + _pleaseSendReport.width(), padding * 2 + _networkSettings.height() + _networkSettings.height() + padding + _getApp.height() + padding);
|
||||||
|
_yourReportName.move(padding, _showReport.y() + _showReport.height() + padding);
|
||||||
|
_includeUsername.move(padding, _yourReportName.y() + _yourReportName.height() + padding);
|
||||||
|
|
||||||
|
_networkSettings.move(padding * 2 + _pleaseSendReport.width(), padding * 2 + _networkSettings.height() + _networkSettings.height() + padding + _getApp.height() + padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_updatingState == UpdatingCheck || _updatingState == UpdatingDownload) {
|
|
||||||
_updatingCheck.move(width() - padding - _updatingCheck.width(), height() - padding - _updatingCheck.height());
|
|
||||||
_updatingSkip.move(width() - padding - _updatingSkip.width(), height() - padding - _updatingSkip.height());
|
|
||||||
} else {
|
|
||||||
_updatingCheck.move(width() - padding - _updatingCheck.width(), height() - padding - _updatingCheck.height());
|
|
||||||
_updatingSkip.move(width() - padding - _updatingCheck.width() - padding - _updatingSkip.width(), height() - padding - _updatingSkip.height());
|
|
||||||
}
|
|
||||||
#else // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
_getApp.move((width() - _getApp.width()) / 2, _updating.y() + _updating.height() + padding);
|
|
||||||
|
|
||||||
_pleaseSendReport.move(padding, padding * 2 + _networkSettings.height() + _networkSettings.height() + padding + _getApp.height() + padding + (_showReport.height() - _pleaseSendReport.height()) / 2);
|
|
||||||
_showReport.move(padding * 2 + _pleaseSendReport.width(), padding * 2 + _networkSettings.height() + _networkSettings.height() + padding + _getApp.height() + padding);
|
|
||||||
_yourReportName.move(padding, _showReport.y() + _showReport.height() + padding);
|
|
||||||
_includeUsername.move(padding, _yourReportName.y() + _yourReportName.height() + padding);
|
|
||||||
|
|
||||||
_networkSettings.move(padding * 2 + _pleaseSendReport.width(), padding * 2 + _networkSettings.height() + _networkSettings.height() + padding + _getApp.height() + padding);
|
|
||||||
#endif // else for !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
if (_reportUsername.isEmpty()) {
|
if (_reportUsername.isEmpty()) {
|
||||||
_report.setGeometry(padding, _yourReportName.y() + _yourReportName.height() + padding, width() - 2 * padding, _pleaseSendReport.height() * 12.5);
|
_report.setGeometry(padding, _yourReportName.y() + _yourReportName.height() + padding, width() - 2 * padding, _pleaseSendReport.height() * 12.5);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -95,7 +95,6 @@ public slots:
|
||||||
void onSendingFinished();
|
void onSendingFinished();
|
||||||
void onSendingProgress(qint64 uploaded, qint64 total);
|
void onSendingProgress(qint64 uploaded, qint64 total);
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
void onUpdateRetry();
|
void onUpdateRetry();
|
||||||
void onUpdateSkip();
|
void onUpdateSkip();
|
||||||
|
|
||||||
|
@ -104,7 +103,6 @@ public slots:
|
||||||
void onUpdateDownloading(qint64 ready, qint64 total);
|
void onUpdateDownloading(qint64 ready, qint64 total);
|
||||||
void onUpdateReady();
|
void onUpdateReady();
|
||||||
void onUpdateFailed();
|
void onUpdateFailed();
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *e);
|
void closeEvent(QCloseEvent *e);
|
||||||
|
@ -153,8 +151,6 @@ private:
|
||||||
QNetworkAccessManager _sendManager;
|
QNetworkAccessManager _sendManager;
|
||||||
QNetworkReply *_checkReply, *_sendReply;
|
QNetworkReply *_checkReply, *_sendReply;
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
PreLaunchButton _updatingCheck, _updatingSkip;
|
|
||||||
enum UpdatingState {
|
enum UpdatingState {
|
||||||
UpdatingNone,
|
UpdatingNone,
|
||||||
UpdatingCheck,
|
UpdatingCheck,
|
||||||
|
@ -163,12 +159,17 @@ private:
|
||||||
UpdatingFail,
|
UpdatingFail,
|
||||||
UpdatingReady
|
UpdatingReady
|
||||||
};
|
};
|
||||||
UpdatingState _updatingState;
|
struct UpdaterData {
|
||||||
QString _newVersionDownload;
|
UpdaterData(QWidget *buttonParent);
|
||||||
|
|
||||||
|
PreLaunchButton check, skip;
|
||||||
|
UpdatingState state;
|
||||||
|
QString newVersionDownload;
|
||||||
|
};
|
||||||
|
const std::unique_ptr<UpdaterData> _updaterData;
|
||||||
|
|
||||||
void setUpdatingState(UpdatingState state, bool force = false);
|
void setUpdatingState(UpdatingState state, bool force = false);
|
||||||
void setDownloadProgress(qint64 ready, qint64 total);
|
void setDownloadProgress(qint64 ready, qint64 total);
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
rpl::lifetime _lifetime;
|
rpl::lifetime _lifetime;
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "platform/platform_specific.h"
|
#include "platform/platform_specific.h"
|
||||||
#include "core/crash_reports.h"
|
#include "core/crash_reports.h"
|
||||||
#include "core/main_queue_processor.h"
|
#include "core/main_queue_processor.h"
|
||||||
|
#include "core/update_checker.h"
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
@ -61,15 +62,12 @@ int Launcher::exec() {
|
||||||
|
|
||||||
DEBUG_LOG(("Telegram finished, result: %1").arg(result));
|
DEBUG_LOG(("Telegram finished, result: %1").arg(result));
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
if (!UpdaterDisabled() && cRestartingUpdate()) {
|
||||||
if (cRestartingUpdate()) {
|
|
||||||
DEBUG_LOG(("Application Info: executing updater to install update..."));
|
DEBUG_LOG(("Application Info: executing updater to install update..."));
|
||||||
if (!launchUpdater(UpdaterLaunch::PerformUpdate)) {
|
if (!launchUpdater(UpdaterLaunch::PerformUpdate)) {
|
||||||
psDeleteDir(cWorkingDir() + qsl("tupdates/temp"));
|
psDeleteDir(cWorkingDir() + qsl("tupdates/temp"));
|
||||||
}
|
}
|
||||||
} else
|
} else if (cRestarting()) {
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
if (cRestarting()) {
|
|
||||||
DEBUG_LOG(("Application Info: executing Telegram, because of restart..."));
|
DEBUG_LOG(("Application Info: executing Telegram, because of restart..."));
|
||||||
launchUpdater(UpdaterLaunch::JustRelaunch);
|
launchUpdater(UpdaterLaunch::JustRelaunch);
|
||||||
}
|
}
|
||||||
|
@ -178,19 +176,20 @@ void Launcher::processArguments() {
|
||||||
AllLeftValues,
|
AllLeftValues,
|
||||||
};
|
};
|
||||||
auto parseMap = std::map<QByteArray, KeyFormat> {
|
auto parseMap = std::map<QByteArray, KeyFormat> {
|
||||||
{ "-testmode" , KeyFormat::NoValues },
|
{ "-testmode" , KeyFormat::NoValues },
|
||||||
{ "-debug" , KeyFormat::NoValues },
|
{ "-debug" , KeyFormat::NoValues },
|
||||||
{ "-many" , KeyFormat::NoValues },
|
{ "-many" , KeyFormat::NoValues },
|
||||||
{ "-key" , KeyFormat::OneValue },
|
{ "-key" , KeyFormat::OneValue },
|
||||||
{ "-autostart" , KeyFormat::NoValues },
|
{ "-autostart" , KeyFormat::NoValues },
|
||||||
{ "-fixprevious", KeyFormat::NoValues },
|
{ "-fixprevious" , KeyFormat::NoValues },
|
||||||
{ "-cleanup" , KeyFormat::NoValues },
|
{ "-cleanup" , KeyFormat::NoValues },
|
||||||
{ "-noupdate" , KeyFormat::NoValues },
|
{ "-noupdate" , KeyFormat::NoValues },
|
||||||
{ "-tosettings" , KeyFormat::NoValues },
|
{ "-externalupdater", KeyFormat::NoValues },
|
||||||
{ "-startintray", KeyFormat::NoValues },
|
{ "-tosettings" , KeyFormat::NoValues },
|
||||||
{ "-sendpath" , KeyFormat::AllLeftValues },
|
{ "-startintray" , KeyFormat::NoValues },
|
||||||
{ "-workdir" , KeyFormat::OneValue },
|
{ "-sendpath" , KeyFormat::AllLeftValues },
|
||||||
{ "--" , KeyFormat::OneValue },
|
{ "-workdir" , KeyFormat::OneValue },
|
||||||
|
{ "--" , KeyFormat::OneValue },
|
||||||
};
|
};
|
||||||
auto parseResult = QMap<QByteArray, QStringList>();
|
auto parseResult = QMap<QByteArray, QStringList>();
|
||||||
auto parsingKey = QByteArray();
|
auto parsingKey = QByteArray();
|
||||||
|
@ -215,6 +214,9 @@ void Launcher::processArguments() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parseResult.contains("-externalupdater")) {
|
||||||
|
SetUpdaterDisabledAtStartup();
|
||||||
|
}
|
||||||
gTestMode = parseResult.contains("-testmode");
|
gTestMode = parseResult.contains("-testmode");
|
||||||
Logs::SetDebugEnabled(parseResult.contains("-debug"));
|
Logs::SetDebugEnabled(parseResult.contains("-debug"));
|
||||||
gManyInstance = parseResult.contains("-many");
|
gManyInstance = parseResult.contains("-many");
|
||||||
|
|
|
@ -32,9 +32,6 @@ extern "C" {
|
||||||
#endif // else of Q_OS_WIN
|
#endif // else of Q_OS_WIN
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
constexpr auto kUpdaterTimeout = 10 * TimeMs(1000);
|
constexpr auto kUpdaterTimeout = 10 * TimeMs(1000);
|
||||||
|
@ -42,6 +39,12 @@ constexpr auto kMaxResponseSize = 1024 * 1024;
|
||||||
constexpr auto kMaxUpdateSize = 256 * 1024 * 1024;
|
constexpr auto kMaxUpdateSize = 256 * 1024 * 1024;
|
||||||
constexpr auto kChunkSize = 128 * 1024;
|
constexpr auto kChunkSize = 128 * 1024;
|
||||||
|
|
||||||
|
#ifdef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
|
bool UpdaterIsDisabled = true;
|
||||||
|
#else // TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
|
bool UpdaterIsDisabled = false;
|
||||||
|
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
|
|
||||||
std::weak_ptr<Updater> UpdaterInstance;
|
std::weak_ptr<Updater> UpdaterInstance;
|
||||||
|
|
||||||
using ErrorSignal = void(QNetworkReply::*)(QNetworkReply::NetworkError);
|
using ErrorSignal = void(QNetworkReply::*)(QNetworkReply::NetworkError);
|
||||||
|
@ -1560,6 +1563,16 @@ Fn<void(const RPCError &)> MtpLoader::failHandler() {
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
bool UpdaterDisabled() {
|
||||||
|
return UpdaterIsDisabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetUpdaterDisabledAtStartup() {
|
||||||
|
Expects(UpdaterInstance.lock() == nullptr);
|
||||||
|
|
||||||
|
UpdaterIsDisabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
class Updater : public base::has_weak_ptr {
|
class Updater : public base::has_weak_ptr {
|
||||||
public:
|
public:
|
||||||
Updater();
|
Updater();
|
||||||
|
@ -2099,36 +2112,32 @@ bool checkReadyUpdate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateApplication() {
|
void UpdateApplication() {
|
||||||
cSetLastUpdateCheck(0);
|
if (UpdaterDisabled()) {
|
||||||
Core::UpdateChecker().start();
|
const auto url = [&] {
|
||||||
if (const auto window = App::wnd()) {
|
#ifdef OS_WIN_STORE
|
||||||
auto settings = Box<Settings::Widget>();
|
return "https://www.microsoft.com/en-us/store/p/telegram-desktop/9nztwsqntd0s";
|
||||||
const auto weak = make_weak(settings.data());
|
#elif defined OS_MAC_STORE // OS_WIN_STORE
|
||||||
window->showSpecialLayer(std::move(settings), anim::type::normal);
|
return "https://itunes.apple.com/ae/app/telegram-desktop/id946399090";
|
||||||
if (weak) {
|
#else // OS_WIN_STORE || OS_MAC_STORE
|
||||||
weak->scrollToUpdateRow();
|
return "https://desktop.telegram.org";
|
||||||
|
#endif // OS_WIN_STORE || OS_MAC_STORE
|
||||||
|
}();
|
||||||
|
UrlClickHandler::Open(url);
|
||||||
|
} else {
|
||||||
|
cSetLastUpdateCheck(0);
|
||||||
|
Core::UpdateChecker().start();
|
||||||
|
if (const auto window = App::wnd()) {
|
||||||
|
auto settings = Box<Settings::Widget>();
|
||||||
|
const auto weak = make_weak(settings.data());
|
||||||
|
window->showSpecialLayer(std::move(settings), anim::type::normal);
|
||||||
|
if (weak) {
|
||||||
|
weak->scrollToUpdateRow();
|
||||||
|
}
|
||||||
|
window->showFromTray();
|
||||||
}
|
}
|
||||||
window->showFromTray();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
void UpdateApplication() {
|
|
||||||
const auto url = [&] {
|
|
||||||
#ifdef OS_WIN_STORE
|
|
||||||
return "https://www.microsoft.com/en-us/store/p/telegram-desktop/9nztwsqntd0s";
|
|
||||||
#elif defined OS_MAC_STORE // OS_WIN_STORE
|
|
||||||
return "https://itunes.apple.com/ae/app/telegram-desktop/id946399090";
|
|
||||||
#else // OS_WIN_STORE || OS_MAC_STORE
|
|
||||||
return "https://desktop.telegram.org";
|
|
||||||
#endif // OS_WIN_STORE || OS_MAC_STORE
|
|
||||||
}();
|
|
||||||
UrlClickHandler::doOpen(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
QString countBetaVersionSignature(uint64 version) { // duplicated in packer.cpp
|
QString countBetaVersionSignature(uint64 version) { // duplicated in packer.cpp
|
||||||
if (cBetaPrivateKey().isEmpty()) {
|
if (cBetaPrivateKey().isEmpty()) {
|
||||||
LOG(("Error: Trying to count beta version signature without beta private key!"));
|
LOG(("Error: Trying to count beta version signature without beta private key!"));
|
||||||
|
|
|
@ -13,7 +13,8 @@ class Instance;
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
bool UpdaterDisabled();
|
||||||
|
void SetUpdaterDisabledAtStartup();
|
||||||
|
|
||||||
class Updater;
|
class Updater;
|
||||||
|
|
||||||
|
@ -53,13 +54,6 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
bool checkReadyUpdate();
|
bool checkReadyUpdate();
|
||||||
|
|
||||||
#else // TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
class UpdateChecker {
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
void UpdateApplication();
|
void UpdateApplication();
|
||||||
QString countBetaVersionSignature(uint64 version);
|
QString countBetaVersionSignature(uint64 version);
|
||||||
|
|
||||||
|
|
|
@ -120,17 +120,17 @@ DialogsWidget::DialogsWidget(QWidget *parent, not_null<Window::Controller*> cont
|
||||||
connect(_filter, SIGNAL(changed()), this, SLOT(onFilterUpdate()));
|
connect(_filter, SIGNAL(changed()), this, SLOT(onFilterUpdate()));
|
||||||
connect(_filter, SIGNAL(cursorPositionChanged(int,int)), this, SLOT(onFilterCursorMoved(int,int)));
|
connect(_filter, SIGNAL(cursorPositionChanged(int,int)), this, SLOT(onFilterCursorMoved(int,int)));
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
if (!Core::UpdaterDisabled()) {
|
||||||
Core::UpdateChecker checker;
|
Core::UpdateChecker checker;
|
||||||
rpl::merge(
|
rpl::merge(
|
||||||
rpl::single(rpl::empty_value()),
|
rpl::single(rpl::empty_value()),
|
||||||
checker.isLatest(),
|
checker.isLatest(),
|
||||||
checker.failed(),
|
checker.failed(),
|
||||||
checker.ready()
|
checker.ready()
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
checkUpdateStatus();
|
checkUpdateStatus();
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
}
|
||||||
|
|
||||||
subscribe(Adaptive::Changed(), [this] { updateForwardBar(); });
|
subscribe(Adaptive::Changed(), [this] { updateForwardBar(); });
|
||||||
|
|
||||||
|
@ -181,8 +181,9 @@ void DialogsWidget::setupConnectingWidget() {
|
||||||
Window::AdaptiveIsOneColumn());
|
Window::AdaptiveIsOneColumn());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
void DialogsWidget::checkUpdateStatus() {
|
void DialogsWidget::checkUpdateStatus() {
|
||||||
|
Expects(!Core::UpdaterDisabled());
|
||||||
|
|
||||||
using Checker = Core::UpdateChecker;
|
using Checker = Core::UpdateChecker;
|
||||||
if (Checker().state() == Checker::State::Ready) {
|
if (Checker().state() == Checker::State::Ready) {
|
||||||
if (_updateTelegram) return;
|
if (_updateTelegram) return;
|
||||||
|
@ -198,7 +199,6 @@ void DialogsWidget::checkUpdateStatus() {
|
||||||
}
|
}
|
||||||
updateControlsGeometry();
|
updateControlsGeometry();
|
||||||
}
|
}
|
||||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
void DialogsWidget::activate() {
|
void DialogsWidget::activate() {
|
||||||
_filter->setFocus();
|
_filter->setFocus();
|
||||||
|
|
|
@ -164,10 +164,7 @@ private:
|
||||||
void updateSearchFromVisibility(bool fast = false);
|
void updateSearchFromVisibility(bool fast = false);
|
||||||
void updateControlsGeometry();
|
void updateControlsGeometry();
|
||||||
void updateForwardBar();
|
void updateForwardBar();
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
void checkUpdateStatus();
|
void checkUpdateStatus();
|
||||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
bool dialogsFailed(const RPCError &error, mtpRequestId req);
|
bool dialogsFailed(const RPCError &error, mtpRequestId req);
|
||||||
bool searchFailed(DialogsSearchRequestType type, const RPCError &error, mtpRequestId req);
|
bool searchFailed(DialogsSearchRequestType type, const RPCError &error, mtpRequestId req);
|
||||||
|
|
|
@ -84,20 +84,20 @@ Widget::Widget(QWidget *parent) : RpWidget(parent)
|
||||||
|
|
||||||
cSetPasswordRecovered(false);
|
cSetPasswordRecovered(false);
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
if (!Core::UpdaterDisabled()) {
|
||||||
Core::UpdateChecker checker;
|
Core::UpdateChecker checker;
|
||||||
checker.isLatest() | rpl::start_with_next([=] {
|
checker.isLatest() | rpl::start_with_next([=] {
|
||||||
|
onCheckUpdateStatus();
|
||||||
|
}, lifetime());
|
||||||
|
checker.failed() | rpl::start_with_next([=] {
|
||||||
|
onCheckUpdateStatus();
|
||||||
|
}, lifetime());
|
||||||
|
checker.ready() | rpl::start_with_next([=] {
|
||||||
|
onCheckUpdateStatus();
|
||||||
|
}, lifetime());
|
||||||
|
checker.start();
|
||||||
onCheckUpdateStatus();
|
onCheckUpdateStatus();
|
||||||
}, lifetime());
|
}
|
||||||
checker.failed() | rpl::start_with_next([=] {
|
|
||||||
onCheckUpdateStatus();
|
|
||||||
}, lifetime());
|
|
||||||
checker.ready() | rpl::start_with_next([=] {
|
|
||||||
onCheckUpdateStatus();
|
|
||||||
}, lifetime());
|
|
||||||
checker.start();
|
|
||||||
onCheckUpdateStatus();
|
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::setupConnectingWidget() {
|
void Widget::setupConnectingWidget() {
|
||||||
|
@ -148,8 +148,9 @@ void Widget::createLanguageLink() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
void Widget::onCheckUpdateStatus() {
|
void Widget::onCheckUpdateStatus() {
|
||||||
|
Expects(!Core::UpdaterDisabled());
|
||||||
|
|
||||||
if (Core::UpdateChecker().state() == Core::UpdateChecker::State::Ready) {
|
if (Core::UpdateChecker().state() == Core::UpdateChecker::State::Ready) {
|
||||||
if (_update) return;
|
if (_update) return;
|
||||||
_update.create(
|
_update.create(
|
||||||
|
@ -173,7 +174,6 @@ void Widget::onCheckUpdateStatus() {
|
||||||
}
|
}
|
||||||
updateControlsGeometry();
|
updateControlsGeometry();
|
||||||
}
|
}
|
||||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
void Widget::setInnerFocus() {
|
void Widget::setInnerFocus() {
|
||||||
if (getStep()->animating()) {
|
if (getStep()->animating()) {
|
||||||
|
|
|
@ -48,10 +48,8 @@ protected:
|
||||||
signals:
|
signals:
|
||||||
void countryChanged();
|
void countryChanged();
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
private slots:
|
private slots:
|
||||||
void onCheckUpdateStatus();
|
void onCheckUpdateStatus();
|
||||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
// Internal interface.
|
// Internal interface.
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -368,10 +368,10 @@ MainWidget::MainWidget(
|
||||||
|
|
||||||
orderWidgets();
|
orderWidgets();
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
if (!Core::UpdaterDisabled()) {
|
||||||
Core::UpdateChecker checker;
|
Core::UpdateChecker checker;
|
||||||
checker.start();
|
checker.start();
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::setupConnectingWidget() {
|
void MainWidget::setupConnectingWidget() {
|
||||||
|
|
|
@ -466,9 +466,9 @@ void Messenger::startMtp() {
|
||||||
_langCloudManager = std::make_unique<Lang::CloudManager>(
|
_langCloudManager = std::make_unique<Lang::CloudManager>(
|
||||||
langpack(),
|
langpack(),
|
||||||
mtp());
|
mtp());
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
if (!Core::UpdaterDisabled()) {
|
||||||
Core::UpdateChecker().setMtproto(mtp());
|
Core::UpdateChecker().setMtproto(mtp());
|
||||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Messenger::destroyMtpKeys(MTP::AuthKeysList &&keys) {
|
void Messenger::destroyMtpKeys(MTP::AuthKeysList &&keys) {
|
||||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "platform/linux/launcher_linux.h"
|
#include "platform/linux/launcher_linux.h"
|
||||||
|
|
||||||
#include "core/crash_reports.h"
|
#include "core/crash_reports.h"
|
||||||
|
#include "core/update_checker.h"
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -83,6 +84,11 @@ bool Launcher::launchUpdater(UpdaterLaunch action) {
|
||||||
if (cTestMode()) {
|
if (cTestMode()) {
|
||||||
argumentsList.push("-testmode");
|
argumentsList.push("-testmode");
|
||||||
}
|
}
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
|
if (Core::UpdaterDisabled()) {
|
||||||
|
argumentsList.push("-externalupdater");
|
||||||
|
}
|
||||||
|
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
if (cDataFile() != qsl("data")) {
|
if (cDataFile() != qsl("data")) {
|
||||||
argumentsList.push("-key");
|
argumentsList.push("-key");
|
||||||
argumentsList.push(QFile::encodeName(cDataFile()));
|
argumentsList.push(QFile::encodeName(cDataFile()));
|
||||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "platform/mac/launcher_mac.h"
|
#include "platform/mac/launcher_mac.h"
|
||||||
|
|
||||||
#include "core/crash_reports.h"
|
#include "core/crash_reports.h"
|
||||||
|
#include "core/update_checker.h"
|
||||||
#include "platform/mac/mac_utilities.h"
|
#include "platform/mac/mac_utilities.h"
|
||||||
|
|
||||||
#include <Cocoa/Cocoa.h>
|
#include <Cocoa/Cocoa.h>
|
||||||
|
@ -125,6 +126,9 @@ bool Launcher::launchUpdater(UpdaterLaunch action) {
|
||||||
if (Logs::DebugEnabled()) [args addObject:@"-debug"];
|
if (Logs::DebugEnabled()) [args addObject:@"-debug"];
|
||||||
if (cStartInTray()) [args addObject:@"-startintray"];
|
if (cStartInTray()) [args addObject:@"-startintray"];
|
||||||
if (cTestMode()) [args addObject:@"-testmode"];
|
if (cTestMode()) [args addObject:@"-testmode"];
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
|
if (Core::UpdaterDisabled()) [args addObject:@"-externalupdater"];
|
||||||
|
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
if (cDataFile() != qsl("data")) {
|
if (cDataFile() != qsl("data")) {
|
||||||
[args addObject:@"-key"];
|
[args addObject:@"-key"];
|
||||||
[args addObject:Q2NSString(cDataFile())];
|
[args addObject:Q2NSString(cDataFile())];
|
||||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "platform/win/launcher_win.h"
|
#include "platform/win/launcher_win.h"
|
||||||
|
|
||||||
#include "core/crash_reports.h"
|
#include "core/crash_reports.h"
|
||||||
|
#include "core/update_checker.h"
|
||||||
#include "platform/platform_specific.h"
|
#include "platform/platform_specific.h"
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -89,6 +90,11 @@ bool Launcher::launchUpdater(UpdaterLaunch action) {
|
||||||
if (cTestMode()) {
|
if (cTestMode()) {
|
||||||
pushArgument(qsl("-testmode"));
|
pushArgument(qsl("-testmode"));
|
||||||
}
|
}
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
|
if (Core::UpdaterDisabled()) {
|
||||||
|
pushArgument(qsl("-externalupdater"));
|
||||||
|
}
|
||||||
|
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
if (customWorkingDir()) {
|
if (customWorkingDir()) {
|
||||||
pushArgument(qsl("-workdir"));
|
pushArgument(qsl("-workdir"));
|
||||||
pushArgument('"' + cWorkingDir() + '"');
|
pushArgument('"' + cWorkingDir() + '"');
|
||||||
|
|
|
@ -27,10 +27,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
namespace Settings {
|
namespace Settings {
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
UpdateStateRow::UpdateStateRow(QWidget *parent) : RpWidget(parent)
|
UpdateStateRow::UpdateStateRow(QWidget *parent) : RpWidget(parent)
|
||||||
, _check(this, lang(lng_settings_check_now))
|
, _check(this, lang(lng_settings_check_now))
|
||||||
, _restart(this, lang(lng_settings_update_now)) {
|
, _restart(this, lang(lng_settings_update_now)) {
|
||||||
|
Expects(!Core::UpdaterDisabled());
|
||||||
|
|
||||||
connect(_check, SIGNAL(clicked()), this, SLOT(onCheck()));
|
connect(_check, SIGNAL(clicked()), this, SLOT(onCheck()));
|
||||||
connect(_restart, SIGNAL(clicked()), this, SIGNAL(restart()));
|
connect(_restart, SIGNAL(clicked()), this, SIGNAL(restart()));
|
||||||
|
|
||||||
|
@ -160,7 +161,6 @@ void UpdateStateRow::onReady() {
|
||||||
void UpdateStateRow::onFailed() {
|
void UpdateStateRow::onFailed() {
|
||||||
setState(State::Fail);
|
setState(State::Fail);
|
||||||
}
|
}
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
GeneralWidget::GeneralWidget(QWidget *parent, UserData *self) : BlockWidget(parent, self, lang(lng_settings_section_general))
|
GeneralWidget::GeneralWidget(QWidget *parent, UserData *self) : BlockWidget(parent, self, lang(lng_settings_section_general))
|
||||||
, _changeLanguage(this, lang(lng_settings_change_lang), st::boxLinkButton) {
|
, _changeLanguage(this, lang(lng_settings_change_lang), st::boxLinkButton) {
|
||||||
|
@ -169,11 +169,8 @@ GeneralWidget::GeneralWidget(QWidget *parent, UserData *self) : BlockWidget(pare
|
||||||
}
|
}
|
||||||
|
|
||||||
int GeneralWidget::getUpdateTop() const {
|
int GeneralWidget::getUpdateTop() const {
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
// Just scroll to the top of the whole General widget
|
||||||
return 0; // _updateRow->y(); // Just scroll to the top of the whole General widget
|
return Core::UpdaterDisabled() ? -1 : 0;
|
||||||
#else // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
return -1;
|
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int GeneralWidget::resizeGetHeight(int newWidth) {
|
int GeneralWidget::resizeGetHeight(int newWidth) {
|
||||||
|
@ -187,15 +184,15 @@ void GeneralWidget::refreshControls() {
|
||||||
style::margins marginSmall(0, 0, 0, st::settingsSmallSkip);
|
style::margins marginSmall(0, 0, 0, st::settingsSmallSkip);
|
||||||
style::margins slidedPadding(0, marginSmall.bottom() / 2, 0, marginSmall.bottom() - (marginSmall.bottom() / 2));
|
style::margins slidedPadding(0, marginSmall.bottom() / 2, 0, marginSmall.bottom() - (marginSmall.bottom() / 2));
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
if (!Core::UpdaterDisabled()) {
|
||||||
createChildRow(_updateAutomatically, marginSub, lang(lng_settings_update_automatically), [this](bool) { onUpdateAutomatically(); }, cAutoUpdate());
|
createChildRow(_updateAutomatically, marginSub, lang(lng_settings_update_automatically), [this](bool) { onUpdateAutomatically(); }, cAutoUpdate());
|
||||||
style::margins marginLink(st::defaultCheck.diameter + st::defaultBoxCheckbox.textPosition.x(), 0, 0, st::settingsSkip);
|
style::margins marginLink(st::defaultCheck.diameter + st::defaultBoxCheckbox.textPosition.x(), 0, 0, st::settingsSkip);
|
||||||
createChildRow(_updateRow, marginLink, slidedPadding);
|
createChildRow(_updateRow, marginLink, slidedPadding);
|
||||||
connect(_updateRow->entity(), SIGNAL(restart()), this, SLOT(onRestart()));
|
connect(_updateRow->entity(), SIGNAL(restart()), this, SLOT(onRestart()));
|
||||||
if (!cAutoUpdate()) {
|
if (!cAutoUpdate()) {
|
||||||
_updateRow->hide(anim::type::instant);
|
_updateRow->hide(anim::type::instant);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
if (cPlatform() == dbipWindows || cSupportTray()) {
|
if (cPlatform() == dbipWindows || cSupportTray()) {
|
||||||
auto workMode = Global::WorkMode().value();
|
auto workMode = Global::WorkMode().value();
|
||||||
|
@ -237,14 +234,15 @@ void GeneralWidget::onChangeLanguage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralWidget::onRestart() {
|
void GeneralWidget::onRestart() {
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
if (!Core::UpdaterDisabled()) {
|
||||||
Core::checkReadyUpdate();
|
Core::checkReadyUpdate();
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
}
|
||||||
App::restart();
|
App::restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
void GeneralWidget::onUpdateAutomatically() {
|
void GeneralWidget::onUpdateAutomatically() {
|
||||||
|
Expects(!Core::UpdaterDisabled());
|
||||||
|
|
||||||
cSetAutoUpdate(_updateAutomatically->checked());
|
cSetAutoUpdate(_updateAutomatically->checked());
|
||||||
Local::writeSettings();
|
Local::writeSettings();
|
||||||
_updateRow->toggle(
|
_updateRow->toggle(
|
||||||
|
@ -257,7 +255,6 @@ void GeneralWidget::onUpdateAutomatically() {
|
||||||
checker.stop();
|
checker.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
void GeneralWidget::onEnableTrayIcon() {
|
void GeneralWidget::onEnableTrayIcon() {
|
||||||
if ((!_enableTrayIcon->checked() || cPlatform() != dbipWindows) && _enableTaskbarIcon && !_enableTaskbarIcon->checked()) {
|
if ((!_enableTrayIcon->checked() || cPlatform() != dbipWindows) && _enableTaskbarIcon && !_enableTaskbarIcon->checked()) {
|
||||||
|
|
|
@ -12,7 +12,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
namespace Settings {
|
namespace Settings {
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
class UpdateStateRow : public Ui::RpWidget {
|
class UpdateStateRow : public Ui::RpWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -60,7 +59,6 @@ private:
|
||||||
QString _versionText;
|
QString _versionText;
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
class GeneralWidget : public BlockWidget {
|
class GeneralWidget : public BlockWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -75,11 +73,7 @@ protected:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onChangeLanguage();
|
void onChangeLanguage();
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
void onUpdateAutomatically();
|
void onUpdateAutomatically();
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
void onEnableTrayIcon();
|
void onEnableTrayIcon();
|
||||||
void onEnableTaskbarIcon();
|
void onEnableTaskbarIcon();
|
||||||
|
|
||||||
|
@ -96,10 +90,8 @@ private:
|
||||||
void updateWorkmode();
|
void updateWorkmode();
|
||||||
|
|
||||||
object_ptr<Ui::LinkButton> _changeLanguage;
|
object_ptr<Ui::LinkButton> _changeLanguage;
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
Ui::Checkbox *_updateAutomatically = nullptr;
|
Ui::Checkbox *_updateAutomatically = nullptr;
|
||||||
Ui::SlideWrap<UpdateStateRow> *_updateRow = nullptr;
|
Ui::SlideWrap<UpdateStateRow> *_updateRow = nullptr;
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
Ui::Checkbox *_enableTrayIcon = nullptr;
|
Ui::Checkbox *_enableTrayIcon = nullptr;
|
||||||
Ui::Checkbox *_enableTaskbarIcon = nullptr;
|
Ui::Checkbox *_enableTaskbarIcon = nullptr;
|
||||||
Ui::Checkbox *_autoStart = nullptr;
|
Ui::Checkbox *_autoStart = nullptr;
|
||||||
|
|
|
@ -59,11 +59,11 @@ void fillCodes() {
|
||||||
Messenger::Instance().onSwitchTestMode();
|
Messenger::Instance().onSwitchTestMode();
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
if (!Core::UpdaterDisabled()) {
|
||||||
Codes.insert(qsl("testupdate"), [] {
|
Codes.insert(qsl("testupdate"), [] {
|
||||||
Core::UpdateChecker().test();
|
Core::UpdateChecker().test();
|
||||||
});
|
});
|
||||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
}
|
||||||
Codes.insert(qsl("loadlang"), [] {
|
Codes.insert(qsl("loadlang"), [] {
|
||||||
Lang::CurrentCloudManager().switchToLanguage(qsl("custom"));
|
Lang::CurrentCloudManager().switchToLanguage(qsl("custom"));
|
||||||
});
|
});
|
||||||
|
|
|
@ -1315,11 +1315,9 @@ bool _readSetting(quint32 blockId, QDataStream &stream, int version, ReadSetting
|
||||||
if (!_checkStreamStatus(stream)) return false;
|
if (!_checkStreamStatus(stream)) return false;
|
||||||
|
|
||||||
cSetAutoUpdate(v == 1);
|
cSetAutoUpdate(v == 1);
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
if (!Core::UpdaterDisabled() && !cAutoUpdate()) {
|
||||||
if (!cAutoUpdate()) {
|
|
||||||
Core::UpdateChecker().stop();
|
Core::UpdateChecker().stop();
|
||||||
}
|
}
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case dbiLastUpdateCheck: {
|
case dbiLastUpdateCheck: {
|
||||||
|
@ -2560,8 +2558,9 @@ void writeMtpData() {
|
||||||
_writeMtpData();
|
_writeMtpData();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
const QString &AutoupdatePrefix(const QString &replaceWith = {}) {
|
const QString &AutoupdatePrefix(const QString &replaceWith = {}) {
|
||||||
|
Expects(!Core::UpdaterDisabled());
|
||||||
|
|
||||||
static auto value = QString();
|
static auto value = QString();
|
||||||
if (!replaceWith.isEmpty()) {
|
if (!replaceWith.isEmpty()) {
|
||||||
value = replaceWith;
|
value = replaceWith;
|
||||||
|
@ -2570,10 +2569,14 @@ const QString &AutoupdatePrefix(const QString &replaceWith = {}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString autoupdatePrefixFile() {
|
QString autoupdatePrefixFile() {
|
||||||
|
Expects(!Core::UpdaterDisabled());
|
||||||
|
|
||||||
return cWorkingDir() + "tdata/prefix";
|
return cWorkingDir() + "tdata/prefix";
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &readAutoupdatePrefixRaw() {
|
const QString &readAutoupdatePrefixRaw() {
|
||||||
|
Expects(!Core::UpdaterDisabled());
|
||||||
|
|
||||||
const auto &result = AutoupdatePrefix();
|
const auto &result = AutoupdatePrefix();
|
||||||
if (!result.isEmpty()) {
|
if (!result.isEmpty()) {
|
||||||
return result;
|
return result;
|
||||||
|
@ -2587,10 +2590,12 @@ const QString &readAutoupdatePrefixRaw() {
|
||||||
}
|
}
|
||||||
return AutoupdatePrefix("https://updates.tdesktop.com");
|
return AutoupdatePrefix("https://updates.tdesktop.com");
|
||||||
}
|
}
|
||||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
void writeAutoupdatePrefix(const QString &prefix) {
|
void writeAutoupdatePrefix(const QString &prefix) {
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
if (Core::UpdaterDisabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const auto current = readAutoupdatePrefixRaw();
|
const auto current = readAutoupdatePrefixRaw();
|
||||||
if (current != prefix) {
|
if (current != prefix) {
|
||||||
AutoupdatePrefix(prefix);
|
AutoupdatePrefix(prefix);
|
||||||
|
@ -2604,15 +2609,14 @@ void writeAutoupdatePrefix(const QString &prefix) {
|
||||||
checker.start();
|
checker.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
QString readAutoupdatePrefix() {
|
QString readAutoupdatePrefix() {
|
||||||
|
Expects(!Core::UpdaterDisabled());
|
||||||
|
|
||||||
auto result = readAutoupdatePrefixRaw();
|
auto result = readAutoupdatePrefixRaw();
|
||||||
return result.replace(QRegularExpression("/+$"), QString());
|
return result.replace(QRegularExpression("/+$"), QString());
|
||||||
}
|
}
|
||||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
if (_localLoader) {
|
if (_localLoader) {
|
||||||
|
|
|
@ -32,9 +32,7 @@ void writeUserSettings();
|
||||||
void writeMtpData();
|
void writeMtpData();
|
||||||
|
|
||||||
void writeAutoupdatePrefix(const QString &prefix);
|
void writeAutoupdatePrefix(const QString &prefix);
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
QString readAutoupdatePrefix();
|
QString readAutoupdatePrefix();
|
||||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ deploy: off
|
||||||
environment:
|
environment:
|
||||||
matrix:
|
matrix:
|
||||||
- BUILD_VERSION:
|
- BUILD_VERSION:
|
||||||
- BUILD_VERSION: disable_autoupdate
|
|
||||||
- BUILD_VERSION: disable_register_custom_scheme
|
- BUILD_VERSION: disable_register_custom_scheme
|
||||||
- BUILD_VERSION: disable_crash_reports
|
- BUILD_VERSION: disable_crash_reports
|
||||||
- BUILD_VERSION: disable_network_proxy
|
- BUILD_VERSION: disable_network_proxy
|
||||||
|
|
Loading…
Add table
Reference in a new issue