[Option][GUI] "View Profile" on top
This commit is contained in:
parent
927f4f9628
commit
af5383522f
4 changed files with 34 additions and 2 deletions
|
|
@ -148,5 +148,7 @@
|
||||||
"ktg_settings_compress_images_default": "Compress images by default",
|
"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_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_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": ""
|
"dummy_last_string": ""
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -358,6 +358,9 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
|
||||||
{ "remember_compress_images", {
|
{ "remember_compress_images", {
|
||||||
.type = SettingType::BoolSetting,
|
.type = SettingType::BoolSetting,
|
||||||
.defaultValue = false, }},
|
.defaultValue = false, }},
|
||||||
|
{ "view_profile_on_top", {
|
||||||
|
.type = SettingType::BoolSetting,
|
||||||
|
.defaultValue = false, }},
|
||||||
};
|
};
|
||||||
|
|
||||||
using OldOptionKey = QString;
|
using OldOptionKey = QString;
|
||||||
|
|
|
||||||
|
|
@ -236,6 +236,28 @@ void SetupKotatoChats(
|
||||||
::Kotato::JsonSettings::Write();
|
::Kotato::JsonSettings::Write();
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
|
|
||||||
|
container->add(object_ptr<Button>(
|
||||||
|
container,
|
||||||
|
rktr("ktg_settings_view_profile_on_top"),
|
||||||
|
st::settingsButtonNoIcon
|
||||||
|
))->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());
|
||||||
|
|
||||||
|
Ui::AddSkip(container);
|
||||||
|
Ui::AddDividerText(container, rktr("ktg_settings_view_profile_on_top_about"));
|
||||||
|
Ui::AddSkip(container);
|
||||||
|
|
||||||
|
|
||||||
Ui::AddSkip(container);
|
Ui::AddSkip(container);
|
||||||
Ui::AddDivider(container);
|
Ui::AddDivider(container);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "window/window_peer_menu.h"
|
#include "window/window_peer_menu.h"
|
||||||
|
|
||||||
|
#include "kotato/kotato_settings.h"
|
||||||
#include "menu/menu_check_item.h"
|
#include "menu/menu_check_item.h"
|
||||||
#include "boxes/share_box.h"
|
#include "boxes/share_box.h"
|
||||||
#include "chat_helpers/compose/compose_show.h"
|
#include "chat_helpers/compose/compose_show.h"
|
||||||
|
|
@ -1289,7 +1290,6 @@ void Filler::fillChatsListActions() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
addCreateTopic();
|
addCreateTopic();
|
||||||
addInfo();
|
|
||||||
addViewAsMessages();
|
addViewAsMessages();
|
||||||
const auto &all = _peer->forum()->topicsList()->indexed()->all();
|
const auto &all = _peer->forum()->topicsList()->indexed()->all();
|
||||||
if (all.size() > kTopicsSearchMinCount) {
|
if (all.size() > kTopicsSearchMinCount) {
|
||||||
|
|
@ -1331,11 +1331,16 @@ void Filler::addVideoChat() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Filler::fillContextMenuActions() {
|
void Filler::fillContextMenuActions() {
|
||||||
|
const auto profileEnabled = ViewProfileInChatsListContextMenu.value();
|
||||||
|
const auto profileOnTop = ::Kotato::JsonSettings::GetBool("view_profile_on_top");
|
||||||
addNewWindow();
|
addNewWindow();
|
||||||
addHidePromotion();
|
addHidePromotion();
|
||||||
|
if (profileEnabled && profileOnTop) {
|
||||||
|
addInfo();
|
||||||
|
}
|
||||||
addToggleArchive();
|
addToggleArchive();
|
||||||
addTogglePin();
|
addTogglePin();
|
||||||
if (ViewProfileInChatsListContextMenu.value()) {
|
if (profileEnabled && !profileOnTop) {
|
||||||
addInfo();
|
addInfo();
|
||||||
}
|
}
|
||||||
addToggleMuteSubmenu(false);
|
addToggleMuteSubmenu(false);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue