mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Optimize theme edit data clearing.
This commit is contained in:
@@ -483,6 +483,10 @@ SendMediaReady PrepareWallPaper(const QImage &image) {
|
||||
0);
|
||||
}
|
||||
|
||||
void ClearEditingPalette() {
|
||||
QFile(EditingPalettePath()).remove();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
ChatBackground::AdjustableColor::AdjustableColor(style::color data)
|
||||
@@ -739,13 +743,20 @@ std::optional<Data::CloudTheme> ChatBackground::editingTheme() const {
|
||||
return _editingTheme;
|
||||
}
|
||||
|
||||
void ChatBackground::setEditingTheme(
|
||||
std::optional<Data::CloudTheme> editing) {
|
||||
if (!_editingTheme && !editing) {
|
||||
void ChatBackground::setEditingTheme(const Data::CloudTheme &editing) {
|
||||
_editingTheme = editing;
|
||||
}
|
||||
|
||||
void ChatBackground::clearEditingTheme(ClearEditing clear) {
|
||||
if (!_editingTheme) {
|
||||
return;
|
||||
}
|
||||
_editingTheme = editing;
|
||||
if (!_editingTheme) {
|
||||
_editingTheme = std::nullopt;
|
||||
if (clear == ClearEditing::Temporary) {
|
||||
return;
|
||||
}
|
||||
ClearEditingPalette();
|
||||
if (clear == ClearEditing::RevertChanges) {
|
||||
reapplyWithNightMode(std::nullopt, _nightMode);
|
||||
KeepApplied();
|
||||
}
|
||||
@@ -1235,10 +1246,6 @@ QString EditingPalettePath() {
|
||||
return cWorkingDir() + "tdata/editing-theme.tdesktop-palette";
|
||||
}
|
||||
|
||||
void ClearEditingPalette() {
|
||||
QFile(EditingPalettePath()).remove();
|
||||
}
|
||||
|
||||
QColor CountAverageColor(const QImage &image) {
|
||||
Expects(image.format() == QImage::Format_ARGB32_Premultiplied);
|
||||
|
||||
|
Reference in New Issue
Block a user