2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

[Option][GUI] Emoji panel options

This commit is contained in:
RadRussianRus
2022-09-10 20:03:06 +03:00
committed by Eric Kotato
parent 4df6fb7e7a
commit 1485e996db
6 changed files with 50 additions and 6 deletions

View File

@@ -150,5 +150,7 @@
"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.",
"ktg_settings_emoji_sidebar": "Enable emoji sidebar",
"ktg_settings_emoji_sidebar_right_click": "Emoji sidebar on right click",
"dummy_last_string": ""
}

View File

@@ -67,6 +67,10 @@ public:
void hideAnimated();
void toggleAnimated();
void setPreventHover(bool value) {
_preventHover = value;
}
~TabbedPanel();
protected:
@@ -127,6 +131,8 @@ private:
Ui::Animations::Simple _a_opacity;
base::Timer _hideTimer;
bool _preventHover = false;
};
} // namespace ChatHelpers

View File

@@ -1176,13 +1176,26 @@ void HistoryWidget::initTabbedSelector() {
refreshTabbedPanel();
_tabbedSelectorToggle->addClickHandler([=] {
if (_tabbedPanel && _tabbedPanel->isHidden()) {
_tabbedPanel->showAnimated();
if (_tabbedPanel && (_tabbedPanel->isHidden()
|| ::Kotato::JsonSettings::GetBool("emoji_sidebar_right_click"))) {
_tabbedPanel->toggleAnimated();
} else {
toggleTabbedSelectorMode();
}
});
base::install_event_filter(_tabbedSelectorToggle, [=](not_null<QEvent*> e) {
if (e->type() == QEvent::ContextMenu) {
if (::Kotato::JsonSettings::GetBool("emoji_sidebar_right_click")) {
toggleTabbedSelectorMode();
} else if (_tabbedPanel) {
_tabbedPanel->toggleAnimated();
}
return base::EventFilterResult::Cancel;
}
return base::EventFilterResult::Continue;
});
const auto selector = controller()->tabbedSelector();
base::install_event_filter(this, selector, [=](not_null<QEvent*> e) {
@@ -5273,7 +5286,8 @@ void HistoryWidget::toggleTabbedSelectorMode() {
}
if (_tabbedPanel) {
if (controller()->canShowThirdSection()
&& !controller()->adaptive().isOneColumn()) {
&& !controller()->adaptive().isOneColumn()
&& ::Kotato::JsonSettings::GetBool("emoji_sidebar")) {
Core::App().settings().setTabbedSelectorSectionEnabled(true);
Core::App().saveSettingsDelayed();
pushTabbedSelectorToThirdSection(

View File

@@ -2111,9 +2111,22 @@ void ComposeControls::initTabbedSelector() {
setTabbedPanel(nullptr);
}
base::install_event_filter(_tabbedSelectorToggle, [=](not_null<QEvent*> e) {
if (e->type() == QEvent::ContextMenu) {
if (::Kotato::JsonSettings::GetBool("emoji_sidebar_right_click")) {
toggleTabbedSelectorMode();
} else if (_tabbedPanel) {
_tabbedPanel->toggleAnimated();
}
return base::EventFilterResult::Cancel;
}
return base::EventFilterResult::Continue;
});
_tabbedSelectorToggle->addClickHandler([=] {
if (_tabbedPanel && _tabbedPanel->isHidden()) {
_tabbedPanel->showAnimated();
if (_tabbedPanel && (_tabbedPanel->isHidden()
|| ::Kotato::JsonSettings::GetBool("emoji_sidebar_right_click"))) {
_tabbedPanel->toggleAnimated();
} else {
toggleTabbedSelectorMode();
}
@@ -2853,7 +2866,8 @@ void ComposeControls::toggleTabbedSelectorMode() {
}
if (_tabbedPanel) {
if (_regularWindow->canShowThirdSection()
&& !_regularWindow->adaptive().isOneColumn()) {
&& !_regularWindow->adaptive().isOneColumn()
&& ::Kotato::JsonSettings::GetBool("emoji_sidebar")) {
Core::App().settings().setTabbedSelectorSectionEnabled(true);
Core::App().saveSettingsDelayed();
const auto topic = _history->peer->forumTopicFor(_topicRootId);

View File

@@ -361,6 +361,12 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
{ "view_profile_on_top", {
.type = SettingType::BoolSetting,
.defaultValue = false, }},
{ "emoji_sidebar", {
.type = SettingType::BoolSetting,
.defaultValue = true, }},
{ "emoji_sidebar_right_click", {
.type = SettingType::BoolSetting,
.defaultValue = false, }},
};
using OldOptionKey = QString;

View File

@@ -258,6 +258,8 @@ void SetupKotatoChats(
Ui::AddDividerText(container, rktr("ktg_settings_view_profile_on_top_about"));
Ui::AddSkip(container);
SettingsMenuJsonSwitch(ktg_settings_emoji_sidebar, emoji_sidebar);
SettingsMenuJsonSwitch(ktg_settings_emoji_sidebar_right_click, emoji_sidebar_right_click);
Ui::AddSkip(container);
Ui::AddDivider(container);