diff --git a/ui/colors.palette b/ui/colors.palette index d709796..f62334b 100644 --- a/ui/colors.palette +++ b/ui/colors.palette @@ -435,8 +435,8 @@ youtubePlayIconBg: #e83131c8; // youtube play icon background (when a link to a youtubePlayIconFg: windowFgActive; // youtube play icon arrow (when a link to a youtube video with a webpage preview is sent) videoPlayIconBg: #0000007f; // other video play icon background (like when a link to a vimeo video with a webpage preview is sent) videoPlayIconFg: #ffffff; // other video play icon arrow (like when a link to a vimeo video with a webpage preview is sent) -toastBg: #000000b2; // toast notification background (like when you click on your t.me link when editing your username) -toastFg: windowFgActive; // toast notification text (like when you click on your t.me link when editing your username) +toastBg: #2c3033e5; // toast notification background (like when you click on your t.me link when editing your username) +toastFg: #ffffff; // toast notification text (like when you click on your t.me link when editing your username) historyToDownBg: windowBg; // arrow button background (to scroll to the end of the viewed chat) historyToDownBgOver: windowBgOver; // arrow button background with mouse over @@ -518,7 +518,7 @@ mediaviewControlBg: #0000003c; // controls background (like next photo / previou mediaviewControlFg: #ffffff; // controls icon (like next photo / previous photo) mediaviewCaptionBg: #11111180; // caption text background (when viewing photo with caption) mediaviewCaptionFg: mediaviewControlFg; // caption text -mediaviewTextLinkFg: #91d9ff; // caption text link +mediaviewTextLinkFg: #4db8ff; // caption text link mediaviewSaveMsgBg: toastBg; // save to file toast message background in Media Viewer mediaviewSaveMsgFg: toastFg; // save to file toast message text diff --git a/ui/toast/toast_widget.cpp b/ui/toast/toast_widget.cpp index 9640f88..6851cc1 100644 --- a/ui/toast/toast_widget.cpp +++ b/ui/toast/toast_widget.cpp @@ -138,7 +138,7 @@ void Widget::paintEvent(QPaintEvent *e) { } _roundRect.paint(p, rect()); if (_dark) { - _roundRect.paint(p, rect()); + //_roundRect.paint(p, rect()); } if (!_st->icon.empty()) { diff --git a/ui/widgets/tooltip.cpp b/ui/widgets/tooltip.cpp index 895bdde..c90065d 100644 --- a/ui/widgets/tooltip.cpp +++ b/ui/widgets/tooltip.cpp @@ -9,6 +9,7 @@ #include "ui/ui_utility.h" #include "ui/painter.h" #include "ui/platform/ui_platform_utility.h" +#include "ui/widgets/labels.h" #include "base/invoke_queued.h" #include "base/platform/base_platform_info.h" #include "styles/style_widgets.h" @@ -410,4 +411,41 @@ void ImportantTooltip::paintEvent(QPaintEvent *e) { } } +object_ptr MakeNiceTooltipLabel( + QWidget *parent, + rpl::producer &&text, + int maxWidth, + const style::FlatLabel &st, + const style::PopupMenu &stMenu) { + Expects(st.minWidth > 0); + Expects(st.minWidth < maxWidth); + + auto result = object_ptr( + parent, + rpl::duplicate(text), + st, + stMenu); + const auto raw = result.data(); + std::move(text) | rpl::start_with_next([=, &st] { + raw->resizeToNaturalWidth(maxWidth); + if (raw->naturalWidth() <= maxWidth) { + return; + } + const auto desired = raw->heightNoMargins(); + auto from = st.minWidth; + auto till = maxWidth; + while (till - from > 1) { + const auto middle = (from + till) / 2; + raw->resizeToWidth(middle); + if (raw->heightNoMargins() > desired) { + from = middle; + } else { + till = middle; + } + } + raw->resizeToWidth(till); + }, raw->lifetime()); + return result; +} + } // namespace Ui diff --git a/ui/widgets/tooltip.h b/ui/widgets/tooltip.h index c7c3d10..b5984f1 100644 --- a/ui/widgets/tooltip.h +++ b/ui/widgets/tooltip.h @@ -16,10 +16,19 @@ namespace style { struct Tooltip; struct ImportantTooltip; +struct FlatLabel; +struct PopupMenu; } // namespace style +namespace st { +extern const style::FlatLabel &defaultFlatLabel; +extern const style::PopupMenu &defaultPopupMenu; +} // namespace st + namespace Ui { +class FlatLabel; + class AbstractTooltipShower { public: virtual QString tooltipText() const = 0; @@ -113,4 +122,11 @@ private: }; +[[nodiscard]] object_ptr MakeNiceTooltipLabel( + QWidget *parent, + rpl::producer &&text, + int maxWidth, + const style::FlatLabel &st = st::defaultFlatLabel, + const style::PopupMenu &stMenu = st::defaultPopupMenu); + } // namespace Ui