2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Closed beta 10019011: various style improvements.

This commit is contained in:
John Preston
2016-12-03 15:10:35 +03:00
parent 2796c53542
commit b0f14d1856
60 changed files with 441 additions and 313 deletions

View File

@@ -141,15 +141,15 @@ void Checkbox::paintEvent(QPaintEvent *e) {
paintRipple(p, _st.rippleAreaPosition.x(), _st.rippleAreaPosition.y(), ms, &color);
if (_checkRect.intersects(e->rect())) {
p.setRenderHint(QPainter::HighQualityAntialiasing);
auto pen = anim::pen(_st.checkFg, _st.checkFgActive, active);
pen.setWidth(_st.thickness);
p.setPen(pen);
p.setBrush(anim::brush(_st.checkBg, anim::color(_st.checkFg, _st.checkFgActive, active), active));
p.drawRoundedRect(QRectF(_checkRect).marginsRemoved(QMarginsF(_st.thickness / 2., _st.thickness / 2., _st.thickness / 2., _st.thickness / 2.)), st::buttonRadius - (_st.thickness / 2.), st::buttonRadius - (_st.thickness / 2.));
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawRoundedRect(QRectF(_checkRect).marginsRemoved(QMarginsF(_st.thickness / 2., _st.thickness / 2., _st.thickness / 2., _st.thickness / 2.)), st::buttonRadius - (_st.thickness / 2.), st::buttonRadius - (_st.thickness / 2.));
}
if (active > 0) {
_st.checkIcon.paint(p, QPoint(_st.margin.left(), _st.margin.top()), width());
@@ -247,7 +247,7 @@ void Radiobutton::paintEvent(QPaintEvent *e) {
paintRipple(p, _st.rippleAreaPosition.x(), _st.rippleAreaPosition.y(), ms, &color);
if (_checkRect.intersects(e->rect())) {
p.setRenderHint(QPainter::HighQualityAntialiasing);
PainterHighQualityEnabler hq(p);
auto pen = anim::pen(_st.checkFg, _st.checkFgActive, active);
pen.setWidth(_st.thickness);
@@ -275,8 +275,6 @@ void Radiobutton::paintEvent(QPaintEvent *e) {
// }
//}
}
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
}
if (_checkRect.contains(e->rect())) return;

View File

@@ -186,8 +186,9 @@ float64 FilledSlider::getOverDuration() const {
void FilledSlider::paintEvent(QPaintEvent *e) {
Painter p(this);
PainterHighQualityEnabler hq(p);
p.setPen(Qt::NoPen);
p.setRenderHint(QPainter::HighQualityAntialiasing);
auto masterOpacity = fadeOpacity();
auto ms = getms();
@@ -233,8 +234,9 @@ float64 MediaSlider::getOverDuration() const {
void MediaSlider::paintEvent(QPaintEvent *e) {
Painter p(this);
PainterHighQualityEnabler hq(p);
p.setPen(Qt::NoPen);
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.setOpacity(fadeOpacity());
auto horizontal = isHorizontal();

View File

@@ -1542,13 +1542,14 @@ void FlatInput::paintEvent(QPaintEvent *e) {
auto ms = getms();
auto placeholderFocused = _a_placeholderFocused.current(ms, hasFocus() ? 1. : 0.);
p.setRenderHint(QPainter::HighQualityAntialiasing);
auto pen = anim::pen(_st.borderColor, _st.borderActive, placeholderFocused);
pen.setWidth(_st.borderWidth);
p.setPen(pen);
p.setBrush(anim::brush(_st.bgColor, _st.bgActive, placeholderFocused));
p.drawRoundedRect(QRectF(0, 0, width(), height()).marginsRemoved(QMarginsF(_st.borderWidth / 2., _st.borderWidth / 2., _st.borderWidth / 2., _st.borderWidth / 2.)), st::buttonRadius - (_st.borderWidth / 2.), st::buttonRadius - (_st.borderWidth / 2.));
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawRoundedRect(QRectF(0, 0, width(), height()).marginsRemoved(QMarginsF(_st.borderWidth / 2., _st.borderWidth / 2., _st.borderWidth / 2., _st.borderWidth / 2.)), st::buttonRadius - (_st.borderWidth / 2.), st::buttonRadius - (_st.borderWidth / 2.));
}
if (!_st.icon.empty()) {
_st.icon.paint(p, 0, 0, width());

View File

@@ -170,19 +170,20 @@ void MultiSelect::Inner::Item::paintOnce(Painter &p, int x, int y, int outerWidt
auto clipEnabled = p.hasClipping();
auto clip = clipEnabled ? p.clipRegion() : QRegion();
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.setClipRect(inner);
p.setPen(Qt::NoPen);
p.setBrush(_active ? _st.textActiveBg : _st.textBg);
p.drawRoundedRect(rtlrect(x, y, _width, _st.height, outerWidth), radius, radius);
{
PainterHighQualityEnabler hq(p);
p.drawRoundedRect(rtlrect(x, y, _width, _st.height, outerWidth), radius, radius);
}
if (clipEnabled) {
p.setClipRegion(clip);
} else {
p.setClipping(false);
}
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
auto overOpacity = _overOpacity.current(ms, _over ? 1. : 0.);
if (overOpacity < 1.) {
@@ -203,9 +204,10 @@ void MultiSelect::Inner::Item::paintDeleteButton(Painter &p, int x, int y, int o
p.setPen(Qt::NoPen);
p.setBrush(_color);
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(rtlrect(x, y, _st.height, _st.height, outerWidth));
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(rtlrect(x, y, _st.height, _st.height, outerWidth));
}
CrossAnimation::paint(p, _st.deleteCross, _st.deleteFg, x, y, outerWidth, overOpacity);
@@ -213,15 +215,15 @@ void MultiSelect::Inner::Item::paintDeleteButton(Painter &p, int x, int y, int o
}
bool MultiSelect::Inner::Item::paintCached(Painter &p, int x, int y, int outerWidth) {
PainterHighQualityEnabler hq(p);
auto opacity = _visibility.current(_hiding ? 0. : 1.);
auto scale = opacity + _st.minScale * (1. - opacity);
auto height = opacity * _cache.height() / _cache.devicePixelRatio();
auto width = opacity * _cache.width() / _cache.devicePixelRatio();
p.setOpacity(opacity);
p.setRenderHint(QPainter::SmoothPixmapTransform, true);
p.drawPixmap(rtlrect(x + (_width - width) / 2., y + (_st.height - height) / 2., width, height, outerWidth), _cache);
p.setRenderHint(QPainter::SmoothPixmapTransform, false);
p.setOpacity(1.);
return true;
}

View File

@@ -139,7 +139,7 @@ void ScrollBar::paintEvent(QPaintEvent *e) {
}
if (a_fullOpacity.current() == 0.) return;
QPainter p(this);
Painter p(this);
auto deltal = _vertical ? _st->deltax : 0, deltar = _vertical ? _st->deltax : 0;
auto deltat = _vertical ? 0 : _st->deltax, deltab = _vertical ? 0 : _st->deltax;
p.setPen(Qt::NoPen);
@@ -148,12 +148,11 @@ void ScrollBar::paintEvent(QPaintEvent *e) {
auto bar = anim::color(_st->barColor, _st->barOverColor, a_barOver.current());
bar.setAlpha(anim::interpolate(0, bar.alpha(), a_fullOpacity.current()));
if (_st->round) {
p.setRenderHint(QPainter::HighQualityAntialiasing, true);
PainterHighQualityEnabler hq(p);
p.setBrush(bg);
p.drawRoundedRect(QRect(deltal, deltat, width() - deltal - deltar, height() - deltat - deltab), _st->round, _st->round);
p.setBrush(bar);
p.drawRoundedRect(_bar, _st->round, _st->round);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
} else {
p.fillRect(QRect(deltal, deltat, width() - deltal - deltar, height() - deltat - deltab), bg);
p.fillRect(_bar, bar);

View File

@@ -464,9 +464,9 @@ defaultFlatLabel: FlatLabel {
}
defaultLinkButton: LinkButton {
color: btnYesColor;
overColor: btnYesColor;
downColor: btnYesHover;
color: windowActiveTextFg;
overColor: windowActiveTextFg;
downColor: windowActiveTextFg;
font: linkFont;
overFont: linkOverFont;
}
@@ -616,7 +616,7 @@ defaultInputArea: InputArea {
duration: 120;
borderFg: #e0e0e0;
borderFgActive: #62c0f7;
borderFgActive: activeLineFg;
borderFgError: #e48383;
border: 1px;
@@ -643,7 +643,7 @@ defaultInputField: InputField {
duration: 120;
borderFg: #e0e0e0;
borderFgActive: #62c0f7;
borderFgActive: activeLineFg;
borderFgError: #e48383;
border: 1px;
@@ -719,8 +719,8 @@ defaultSettingsSlider: SettingsSlider {
barFgActive: windowBgActive;
labelTop: 17px;
labelFont: normalFont;
labelFg: #1485c2;
labelFgActive: #1485c2;
labelFg: windowActiveTextFg;
labelFgActive: windowActiveTextFg;
duration: 150;
}