Update default tooltip colors.
This commit is contained in:
parent
ad852f0f4a
commit
bd1e8f7c47
4 changed files with 58 additions and 4 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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()) {
|
||||
|
|
|
|||
|
|
@ -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<FlatLabel> MakeNiceTooltipLabel(
|
||||
QWidget *parent,
|
||||
rpl::producer<TextWithEntities> &&text,
|
||||
int maxWidth,
|
||||
const style::FlatLabel &st,
|
||||
const style::PopupMenu &stMenu) {
|
||||
Expects(st.minWidth > 0);
|
||||
Expects(st.minWidth < maxWidth);
|
||||
|
||||
auto result = object_ptr<FlatLabel>(
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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<FlatLabel> MakeNiceTooltipLabel(
|
||||
QWidget *parent,
|
||||
rpl::producer<TextWithEntities> &&text,
|
||||
int maxWidth,
|
||||
const style::FlatLabel &st = st::defaultFlatLabel,
|
||||
const style::PopupMenu &stMenu = st::defaultPopupMenu);
|
||||
|
||||
} // namespace Ui
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue