2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Apply dark theme to reply controls in stories.

This commit is contained in:
John Preston
2023-05-16 19:48:49 +04:00
parent a745c9ff75
commit 75d2b5994f
32 changed files with 836 additions and 552 deletions

View File

@@ -50,7 +50,7 @@ public:
void setFinalImages(Direction direction, QImage &&left, QImage &&right, QRect inner, bool wasSectionIcons);
void start();
void paintFrame(QPainter &p, float64 dt, float64 opacity);
void paintFrame(QPainter &p, const style::EmojiPan &st, float64 dt, float64 opacity);
private:
Direction _direction = Direction::LeftToRight;
@@ -131,7 +131,11 @@ void TabbedSelector::SlideAnimation::start() {
_frameIntsPerLineAdd = (_width - _innerWidth) + _frameIntsPerLineAdded;
}
void TabbedSelector::SlideAnimation::paintFrame(QPainter &p, float64 dt, float64 opacity) {
void TabbedSelector::SlideAnimation::paintFrame(
QPainter &p,
const style::EmojiPan &st,
float64 dt,
float64 opacity) {
Expects(started());
Expects(dt >= 0.);
@@ -168,8 +172,8 @@ void TabbedSelector::SlideAnimation::paintFrame(QPainter &p, float64 dt, float64
{
auto p = QPainter(&_frame);
p.setOpacity(opacity);
p.fillRect(_painterInnerLeft, _painterInnerTop, _painterInnerWidth, _painterCategoriesTop - _painterInnerTop, st::emojiPanBg);
p.fillRect(_painterInnerLeft, _painterCategoriesTop, _painterInnerWidth, _painterInnerBottom - _painterCategoriesTop, _wasSectionIcons ? st::emojiPanCategories : st::emojiPanBg);
p.fillRect(_painterInnerLeft, _painterInnerTop, _painterInnerWidth, _painterCategoriesTop - _painterInnerTop, st.bg);
p.fillRect(_painterInnerLeft, _painterCategoriesTop, _painterInnerWidth, _painterInnerBottom - _painterCategoriesTop, _wasSectionIcons ? st.categoriesBg : st.bg);
p.setCompositionMode(QPainter::CompositionMode_SourceOver);
if (leftTo > _innerLeft) {
p.setOpacity(opacity * leftAlpha);
@@ -325,11 +329,24 @@ TabbedSelector::TabbedSelector(
std::shared_ptr<Show> show,
PauseReason level,
Mode mode)
: TabbedSelector(parent, {
.show = std::move(show),
.st = (mode == Mode::EmojiStatus
? st::statusEmojiPan
: st::defaultEmojiPan),
.level = level,
.mode = mode,
}) {
}
TabbedSelector::TabbedSelector(
QWidget *parent,
TabbedSelectorDescriptor &&descriptor)
: RpWidget(parent)
, _st((mode == Mode::EmojiStatus) ? st::statusEmojiPan : st::defaultEmojiPan)
, _show(std::move(show))
, _level(level)
, _mode(mode)
, _st(descriptor.st)
, _show(std::move(descriptor.show))
, _level(descriptor.level)
, _mode(descriptor.mode)
, _panelRounding(Ui::PrepareCornerPixmaps(st::emojiPanRadius, _st.bg))
, _categoriesRounding(
Ui::PrepareCornerPixmaps(st::emojiPanRadius, _st.categoriesBg))
@@ -360,6 +377,7 @@ TabbedSelector::TabbedSelector(
: SelectorTab::Emoji)
, _hasEmojiTab(ranges::contains(_tabs, SelectorTab::Emoji, &Tab::type))
, _hasStickersTab(ranges::contains(_tabs, SelectorTab::Stickers, &Tab::type))
, _stickersSettingsHidden(descriptor.stickersSettingsHidden)
, _hasGifsTab(ranges::contains(_tabs, SelectorTab::Gifs, &Tab::type))
, _hasMasksTab(ranges::contains(_tabs, SelectorTab::Masks, &Tab::type))
, _tabbed(_tabs.size() > 1) {
@@ -445,10 +463,10 @@ TabbedSelector::TabbedSelector(
) | rpl::start_with_next([=] {
_panelRounding = Ui::PrepareCornerPixmaps(
st::emojiPanRadius,
st::emojiPanBg);
_st.bg);
_categoriesRounding = Ui::PrepareCornerPixmaps(
st::emojiPanRadius,
st::emojiPanCategories);
_st.categoriesBg);
}, lifetime());
if (hasEmojiTab()) {
@@ -503,6 +521,7 @@ TabbedSelector::Tab TabbedSelector::createTab(SelectorTab type, int index) {
.mode = StickersMode::Full,
.paused = paused,
.st = &_st,
.settingsHidden = _stickersSettingsHidden,
});
}
case SelectorTab::Gifs: {
@@ -704,10 +723,10 @@ void TabbedSelector::paintSlideFrame(QPainter &p) {
if (_roundRadius > 0) {
paintBgRoundedPart(p);
} else if (_tabsSlider) {
p.fillRect(0, 0, width(), _tabsSlider->height(), st::emojiPanBg);
p.fillRect(0, 0, width(), _tabsSlider->height(), _st.bg);
}
auto slideDt = _a_slide.value(1.);
_slideAnimation->paintFrame(p, slideDt, 1.);
_slideAnimation->paintFrame(p, _st, slideDt, 1.);
}
void TabbedSelector::paintBgRoundedPart(QPainter &p) {
@@ -716,7 +735,7 @@ void TabbedSelector::paintBgRoundedPart(QPainter &p) {
: _tabsSlider
? QRect(0, 0, width(), _tabsSlider->height())
: QRect(0, 0, width(), _roundRadius);
Ui::FillRoundRect(p, fill, st::emojiPanBg, {
Ui::FillRoundRect(p, fill, _st.bg, {
.p = {
_dropDown ? QPixmap() : _panelRounding.p[0],
_dropDown ? QPixmap() : _panelRounding.p[1],
@@ -765,10 +784,10 @@ void TabbedSelector::paintContent(QPainter &p) {
sidesTop,
st::emojiScroll.width,
sidesHeight),
st::emojiPanBg);
_st.bg);
p.fillRect(
myrtlrect(0, sidesTop, st::emojiPanRadius, sidesHeight),
st::emojiPanBg);
_st.bg);
}
}
@@ -1030,7 +1049,7 @@ void TabbedSelector::setAllowEmojiWithoutPremium(bool allow) {
}
void TabbedSelector::createTabsSlider() {
_tabsSlider.create(this, st::emojiTabs);
_tabsSlider.create(this, _st.tabs);
fillTabsSliderSections();
@@ -1324,7 +1343,7 @@ void TabbedSelector::Inner::paintEmptySearchResults(
iconTop + icon.height() - st::normalFont->height,
height() - 2 * st::normalFont->height);
p.setFont(st::normalFont);
p.setPen(st::windowSubTextFg);
p.setPen(_st.tabs.labelFg);
p.drawTextLeft(
(width() - textWidth) / 2,
textTop,