Fix poll answer check in custom chat themes.
This commit is contained in:
parent
1f25777929
commit
af100c2d13
|
@ -1207,31 +1207,67 @@ void Poll::paintFilling(
|
||||||
|
|
||||||
top += st::historyPollAnswerPadding.top();
|
top += st::historyPollAnswerPadding.top();
|
||||||
|
|
||||||
PainterHighQualityEnabler hq(p);
|
|
||||||
p.setPen(Qt::NoPen);
|
|
||||||
const auto thickness = st::historyPollFillingHeight;
|
const auto thickness = st::historyPollFillingHeight;
|
||||||
const auto max = awidth - st::historyPollFillingRight;
|
const auto max = awidth - st::historyPollFillingRight;
|
||||||
const auto size = anim::interpolate(st::historyPollFillingMin, max, filling);
|
const auto size = anim::interpolate(st::historyPollFillingMin, max, filling);
|
||||||
const auto radius = st::historyPollFillingRadius;
|
const auto radius = st::historyPollFillingRadius;
|
||||||
const auto ftop = bottom - st::historyPollFillingBottom - thickness;
|
const auto ftop = bottom - st::historyPollFillingBottom - thickness;
|
||||||
|
|
||||||
if (chosen && !correct) {
|
enum class Style {
|
||||||
p.setBrush(st->boxTextFgError());
|
Incorrect,
|
||||||
} else if (chosen && correct && _poll->quiz() && !context.outbg) {
|
Correct,
|
||||||
p.setBrush(st->boxTextFgGood());
|
Default,
|
||||||
} else {
|
};
|
||||||
p.setBrush(stm->msgWaveformActive);
|
const auto style = [&] {
|
||||||
}
|
if (chosen && !correct) {
|
||||||
|
return Style::Incorrect;
|
||||||
|
} else if (chosen && correct && _poll->quiz() && !context.outbg) {
|
||||||
|
return Style::Correct;
|
||||||
|
} else {
|
||||||
|
return Style::Default;
|
||||||
|
}
|
||||||
|
}();
|
||||||
auto barleft = aleft;
|
auto barleft = aleft;
|
||||||
auto barwidth = size;
|
auto barwidth = size;
|
||||||
|
const auto &color = (style == Style::Incorrect)
|
||||||
|
? st->boxTextFgError()
|
||||||
|
: (style == Style::Correct)
|
||||||
|
? st->boxTextFgGood()
|
||||||
|
: stm->msgFileBg;
|
||||||
|
p.setPen(Qt::NoPen);
|
||||||
|
p.setBrush(color);
|
||||||
|
PainterHighQualityEnabler hq(p);
|
||||||
if (chosen || correct) {
|
if (chosen || correct) {
|
||||||
const auto &icon = (chosen && !correct)
|
const auto &icon = (style == Style::Incorrect)
|
||||||
? st->historyPollChoiceWrong()
|
? st->historyPollChoiceWrong()
|
||||||
: st->historyPollChoiceRight();
|
: (style == Style::Correct)
|
||||||
|
? st->historyPollChoiceRight()
|
||||||
|
: stm->historyPollChoiceRight;
|
||||||
const auto cleft = aleft - st::historyPollPercentSkip - icon.width();
|
const auto cleft = aleft - st::historyPollPercentSkip - icon.width();
|
||||||
const auto ctop = ftop - (icon.height() - thickness) / 2;
|
const auto ctop = ftop - (icon.height() - thickness) / 2;
|
||||||
p.drawEllipse(cleft, ctop, icon.width(), icon.height());
|
p.drawEllipse(cleft, ctop, icon.width(), icon.height());
|
||||||
icon.paint(p, cleft, ctop, width);
|
|
||||||
|
const auto paintContent = [&](Painter &p) {
|
||||||
|
icon.paint(p, cleft, ctop, width);
|
||||||
|
};
|
||||||
|
if (style == Style::Default && usesBubblePattern(context)) {
|
||||||
|
const auto add = st::lineWidth * 2;
|
||||||
|
const auto target = QRect(
|
||||||
|
cleft,
|
||||||
|
ctop,
|
||||||
|
icon.width(),
|
||||||
|
icon.height()
|
||||||
|
).marginsAdded({ add, add, add, add });
|
||||||
|
Ui::PaintPatternBubblePart(
|
||||||
|
p,
|
||||||
|
context.viewport,
|
||||||
|
context.bubblesPattern->pixmap,
|
||||||
|
target,
|
||||||
|
paintContent,
|
||||||
|
_fillingIconCache);
|
||||||
|
} else {
|
||||||
|
paintContent(p);
|
||||||
|
}
|
||||||
//barleft += icon.width() - radius;
|
//barleft += icon.width() - radius;
|
||||||
//barwidth -= icon.width() - radius;
|
//barwidth -= icon.width() - radius;
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,6 +214,7 @@ private:
|
||||||
Ui::Animations::Simple _wrongAnswerAnimation;
|
Ui::Animations::Simple _wrongAnswerAnimation;
|
||||||
mutable QPoint _lastLinkPoint;
|
mutable QPoint _lastLinkPoint;
|
||||||
mutable QImage _userpicCircleCache;
|
mutable QImage _userpicCircleCache;
|
||||||
|
mutable QImage _fillingIconCache;
|
||||||
|
|
||||||
mutable std::unique_ptr<CloseInformation> _close;
|
mutable std::unique_ptr<CloseInformation> _close;
|
||||||
|
|
||||||
|
|
|
@ -741,6 +741,10 @@ historyPollBottomButtonSkip: 15px;
|
||||||
historyPollBottomButtonTop: 4px;
|
historyPollBottomButtonTop: 4px;
|
||||||
historyPollChoiceRight: icon {{ "poll_choice_right", activeButtonFg }};
|
historyPollChoiceRight: icon {{ "poll_choice_right", activeButtonFg }};
|
||||||
historyPollChoiceWrong: icon {{ "poll_choice_wrong", activeButtonFg }};
|
historyPollChoiceWrong: icon {{ "poll_choice_wrong", activeButtonFg }};
|
||||||
|
historyPollOutChoiceRight: icon {{ "poll_choice_right", historyFileOutIconFg }};
|
||||||
|
historyPollOutChoiceRightSelected: icon {{ "poll_choice_right", historyFileOutIconFgSelected }};
|
||||||
|
historyPollInChoiceRight: icon {{ "poll_choice_right", historyFileInIconFg }};
|
||||||
|
historyPollInChoiceRightSelected: icon {{ "poll_choice_right", historyFileInIconFgSelected }};
|
||||||
historyPollOutChosen: icon {{ "poll_select_check", historyFileOutIconFg }};
|
historyPollOutChosen: icon {{ "poll_select_check", historyFileOutIconFg }};
|
||||||
historyPollOutChosenSelected: icon {{ "poll_select_check", historyFileOutIconFgSelected }};
|
historyPollOutChosenSelected: icon {{ "poll_select_check", historyFileOutIconFgSelected }};
|
||||||
historyPollInChosen: icon {{ "poll_select_check", historyFileInIconFg }};
|
historyPollInChosen: icon {{ "poll_select_check", historyFileInIconFg }};
|
||||||
|
|
|
@ -391,6 +391,12 @@ ChatStyle::ChatStyle() {
|
||||||
st::historyPollInChosenSelected,
|
st::historyPollInChosenSelected,
|
||||||
st::historyPollOutChosen,
|
st::historyPollOutChosen,
|
||||||
st::historyPollOutChosenSelected);
|
st::historyPollOutChosenSelected);
|
||||||
|
make(
|
||||||
|
&MessageStyle::historyPollChoiceRight,
|
||||||
|
st::historyPollInChoiceRight,
|
||||||
|
st::historyPollInChoiceRightSelected,
|
||||||
|
st::historyPollOutChoiceRight,
|
||||||
|
st::historyPollOutChoiceRightSelected);
|
||||||
make(
|
make(
|
||||||
&MessageImageStyle::msgDateImgBg,
|
&MessageImageStyle::msgDateImgBg,
|
||||||
st::msgDateImgBg,
|
st::msgDateImgBg,
|
||||||
|
|
|
@ -69,6 +69,7 @@ struct MessageStyle {
|
||||||
style::icon historyQuizTimer = { Qt::Uninitialized };
|
style::icon historyQuizTimer = { Qt::Uninitialized };
|
||||||
style::icon historyQuizExplain = { Qt::Uninitialized };
|
style::icon historyQuizExplain = { Qt::Uninitialized };
|
||||||
style::icon historyPollChosen = { Qt::Uninitialized };
|
style::icon historyPollChosen = { Qt::Uninitialized };
|
||||||
|
style::icon historyPollChoiceRight = { Qt::Uninitialized };
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MessageImageStyle {
|
struct MessageImageStyle {
|
||||||
|
|
Loading…
Reference in New Issue