mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
[Option][GUI] "View Profile" on top
This commit is contained in:
committed by
Eric Kotato
parent
cda999862f
commit
d262461620
@@ -398,6 +398,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;
|
||||
|
@@ -256,6 +256,28 @@ void SetupKotatoChats(
|
||||
::Kotato::JsonSettings::Write();
|
||||
}, 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::AddDivider(container);
|
||||
|
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "window/window_peer_menu.h"
|
||||
|
||||
#include "kotato/kotato_settings.h"
|
||||
#include "menu/menu_check_item.h"
|
||||
#include "boxes/share_box.h"
|
||||
#include "chat_helpers/compose/compose_show.h"
|
||||
@@ -1235,7 +1236,6 @@ void Filler::fillChatsListActions() {
|
||||
return;
|
||||
}
|
||||
addCreateTopic();
|
||||
addInfo();
|
||||
addViewAsMessages();
|
||||
const auto &all = _peer->forum()->topicsList()->indexed()->all();
|
||||
if (all.size() > kTopicsSearchMinCount) {
|
||||
@@ -1277,11 +1277,16 @@ void Filler::addVideoChat() {
|
||||
}
|
||||
|
||||
void Filler::fillContextMenuActions() {
|
||||
const auto profileEnabled = ViewProfileInChatsListContextMenu.value();
|
||||
const auto profileOnTop = ::Kotato::JsonSettings::GetBool("view_profile_on_top");
|
||||
addNewWindow();
|
||||
addHidePromotion();
|
||||
if (profileEnabled && profileOnTop) {
|
||||
addInfo();
|
||||
}
|
||||
addToggleArchive();
|
||||
addTogglePin();
|
||||
if (ViewProfileInChatsListContextMenu.value()) {
|
||||
if (profileEnabled && !profileOnTop) {
|
||||
addInfo();
|
||||
}
|
||||
addToggleMuteSubmenu(false);
|
||||
|
Reference in New Issue
Block a user