2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Sort backgrounds in the gallery.

This commit is contained in:
John Preston
2019-02-04 21:37:40 +03:00
parent 64afed0fb2
commit aae2101131
5 changed files with 73 additions and 47 deletions

View File

@@ -36,7 +36,8 @@ constexpr auto kTestingEditorBackground = FromLegacyBackgroundId(-664);
constexpr auto kThemeBackground = FromLegacyBackgroundId(-2);
constexpr auto kCustomBackground = FromLegacyBackgroundId(-1);
constexpr auto kLegacy1DefaultBackground = FromLegacyBackgroundId(0);
constexpr auto kDefaultBackground = FromLegacyBackgroundId(105);
constexpr auto kDefaultBackground = 5947530738516623361;
constexpr auto kIncorrectDefaultBackground = FromLegacyBackgroundId(105);
quint32 SerializeMaybeColor(std::optional<QColor> color) {
return color
@@ -141,6 +142,14 @@ bool WallPaper::isCreator() const {
return _flags & MTPDwallPaper::Flag::f_creator;
}
bool WallPaper::isDark() const {
return _flags & MTPDwallPaper::Flag::f_dark;
}
bool WallPaper::isLocal() const {
return !document() && thumbnail();
}
int WallPaper::patternIntensity() const {
return _intensity;
}
@@ -394,7 +403,8 @@ WallPaper DefaultWallPaper() {
}
bool IsDefaultWallPaper(const WallPaper &paper) {
return (paper.id() == kDefaultBackground);
return (paper.id() == kDefaultBackground)
|| (paper.id() == kIncorrectDefaultBackground);
}
QColor PatternColor(QColor background) {