mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-04-01 00:08:02 +00:00
Change default wallpaper.
This commit is contained in:
parent
9943f8a093
commit
8f478b86ee
BIN
Telegram/Resources/art/background.jpg
Normal file
BIN
Telegram/Resources/art/background.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 103 KiB |
Binary file not shown.
Before Width: | Height: | Size: 105 KiB |
@ -42,7 +42,7 @@
|
||||
<file alias="js/script.js">../../export_html/js/script.js</file>
|
||||
</qresource>
|
||||
<qresource prefix="/gui">
|
||||
<file alias="art/bg.jpg">../../art/bg.jpg</file>
|
||||
<file alias="art/background.jpg">../../art/background.jpg</file>
|
||||
<file alias="art/bg_initial.jpg">../../art/bg_initial.jpg</file>
|
||||
<file alias="art/logo_256.png">../../art/logo_256.png</file>
|
||||
<file alias="art/logo_256_no_margin.png">../../art/logo_256_no_margin.png</file>
|
||||
|
@ -239,8 +239,9 @@ void BackgroundBox::Inner::sortPapers() {
|
||||
return std::make_tuple(
|
||||
data.id() == current,
|
||||
night ? data.isDark() : !data.isDark(),
|
||||
!data.isDefault() && !data.isLocal(),
|
||||
!data.isDefault() && data.isLocal());
|
||||
!data.isDefault() && !Data::IsLegacy1DefaultWallPaper(data),
|
||||
Data::IsLegacy2DefaultWallPaper(data),
|
||||
Data::IsLegacy1DefaultWallPaper(data));
|
||||
});
|
||||
if (!_papers.empty() && _papers.front().data.id() == current) {
|
||||
_papers.front().data = _papers.front().data.withParamsFrom(
|
||||
@ -366,6 +367,7 @@ void BackgroundBox::Inner::paintPaper(
|
||||
_check->paint(p, checkLeft, checkTop, width());
|
||||
} else if (Data::IsCloudWallPaper(paper.data)
|
||||
&& !Data::IsDefaultWallPaper(paper.data)
|
||||
&& !Data::IsLegacy2DefaultWallPaper(paper.data)
|
||||
&& !v::is_null(over)
|
||||
&& (&paper == &_papers[getSelectionIndex(over)])) {
|
||||
const auto deleteSelected = v::is<DeleteSelected>(over);
|
||||
@ -395,6 +397,7 @@ void BackgroundBox::Inner::mouseMoveEvent(QMouseEvent *e) {
|
||||
} else if (result >= _papers.size()) {
|
||||
return Selection();
|
||||
}
|
||||
auto &data = _papers[result].data;
|
||||
const auto deleteLeft = (column + 1) * (width + skip)
|
||||
- st::stickerPanDeleteIconBg.width();
|
||||
const auto deleteBottom = row * (height + skip) + skip
|
||||
@ -402,9 +405,10 @@ void BackgroundBox::Inner::mouseMoveEvent(QMouseEvent *e) {
|
||||
const auto currentId = Window::Theme::Background()->id();
|
||||
const auto inDelete = (x >= deleteLeft)
|
||||
&& (y < deleteBottom)
|
||||
&& Data::IsCloudWallPaper(_papers[result].data)
|
||||
&& !Data::IsDefaultWallPaper(_papers[result].data)
|
||||
&& (currentId != _papers[result].data.id());
|
||||
&& Data::IsCloudWallPaper(data)
|
||||
&& !Data::IsDefaultWallPaper(data)
|
||||
&& !Data::IsLegacy2DefaultWallPaper(data)
|
||||
&& (currentId != data.id());
|
||||
return (result >= _papers.size())
|
||||
? Selection()
|
||||
: inDelete
|
||||
|
@ -4155,10 +4155,19 @@ void Session::setWallpapers(const QVector<MTPWallPaper> &data, int32 hash) {
|
||||
_wallpapers.push_back(*parsed);
|
||||
}
|
||||
}
|
||||
|
||||
// Put the legacy2 (flowers) wallpaper to the front of the list.
|
||||
const auto legacy2 = ranges::find_if(
|
||||
_wallpapers,
|
||||
Data::IsLegacy2DefaultWallPaper);
|
||||
if (legacy2 != end(_wallpapers)) {
|
||||
ranges::rotate(begin(_wallpapers), legacy2, legacy2 + 1);
|
||||
}
|
||||
|
||||
if (ranges::none_of(_wallpapers, Data::IsDefaultWallPaper)) {
|
||||
_wallpapers.push_back(Data::DefaultWallPaper());
|
||||
_wallpapers.back().setLocalImageAsThumbnail(std::make_shared<Image>(
|
||||
u":/gui/arg/bg.jpg"_q));
|
||||
u":/gui/art/background.jpg"_q));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,8 @@ constexpr auto kTestingEditorBackground = FromLegacyBackgroundId(-664);
|
||||
constexpr auto kThemeBackground = FromLegacyBackgroundId(-2);
|
||||
constexpr auto kCustomBackground = FromLegacyBackgroundId(-1);
|
||||
constexpr auto kLegacy1DefaultBackground = FromLegacyBackgroundId(0);
|
||||
constexpr auto kDefaultBackground = 5947530738516623361;
|
||||
constexpr auto kLegacy2DefaultBackground = 5947530738516623361;
|
||||
constexpr auto kDefaultBackground = 5778236420632084488;
|
||||
constexpr auto kIncorrectDefaultBackground = FromLegacyBackgroundId(105);
|
||||
|
||||
quint32 SerializeMaybeColor(std::optional<QColor> color) {
|
||||
@ -497,13 +498,17 @@ bool IsLegacy1DefaultWallPaper(const WallPaper &paper) {
|
||||
return (paper.id() == kLegacy1DefaultBackground);
|
||||
}
|
||||
|
||||
bool IsLegacy2DefaultWallPaper(const WallPaper &paper) {
|
||||
return (paper.id() == kLegacy2DefaultBackground)
|
||||
|| (paper.id() == kIncorrectDefaultBackground);
|
||||
}
|
||||
|
||||
WallPaper DefaultWallPaper() {
|
||||
return WallPaper(kDefaultBackground);
|
||||
}
|
||||
|
||||
bool IsDefaultWallPaper(const WallPaper &paper) {
|
||||
return (paper.id() == kDefaultBackground)
|
||||
|| (paper.id() == kIncorrectDefaultBackground);
|
||||
return (paper.id() == kDefaultBackground);
|
||||
}
|
||||
|
||||
bool IsCloudWallPaper(const WallPaper &paper) {
|
||||
|
@ -98,6 +98,7 @@ private:
|
||||
[[nodiscard]] bool IsCustomWallPaper(const WallPaper &paper);
|
||||
[[nodiscard]] WallPaper Legacy1DefaultWallPaper();
|
||||
[[nodiscard]] bool IsLegacy1DefaultWallPaper(const WallPaper &paper);
|
||||
[[nodiscard]] bool IsLegacy2DefaultWallPaper(const WallPaper &paper);
|
||||
[[nodiscard]] WallPaper DefaultWallPaper();
|
||||
[[nodiscard]] bool IsDefaultWallPaper(const WallPaper &paper);
|
||||
[[nodiscard]] bool IsCloudWallPaper(const WallPaper &paper);
|
||||
|
@ -682,9 +682,10 @@ bool readBackground() {
|
||||
const auto isOldEmptyImage = (bg.stream.status() != QDataStream::Ok);
|
||||
if (isOldEmptyImage
|
||||
|| Data::IsLegacy1DefaultWallPaper(*paper)
|
||||
|| (Data::IsLegacy2DefaultWallPaper(*paper) && bg.version < 2008012)
|
||||
|| Data::IsDefaultWallPaper(*paper)) {
|
||||
_backgroundCanWrite = false;
|
||||
if (isOldEmptyImage || bg.version < 8005) {
|
||||
if (isOldEmptyImage || bg.version < 2008012) {
|
||||
Window::Theme::Background()->set(Data::DefaultWallPaper());
|
||||
Window::Theme::Background()->setTile(false);
|
||||
} else {
|
||||
|
@ -654,7 +654,7 @@ void ChatBackground::set(const Data::WallPaper &paper, QImage image) {
|
||||
|| Data::details::IsTestingEditorWallPaper(_paper)) {
|
||||
if (Data::details::IsTestingDefaultWallPaper(_paper)
|
||||
|| image.isNull()) {
|
||||
image.load(qsl(":/gui/art/bg.jpg"));
|
||||
image.load(qsl(":/gui/art/background.jpg"));
|
||||
setPaper(Data::details::TestingDefaultWallPaper());
|
||||
}
|
||||
image = validateBackgroundImage(std::move(image));
|
||||
@ -671,7 +671,7 @@ void ChatBackground::set(const Data::WallPaper &paper, QImage image) {
|
||||
} else if (Data::IsDefaultWallPaper(_paper)
|
||||
|| (!_paper.backgroundColor() && image.isNull())) {
|
||||
setPaper(Data::DefaultWallPaper().withParamsFrom(_paper));
|
||||
image.load(qsl(":/gui/art/bg.jpg"));
|
||||
image.load(qsl(":/gui/art/background.jpg"));
|
||||
}
|
||||
Local::writeBackground(
|
||||
_paper,
|
||||
|
@ -416,7 +416,7 @@ void Generator::paintHistoryBackground() {
|
||||
if (background.isNull()) {
|
||||
const auto fakePaper = Data::WallPaper(_current.backgroundId);
|
||||
if (Data::IsThemeWallPaper(fakePaper)) {
|
||||
background.load(qsl(":/gui/art/bg.jpg"));
|
||||
background.load(qsl(":/gui/art/background.jpg"));
|
||||
tiled = false;
|
||||
} else {
|
||||
background = std::move(_current.backgroundImage);
|
||||
|
Loading…
Reference in New Issue
Block a user