mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Save themes, apply and close editor on save.
This commit is contained in:
@@ -78,4 +78,12 @@ const std::vector<CloudTheme> &CloudThemes::list() const {
|
||||
return _list;
|
||||
}
|
||||
|
||||
void CloudThemes::apply(const CloudTheme &theme) {
|
||||
const auto i = ranges::find(_list, theme.id, &CloudTheme::id);
|
||||
if (i != end(_list)) {
|
||||
*i = theme;
|
||||
_updates.fire({});
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Data
|
||||
|
@@ -35,6 +35,7 @@ public:
|
||||
void refresh();
|
||||
[[nodiscard]] rpl::producer<> updated() const;
|
||||
[[nodiscard]] const std::vector<CloudTheme> &list() const;
|
||||
void apply(const CloudTheme &data);
|
||||
|
||||
private:
|
||||
void parseThemes(const QVector<MTPTheme> &list);
|
||||
|
@@ -568,6 +568,17 @@ void DocumentData::validateLottieSticker() {
|
||||
}
|
||||
}
|
||||
|
||||
void DocumentData::setDataAndCache(const QByteArray &data) {
|
||||
setData(data);
|
||||
if (saveToCache() && data.size() <= Storage::kMaxFileInMemory) {
|
||||
session().data().cache().put(
|
||||
cacheKey(),
|
||||
Storage::Cache::Database::TaggedValue(
|
||||
base::duplicate(data),
|
||||
cacheTag()));
|
||||
}
|
||||
}
|
||||
|
||||
bool DocumentData::checkWallPaperProperties() {
|
||||
if (type == WallPaperDocument) {
|
||||
return true;
|
||||
|
@@ -166,6 +166,7 @@ public:
|
||||
void setData(const QByteArray &data) {
|
||||
_data = data;
|
||||
}
|
||||
void setDataAndCache(const QByteArray &data);
|
||||
bool checkWallPaperProperties();
|
||||
[[nodiscard]] bool isWallPaper() const;
|
||||
[[nodiscard]] bool isPatternWallPaper() const;
|
||||
|
Reference in New Issue
Block a user