mirror of
https://github.com/vale981/tdesktop
synced 2025-03-05 17:51:41 -05:00
Send installWallPaper requests.
This commit is contained in:
parent
95565c39ed
commit
f9d56eb4c1
4 changed files with 36 additions and 6 deletions
|
@ -476,7 +476,15 @@ void BackgroundPreviewBox::createBlurCheckbox() {
|
|||
}
|
||||
|
||||
void BackgroundPreviewBox::apply() {
|
||||
const auto install = (_paper.id() != Window::Theme::Background()->id())
|
||||
&& Data::IsCloudWallPaper(_paper);
|
||||
App::main()->setChatBackground(_paper, std::move(_full));
|
||||
if (install) {
|
||||
Auth().api().request(MTPaccount_InstallWallPaper(
|
||||
_paper.mtpInput(),
|
||||
_paper.mtpSettings()
|
||||
)).send();
|
||||
}
|
||||
closeBox();
|
||||
}
|
||||
|
||||
|
|
|
@ -206,6 +206,10 @@ FileOrigin WallPaper::fileOrigin() const {
|
|||
return FileOriginWallpaper(_id, _accessHash);
|
||||
}
|
||||
|
||||
MTPInputWallPaper WallPaper::mtpInput() const {
|
||||
return MTP_inputWallPaper(MTP_long(_id), MTP_long(_accessHash));
|
||||
}
|
||||
|
||||
MTPWallPaperSettings WallPaper::mtpSettings() const {
|
||||
return MTP_wallPaperSettings(
|
||||
MTP_flags(_settings),
|
||||
|
@ -472,6 +476,17 @@ bool IsDefaultWallPaper(const WallPaper &paper) {
|
|||
|| (paper.id() == kIncorrectDefaultBackground);
|
||||
}
|
||||
|
||||
bool IsCloudWallPaper(const WallPaper &paper) {
|
||||
return (paper.id() != kIncorrectDefaultBackground)
|
||||
&& !IsThemeWallPaper(paper)
|
||||
&& !IsCustomWallPaper(paper)
|
||||
&& !IsLegacy1DefaultWallPaper(paper)
|
||||
&& !details::IsUninitializedWallPaper(paper)
|
||||
&& !details::IsTestingThemeWallPaper(paper)
|
||||
&& !details::IsTestingDefaultWallPaper(paper)
|
||||
&& !details::IsTestingEditorWallPaper(paper);
|
||||
}
|
||||
|
||||
QColor PatternColor(QColor background) {
|
||||
const auto hue = background.hueF();
|
||||
const auto saturation = background.saturationF();
|
||||
|
|
|
@ -36,6 +36,8 @@ public:
|
|||
void loadDocument() const;
|
||||
void loadThumbnail() const;
|
||||
[[nodiscard]] FileOrigin fileOrigin() const;
|
||||
|
||||
[[nodiscard]] MTPInputWallPaper mtpInput() const;
|
||||
[[nodiscard]] MTPWallPaperSettings mtpSettings() const;
|
||||
|
||||
[[nodiscard]] WallPaper withUrlParams(
|
||||
|
@ -89,6 +91,7 @@ private:
|
|||
[[nodiscard]] bool IsLegacy1DefaultWallPaper(const WallPaper &paper);
|
||||
[[nodiscard]] WallPaper DefaultWallPaper();
|
||||
[[nodiscard]] bool IsDefaultWallPaper(const WallPaper &paper);
|
||||
[[nodiscard]] bool IsCloudWallPaper(const WallPaper &paper);
|
||||
|
||||
QColor PatternColor(QColor background);
|
||||
QImage PreparePatternImage(
|
||||
|
|
|
@ -317,12 +317,16 @@ void RoundCheckbox::setChecked(bool newChecked, SetStyle speed) {
|
|||
return;
|
||||
}
|
||||
_checked = newChecked;
|
||||
_checkedProgress.start(
|
||||
_updateCallback,
|
||||
_checked ? 0. : 1.,
|
||||
_checked ? 1. : 0.,
|
||||
_st.duration,
|
||||
anim::linear);
|
||||
if (speed == SetStyle::Animated) {
|
||||
_checkedProgress.start(
|
||||
_updateCallback,
|
||||
_checked ? 0. : 1.,
|
||||
_checked ? 1. : 0.,
|
||||
_st.duration,
|
||||
anim::linear);
|
||||
} else {
|
||||
_checkedProgress.finish();
|
||||
}
|
||||
}
|
||||
|
||||
void RoundCheckbox::invalidateCache() {
|
||||
|
|
Loading…
Add table
Reference in a new issue