Update spellcheck and ui submodules.

This commit is contained in:
John Preston 2019-12-14 17:46:31 +03:00
parent dc3e9e2f3d
commit 1f2b5ba0a2
10 changed files with 35 additions and 25 deletions

View File

@ -365,6 +365,7 @@ void AlbumThumb::prepareCache(QSize size, int shrink) {
ImageRoundRadius::Large, ImageRoundRadius::Large,
_albumCorners, _albumCorners,
QRect(QPoint(), size * cIntRetinaFactor())); QRect(QPoint(), size * cIntRetinaFactor()));
_albumCache.setDevicePixelRatio(cRetinaFactor());
} }
void AlbumThumb::drawSimpleFrame(Painter &p, QRect to, QSize size) const { void AlbumThumb::drawSimpleFrame(Painter &p, QRect to, QSize size) const {

View File

@ -411,7 +411,7 @@ void StickersBox::updateTabsGeometry() {
auto featuredLeft = width() / 3; auto featuredLeft = width() / 3;
auto featuredRight = 2 * 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 featuredTextRight = featuredLeft + (featuredRight - featuredLeft - featuredTextWidth) / 2 + featuredTextWidth;
auto unreadBadgeLeft = featuredTextRight - st::stickersFeaturedBadgeSkip; auto unreadBadgeLeft = featuredTextRight - st::stickersFeaturedBadgeSkip;
auto unreadBadgeTop = st::stickersFeaturedBadgeTop; auto unreadBadgeTop = st::stickersFeaturedBadgeTop;

View File

@ -898,7 +898,6 @@ void Gif::playAnimation(bool autoplay) {
Core::App().showDocument(_data, _parent->data()); Core::App().showDocument(_data, _parent->data());
return; return;
} }
using Mode = ::Media::Clip::Reader::Mode;
if (_streamed) { if (_streamed) {
stopAnimation(); stopAnimation();
} else if (_data->canBePlayed()) { } else if (_data->canBePlayed()) {

View File

@ -185,6 +185,7 @@ void PreviewWindowFramePaint(QImage &preview, const style::palette &palette, QRe
corners[3] = roundMask.copy(retinaRadius, retinaRadius, retinaRadius, retinaRadius); corners[3] = roundMask.copy(retinaRadius, retinaRadius, retinaRadius, retinaRadius);
auto rounded = preview.copy(inner.x() * retina, inner.y() * retina, inner.width() * retina, inner.height() * retina); auto rounded = preview.copy(inner.x() * retina, inner.y() * retina, inner.width() * retina, inner.height() * retina);
Images::prepareRound(rounded, corners); Images::prepareRound(rounded, corners);
rounded.setDevicePixelRatio(cRetinaFactor());
preview.fill(st::themePreviewBg->c); preview.fill(st::themePreviewBg->c);
auto topLeft = st::macWindowShadowTopLeft.instance(QColor(0, 0, 0), 100); auto topLeft = st::macWindowShadowTopLeft.instance(QColor(0, 0, 0), 100);

View File

@ -848,7 +848,7 @@ QPixmap Image::pixNoCache(
outerh *= cIntRetinaFactor(); outerh *= cIntRetinaFactor();
QImage result(outerw, outerh, QImage::Format_ARGB32_Premultiplied); QImage result(outerw, outerh, QImage::Format_ARGB32_Premultiplied);
result.setDevicePixelRatio(cRetinaFactor()); result.setDevicePixelRatio(style::DevicePixelRatio());
{ {
QPainter p(&result); QPainter p(&result);

View File

@ -54,7 +54,7 @@ void DiscreteSlider::setSelectOnPress(bool selectOnPress) {
} }
void DiscreteSlider::addSection(const QString &label) { void DiscreteSlider::addSection(const QString &label) {
_sections.push_back(Section(label, getLabelFont())); _sections.push_back(Section(label, getLabelStyle()));
resizeToWidth(width()); resizeToWidth(width());
} }
@ -63,7 +63,7 @@ void DiscreteSlider::setSections(const QStringList &labels) {
_sections.clear(); _sections.clear();
for (const auto &label : labels) { for (const auto &label : labels) {
_sections.push_back(Section(label, getLabelFont())); _sections.push_back(Section(label, getLabelStyle()));
} }
stopAnimation(); stopAnimation();
if (_activeIndex >= _sections.size()) { if (_activeIndex >= _sections.size()) {
@ -152,12 +152,16 @@ int DiscreteSlider::getIndexFromPosition(QPoint pos) {
return count - 1; return count - 1;
} }
DiscreteSlider::Section::Section(const QString &label, const style::font &font) DiscreteSlider::Section::Section(
: label(label) const QString &label,
, labelWidth(font->width(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) { , _st(st) {
setSelectOnPress(_st.ripple.showDuration == 0); setSelectOnPress(_st.ripple.showDuration == 0);
} }
@ -166,8 +170,8 @@ void SettingsSlider::setRippleTopRoundRadius(int radius) {
_rippleTopRoundRadius = radius; _rippleTopRoundRadius = radius;
} }
const style::font &SettingsSlider::getLabelFont() const { const style::TextStyle &SettingsSlider::getLabelStyle() const {
return _st.labelFont; return _st.labelStyle;
} }
int SettingsSlider::getAnimationDuration() const { int SettingsSlider::getAnimationDuration() const {
@ -206,8 +210,8 @@ std::vector<float64> SettingsSlider::countSectionsWidths(
auto labelsWidth = 0; auto labelsWidth = 0;
auto commonWidth = true; auto commonWidth = true;
enumerateSections([&](const Section &section) { enumerateSections([&](const Section &section) {
labelsWidth += section.labelWidth; labelsWidth += section.label.maxWidth();
if (section.labelWidth >= sectionWidth) { if (section.label.maxWidth() >= sectionWidth) {
commonWidth = false; commonWidth = false;
} }
return true; return true;
@ -219,7 +223,7 @@ std::vector<float64> SettingsSlider::countSectionsWidths(
enumerateSections([&](const Section &section) { enumerateSections([&](const Section &section) {
Expects(currentWidth != result.end()); Expects(currentWidth != result.end());
*currentWidth = padding + section.labelWidth + padding; *currentWidth = padding + section.label.maxWidth() + padding;
++currentWidth; ++currentWidth;
return true; return true;
}); });
@ -275,7 +279,6 @@ void SettingsSlider::paintEvent(QPaintEvent *e) {
auto clip = e->rect(); auto clip = e->rect();
auto activeLeft = getCurrentActiveLeft(); auto activeLeft = getCurrentActiveLeft();
p.setFont(_st.labelFont);
enumerateSections([&](Section &section) { enumerateSections([&](Section &section) {
auto active = 1. - snap(qAbs(activeLeft - section.left) / float64(section.width), 0., 1.); auto active = 1. - snap(qAbs(activeLeft - section.left) / float64(section.width), 0., 1.);
if (section.ripple) { if (section.ripple) {
@ -302,9 +305,14 @@ void SettingsSlider::paintEvent(QPaintEvent *e) {
if (tofill) { if (tofill) {
p.fillRect(myrtlrect(from, _st.barTop, tofill, _st.barStroke), _st.barFg); 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.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; return true;
}); });

View File

@ -41,11 +41,11 @@ protected:
int resizeGetHeight(int newWidth) override = 0; int resizeGetHeight(int newWidth) override = 0;
struct Section { struct Section {
Section(const QString &label, const style::font &font); Section(const QString &label, const style::TextStyle &st);
int left, width; int left = 0;
QString label; int width = 0;
int labelWidth; Ui::Text::String label;
std::unique_ptr<RippleAnimation> ripple; std::unique_ptr<RippleAnimation> ripple;
}; };
@ -72,7 +72,7 @@ protected:
private: private:
void activateCallback(); void activateCallback();
virtual const style::font &getLabelFont() const = 0; virtual const style::TextStyle &getLabelStyle() const = 0;
virtual int getAnimationDuration() const = 0; virtual int getAnimationDuration() const = 0;
int getIndexFromPosition(QPoint pos); int getIndexFromPosition(QPoint pos);
@ -107,7 +107,7 @@ protected:
void startRipple(int sectionIndex) override; void startRipple(int sectionIndex) override;
private: private:
const style::font &getLabelFont() const override; const style::TextStyle &getLabelStyle() const override;
int getAnimationDuration() const override; int getAnimationDuration() const override;
QImage prepareRippleMask(int sectionIndex, const Section &section); QImage prepareRippleMask(int sectionIndex, const Section &section);

View File

@ -211,6 +211,7 @@ void CloudListCheck::validateBackgroundCache(int width) {
imageWidth, imageWidth,
_backgroundFull.height()); _backgroundFull.height());
Images::prepareRound(_backgroundCache, ImageRoundRadius::Large); Images::prepareRound(_backgroundCache, ImageRoundRadius::Large);
_backgroundCache.setDevicePixelRatio(cRetinaFactor());
} }
void CloudListCheck::paint(Painter &p, int left, int top, int outerWidth) { void CloudListCheck::paint(Painter &p, int left, int top, int outerWidth) {

@ -1 +1 @@
Subproject commit cec0789e68a892c62b2ad910a06191c665b8d137 Subproject commit 1cd02eaf489056359ab1dcd8b7449b6a0b50bf94

@ -1 +1 @@
Subproject commit 21b976569ae2051955c7346295c7029a75bf1bbc Subproject commit 65eb03a6a78ffe09cd8f644edfe14560854b89eb