2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-28 13:17:43 +00:00

[Option][GUI] Remember image compression

This commit is contained in:
RadRussianRus 2022-09-10 19:49:31 +03:00 committed by Eric Kotato
parent bca35c2cbb
commit cda999862f
4 changed files with 24 additions and 1 deletions

View File

@ -155,6 +155,8 @@
"ktg_forward_force_old_unquoted": "Old unquoted forward method",
"ktg_forward_force_old_unquoted_desc": "Old method copies messages content on client rather than server. Currently it's used only for \"Regroup media\" grouping mode, since new one doesn't support it. If for some reason unquoted forward doesn't work correctly, try switching this option.",
"ktg_disable_chat_themes": "Disable chat themes",
"ktg_settings_remember_compress_images": "Remember compress images",
"ktg_settings_compress_images_default": "Compress images by default",
"ktg_forward_quiz_unquoted": "Sorry, quizzes that are currently open and unvoted on cannot be forwarded unquoted.",
"ktg_in_app_update_disabled": "In-app updater is disabled.",
"dummy_last_string": ""

View File

@ -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) {

View File

@ -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;

View File

@ -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);