diff --git a/Telegram/SourceFiles/boxes/send_files_box.cpp b/Telegram/SourceFiles/boxes/send_files_box.cpp index 0f5a430546..3bbd168daa 100644 --- a/Telegram/SourceFiles/boxes/send_files_box.cpp +++ b/Telegram/SourceFiles/boxes/send_files_box.cpp @@ -365,6 +365,7 @@ void AlbumThumb::prepareCache(QSize size, int shrink) { ImageRoundRadius::Large, _albumCorners, QRect(QPoint(), size * cIntRetinaFactor())); + _albumCache.setDevicePixelRatio(cRetinaFactor()); } void AlbumThumb::drawSimpleFrame(Painter &p, QRect to, QSize size) const { diff --git a/Telegram/SourceFiles/boxes/stickers_box.cpp b/Telegram/SourceFiles/boxes/stickers_box.cpp index 3f819d294d..5ffdfc1313 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.cpp +++ b/Telegram/SourceFiles/boxes/stickers_box.cpp @@ -411,7 +411,7 @@ void StickersBox::updateTabsGeometry() { auto featuredLeft = width() / 3; auto featuredRight = 2 * width() / 3; - auto featuredTextWidth = st::stickersTabs.labelFont->width(tr::lng_stickers_featured_tab(tr::now).toUpper()); + auto featuredTextWidth = st::stickersTabs.labelStyle.font->width(tr::lng_stickers_featured_tab(tr::now).toUpper()); auto featuredTextRight = featuredLeft + (featuredRight - featuredLeft - featuredTextWidth) / 2 + featuredTextWidth; auto unreadBadgeLeft = featuredTextRight - st::stickersFeaturedBadgeSkip; auto unreadBadgeTop = st::stickersFeaturedBadgeTop; diff --git a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp index 2bcacbbf0e..0e8e496c93 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp @@ -898,7 +898,6 @@ void Gif::playAnimation(bool autoplay) { Core::App().showDocument(_data, _parent->data()); return; } - using Mode = ::Media::Clip::Reader::Mode; if (_streamed) { stopAnimation(); } else if (_data->canBePlayed()) { diff --git a/Telegram/SourceFiles/platform/mac/window_title_mac.mm b/Telegram/SourceFiles/platform/mac/window_title_mac.mm index 6ce64034f0..f90a86e151 100644 --- a/Telegram/SourceFiles/platform/mac/window_title_mac.mm +++ b/Telegram/SourceFiles/platform/mac/window_title_mac.mm @@ -185,6 +185,7 @@ void PreviewWindowFramePaint(QImage &preview, const style::palette &palette, QRe corners[3] = roundMask.copy(retinaRadius, retinaRadius, retinaRadius, retinaRadius); auto rounded = preview.copy(inner.x() * retina, inner.y() * retina, inner.width() * retina, inner.height() * retina); Images::prepareRound(rounded, corners); + rounded.setDevicePixelRatio(cRetinaFactor()); preview.fill(st::themePreviewBg->c); auto topLeft = st::macWindowShadowTopLeft.instance(QColor(0, 0, 0), 100); diff --git a/Telegram/SourceFiles/ui/image/image.cpp b/Telegram/SourceFiles/ui/image/image.cpp index 559e0e9b5a..157f8e0163 100644 --- a/Telegram/SourceFiles/ui/image/image.cpp +++ b/Telegram/SourceFiles/ui/image/image.cpp @@ -848,7 +848,7 @@ QPixmap Image::pixNoCache( outerh *= cIntRetinaFactor(); QImage result(outerw, outerh, QImage::Format_ARGB32_Premultiplied); - result.setDevicePixelRatio(cRetinaFactor()); + result.setDevicePixelRatio(style::DevicePixelRatio()); { QPainter p(&result); diff --git a/Telegram/SourceFiles/ui/widgets/discrete_sliders.cpp b/Telegram/SourceFiles/ui/widgets/discrete_sliders.cpp index f8c4f3bb5c..e4cb7cdb98 100644 --- a/Telegram/SourceFiles/ui/widgets/discrete_sliders.cpp +++ b/Telegram/SourceFiles/ui/widgets/discrete_sliders.cpp @@ -54,7 +54,7 @@ void DiscreteSlider::setSelectOnPress(bool selectOnPress) { } void DiscreteSlider::addSection(const QString &label) { - _sections.push_back(Section(label, getLabelFont())); + _sections.push_back(Section(label, getLabelStyle())); resizeToWidth(width()); } @@ -63,7 +63,7 @@ void DiscreteSlider::setSections(const QStringList &labels) { _sections.clear(); for (const auto &label : labels) { - _sections.push_back(Section(label, getLabelFont())); + _sections.push_back(Section(label, getLabelStyle())); } stopAnimation(); if (_activeIndex >= _sections.size()) { @@ -152,12 +152,16 @@ int DiscreteSlider::getIndexFromPosition(QPoint pos) { return count - 1; } -DiscreteSlider::Section::Section(const QString &label, const style::font &font) -: label(label) -, labelWidth(font->width(label)) { +DiscreteSlider::Section::Section( + const QString &label, + const style::TextStyle &st) +: label(st, label) { } -SettingsSlider::SettingsSlider(QWidget *parent, const style::SettingsSlider &st) : DiscreteSlider(parent) +SettingsSlider::SettingsSlider( + QWidget *parent, + const style::SettingsSlider &st) +: DiscreteSlider(parent) , _st(st) { setSelectOnPress(_st.ripple.showDuration == 0); } @@ -166,8 +170,8 @@ void SettingsSlider::setRippleTopRoundRadius(int radius) { _rippleTopRoundRadius = radius; } -const style::font &SettingsSlider::getLabelFont() const { - return _st.labelFont; +const style::TextStyle &SettingsSlider::getLabelStyle() const { + return _st.labelStyle; } int SettingsSlider::getAnimationDuration() const { @@ -206,8 +210,8 @@ std::vector SettingsSlider::countSectionsWidths( auto labelsWidth = 0; auto commonWidth = true; enumerateSections([&](const Section §ion) { - labelsWidth += section.labelWidth; - if (section.labelWidth >= sectionWidth) { + labelsWidth += section.label.maxWidth(); + if (section.label.maxWidth() >= sectionWidth) { commonWidth = false; } return true; @@ -219,7 +223,7 @@ std::vector SettingsSlider::countSectionsWidths( enumerateSections([&](const Section §ion) { Expects(currentWidth != result.end()); - *currentWidth = padding + section.labelWidth + padding; + *currentWidth = padding + section.label.maxWidth() + padding; ++currentWidth; return true; }); @@ -275,7 +279,6 @@ void SettingsSlider::paintEvent(QPaintEvent *e) { auto clip = e->rect(); auto activeLeft = getCurrentActiveLeft(); - p.setFont(_st.labelFont); enumerateSections([&](Section §ion) { auto active = 1. - snap(qAbs(activeLeft - section.left) / float64(section.width), 0., 1.); if (section.ripple) { @@ -302,9 +305,14 @@ void SettingsSlider::paintEvent(QPaintEvent *e) { if (tofill) { p.fillRect(myrtlrect(from, _st.barTop, tofill, _st.barStroke), _st.barFg); } - if (myrtlrect(section.left, _st.labelTop, section.width, _st.labelFont->height).intersects(clip)) { + if (myrtlrect(section.left, _st.labelTop, section.width, _st.labelStyle.font->height).intersects(clip)) { p.setPen(anim::pen(_st.labelFg, _st.labelFgActive, active)); - p.drawTextLeft(section.left + (section.width - section.labelWidth) / 2, _st.labelTop, width(), section.label, section.labelWidth); + section.label.drawLeft( + p, + section.left + (section.width - section.label.maxWidth()) / 2, + _st.labelTop, + section.label.maxWidth(), + width()); } return true; }); diff --git a/Telegram/SourceFiles/ui/widgets/discrete_sliders.h b/Telegram/SourceFiles/ui/widgets/discrete_sliders.h index a09c550b09..3947cab845 100644 --- a/Telegram/SourceFiles/ui/widgets/discrete_sliders.h +++ b/Telegram/SourceFiles/ui/widgets/discrete_sliders.h @@ -41,11 +41,11 @@ protected: int resizeGetHeight(int newWidth) override = 0; struct Section { - Section(const QString &label, const style::font &font); + Section(const QString &label, const style::TextStyle &st); - int left, width; - QString label; - int labelWidth; + int left = 0; + int width = 0; + Ui::Text::String label; std::unique_ptr ripple; }; @@ -72,7 +72,7 @@ protected: private: void activateCallback(); - virtual const style::font &getLabelFont() const = 0; + virtual const style::TextStyle &getLabelStyle() const = 0; virtual int getAnimationDuration() const = 0; int getIndexFromPosition(QPoint pos); @@ -107,7 +107,7 @@ protected: void startRipple(int sectionIndex) override; private: - const style::font &getLabelFont() const override; + const style::TextStyle &getLabelStyle() const override; int getAnimationDuration() const override; QImage prepareRippleMask(int sectionIndex, const Section §ion); diff --git a/Telegram/SourceFiles/window/themes/window_themes_cloud_list.cpp b/Telegram/SourceFiles/window/themes/window_themes_cloud_list.cpp index fb33bb12be..c63be6ba50 100644 --- a/Telegram/SourceFiles/window/themes/window_themes_cloud_list.cpp +++ b/Telegram/SourceFiles/window/themes/window_themes_cloud_list.cpp @@ -211,6 +211,7 @@ void CloudListCheck::validateBackgroundCache(int width) { imageWidth, _backgroundFull.height()); Images::prepareRound(_backgroundCache, ImageRoundRadius::Large); + _backgroundCache.setDevicePixelRatio(cRetinaFactor()); } void CloudListCheck::paint(Painter &p, int left, int top, int outerWidth) { diff --git a/Telegram/lib_spellcheck b/Telegram/lib_spellcheck index cec0789e68..1cd02eaf48 160000 --- a/Telegram/lib_spellcheck +++ b/Telegram/lib_spellcheck @@ -1 +1 @@ -Subproject commit cec0789e68a892c62b2ad910a06191c665b8d137 +Subproject commit 1cd02eaf489056359ab1dcd8b7449b6a0b50bf94 diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 21b976569a..65eb03a6a7 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 21b976569ae2051955c7346295c7029a75bf1bbc +Subproject commit 65eb03a6a78ffe09cd8f644edfe14560854b89eb