mirror of
https://github.com/Qz3rK/tdesktop.git
synced 2026-07-03 14:15:08 +02:00
Top bar buttons design improved, emoji pan animations removed.
This commit is contained in:
@@ -36,7 +36,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
namespace Window {
|
||||
|
||||
TopBarWidget::TopBarWidget(MainWidget *w) : TWidget(w)
|
||||
, _a_appearance(animation(this, &TopBarWidget::step_appearance))
|
||||
, _clearSelection(this, lang(lng_selected_clear), st::topBarClearButton)
|
||||
, _forward(this, lang(lng_selected_forward), st::defaultActiveButton)
|
||||
, _delete(this, lang(lng_selected_delete), st::defaultActiveButton)
|
||||
@@ -44,8 +43,6 @@ TopBarWidget::TopBarWidget(MainWidget *w) : TWidget(w)
|
||||
, _mediaType(this, lang(lng_media_type), st::topBarButton)
|
||||
, _search(this, st::topBarSearch)
|
||||
, _menuToggle(this, st::topBarMenuToggle) {
|
||||
_mediaType->setTextTransform(Ui::RoundButton::TextTransform::NoTransform);
|
||||
|
||||
_forward->setClickedCallback([this] { onForwardSelection(); });
|
||||
_delete->setClickedCallback([this] { onDeleteSelection(); });
|
||||
_clearSelection->setClickedCallback([this] { onClearSelection(); });
|
||||
@@ -139,41 +136,6 @@ void TopBarWidget::showMenu() {
|
||||
}
|
||||
}
|
||||
|
||||
void TopBarWidget::enterEvent(QEvent *e) {
|
||||
a_over.start(1);
|
||||
_a_appearance.start();
|
||||
}
|
||||
|
||||
void TopBarWidget::enterFromChildEvent(QEvent *e, QWidget *child) {
|
||||
if (child != _membersShowArea) {
|
||||
a_over.start(1);
|
||||
_a_appearance.start();
|
||||
}
|
||||
}
|
||||
|
||||
void TopBarWidget::leaveEvent(QEvent *e) {
|
||||
a_over.start(0);
|
||||
_a_appearance.start();
|
||||
}
|
||||
|
||||
void TopBarWidget::leaveToChildEvent(QEvent *e, QWidget *child) {
|
||||
if (child != _membersShowArea) {
|
||||
a_over.start(0);
|
||||
_a_appearance.start();
|
||||
}
|
||||
}
|
||||
|
||||
void TopBarWidget::step_appearance(float64 ms, bool timer) {
|
||||
float64 dt = ms / st::topBarDuration;
|
||||
if (dt >= 1) {
|
||||
_a_appearance.stop();
|
||||
a_over.finish();
|
||||
} else {
|
||||
a_over.update(dt, anim::linear);
|
||||
}
|
||||
if (timer) update();
|
||||
}
|
||||
|
||||
bool TopBarWidget::eventFilter(QObject *obj, QEvent *e) {
|
||||
if (obj == _membersShowArea) {
|
||||
switch (e->type()) {
|
||||
@@ -207,7 +169,7 @@ void TopBarWidget::paintEvent(QPaintEvent *e) {
|
||||
if (!_search->isHidden()) {
|
||||
decreaseWidth += _search->width();
|
||||
}
|
||||
auto paintCounter = main()->paintTopBar(p, a_over.current(), decreaseWidth);
|
||||
auto paintCounter = main()->paintTopBar(p, decreaseWidth);
|
||||
p.restore();
|
||||
|
||||
if (paintCounter) {
|
||||
|
||||
@@ -37,16 +37,6 @@ class TopBarWidget : public TWidget, private base::Subscriber {
|
||||
public:
|
||||
TopBarWidget(MainWidget *w);
|
||||
|
||||
void enterEvent(QEvent *e) override;
|
||||
void enterFromChildEvent(QEvent *e, QWidget *child) override;
|
||||
void leaveEvent(QEvent *e) override;
|
||||
void leaveToChildEvent(QEvent *e, QWidget *child) override;
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void mousePressEvent(QMouseEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void step_appearance(float64 ms, bool timer);
|
||||
|
||||
void startAnim();
|
||||
void stopAnim();
|
||||
void showAll();
|
||||
@@ -59,6 +49,9 @@ public:
|
||||
static void paintUnreadCounter(Painter &p, int outerWidth);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void mousePressEvent(QMouseEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
bool eventFilter(QObject *obj, QEvent *e) override;
|
||||
|
||||
signals:
|
||||
@@ -75,8 +68,6 @@ private:
|
||||
void updateAdaptiveLayout();
|
||||
|
||||
MainWidget *main();
|
||||
anim::fvalue a_over = { 0. };
|
||||
Animation _a_appearance;
|
||||
|
||||
PeerData *_searchInPeer = nullptr;
|
||||
PeerData *_selPeer = nullptr;
|
||||
|
||||
@@ -174,31 +174,12 @@ topBarMenuPosition: point(-2px, 35px);
|
||||
topBarDuration: 200;
|
||||
topBarBackward: icon {{ "title_back", #a3a3a3 }};
|
||||
topBarForwardAlpha: 0.6;
|
||||
topBarBack: icon {{ "title_back", #259fd8 }};
|
||||
topBarBackAlpha: 0.8;
|
||||
topBarBackColor: #005faf;
|
||||
topBarBackFont: font(16px);
|
||||
topBarBack: icon {{ "title_back", lightButtonFg }};
|
||||
topBarArrowPadding: margins(39px, 8px, 17px, 8px);
|
||||
topBarMinPadding: 5px;
|
||||
topBarButton: RoundButton {
|
||||
textFg: btnYesColor;
|
||||
textFgOver: btnYesColor;
|
||||
secondaryTextFg: btnYesColor;
|
||||
secondaryTextFgOver: btnYesColor;
|
||||
textBg: windowBg;
|
||||
textBgOver: #edf4f7;
|
||||
|
||||
width: -22px;
|
||||
height: 28px;
|
||||
padding: margins(0px, 14px, 12px, 12px);
|
||||
|
||||
textTop: 6px;
|
||||
|
||||
font: font(fsize);
|
||||
|
||||
ripple: RippleAnimation(defaultRippleAnimation) {
|
||||
color: lightButtonBgRipple;
|
||||
}
|
||||
topBarButton: RoundButton(defaultLightButton) {
|
||||
width: -18px;
|
||||
padding: margins(0px, 10px, 12px, 10px);
|
||||
}
|
||||
topBarClearButton: RoundButton(defaultLightButton) {
|
||||
width: -18px;
|
||||
|
||||
Reference in New Issue
Block a user