2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-29 21:57:42 +00:00

[Option][GUI] Always show scheduled

This commit is contained in:
RadRussianRus 2022-08-26 21:49:24 +03:00 committed by Eric Kotato
parent 514e8ba9f8
commit 393bb7d455
8 changed files with 37 additions and 12 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -32,6 +32,7 @@
"ktg_settings_sticker_scale_both": "Apply to sticker width", "ktg_settings_sticker_scale_both": "Apply to sticker width",
"ktg_settings_sticker_scale_both_about": "When enabled, sticker maximum width will be changed along with sticker height.", "ktg_settings_sticker_scale_both_about": "When enabled, sticker maximum width will be changed along with sticker height.",
"ktg_settings_emoji_outline": "Big emoji outline", "ktg_settings_emoji_outline": "Big emoji outline",
"ktg_settings_always_show_scheduled": "Always show scheduled",
"ktg_fonts_title": "Fonts", "ktg_fonts_title": "Fonts",
"ktg_settings_fonts": "Change application fonts", "ktg_settings_fonts": "Change application fonts",
"ktg_fonts_reset": "Reset", "ktg_fonts_reset": "Reset",

View File

@ -1031,6 +1031,11 @@ historyScheduledToggle: IconButton(historyAttach) {
{ "chat/input_scheduled_dot", attentionButtonFg } { "chat/input_scheduled_dot", attentionButtonFg }
}; };
} }
historyScheduledToggleEmpty: IconButton(historyAttach) {
icon: icon {{ "send_control_scheduled_no_dot", historyComposeIconFg }};
iconOver: icon {{ "send_control_scheduled_no_dot", historyComposeIconFgOver }};
iconPosition: point(-1px, -1px);
}
historyAttachEmojiInner: IconButton(historyAttach) { historyAttachEmojiInner: IconButton(historyAttach) {
icon: icon {{ "chat/input_smile_face", historyComposeIconFg }}; icon: icon {{ "chat/input_smile_face", historyComposeIconFg }};

View File

@ -628,6 +628,16 @@ HistoryWidget::HistoryWidget(
}); });
}, lifetime()); }, lifetime());
::Kotato::JsonSettings::Events(
"always_show_scheduled"
) | rpl::start_with_next([=] {
crl::on_main(this, [=] {
refreshScheduledToggle();
updateControlsVisibility();
updateControlsGeometry();
});
}, lifetime());
session().data().channelDifferenceTooLong( session().data().channelDifferenceTooLong(
) | rpl::filter([=](not_null<ChannelData*> channel) { ) | rpl::filter([=](not_null<ChannelData*> channel) {
return _peer == channel.get(); return _peer == channel.get();
@ -2746,19 +2756,23 @@ void HistoryWidget::setupScheduledToggle() {
} }
void HistoryWidget::refreshScheduledToggle() { void HistoryWidget::refreshScheduledToggle() {
const auto has = _history const auto canWrite = _history && _canSendMessages;
&& _canSendMessages const auto has = canWrite && (session().data().scheduledMessages().count(_history) > 0);
&& (session().data().scheduledMessages().count(_history) > 0); if (_scheduled && !canWrite) {
if (!_scheduled && has) { _scheduled.destroy();
_scheduled.create(this, st::historyScheduledToggle); } else if (canWrite) {
if (_scheduled) {
_scheduled.destroy();
}
if (::Kotato::JsonSettings::GetBool("always_show_scheduled") || has){
_scheduled.create(this, (has ? st::historyScheduledToggle : st::historyScheduledToggleEmpty));
_scheduled->show(); _scheduled->show();
_scheduled->addClickHandler([=] { _scheduled->addClickHandler([=] {
controller()->showSection( controller()->showSection(
std::make_shared<HistoryView::ScheduledMemento>(_history)); std::make_shared<HistoryView::ScheduledMemento>(_history));
}); });
orderWidgets(); // Raise drag areas to the top. orderWidgets(); // Raise drag areas to the top.
} else if (_scheduled && !has) { }
_scheduled.destroy();
} }
} }

View File

@ -259,6 +259,9 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
{ "monospace_large_bubbles", { { "monospace_large_bubbles", {
.type = SettingType::BoolSetting, .type = SettingType::BoolSetting,
.defaultValue = false, }}, .defaultValue = false, }},
{ "always_show_scheduled", {
.type = SettingType::BoolSetting,
.defaultValue = false, }},
}; };
using OldOptionKey = QString; using OldOptionKey = QString;

View File

@ -71,6 +71,8 @@ void SetupKotatoChats(
Ui::AddSkip(container); Ui::AddSkip(container);
Ui::AddSubsectionTitle(container, rktr("ktg_settings_chats")); Ui::AddSubsectionTitle(container, rktr("ktg_settings_chats"));
SettingsMenuJsonSwitch(ktg_settings_always_show_scheduled, always_show_scheduled);
container->add(object_ptr<Button>( container->add(object_ptr<Button>(
container, container,
rktr("ktg_settings_fonts"), rktr("ktg_settings_fonts"),