|
|
|
@@ -194,6 +194,11 @@ void NotStartedWindow::resizeEvent(QResizeEvent *e) {
|
|
|
|
|
_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()
|
|
|
|
|
: _port(80)
|
|
|
|
|
, _label(this)
|
|
|
|
@@ -218,11 +223,9 @@ LastCrashedWindow::LastCrashedWindow()
|
|
|
|
|
, _sendingTotal(0)
|
|
|
|
|
, _checkReply(0)
|
|
|
|
|
, _sendReply(0)
|
|
|
|
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
|
|
|
, _updatingCheck(this)
|
|
|
|
|
, _updatingSkip(this, false)
|
|
|
|
|
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
|
|
|
{
|
|
|
|
|
, _updaterData(Core::UpdaterDisabled()
|
|
|
|
|
? nullptr
|
|
|
|
|
: std::make_unique<UpdaterData>(this)) {
|
|
|
|
|
excludeReportUsername();
|
|
|
|
|
|
|
|
|
|
if (!cAlphaVersion() && !cBetaVersion()) { // currently accept crash reports only from testers
|
|
|
|
@@ -293,49 +296,49 @@ LastCrashedWindow::LastCrashedWindow()
|
|
|
|
|
_label.setText(qsl("Last time Telegram Desktop crashed :("));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
|
|
|
_updatingCheck.setText(qsl("TRY AGAIN"));
|
|
|
|
|
connect(&_updatingCheck, SIGNAL(clicked()), this, SLOT(onUpdateRetry()));
|
|
|
|
|
_updatingSkip.setText(qsl("SKIP"));
|
|
|
|
|
connect(&_updatingSkip, SIGNAL(clicked()), this, SLOT(onUpdateSkip()));
|
|
|
|
|
if (_updaterData) {
|
|
|
|
|
_updaterData->check.setText(qsl("TRY AGAIN"));
|
|
|
|
|
connect(&_updaterData->check, SIGNAL(clicked()), this, SLOT(onUpdateRetry()));
|
|
|
|
|
_updaterData->skip.setText(qsl("SKIP"));
|
|
|
|
|
connect(&_updaterData->skip, SIGNAL(clicked()), this, SLOT(onUpdateSkip()));
|
|
|
|
|
|
|
|
|
|
Core::UpdateChecker checker;
|
|
|
|
|
using Progress = Core::UpdateChecker::Progress;
|
|
|
|
|
checker.checking(
|
|
|
|
|
) | rpl::start_with_next([=] { onUpdateChecking(); }, _lifetime);
|
|
|
|
|
checker.isLatest(
|
|
|
|
|
) | rpl::start_with_next([=] { onUpdateLatest(); }, _lifetime);
|
|
|
|
|
checker.progress(
|
|
|
|
|
) | rpl::start_with_next([=](const Progress &result) {
|
|
|
|
|
onUpdateDownloading(result.already, result.size);
|
|
|
|
|
}, _lifetime);
|
|
|
|
|
checker.failed(
|
|
|
|
|
) | rpl::start_with_next([=] { onUpdateFailed(); }, _lifetime);
|
|
|
|
|
checker.ready(
|
|
|
|
|
) | rpl::start_with_next([=] { onUpdateReady(); }, _lifetime);
|
|
|
|
|
Core::UpdateChecker checker;
|
|
|
|
|
using Progress = Core::UpdateChecker::Progress;
|
|
|
|
|
checker.checking(
|
|
|
|
|
) | rpl::start_with_next([=] { onUpdateChecking(); }, _lifetime);
|
|
|
|
|
checker.isLatest(
|
|
|
|
|
) | rpl::start_with_next([=] { onUpdateLatest(); }, _lifetime);
|
|
|
|
|
checker.progress(
|
|
|
|
|
) | rpl::start_with_next([=](const Progress &result) {
|
|
|
|
|
onUpdateDownloading(result.already, result.size);
|
|
|
|
|
}, _lifetime);
|
|
|
|
|
checker.failed(
|
|
|
|
|
) | rpl::start_with_next([=] { onUpdateFailed(); }, _lifetime);
|
|
|
|
|
checker.ready(
|
|
|
|
|
) | rpl::start_with_next([=] { onUpdateReady(); }, _lifetime);
|
|
|
|
|
|
|
|
|
|
switch (checker.state()) {
|
|
|
|
|
case Core::UpdateChecker::State::Download:
|
|
|
|
|
setUpdatingState(UpdatingDownload, true);
|
|
|
|
|
setDownloadProgress(checker.already(), checker.size());
|
|
|
|
|
break;
|
|
|
|
|
case Core::UpdateChecker::State::Ready:
|
|
|
|
|
setUpdatingState(UpdatingReady, true);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
setUpdatingState(UpdatingCheck, true);
|
|
|
|
|
break;
|
|
|
|
|
switch (checker.state()) {
|
|
|
|
|
case Core::UpdateChecker::State::Download:
|
|
|
|
|
setUpdatingState(UpdatingDownload, true);
|
|
|
|
|
setDownloadProgress(checker.already(), checker.size());
|
|
|
|
|
break;
|
|
|
|
|
case Core::UpdateChecker::State::Ready:
|
|
|
|
|
setUpdatingState(UpdatingReady, true);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
setUpdatingState(UpdatingCheck, true);
|
|
|
|
|
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."));
|
|
|
|
|
_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);
|
|
|
|
@@ -552,69 +555,41 @@ void LastCrashedWindow::updateControls() {
|
|
|
|
|
int padding = _size, h = padding + _networkSettings.height() + padding;
|
|
|
|
|
|
|
|
|
|
_label.show();
|
|
|
|
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
|
|
|
h += _networkSettings.height() + padding;
|
|
|
|
|
if (_updatingState == 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) {
|
|
|
|
|
if (_updaterData) {
|
|
|
|
|
h += _networkSettings.height() + padding;
|
|
|
|
|
if (_updaterData->state == UpdatingFail && (_sendingState == SendingNoReport || _sendingState == SendingUpdateCheck)) {
|
|
|
|
|
_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 {
|
|
|
|
|
_networkSettings.hide();
|
|
|
|
|
}
|
|
|
|
|
if (_updatingState == UpdatingNone || _updatingState == UpdatingLatest || _updatingState == UpdatingFail) {
|
|
|
|
|
h += padding + _updatingCheck.height() + padding;
|
|
|
|
|
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();
|
|
|
|
|
if (_updaterData->state == UpdatingCheck
|
|
|
|
|
|| _sendingState == SendingFail
|
|
|
|
|
|| _sendingState == SendingProgress) {
|
|
|
|
|
_networkSettings.show();
|
|
|
|
|
} else {
|
|
|
|
|
h += _showReport.height() + padding + _yourReportName.height() + padding;
|
|
|
|
|
_pleaseSendReport.show();
|
|
|
|
|
_yourReportName.show();
|
|
|
|
|
if (_reportUsername.isEmpty()) {
|
|
|
|
|
_networkSettings.hide();
|
|
|
|
|
}
|
|
|
|
|
if (_updaterData->state == UpdatingNone
|
|
|
|
|
|| _updaterData->state == UpdatingLatest
|
|
|
|
|
|| _updaterData->state == UpdatingFail) {
|
|
|
|
|
h += padding + _updaterData->check.height() + padding;
|
|
|
|
|
if (_sendingState == SendingNoReport) {
|
|
|
|
|
_pleaseSendReport.hide();
|
|
|
|
|
_yourReportName.hide();
|
|
|
|
|
_includeUsername.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 {
|
|
|
|
|
_getApp.hide();
|
|
|
|
|
}
|
|
|
|
|
_getApp.hide();
|
|
|
|
|
_showReport.hide();
|
|
|
|
|
_report.hide();
|
|
|
|
|
_minidump.hide();
|
|
|
|
@@ -623,48 +598,104 @@ void LastCrashedWindow::updateControls() {
|
|
|
|
|
_sendSkip.hide();
|
|
|
|
|
_continue.show();
|
|
|
|
|
} else {
|
|
|
|
|
_getApp.hide();
|
|
|
|
|
if (_reportShown) {
|
|
|
|
|
h += (_pleaseSendReport.height() * 12.5) + padding + (_minidumpName.isEmpty() ? 0 : (_minidump.height() + padding));
|
|
|
|
|
_report.show();
|
|
|
|
|
if (_minidumpName.isEmpty()) {
|
|
|
|
|
_minidump.hide();
|
|
|
|
|
h += _showReport.height() + padding + _yourReportName.height() + padding;
|
|
|
|
|
_pleaseSendReport.show();
|
|
|
|
|
_yourReportName.show();
|
|
|
|
|
if (_reportUsername.isEmpty()) {
|
|
|
|
|
_includeUsername.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 {
|
|
|
|
|
_minidump.show();
|
|
|
|
|
}
|
|
|
|
|
if (_reportSaved || _sendingState == SendingFail || _sendingState == SendingProgress || _sendingState == SendingUploading) {
|
|
|
|
|
_saveReport.hide();
|
|
|
|
|
} else {
|
|
|
|
|
_saveReport.show();
|
|
|
|
|
_getApp.hide();
|
|
|
|
|
}
|
|
|
|
|
_showReport.hide();
|
|
|
|
|
} else {
|
|
|
|
|
_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();
|
|
|
|
|
_getApp.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 {
|
|
|
|
|
_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 {
|
|
|
|
|
_getApp.hide();
|
|
|
|
|
_updaterData->check.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();
|
|
|
|
|
_yourReportName.hide();
|
|
|
|
|
_includeUsername.hide();
|
|
|
|
@@ -672,91 +703,68 @@ void LastCrashedWindow::updateControls() {
|
|
|
|
|
_report.hide();
|
|
|
|
|
_minidump.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();
|
|
|
|
|
_sendSkip.hide();
|
|
|
|
|
_continue.show();
|
|
|
|
|
_networkSettings.hide();
|
|
|
|
|
} 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();
|
|
|
|
|
} else {
|
|
|
|
|
_send.show();
|
|
|
|
|
}
|
|
|
|
|
_sendSkip.show();
|
|
|
|
|
if (_sendingState == SendingFail) {
|
|
|
|
|
_networkSettings.show();
|
|
|
|
|
} else {
|
|
|
|
|
_sendSkip.hide();
|
|
|
|
|
_continue.show();
|
|
|
|
|
_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();
|
|
|
|
|
h += _networkSettings.height() + padding;
|
|
|
|
|
#endif // else for !TDESKTOP_DISABLE_AUTOUPDATE
|
|
|
|
|
_getApp.show();
|
|
|
|
|
h += _networkSettings.height() + padding;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
@@ -801,24 +809,27 @@ void LastCrashedWindow::onNetworkSettingsSaved(
|
|
|
|
|
|
|
|
|
|
Sandbox::refreshGlobalProxy();
|
|
|
|
|
|
|
|
|
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
|
|
|
if ((_updatingState == UpdatingFail && (_sendingState == SendingNoReport || _sendingState == SendingUpdateCheck)) || (_updatingState == UpdatingCheck)) {
|
|
|
|
|
if (_updaterData
|
|
|
|
|
&& ((_updaterData->state == UpdatingCheck)
|
|
|
|
|
|| (_updaterData->state == UpdatingFail
|
|
|
|
|
&& (_sendingState == SendingNoReport
|
|
|
|
|
|| _sendingState == SendingUpdateCheck)))) {
|
|
|
|
|
Core::UpdateChecker checker;
|
|
|
|
|
checker.stop();
|
|
|
|
|
cSetLastUpdateCheck(0);
|
|
|
|
|
checker.start();
|
|
|
|
|
} else
|
|
|
|
|
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
|
|
|
if (_sendingState == SendingFail || _sendingState == SendingProgress) {
|
|
|
|
|
} else if (_sendingState == SendingFail
|
|
|
|
|
|| _sendingState == SendingProgress) {
|
|
|
|
|
onSendReport();
|
|
|
|
|
}
|
|
|
|
|
activate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
|
|
|
void LastCrashedWindow::setUpdatingState(UpdatingState state, bool force) {
|
|
|
|
|
if (_updatingState != state || force) {
|
|
|
|
|
_updatingState = state;
|
|
|
|
|
Expects(_updaterData != nullptr);
|
|
|
|
|
|
|
|
|
|
if (_updaterData->state != state || force) {
|
|
|
|
|
_updaterData->state = state;
|
|
|
|
|
switch (state) {
|
|
|
|
|
case UpdatingLatest:
|
|
|
|
|
_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) {
|
|
|
|
|
Expects(_updaterData != nullptr);
|
|
|
|
|
|
|
|
|
|
qint64 readyTenthMb = (ready * 10 / (1024 * 1024)), totalTenthMb = (total * 10 / (1024 * 1024));
|
|
|
|
|
QString readyStr = QString::number(readyTenthMb / 10) + '.' + QString::number(readyTenthMb % 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);
|
|
|
|
|
if (_newVersionDownload != res) {
|
|
|
|
|
_newVersionDownload = res;
|
|
|
|
|
_updating.setText(_newVersionDownload);
|
|
|
|
|
if (_updaterData->newVersionDownload != res) {
|
|
|
|
|
_updaterData->newVersionDownload = res;
|
|
|
|
|
_updating.setText(_updaterData->newVersionDownload);
|
|
|
|
|
updateControls();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LastCrashedWindow::onUpdateRetry() {
|
|
|
|
|
Expects(_updaterData != nullptr);
|
|
|
|
|
|
|
|
|
|
cSetLastUpdateCheck(0);
|
|
|
|
|
Core::UpdateChecker checker;
|
|
|
|
|
checker.start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LastCrashedWindow::onUpdateSkip() {
|
|
|
|
|
Expects(_updaterData != nullptr);
|
|
|
|
|
|
|
|
|
|
if (_sendingState == SendingNoReport) {
|
|
|
|
|
onContinue();
|
|
|
|
|
} else {
|
|
|
|
|
if (_updatingState == UpdatingCheck
|
|
|
|
|
|| _updatingState == UpdatingDownload) {
|
|
|
|
|
if (_updaterData->state == UpdatingCheck
|
|
|
|
|
|| _updaterData->state == UpdatingDownload) {
|
|
|
|
|
Core::UpdateChecker checker;
|
|
|
|
|
checker.stop();
|
|
|
|
|
setUpdatingState(UpdatingFail);
|
|
|
|
@@ -883,26 +900,35 @@ void LastCrashedWindow::onUpdateSkip() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LastCrashedWindow::onUpdateChecking() {
|
|
|
|
|
Expects(_updaterData != nullptr);
|
|
|
|
|
|
|
|
|
|
setUpdatingState(UpdatingCheck);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LastCrashedWindow::onUpdateLatest() {
|
|
|
|
|
Expects(_updaterData != nullptr);
|
|
|
|
|
|
|
|
|
|
setUpdatingState(UpdatingLatest);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LastCrashedWindow::onUpdateDownloading(qint64 ready, qint64 total) {
|
|
|
|
|
Expects(_updaterData != nullptr);
|
|
|
|
|
|
|
|
|
|
setUpdatingState(UpdatingDownload);
|
|
|
|
|
setDownloadProgress(ready, total);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LastCrashedWindow::onUpdateReady() {
|
|
|
|
|
Expects(_updaterData != nullptr);
|
|
|
|
|
|
|
|
|
|
setUpdatingState(UpdatingReady);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LastCrashedWindow::onUpdateFailed() {
|
|
|
|
|
Expects(_updaterData != nullptr);
|
|
|
|
|
|
|
|
|
|
setUpdatingState(UpdatingFail);
|
|
|
|
|
}
|
|
|
|
|
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
|
|
|
|
|
|
|
|
|
void LastCrashedWindow::onContinue() {
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
|
|
|
_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);
|
|
|
|
|
_yourReportName.move(padding, _showReport.y() + _showReport.height() + padding);
|
|
|
|
|
_includeUsername.move(padding, _yourReportName.y() + _yourReportName.height() + padding);
|
|
|
|
|
_getApp.move((width() - _getApp.width()) / 2, _showReport.y() + _showReport.height() + padding);
|
|
|
|
|
if (_updaterData) {
|
|
|
|
|
_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);
|
|
|
|
|
_yourReportName.move(padding, _showReport.y() + _showReport.height() + padding);
|
|
|
|
|
_includeUsername.move(padding, _yourReportName.y() + _yourReportName.height() + padding);
|
|
|
|
|
_getApp.move((width() - _getApp.width()) / 2, _showReport.y() + _showReport.height() + padding);
|
|
|
|
|
|
|
|
|
|
if (_sendingState == SendingFail || _sendingState == SendingProgress) {
|
|
|
|
|
_networkSettings.move(padding * 2 + _pleaseSendReport.width(), padding * 2 + _networkSettings.height() + _networkSettings.height() + padding);
|
|
|
|
|
if (_sendingState == SendingFail || _sendingState == SendingProgress) {
|
|
|
|
|
_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 {
|
|
|
|
|
_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()) {
|
|
|
|
|
_report.setGeometry(padding, _yourReportName.y() + _yourReportName.height() + padding, width() - 2 * padding, _pleaseSendReport.height() * 12.5);
|
|
|
|
|
} else {
|
|
|
|
|