diff --git a/Telegram/Resources/colors.palette b/Telegram/Resources/colors.palette index 0c241710b4..82473313ee 100644 --- a/Telegram/Resources/colors.palette +++ b/Telegram/Resources/colors.palette @@ -51,11 +51,6 @@ attentionButtonFgOver: #d14e4e; // default attention button text with mouse over attentionButtonBgOver: #fcdfde; // default attention button background with mouse over attentionButtonBgRipple: #f4c3c2; // default attention button ripple effect -outlineButtonBg: windowBg; // default left outlined button background (like shared media links in profiles) -outlineButtonBgOver: lightButtonBgOver; // default left outlined button background with mouse over -outlineButtonOutlineFg: windowBgActive; // default left outlined button left outline border -outlineButtonBgRipple: lightButtonBgRipple; // default left outlined button ripple effect - menuBg: windowBg; // default popup menu background menuBgOver: windowBgOver; // default popup menu item background with mouse over menuBgRipple: windowBgRipple; // default popup menu item ripple effect diff --git a/Telegram/SourceFiles/profile/profile_block_group_members.h b/Telegram/SourceFiles/profile/profile_block_group_members.h index 9b7958aded..99c791a39b 100644 --- a/Telegram/SourceFiles/profile/profile_block_group_members.h +++ b/Telegram/SourceFiles/profile/profile_block_group_members.h @@ -11,7 +11,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace Ui { class FlatLabel; -class LeftOutlineButton; } // namespace Ui namespace Notify { diff --git a/Telegram/SourceFiles/profile/profile_block_peer_list.cpp b/Telegram/SourceFiles/profile/profile_block_peer_list.cpp index 16a29b19c2..a57b8ffb65 100644 --- a/Telegram/SourceFiles/profile/profile_block_peer_list.cpp +++ b/Telegram/SourceFiles/profile/profile_block_peer_list.cpp @@ -74,10 +74,10 @@ void PeerListWidget::paintItem(Painter &p, int x, int y, Item *item, bool select auto memberRowWidth = rowWidth(); if (selected) { - paintOutlinedRect(p, x, y, memberRowWidth, _st.height); + paintItemRect(p, x, y, memberRowWidth, _st.height); } if (auto &ripple = item->ripple) { - ripple->paint(p, x + _st.button.outlineWidth, y, width()); + ripple->paint(p, x, y, width()); if (ripple->empty()) { ripple.reset(); } @@ -121,12 +121,8 @@ void PeerListWidget::paintItem(Painter &p, int x, int y, Item *item, bool select p.drawTextLeft(x + _st.statusPosition.x(), y + _st.statusPosition.y(), width(), item->statusText); } -void PeerListWidget::paintOutlinedRect(Painter &p, int x, int y, int w, int h) const { - auto outlineWidth = _st.button.outlineWidth; - if (outlineWidth) { - p.fillRect(rtlrect(x, y, outlineWidth, h, width()), _st.button.outlineFgOver); - } - p.fillRect(rtlrect(x + outlineWidth, y, w - outlineWidth, h, width()), _st.button.textBgOver); +void PeerListWidget::paintItemRect(Painter &p, int x, int y, int w, int h) const { + p.fillRect(rtlrect(x, y, w, h, width()), _st.button.textBgOver); } void PeerListWidget::mouseMoveEvent(QMouseEvent *e) { @@ -145,12 +141,12 @@ void PeerListWidget::mousePressEvent(QMouseEvent *e) { auto item = _items[_pressed]; if (!item->ripple) { auto memberRowWidth = rowWidth(); - auto mask = Ui::RippleAnimation::rectMask(QSize(memberRowWidth - _st.button.outlineWidth, _st.height)); + auto mask = Ui::RippleAnimation::rectMask(QSize(memberRowWidth, _st.height)); item->ripple = std::make_unique(_st.button.ripple, std::move(mask), [this, index = _pressed] { repaintRow(index); }); } - auto left = getListLeft() + _st.button.outlineWidth; + auto left = getListLeft(); auto top = getListTop() + _st.height * _pressed; item->ripple->add(e->pos() - QPoint(left, top)); } diff --git a/Telegram/SourceFiles/profile/profile_block_peer_list.h b/Telegram/SourceFiles/profile/profile_block_peer_list.h index 2dc1b03b1b..3d95a9f677 100644 --- a/Telegram/SourceFiles/profile/profile_block_peer_list.h +++ b/Telegram/SourceFiles/profile/profile_block_peer_list.h @@ -93,7 +93,7 @@ protected: int visibleTop, int visibleBottom) override; - void paintOutlinedRect(Painter &p, int x, int y, int w, int h) const; + void paintItemRect(Painter &p, int x, int y, int w, int h) const; void refreshVisibility(); void paintContents(Painter &p) override; diff --git a/Telegram/SourceFiles/profile/profile_block_widget.cpp b/Telegram/SourceFiles/profile/profile_block_widget.cpp index 2406ae1bde..ff51bd84ad 100644 --- a/Telegram/SourceFiles/profile/profile_block_widget.cpp +++ b/Telegram/SourceFiles/profile/profile_block_widget.cpp @@ -41,8 +41,4 @@ void BlockWidget::paintTitle(Painter &p) { p.drawTextLeft(titleLeft, titleTop, width(), _title); } -int defaultOutlineButtonLeft() { - return st::profileBlockTitlePosition.x() - st::defaultLeftOutlineButton.padding.left(); -} - } // namespace Profile diff --git a/Telegram/SourceFiles/profile/profile_block_widget.h b/Telegram/SourceFiles/profile/profile_block_widget.h index 2162121cb7..1d86bda52f 100644 --- a/Telegram/SourceFiles/profile/profile_block_widget.h +++ b/Telegram/SourceFiles/profile/profile_block_widget.h @@ -59,6 +59,4 @@ private: }; -int defaultOutlineButtonLeft(); - } // namespace Profile diff --git a/Telegram/SourceFiles/ui/widgets/buttons.cpp b/Telegram/SourceFiles/ui/widgets/buttons.cpp index 2bfc2930c4..d002c3d0db 100644 --- a/Telegram/SourceFiles/ui/widgets/buttons.cpp +++ b/Telegram/SourceFiles/ui/widgets/buttons.cpp @@ -497,49 +497,6 @@ QImage IconButton::prepareRippleMask() const { return RippleAnimation::ellipseMask(QSize(_st.rippleAreaSize, _st.rippleAreaSize)); } -LeftOutlineButton::LeftOutlineButton(QWidget *parent, const QString &text, const style::OutlineButton &st) : RippleButton(parent, st.ripple) -, _text(text) -, _fullText(text) -, _textWidth(st.font->width(_text)) -, _fullTextWidth(_textWidth) -, _st(st) { - resizeToWidth(_textWidth + _st.padding.left() + _st.padding.right()); - - setCursor(style::cur_pointer); -} - -void LeftOutlineButton::setText(const QString &text) { - _text = text; - _fullText = text; - _fullTextWidth = _textWidth = _st.font->width(_text); - resizeToWidth(width()); - update(); -} - -int LeftOutlineButton::resizeGetHeight(int newWidth) { - int availableWidth = qMax(newWidth - _st.padding.left() - _st.padding.right(), 1); - if ((availableWidth < _fullTextWidth) || (_textWidth < availableWidth)) { - _text = _st.font->elided(_fullText, availableWidth); - _textWidth = _st.font->width(_text); - } - return _st.padding.top() + _st.font->height + _st.padding.bottom(); -} - -void LeftOutlineButton::paintEvent(QPaintEvent *e) { - Painter p(this); - - auto over = isOver(); - auto down = isDown(); - if (width() > _st.outlineWidth) { - p.fillRect(rtlrect(_st.outlineWidth, 0, width() - _st.outlineWidth, height(), width()), (over || down) ? _st.textBgOver : _st.textBg); - paintRipple(p, 0, 0); - p.fillRect(rtlrect(0, 0, _st.outlineWidth, height(), width()), (over || down) ? _st.outlineFgOver : _st.outlineFg); - } - p.setFont(_st.font); - p.setPen((over || down) ? _st.textFgOver : _st.textFg); - p.drawTextLeft(_st.padding.left(), _st.padding.top(), width(), _text, _textWidth); -} - CrossButton::CrossButton(QWidget *parent, const style::CrossButton &st) : RippleButton(parent, st.ripple) , _st(st) , _loadingAnimation([=](crl::time now) { return loadingCallback(now); }) { diff --git a/Telegram/SourceFiles/ui/widgets/buttons.h b/Telegram/SourceFiles/ui/widgets/buttons.h index 8965b52592..3371875299 100644 --- a/Telegram/SourceFiles/ui/widgets/buttons.h +++ b/Telegram/SourceFiles/ui/widgets/buttons.h @@ -184,25 +184,6 @@ private: }; -class LeftOutlineButton : public RippleButton { -public: - LeftOutlineButton(QWidget *parent, const QString &text, const style::OutlineButton &st = st::defaultLeftOutlineButton); - - void setText(const QString &text); - -protected: - void paintEvent(QPaintEvent *e) override; - - int resizeGetHeight(int newWidth) override; - -private: - QString _text, _fullText; - int _textWidth, _fullTextWidth; - - const style::OutlineButton &_st; - -}; - class CrossButton : public RippleButton { public: CrossButton(QWidget *parent, const style::CrossButton &st); diff --git a/Telegram/SourceFiles/ui/widgets/widgets.style b/Telegram/SourceFiles/ui/widgets/widgets.style index 1eb6db464e..275b0e14ea 100644 --- a/Telegram/SourceFiles/ui/widgets/widgets.style +++ b/Telegram/SourceFiles/ui/widgets/widgets.style @@ -239,10 +239,6 @@ InputField { } OutlineButton { - outlineWidth: pixels; - outlineFg: color; - outlineFgOver: color; - textBg: color; textBgOver: color; @@ -675,37 +671,6 @@ defaultFlatInput: FlatInput { phDuration: 100; } -defaultLeftOutlineButton: OutlineButton { - outlineWidth: 3px; - outlineFg: outlineButtonBg; - outlineFgOver: outlineButtonOutlineFg; - - textBg: outlineButtonBg; - textBgOver: outlineButtonBgOver; - - textFg: windowActiveTextFg; - textFgOver: windowActiveTextFg; - - font: normalFont; - padding: margins(11px, 5px, 11px, 5px); - - ripple: RippleAnimation(defaultRippleAnimation) { - color: outlineButtonBgRipple; - } -} -attentionLeftOutlineButton: OutlineButton(defaultLeftOutlineButton) { - outlineFgOver: attentionButtonFg; - - textBgOver: attentionButtonBgOver; - - textFg: attentionButtonFg; - textFgOver: attentionButtonFgOver; - - ripple: RippleAnimation(defaultRippleAnimation) { - color: attentionButtonBgRipple; - } -} - defaultInputField: InputField { textBg: windowBg; textFg: windowFg; @@ -1147,8 +1112,6 @@ PeerList { } defaultPeerListButton: OutlineButton { - outlineWidth: 0px; - textBg: windowBg; textBgOver: windowBgOver;