mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-05 17:06:03 +00:00
min connection timeout 4secs, fixed photo display, thumbs size is less now, update button text and animation added
This commit is contained in:
@@ -54,7 +54,7 @@ TitleWidget::TitleWidget(Window *window)
|
||||
, _settings(this, lang(lng_menu_settings), st::titleTextButton)
|
||||
, _contacts(this, lang(lng_menu_contacts), st::titleTextButton)
|
||||
, _about(this, lang(lng_menu_about), st::titleTextButton)
|
||||
, _update(this, window)
|
||||
, _update(this, window, lang(lng_menu_update))
|
||||
, _minimize(this, window)
|
||||
, _maximize(this, window)
|
||||
, _restore(this, window)
|
||||
@@ -65,10 +65,9 @@ TitleWidget::TitleWidget(Window *window)
|
||||
setGeometry(0, 0, wnd->width(), st::titleHeight);
|
||||
stateChanged();
|
||||
|
||||
_update.hide();
|
||||
if (App::app()->updatingState() == Application::UpdatingReady) {
|
||||
_update.show();
|
||||
} else {
|
||||
_update.hide();
|
||||
showUpdateBtn();
|
||||
}
|
||||
|
||||
connect(&_settings, SIGNAL(clicked()), window, SLOT(showSettings()));
|
||||
@@ -92,6 +91,13 @@ void TitleWidget::paintEvent(QPaintEvent *e) {
|
||||
p.drawPixmap(st::titleIconPos, App::sprite(), st::titleIconRect);
|
||||
}
|
||||
|
||||
bool TitleWidget::animStep(float64 ms) {
|
||||
float64 phase = sin(M_PI_2 * (ms / st::updateBlinkDuration));
|
||||
if (phase < 0) phase = -phase;
|
||||
_update.setOverLevel(phase);
|
||||
return true;
|
||||
}
|
||||
|
||||
void TitleWidget::setHideLevel(float64 level) {
|
||||
if (level != hideLevel) {
|
||||
hideLevel = level;
|
||||
@@ -126,7 +132,13 @@ TitleWidget::~TitleWidget() {
|
||||
|
||||
void TitleWidget::resizeEvent(QResizeEvent *e) {
|
||||
QPoint p(width() - ((cPlatform() == dbipWindows && lastMaximized) ? 0 : st::sysBtnDelta), 0);
|
||||
|
||||
|
||||
if (!_update.isHidden()) {
|
||||
p.setX(p.x() - _update.width());
|
||||
_update.move(p);
|
||||
p.setX(p.x() + _update.width());
|
||||
}
|
||||
|
||||
if (cPlatform() == dbipWindows) {
|
||||
p.setX(p.x() - _close.width());
|
||||
_close.move(p);
|
||||
@@ -138,11 +150,6 @@ void TitleWidget::resizeEvent(QResizeEvent *e) {
|
||||
_minimize.move(p);
|
||||
}
|
||||
|
||||
if (!_update.isHidden()) {
|
||||
p.setX(p.x() - _update.width());
|
||||
_update.move(p);
|
||||
}
|
||||
|
||||
_settings.move(st::titleMenuOffset, 0);
|
||||
if (MTP::authedId()) {
|
||||
_contacts.show();
|
||||
@@ -182,19 +189,30 @@ void TitleWidget::stateChanged(Qt::WindowState state) {
|
||||
void TitleWidget::showUpdateBtn() {
|
||||
if (App::app()->updatingState() == Application::UpdatingReady || cEvalScale(cConfigScale()) != cEvalScale(cRealScale())) {
|
||||
_update.show();
|
||||
_minimize.hide();
|
||||
_restore.hide();
|
||||
_maximize.hide();
|
||||
_close.hide();
|
||||
anim::start(this);
|
||||
} else {
|
||||
_update.hide();
|
||||
if (cPlatform() == dbipWindows) {
|
||||
_minimize.show();
|
||||
maximizedChanged(wnd->windowState().testFlag(Qt::WindowMaximized), true);
|
||||
_close.show();
|
||||
}
|
||||
anim::stop(this);
|
||||
}
|
||||
resizeEvent(0);
|
||||
update();
|
||||
}
|
||||
|
||||
void TitleWidget::maximizedChanged(bool maximized) {
|
||||
if (lastMaximized == maximized) return;
|
||||
void TitleWidget::maximizedChanged(bool maximized, bool force) {
|
||||
if (lastMaximized == maximized && !force) return;
|
||||
|
||||
lastMaximized = maximized;
|
||||
|
||||
if (cPlatform() != dbipWindows) return;
|
||||
if (cPlatform() != dbipWindows || !_update.isHidden()) return;
|
||||
if (maximized) {
|
||||
_maximize.clearState();
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user