From c55c606af6a38dac12ca271726f865b111a5f4b8 Mon Sep 17 00:00:00 2001 From: RadRussianRus Date: Thu, 10 Oct 2019 19:57:03 +0300 Subject: [PATCH] Started work on settings --- Telegram/Resources/icons/settings_kotato.png | Bin 0 -> 1727 bytes .../Resources/icons/settings_kotato@2x.png | Bin 0 -> 2015 bytes .../Resources/icons/settings_kotato@3x.png | Bin 0 -> 2158 bytes Telegram/Resources/langs/lang.strings | 6 + Telegram/Resources/langs/rewrites/ru.json | 7 +- Telegram/SourceFiles/info/info_top_bar.cpp | 2 + Telegram/SourceFiles/settings/settings.style | 1 + .../SourceFiles/settings/settings_common.cpp | 3 + .../SourceFiles/settings/settings_common.h | 1 + .../SourceFiles/settings/settings_kotato.cpp | 116 ++++++++++++++++++ .../SourceFiles/settings/settings_kotato.h | 30 +++++ .../SourceFiles/settings/settings_main.cpp | 4 + Telegram/gyp/telegram/sources.txt | 2 + 13 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 Telegram/Resources/icons/settings_kotato.png create mode 100644 Telegram/Resources/icons/settings_kotato@2x.png create mode 100644 Telegram/Resources/icons/settings_kotato@3x.png create mode 100644 Telegram/SourceFiles/settings/settings_kotato.cpp create mode 100644 Telegram/SourceFiles/settings/settings_kotato.h diff --git a/Telegram/Resources/icons/settings_kotato.png b/Telegram/Resources/icons/settings_kotato.png new file mode 100644 index 0000000000000000000000000000000000000000..9728961881c089040c69a79513ed07c81df91a01 GIT binary patch literal 1727 zcmbVNTWs4@81~pYMlTYDu?_^n^(NS~`WD-XZ8a-x+>rn-RhQ9@r=Hj+iD~TP+0K%b z@c`AvWiV-*#6wl~fCNYt+5=*JXrUA0fgyo_Zh*u^+cXJ;s=*#WLINg^bL)o6ZILg> z_IJMj`>%O^c<8~7*1K8>g6K#kwGn*3J3Kesgs*>~6&Rpiu2gslH4Y|S&X>WH?hZVNxfseBN) zD$ABiC8i`W$jh<3q9`mEVIvV5BWS1E3LU; zyG>fhuZIZ-j4cC~7lJHflL0D*4;5*#k8Yz&I6tr+E$^X--n{Axb+qLFKp_R7a+jt*i#+agJlx zL2=cXAOQagHVrk4JR4x2EgR$@>pD4#Y(`Q|paSx+VXRK5s?c>c<@f<`44Bg56n2}j zEK?PEQ2`PU=&YGhXds9YT9!y&RRQ~$iPxpw#GyOM4=36E-J`0&&L2QXQL7=8z2)^ zB-1cr(Ox#}4opGTRyA67g=97R)tXh4R;Z^^SFs!JYw97ZWvT)rY`-{Vgmni^s{Y!# z;r!HSOL>S%|DhObFdt=u67XPu4(IZ})H~aVLCqERuU=Lob&N5`MvHJ4i0Z5KAot1<~-Ilen;27sn+TCCr%w6-_+T| zTxhu%JN~ix_WYWuh4O`aZoThJ>FP(%_FaBu?Xj)zzP>zvNxrgo#_wKt;EOq1GdHh) z=PBI#P@slytb|Nn%zSZ7&eCwSb z96j;o^5Yv@s6*h4a{sHMe(|7u}V?Uo?B#Z}6Z~u0w`&{@JlNub-P7aJe^Cu%- BI9&h$ literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/settings_kotato@2x.png b/Telegram/Resources/icons/settings_kotato@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..39f327c835d3cc1811d9ff4c5dc670a9daad9375 GIT binary patch literal 2015 zcmbVNdrT8|94{ginL37#_{w&ii*sUocYSfaQ3=qxcCpMMA|$$a-2K`fw0B4EpoO^2 z;RDf4)J)9`;G#1`T{Lbp>K>Y|PGh!-nW8~OCAj&AAr9snr~6%B>cU<&_xRo2=lA)3 zzRxzzEqZ-a`lNJ~N;S%1w-&=YshnxU;PsWOpE=-dglI39RI2C3C})ytOUne6DrG%a zQYM!<=TMB`)6%R^0klD%2+=B4ZeCENnJOS76~N8$7WBr~M^J=gE$9NH6L*S*z{A<= z{a{{wQ3+FD#h6(%Zx)gpq#%J0$TSl4d3lKnTF?kD1=q@J3`HUkxypj(D+ZA==Uk*v z@B_rCHE9^aU_^4vTEe6^n9Va09ZrxKPGW>!LzpN7PU&<=?1w^Ye%3`5TW7~?!6ysq zk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;q;)p_R3nVg=`wWls$4!>0TgXL(Y zRXJaI?%cUs$I?b;SGfE74z%B_i9Fia*mLDNr+K)ox3{;vyu76)X=p&m=K!4%>;9$Y+q_`;`u3nw(E-oHDwQ&yg9a8aSZEfvBRefA!WaPkts;a8i z`qZwk>*}V2j zwI{Ewt?i49jgNk|DjOOadJm?irMU+R?rf&B_M6ULyO$mlu{Gwi)MaJOuGX6a^>H25 z1B0u2g&L5` YW9C#>9IG$yKjS$`NlY`;&3$jppB6I~ TitleValue( return tr::lng_settings_section_chat_settings(); case Section::SettingsType::Calls: return tr::lng_settings_section_call_settings(); + case Section::SettingsType::Kotato: + return tr::ktg_settings_kotato(); } Unexpected("Bad settings type in Info::TitleValue()"); } diff --git a/Telegram/SourceFiles/settings/settings.style b/Telegram/SourceFiles/settings/settings.style index fc9e71d41..48226f549 100644 --- a/Telegram/SourceFiles/settings/settings.style +++ b/Telegram/SourceFiles/settings/settings.style @@ -60,6 +60,7 @@ settingsIconFaq: icon {{ "settings_faq", menuIconFg }}; settingsIconStickers: icon {{ "settings_stickers", menuIconFg }}; settingsIconEmoji: icon {{ "settings_emoji", menuIconFg }}; settingsIconThemes: icon {{ "settings_themes", menuIconFg }}; +settingsIconKotato: icon {{ "settings_kotato", menuIconFg }}; settingsSetPhotoSkip: 7px; diff --git a/Telegram/SourceFiles/settings/settings_common.cpp b/Telegram/SourceFiles/settings/settings_common.cpp index 8044e0505..8b44eb630 100644 --- a/Telegram/SourceFiles/settings/settings_common.cpp +++ b/Telegram/SourceFiles/settings/settings_common.cpp @@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "settings/settings_notifications.h" #include "settings/settings_privacy_security.h" #include "settings/settings_calls.h" +#include "settings/settings_kotato.h" #include "ui/wrap/padding_wrap.h" #include "ui/wrap/vertical_layout.h" #include "ui/widgets/labels.h" @@ -51,6 +52,8 @@ object_ptr
CreateSection( return object_ptr(parent, controller); case Type::Calls: return object_ptr(parent, controller); + case Type::Kotato: + return object_ptr(parent, controller); } Unexpected("Settings section type in Widget::createInnerWidget."); } diff --git a/Telegram/SourceFiles/settings/settings_common.h b/Telegram/SourceFiles/settings/settings_common.h index 1e0d57dea..7635b7613 100644 --- a/Telegram/SourceFiles/settings/settings_common.h +++ b/Telegram/SourceFiles/settings/settings_common.h @@ -43,6 +43,7 @@ enum class Type { Advanced, Chat, Calls, + Kotato, }; using Button = Info::Profile::Button; diff --git a/Telegram/SourceFiles/settings/settings_kotato.cpp b/Telegram/SourceFiles/settings/settings_kotato.cpp new file mode 100644 index 000000000..979d0c3a4 --- /dev/null +++ b/Telegram/SourceFiles/settings/settings_kotato.cpp @@ -0,0 +1,116 @@ +/* +This file is part of Kotatogram Desktop, +the unofficial app based on Telegram Desktop. + +For license and copyright information please follow this link: +https://github.com/kotatogram/kotatogram-desktop/blob/dev/LEGAL +*/ +#include "settings/settings_kotato.h" + +#include "settings/settings_common.h" +#include "settings/settings_chat.h" +#include "ui/wrap/vertical_layout.h" +#include "ui/wrap/slide_wrap.h" +#include "ui/widgets/labels.h" +#include "ui/widgets/checkbox.h" +#include "ui/widgets/continuous_sliders.h" +#include "ui/text/text_utilities.h" // Ui::Text::ToUpper +#include "boxes/connection_box.h" +#include "boxes/about_box.h" +#include "boxes/confirm_box.h" +#include "info/profile/info_profile_button.h" +#include "platform/platform_specific.h" +#include "platform/platform_info.h" +#include "window/window_session_controller.h" +#include "lang/lang_keys.h" +#include "core/update_checker.h" +#include "core/application.h" +#include "storage/localstorage.h" +#include "data/data_session.h" +#include "main/main_session.h" +#include "layout.h" +#include "facades.h" +#include "app.h" +#include "styles/style_settings.h" + +namespace Settings { + +void SetupKotatoChats(not_null container) { + AddSkip(container); + AddSubsectionTitle(container, tr::ktg_settings_chats()); + + const auto stickerHeightLabel = container->add( + object_ptr( + container, + st::settingsAudioVolumeLabel), + st::settingsAudioVolumeLabelPadding); + const auto stickerHeightSlider = container->add( + object_ptr( + container, + st::settingsAudioVolumeSlider), + st::settingsAudioVolumeSliderPadding); + const auto updateStickerHeightLabel = [=](int value) { + const auto pixels = QString::number(value); + stickerHeightLabel->setText( + tr::ktg_settings_sticker_height(tr::now, lt_pixels, pixels)); + }; + const auto updateStickerHeight = [=](int value) { + updateStickerHeightLabel(value); + cSetStickerHeight(value); + }; + stickerHeightSlider->resize(st::settingsAudioVolumeSlider.seekSize); + stickerHeightSlider->setPseudoDiscrete( + 129, + [](int val) { return val + 128; }, + cStickerHeight(), + updateStickerHeight); + updateStickerHeightLabel(cStickerHeight()); + + AddButton( + container, + tr::ktg_settings_emoji_outline(), + st::settingsButton + )->toggleOn( + rpl::single(cBigEmojiOutline()) + )->toggledValue( + ) | rpl::filter([](bool enabled) { + return (enabled != cBigEmojiOutline()); + }) | rpl::start_with_next([](bool enabled) { + cSetBigEmojiOutline(enabled); + }, container->lifetime()); + + AddButton( + container, + tr::ktg_settings_always_show_scheduled(), + st::settingsButton + )->toggleOn( + rpl::single(cAlwaysShowScheduled()) + )->toggledValue( + ) | rpl::filter([](bool enabled) { + return (enabled != cAlwaysShowScheduled()); + }) | rpl::start_with_next([](bool enabled) { + cSetAlwaysShowScheduled(enabled); + }, container->lifetime()); + + AddSkip(container); +} + +Kotato::Kotato( + QWidget *parent, + not_null controller) +: Section(parent) { + setupContent(controller); +} + +void Kotato::setupContent(not_null controller) { + const auto content = Ui::CreateChild(this); + + SetupKotatoChats(content); + //SetupKotatoFonts(content); + //SetupKotatoNetwork(content); + //SetupKotatoOther(content); + + Ui::ResizeFitChild(this, content); +} + +} // namespace Settings diff --git a/Telegram/SourceFiles/settings/settings_kotato.h b/Telegram/SourceFiles/settings/settings_kotato.h new file mode 100644 index 000000000..a490c3f2f --- /dev/null +++ b/Telegram/SourceFiles/settings/settings_kotato.h @@ -0,0 +1,30 @@ +/* +This file is part of Kotatogram Desktop, +the unofficial app based on Telegram Desktop. + +For license and copyright information please follow this link: +https://github.com/kotatogram/kotatogram-desktop/blob/dev/LEGAL +*/ +#pragma once + +#include "settings/settings_common.h" + +namespace Settings { + +void SetupKotatoChats(not_null container); +//void SetupKotatoFonts(not_null container); +//void SetupKotatoNetwork(not_null container); +//void SetupKotatoOther(not_null container); + +class Kotato : public Section { +public: + Kotato( + QWidget *parent, + not_null controller); + +private: + void setupContent(not_null controller); + +}; + +} // namespace Settings diff --git a/Telegram/SourceFiles/settings/settings_main.cpp b/Telegram/SourceFiles/settings/settings_main.cpp index 9794a14c9..0fe486e2c 100644 --- a/Telegram/SourceFiles/settings/settings_main.cpp +++ b/Telegram/SourceFiles/settings/settings_main.cpp @@ -104,6 +104,10 @@ void SetupSections( tr::lng_settings_advanced(), Type::Advanced, &st::settingsIconGeneral); + addSection( + tr::ktg_settings_kotato(), + Type::Kotato, + &st::settingsIconKotato); SetupLanguageButton(container); diff --git a/Telegram/gyp/telegram/sources.txt b/Telegram/gyp/telegram/sources.txt index 143adcca5..a47ea1e61 100644 --- a/Telegram/gyp/telegram/sources.txt +++ b/Telegram/gyp/telegram/sources.txt @@ -699,6 +699,8 @@ <(src_loc)/settings/settings_information.h <(src_loc)/settings/settings_intro.cpp <(src_loc)/settings/settings_intro.h +<(src_loc)/settings/settings_kotato.cpp +<(src_loc)/settings/settings_kotato.h <(src_loc)/settings/settings_main.cpp <(src_loc)/settings/settings_main.h <(src_loc)/settings/settings_notifications.cpp