[Option][GUI] "View Profile" on top
This commit is contained in:
parent
8e0dd6b0c6
commit
7438b3438e
4 changed files with 33 additions and 2 deletions
|
|
@ -176,5 +176,7 @@
|
|||
"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.",
|
||||
"ktg_settings_view_profile_on_top": "Show \"View Profile\" first",
|
||||
"ktg_settings_view_profile_on_top_about": "This option also enables \"Add \"View Profile\"\" from TDesktop's experimental settings.",
|
||||
"dummy_last_string": ""
|
||||
}
|
||||
|
|
|
|||
|
|
@ -462,6 +462,9 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
|
|||
{ "remember_compress_images", {
|
||||
.type = SettingType::BoolSetting,
|
||||
.defaultValue = false, }},
|
||||
{ "view_profile_on_top", {
|
||||
.type = SettingType::BoolSetting,
|
||||
.defaultValue = false, }},
|
||||
};
|
||||
|
||||
using OldOptionKey = QString;
|
||||
|
|
|
|||
|
|
@ -352,6 +352,28 @@ void SetupKotatoChats(
|
|||
::Kotato::JsonSettings::Write();
|
||||
}, container->lifetime());
|
||||
|
||||
AddButton(
|
||||
container,
|
||||
rktr("ktg_settings_view_profile_on_top"),
|
||||
st::settingsButton
|
||||
)->toggleOn(
|
||||
rpl::single(::Kotato::JsonSettings::GetBool("view_profile_on_top"))
|
||||
)->toggledValue(
|
||||
) | rpl::filter([](bool enabled) {
|
||||
return (enabled != ::Kotato::JsonSettings::GetBool("view_profile_on_top"));
|
||||
}) | rpl::start_with_next([](bool enabled) {
|
||||
::Kotato::JsonSettings::Set("view_profile_on_top", enabled);
|
||||
if (enabled) {
|
||||
auto &option = ::base::options::lookup<bool>(Window::kOptionViewProfileInChatsListContextMenu);
|
||||
option.set(true);
|
||||
}
|
||||
::Kotato::JsonSettings::Write();
|
||||
}, container->lifetime());
|
||||
|
||||
AddSkip(container);
|
||||
AddDividerText(container, rktr("ktg_settings_view_profile_on_top_about"));
|
||||
AddSkip(container);
|
||||
|
||||
|
||||
AddSkip(container);
|
||||
AddDivider(container);
|
||||
|
|
|
|||
|
|
@ -755,10 +755,15 @@ void Filler::fill() {
|
|||
}
|
||||
|
||||
void Filler::fillChatsListActions() {
|
||||
const auto profileEnabled = ViewProfileInChatsListContextMenu.value();
|
||||
const auto profileOnTop = ::Kotato::JsonSettings::GetBool("view_profile_on_top");
|
||||
addHidePromotion();
|
||||
if (profileEnabled && profileOnTop) {
|
||||
addInfo();
|
||||
}
|
||||
addToggleArchive();
|
||||
addTogglePin();
|
||||
if (ViewProfileInChatsListContextMenu.value()) {
|
||||
if (profileEnabled && !profileOnTop) {
|
||||
addInfo();
|
||||
}
|
||||
addToggleMute();
|
||||
|
|
@ -775,7 +780,6 @@ void Filler::fillChatsListActions() {
|
|||
}
|
||||
|
||||
void Filler::fillHistoryActions() {
|
||||
addInfo();
|
||||
addToggleMute();
|
||||
addSupportInfo();
|
||||
addManageChat();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue