Some colors split for the palette. Theme preview applying improved.

Also attempting to fix travis build.
This commit is contained in:
John Preston
2017-01-11 12:16:44 +04:00
parent 30c9bcb985
commit 2d185cf66e
13 changed files with 121 additions and 70 deletions
+31 -24
View File
@@ -102,30 +102,37 @@ membersInnerItem: ProfilePeerListItem {
statusFgActive: windowActiveTextFg;
}
historyFileOutImage: icon {{ "history_file_image", msgOutBg }};
historyFileOutImageSelected: icon {{ "history_file_image", msgOutBgSelected }};
historyFileInImage: icon {{ "history_file_image", msgInBg }};
historyFileInImageSelected: icon {{ "history_file_image", msgInBgSelected }};
historyFileOutDocument: icon {{ "history_file_document", msgOutBg }};
historyFileOutDocumentSelected: icon {{ "history_file_document", msgOutBgSelected }};
historyFileInDocument: icon {{ "history_file_document", msgInBg }};
historyFileInDocumentSelected: icon {{ "history_file_document", msgInBgSelected }};
historyFileOutDownload: icon {{ "history_file_download", msgOutBg }};
historyFileOutDownloadSelected: icon {{ "history_file_download", msgOutBgSelected }};
historyFileInDownload: icon {{ "history_file_download", msgInBg }};
historyFileInDownloadSelected: icon {{ "history_file_download", msgInBgSelected }};
historyFileOutCancel: icon {{ "history_file_cancel", msgOutBg }};
historyFileOutCancelSelected: icon {{ "history_file_cancel", msgOutBgSelected }};
historyFileInCancel: icon {{ "history_file_cancel", msgInBg }};
historyFileInCancelSelected: icon {{ "history_file_cancel", msgInBgSelected }};
historyFileOutPause: icon {{ "history_file_pause", msgOutBg }};
historyFileOutPauseSelected: icon {{ "history_file_pause", msgOutBgSelected }};
historyFileInPause: icon {{ "history_file_pause", msgInBg }};
historyFileInPauseSelected: icon {{ "history_file_pause", msgInBgSelected }};
historyFileOutPlay: icon {{ "history_file_play", msgOutBg }};
historyFileOutPlaySelected: icon {{ "history_file_play", msgOutBgSelected }};
historyFileInPlay: icon {{ "history_file_play", msgInBg }};
historyFileInPlaySelected: icon {{ "history_file_play", msgInBgSelected }};
historyFileOutImage: icon {{ "history_file_image", historyFileOutIconFg }};
historyFileOutImageSelected: icon {{ "history_file_image", historyFileOutIconFgSelected }};
historyFileInImage: icon {{ "history_file_image", historyFileInIconFg }};
historyFileInImageSelected: icon {{ "history_file_image", historyFileInIconFgSelected }};
historyFileOutDocument: icon {{ "history_file_document", historyFileOutIconFg }};
historyFileOutDocumentSelected: icon {{ "history_file_document", historyFileOutIconFgSelected }};
historyFileInDocument: icon {{ "history_file_document", historyFileInIconFg }};
historyFileInDocumentSelected: icon {{ "history_file_document", historyFileInIconFgSelected }};
historyFileOutDownload: icon {{ "history_file_download", historyFileOutIconFg }};
historyFileOutDownloadSelected: icon {{ "history_file_download", historyFileOutIconFgSelected }};
historyFileInDownload: icon {{ "history_file_download", historyFileInIconFg }};
historyFileInDownloadSelected: icon {{ "history_file_download", historyFileInIconFgSelected }};
historyFileOutCancel: icon {{ "history_file_cancel", historyFileOutIconFg }};
historyFileOutCancelSelected: icon {{ "history_file_cancel", historyFileOutIconFgSelected }};
historyFileInCancel: icon {{ "history_file_cancel", historyFileInIconFg }};
historyFileInCancelSelected: icon {{ "history_file_cancel", historyFileInIconFgSelected }};
historyFileOutPause: icon {{ "history_file_pause", historyFileOutIconFg }};
historyFileOutPauseSelected: icon {{ "history_file_pause", historyFileOutIconFgSelected }};
historyFileInPause: icon {{ "history_file_pause", historyFileInIconFg }};
historyFileInPauseSelected: icon {{ "history_file_pause", historyFileInIconFgSelected }};
historyFileOutPlay: icon {{ "history_file_play", historyFileOutIconFg }};
historyFileOutPlaySelected: icon {{ "history_file_play", historyFileOutIconFgSelected }};
historyFileInPlay: icon {{ "history_file_play", historyFileInIconFg }};
historyFileInPlaySelected: icon {{ "history_file_play", historyFileInIconFgSelected }};
historyFileThumbDownload: icon {{ "history_file_download", historyFileThumbIconFg }};
historyFileThumbDownloadSelected: icon {{ "history_file_download", historyFileThumbIconFgSelected }};
historyFileThumbCancel: icon {{ "history_file_cancel", historyFileThumbIconFg }};
historyFileThumbCancelSelected: icon {{ "history_file_cancel", historyFileThumbIconFgSelected }};
historyFileThumbPlay: icon {{ "history_file_play", historyFileThumbIconFg }};
historyFileThumbPlaySelected: icon {{ "history_file_play", historyFileThumbIconFgSelected }};
historySendStateSpace: 24px;
historySendStatePosition: point(-17px, -19px);
@@ -422,26 +422,24 @@ void HistoryPhoto::draw(Painter &p, const QRect &r, TextSelection selection, Tim
p.drawEllipse(inner);
}
p.setOpacity(radial ? _animation->radial.opacity() : 1);
p.setOpacity(radialOpacity);
auto icon = ([radial, this, selected]() -> const style::icon* {
if (radial || _data->loading()) {
auto delayed = _data->full->toDelayedStorageImage();
if (!delayed || !delayed->location().isNull()) {
return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
return &(selected ? st::historyFileThumbCancelSelected : st::historyFileThumbCancel);
}
return nullptr;
}
return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
return &(selected ? st::historyFileThumbDownloadSelected : st::historyFileThumbDownload);
})();
if (icon) {
icon->paintInCenter(p, inner);
}
p.setOpacity(1);
if (radial) {
p.setOpacity(1);
QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine)));
_animation->radial.draw(p, rinner, st::msgFileRadialLine, selected ? st::msgInBgSelected : st::msgInBg);
_animation->radial.draw(p, rinner, st::msgFileRadialLine, selected ? st::historyFileThumbRadialFgSelected : st::historyFileThumbRadialFg);
}
}
@@ -766,16 +764,16 @@ void HistoryVideo::draw(Painter &p, const QRect &r, TextSelection selection, Tim
auto icon = ([loaded, radial, this, selected] {
if (loaded) {
return &(selected ? st::historyFileInPlaySelected : st::historyFileInPlay);
return &(selected ? st::historyFileThumbPlaySelected : st::historyFileThumbPlay);
} else if (radial || _data->loading()) {
return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
return &(selected ? st::historyFileThumbCancelSelected : st::historyFileThumbCancel);
}
return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
return &(selected ? st::historyFileThumbDownloadSelected : st::historyFileThumbDownload);
})();
icon->paintInCenter(p, inner);
if (radial) {
QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine)));
_animation->radial.draw(p, rinner, st::msgFileRadialLine, selected ? st::msgInBgSelected : st::msgInBg);
_animation->radial.draw(p, rinner, st::msgFileRadialLine, selected ? st::historyFileThumbRadialFgSelected : st::historyFileThumbRadialFg);
}
int32 statusX = skipx + st::msgDateImgDelta + st::msgDateImgPadding.x(), statusY = skipy + st::msgDateImgDelta + st::msgDateImgPadding.y();
@@ -1135,9 +1133,9 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection,
p.setOpacity(radialOpacity);
auto icon = ([radial, this, selected] {
if (radial || _data->loading()) {
return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
return &(selected ? st::historyFileThumbCancelSelected : st::historyFileThumbCancel);
}
return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
return &(selected ? st::historyFileThumbDownloadSelected : st::historyFileThumbDownload);
})();
p.setOpacity((radial && loaded) ? _animation->radial.opacity() : 1);
icon->paintInCenter(p, inner);
@@ -1145,7 +1143,7 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection,
p.setOpacity(1);
QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine)));
_animation->radial.draw(p, rinner, st::msgFileRadialLine, selected ? st::msgInBgSelected : st::msgInBg);
_animation->radial.draw(p, rinner, st::msgFileRadialLine, selected ? st::historyFileThumbRadialFgSelected : st::historyFileThumbRadialFg);
}
}
@@ -1182,8 +1180,8 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection,
if (radial) {
QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine)));
auto &bg = outbg ? (selected ? st::msgOutBgSelected : st::msgOutBg) : (selected ? st::msgInBgSelected : st::msgInBg);
_animation->radial.draw(p, rinner, st::msgFileRadialLine, bg);
auto fg = outbg ? (selected ? st::historyFileOutRadialFgSelected : st::historyFileOutRadialFg) : (selected ? st::historyFileInRadialFgSelected : st::historyFileInRadialFg);
_animation->radial.draw(p, rinner, st::msgFileRadialLine, fg);
}
auto icon = ([showPause, radial, this, loaded, outbg, selected] {
@@ -1769,14 +1767,14 @@ void HistoryGif::draw(Painter &p, const QRect &r, TextSelection selection, TimeM
p.setOpacity(radialOpacity);
auto icon = ([this, radial, selected]() -> const style::icon * {
if (_data->loaded() && !radial) {
return &(selected ? st::historyFileInPlaySelected : st::historyFileInPlay);
return &(selected ? st::historyFileThumbPlaySelected : st::historyFileThumbPlay);
} else if (radial || _data->loading()) {
if (_parent->id > 0 || _data->uploading()) {
return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
return &(selected ? st::historyFileThumbCancelSelected : st::historyFileThumbCancel);
}
return nullptr;
}
return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
return &(selected ? st::historyFileThumbDownloadSelected : st::historyFileThumbDownload);
})();
if (icon) {
icon->paintInCenter(p, inner);
@@ -1784,7 +1782,7 @@ void HistoryGif::draw(Painter &p, const QRect &r, TextSelection selection, TimeM
if (radial) {
p.setOpacity(1);
QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine)));
_animation->radial.draw(p, rinner, st::msgFileRadialLine, selected ? st::msgInBgSelected : st::msgInBg);
_animation->radial.draw(p, rinner, st::msgFileRadialLine, selected ? st::historyFileThumbRadialFgSelected : st::historyFileThumbRadialFg);
}
if (!animating || _parent->id < 0) {
@@ -399,17 +399,17 @@ void Video::paint(Painter &p, const QRect &clip, TextSelection selection, const
p.setOpacity((radial && loaded) ? _radial->opacity() : 1);
auto icon = ([radial, loaded, selected] {
if (radial) {
return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
return &(selected ? st::historyFileThumbCancelSelected : st::historyFileThumbCancel);
} else if (loaded) {
return &(selected ? st::historyFileInPlaySelected : st::historyFileInPlay);
return &(selected ? st::historyFileThumbPlaySelected : st::historyFileThumbPlay);
}
return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
return &(selected ? st::historyFileThumbDownloadSelected : st::historyFileThumbDownload);
})();
icon->paintInCenter(p, inner);
if (radial) {
p.setOpacity(1);
QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine)));
_radial->draw(p, rinner, st::msgFileRadialLine, selected ? st::msgInBgSelected : st::msgInBg);
_radial->draw(p, rinner, st::msgFileRadialLine, selected ? st::historyFileThumbRadialFgSelected : st::historyFileThumbRadialFg);
}
}
@@ -830,16 +830,16 @@ void Document::paint(Painter &p, const QRect &clip, TextSelection selection, con
p.setOpacity(radialOpacity);
auto icon = ([loaded, this, selected] {
if (loaded || _data->loading()) {
return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
return &(selected ? st::historyFileThumbCancelSelected : st::historyFileThumbCancel);
}
return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
return &(selected ? st::historyFileThumbDownloadSelected : st::historyFileThumbDownload);
})();
icon->paintInCenter(p, inner);
if (radial) {
p.setOpacity(1);
QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine)));
_radial->draw(p, rinner, st::msgFileRadialLine, selected ? st::msgInBgSelected : st::msgInBg);
_radial->draw(p, rinner, st::msgFileRadialLine, selected ? st::historyFileThumbRadialFgSelected : st::historyFileThumbRadialFg);
}
}
}
@@ -80,7 +80,7 @@ void BackgroundRow::paintEvent(QPaintEvent *e) {
p.drawPixmap(0, 0, _background);
} else {
const QPixmap &pix = App::main()->newBackgroundThumb()->pixBlurred(st::settingsBackgroundSize);
p.drawPixmap(0, 0, st::settingsBackgroundSize, st::settingsBackgroundSize, pix, 0, (pix.height() - st::settingsBackgroundSize) / 2, st::settingsBackgroundSize, st::settingsBackgroundSize);
p.drawPixmap(0, 0, st::settingsBackgroundSize, st::settingsBackgroundSize, pix, 0, (pix.height() - st::settingsBackgroundSize * cIntRetinaFactor()) / 2, st::settingsBackgroundSize * cIntRetinaFactor(), st::settingsBackgroundSize * cIntRetinaFactor());
}
auto outer = radialRect();
+1 -1
View File
@@ -97,7 +97,7 @@ extern transition easeOutBack;
extern transition easeInCirc;
extern transition easeOutCirc;
extern transition easeInCubic;
extern transition easeOutCirc;
extern transition easeOutCubic;
extern transition easeInQuint;
extern transition easeOutQuint;
@@ -72,7 +72,7 @@ RippleAnimation::Ripple::Ripple(const style::RippleAnimation &st, QPoint origin,
}
_radiusTo = qRound(sqrt(_radiusTo));
_show.start(UpdateCallback(_update), 0., 1., _st.showDuration, anim::easeOutCirc);
_show.start(UpdateCallback(_update), 0., 1., _st.showDuration, anim::easeOutQuint);
}
RippleAnimation::Ripple::Ripple(const style::RippleAnimation &st, const QPixmap &mask, const UpdateCallback &update)
@@ -461,7 +461,7 @@ defaultLinkButton: LinkButton {
defaultRippleAnimation: RippleAnimation {
color: windowBgRipple;
showDuration: 450;
showDuration: 650;
hideDuration: 200;
}
@@ -542,7 +542,7 @@ defaultSolidScroll: ScrollArea(defaultScrollArea) {
defaultInputFont: font(17px);
defaultFlatInput: FlatInput {
textColor: windowFg;
bgColor: windowBgOver;
bgColor: filterInputInactiveBg;
bgActive: windowBg;
width: 210px;
height: 40px;
@@ -551,7 +551,7 @@ defaultFlatInput: FlatInput {
font: defaultInputFont;
borderWidth: 2px;
borderColor: windowBgOver;
borderColor: filterInputInactiveBg;
borderActive: filterInputBorderFg;
phColor: placeholderFg;
+17 -2
View File
@@ -421,7 +421,13 @@ void ChatBackground::setPreparedImage(QImage &&image) {
image = std_::move(image).convertToFormat(QImage::Format_ARGB32_Premultiplied);
image.setDevicePixelRatio(cRetinaFactor());
if (_id != kThemeBackground && _id != internal::kTestingThemeBackground) {
initColorsFromBackground(image);
auto colorsFromSomeTheme = Local::hasTheme();
if (instance && !instance->applying.paletteForRevert.isEmpty()) {
colorsFromSomeTheme = !instance->applying.path.isEmpty();
}
if (colorsFromSomeTheme || (_id != kDefaultBackground && _id != internal::kTestingDefaultBackground)) {
initColorsFromBackground(image);
}
}
auto width = image.width();
@@ -520,16 +526,22 @@ void ChatBackground::setTestingTheme(Instance &&theme) {
saveForRevert();
setImage(internal::kTestingThemeBackground, std_::move(theme.background));
setTile(theme.tiled);
} else {
// Apply current background image so that service bg colors are recounted.
setImage(_id, std_::move(_pixmap).toImage());
}
notify(BackgroundUpdate(BackgroundUpdate::Type::TestingTheme, _tile), true);
}
void ChatBackground::setTestingDefaultTheme() {
style::main_palette::reset();
if (_id != kDefaultBackground) {
if (_id == kThemeBackground) {
saveForRevert();
setImage(internal::kTestingDefaultBackground);
setTile(false);
} else {
// Apply current background image so that service bg colors are recounted.
setImage(_id, std_::move(_pixmap).toImage());
}
notify(BackgroundUpdate(BackgroundUpdate::Type::TestingTheme, _tile), true);
}
@@ -560,6 +572,9 @@ void ChatBackground::revert() {
if (_id == internal::kTestingThemeBackground || _id == internal::kTestingDefaultBackground) {
setTile(_tileForRevert);
setImage(_idForRevert, std_::move(_imageForRevert));
} else {
// Apply current background image so that service bg colors are recounted.
setImage(_id, std_::move(_pixmap).toImage());
}
notify(BackgroundUpdate(BackgroundUpdate::Type::RevertingTheme, _tile), true);
}
@@ -829,6 +829,7 @@ void Generator::paintService(QString text) {
auto bubbleLeft = _history.x() + (_history.width() - bubbleWidth) / 2;
_p->drawRoundedRect(bubbleLeft, bubbleTop, bubbleWidth, bubbleHeight, radius, radius);
_p->setPen(st::msgServiceFg[_palette]);
_p->setFont(st::msgServiceFont);
_p->drawText(bubbleLeft + st::msgServicePadding.left(), bubbleTop + st::msgServicePadding.top() + st::msgServiceFont->ascent, text);
_historyBottom = bubbleTop - st::msgServiceMargin.top();
}