2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-29 05:37:45 +00:00

Add the option to remember compressing images (#243)

This commit is contained in:
blank X 2021-12-17 14:00:44 +00:00 committed by GitHub
parent a851f7711d
commit c75ad3ec1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 1 deletions

View File

@ -255,5 +255,7 @@
"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",
"dummy_last_string": ""
}

View File

@ -976,7 +976,8 @@ void SendFilesBox::saveSendWaySettings() {
way.setGroupFiles(oldWay.groupFiles());
}
if (_list.overrideSendImagesAsPhotos == way.sendImagesAsPhotos()
|| _sendImagesAsPhotos->isHidden()) {
|| _sendImagesAsPhotos->isHidden()
|| !cRememberCompressImages()) {
way.setSendImagesAsPhotos(oldWay.sendImagesAsPhotos());
}
if (way != oldWay) {

View File

@ -397,6 +397,7 @@ QByteArray GenerateSettingsJson(bool areDefault = false) {
settings.insert(qsl("forward_grouping_mode"), ForwardGroupingMode());
settings.insert(qsl("forward_force_old_unquoted"), cForwardForceOld());
settings.insert(qsl("disable_chat_themes"), cDisableChatThemes());
settings.insert(qsl("remember_compress_images"), cRememberCompressImages());
settingsFonts.insert(qsl("size"), cFontSize());
settingsFonts.insert(qsl("use_system_font"), cUseSystemFont());
@ -993,6 +994,9 @@ bool Manager::readCustomFile() {
ReadBoolOption(settings, "disable_chat_themes", [&](auto v) {
cSetDisableChatThemes(v);
});
ReadBoolOption(settings, "remember_compress_images", [&](auto v) {
cSetRememberCompressImages(v);
});
return true;
}

View File

@ -295,3 +295,4 @@ rpl::producer<int> ForwardGroupingModeChanges() {
bool gForwardForceOld = false;
bool gDisableChatThemes = false;
bool gRememberCompressImages = true;

View File

@ -187,3 +187,4 @@ void SetForwardGroupingMode(int mode);
DeclareSetting(bool, ForwardForceOld);
DeclareSetting(bool, DisableChatThemes);
DeclareSetting(bool, RememberCompressImages);

View File

@ -755,6 +755,22 @@ void SetupKotatoOther(
});
SettingsMenuCSwitch(ktg_settings_call_confirm, ConfirmBeforeCall);
SettingsMenuCSwitch(ktg_settings_remember_compress_images, RememberCompressImages);
AddButton(
container,
rktr("ktg_settings_compress_images_default"),
st::settingsButton
)->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());
SettingsMenuCSwitch(ktg_settings_ffmpeg_multithread, FFmpegMultithread);
AddSkip(container);