mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
[Option][GUI] Remember image compression
This commit is contained in:
committed by
Eric Kotato
parent
bca35c2cbb
commit
cda999862f
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "boxes/send_files_box.h"
|
||||
|
||||
#include "kotato/kotato_settings.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "storage/localimageloader.h"
|
||||
#include "storage/localstorage.h"
|
||||
@@ -1361,7 +1362,8 @@ void SendFilesBox::saveSendWaySettings() {
|
||||
way.setGroupFiles(oldWay.groupFiles());
|
||||
}
|
||||
if (_list.overrideSendImagesAsPhotos == way.sendImagesAsPhotos()
|
||||
|| _sendImagesAsPhotos->isHidden()) {
|
||||
|| _sendImagesAsPhotos->isHidden()
|
||||
|| !::Kotato::JsonSettings::GetBool("remember_compress_images")) {
|
||||
way.setSendImagesAsPhotos(oldWay.sendImagesAsPhotos());
|
||||
}
|
||||
if (way != oldWay) {
|
||||
|
@@ -395,6 +395,9 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
|
||||
{ "disable_chat_themes", {
|
||||
.type = SettingType::BoolSetting,
|
||||
.defaultValue = false, }},
|
||||
{ "remember_compress_images", {
|
||||
.type = SettingType::BoolSetting,
|
||||
.defaultValue = false, }},
|
||||
};
|
||||
|
||||
using OldOptionKey = QString;
|
||||
|
@@ -594,6 +594,22 @@ void SetupKotatoOther(
|
||||
}));
|
||||
});
|
||||
|
||||
SettingsMenuJsonSwitch(ktg_settings_remember_compress_images, remember_compress_images);
|
||||
container->add(object_ptr<Button>(
|
||||
container,
|
||||
rktr("ktg_settings_compress_images_default"),
|
||||
st::settingsButtonNoIcon
|
||||
))->toggleOn(
|
||||
rpl::single(Core::App().settings().sendFilesWay().sendImagesAsPhotos())
|
||||
)->toggledValue(
|
||||
) | rpl::filter([](bool enabled) {
|
||||
return (enabled != Core::App().settings().sendFilesWay().sendImagesAsPhotos());
|
||||
}) | rpl::start_with_next([](bool enabled) {
|
||||
auto way = Core::App().settings().sendFilesWay();
|
||||
way.setSendImagesAsPhotos(enabled);
|
||||
Core::App().settings().setSendFilesWay(way);
|
||||
Core::App().saveSettingsDelayed();
|
||||
}, container->lifetime());
|
||||
SettingsMenuJsonSwitch(ktg_settings_ffmpeg_multithread, ffmpeg_multithread);
|
||||
|
||||
Ui::AddSkip(container);
|
||||
|
Reference in New Issue
Block a user