2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Add an 'Update your OS' top bar.

Set EOL for Windows XP / Vista version at September 1, 2019.
This commit is contained in:
John Preston
2019-06-04 01:34:34 +03:00
parent 3355e6da0c
commit 1fb529803e
14 changed files with 299 additions and 8 deletions

View File

@@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/themes/window_theme.h"
#include "window/window_controller.h"
#include "window/window_lock_widgets.h"
#include "window/window_outdated_bar.h"
#include "boxes/confirm_box.h"
#include "core/click_handler_types.h"
#include "core/application.h"
@@ -108,6 +109,7 @@ QIcon CreateIcon() {
MainWindow::MainWindow()
: _positionUpdatedTimer([=] { savePosition(); })
, _outdated(CreateOutdatedBar(this))
, _body(this)
, _icon(CreateIcon())
, _titleText(qsl("Telegram")) {
@@ -134,6 +136,18 @@ MainWindow::MainWindow()
checkLockByTerms();
}, lifetime());
if (_outdated) {
_outdated->heightValue(
) | rpl::filter([=] {
return window()->windowHandle() != nullptr;
}) | rpl::start_with_next([=](int height) {
if (!height) {
crl::on_main(this, [=] { _outdated.destroy(); });
}
updateControlsGeometry();
}, _outdated->lifetime());
}
_isActiveTimer.setCallback([this] { updateIsActive(0); });
_inactivePressTimer.setCallback([this] { setInactivePress(false); });
}
@@ -341,7 +355,14 @@ HitTestResult MainWindow::hitTest(const QPoint &p) const {
int MainWindow::computeMinHeight() const {
const auto title = _title ? _title->height() : 0;
return title + st::windowMinHeight;
const auto outdated = [&] {
if (!_outdated) {
return 0;
}
_outdated->resizeToWidth(st::windowMinWidth);
return _outdated->height();
}();
return title + outdated + st::windowMinHeight;
}
void MainWindow::initSize() {
@@ -446,6 +467,12 @@ void MainWindow::updateControlsGeometry() {
_title->setGeometry(0, bodyTop, width(), _title->height());
bodyTop += _title->height();
}
if (_outdated) {
Ui::SendPendingMoveResizeEvents(_outdated.data());
_outdated->resizeToWidth(width());
_outdated->moveToLeft(0, bodyTop);
bodyTop += _outdated->height();
}
if (_rightColumn) {
bodyWidth -= _rightColumn->width();
_rightColumn->setGeometry(bodyWidth, bodyTop, width() - bodyWidth, height() - bodyTop);