[Option][GUI] Always show scheduled
This commit is contained in:
parent
09c94b2a56
commit
3c67eea727
13 changed files with 57 additions and 12 deletions
BIN
Telegram/Resources/icons/send_control_scheduled_no_dot.png
Normal file
BIN
Telegram/Resources/icons/send_control_scheduled_no_dot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
BIN
Telegram/Resources/icons/send_control_scheduled_no_dot@2x.png
Normal file
BIN
Telegram/Resources/icons/send_control_scheduled_no_dot@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
BIN
Telegram/Resources/icons/send_control_scheduled_no_dot@3x.png
Normal file
BIN
Telegram/Resources/icons/send_control_scheduled_no_dot@3x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
|
|
@ -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",
|
||||||
|
|
|
||||||
|
|
@ -287,6 +287,10 @@ bool skipPaintEvent(QWidget *widget, QPaintEvent *event) {
|
||||||
|
|
||||||
namespace Notify {
|
namespace Notify {
|
||||||
|
|
||||||
|
void showScheduledButtonChanged(not_null<Main::Session*> session) {
|
||||||
|
if (const auto m = CheckMainWidget(session)) m->notify_showScheduledButtonChanged();
|
||||||
|
}
|
||||||
|
|
||||||
bool switchInlineBotButtonReceived(
|
bool switchInlineBotButtonReceived(
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
const QString &query,
|
const QString &query,
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ enum ClipStopperType {
|
||||||
|
|
||||||
namespace Notify {
|
namespace Notify {
|
||||||
|
|
||||||
|
void showScheduledButtonChanged(not_null<Main::Session*> session);
|
||||||
bool switchInlineBotButtonReceived(
|
bool switchInlineBotButtonReceived(
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
const QString &query,
|
const QString &query,
|
||||||
|
|
|
||||||
|
|
@ -1828,6 +1828,12 @@ bool HistoryWidget::notify_switchInlineBotButtonReceived(const QString &query, U
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HistoryWidget::notify_showScheduledButtonChanged() {
|
||||||
|
refreshScheduledToggle();
|
||||||
|
updateControlsVisibility();
|
||||||
|
updateControlsGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
void HistoryWidget::setupShortcuts() {
|
void HistoryWidget::setupShortcuts() {
|
||||||
Shortcuts::Requests(
|
Shortcuts::Requests(
|
||||||
) | rpl::filter([=] {
|
) | rpl::filter([=] {
|
||||||
|
|
@ -2517,19 +2523,23 @@ void HistoryWidget::setupScheduledToggle() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::refreshScheduledToggle() {
|
void HistoryWidget::refreshScheduledToggle() {
|
||||||
const auto has = _history
|
const auto canWrite = _history && _peer->canWrite();
|
||||||
&& _peer->canWrite()
|
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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -285,6 +285,7 @@ public:
|
||||||
QRect floatPlayerAvailableRect() override;
|
QRect floatPlayerAvailableRect() override;
|
||||||
|
|
||||||
bool notify_switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot, MsgId samePeerReplyTo);
|
bool notify_switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot, MsgId samePeerReplyTo);
|
||||||
|
void notify_showScheduledButtonChanged();
|
||||||
|
|
||||||
~HistoryWidget();
|
~HistoryWidget();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -260,6 +260,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;
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,21 @@ void SetupKotatoChats(
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
AddSubsectionTitle(container, rktr("ktg_settings_chats"));
|
AddSubsectionTitle(container, rktr("ktg_settings_chats"));
|
||||||
|
|
||||||
|
AddButton(
|
||||||
|
container,
|
||||||
|
rktr("ktg_settings_always_show_scheduled"),
|
||||||
|
st::settingsButton
|
||||||
|
)->toggleOn(
|
||||||
|
rpl::single(::Kotato::JsonSettings::GetBool("always_show_scheduled"))
|
||||||
|
)->toggledValue(
|
||||||
|
) | rpl::filter([](bool enabled) {
|
||||||
|
return (enabled != ::Kotato::JsonSettings::GetBool("always_show_scheduled"));
|
||||||
|
}) | rpl::start_with_next([controller](bool enabled) {
|
||||||
|
::Kotato::JsonSettings::Set("always_show_scheduled", enabled);
|
||||||
|
Notify::showScheduledButtonChanged(&controller->session());
|
||||||
|
::Kotato::JsonSettings::Write();
|
||||||
|
}, container->lifetime());
|
||||||
|
|
||||||
AddButton(
|
AddButton(
|
||||||
container,
|
container,
|
||||||
rktr("ktg_settings_fonts"),
|
rktr("ktg_settings_fonts"),
|
||||||
|
|
|
||||||
|
|
@ -621,6 +621,10 @@ bool MainWidget::notify_switchInlineBotButtonReceived(const QString &query, User
|
||||||
return _history->notify_switchInlineBotButtonReceived(query, samePeerBot, samePeerReplyTo);
|
return _history->notify_switchInlineBotButtonReceived(query, samePeerBot, samePeerReplyTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWidget::notify_showScheduledButtonChanged() {
|
||||||
|
_history->notify_showScheduledButtonChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWidget::clearHider(not_null<Window::HistoryHider*> instance) {
|
void MainWidget::clearHider(not_null<Window::HistoryHider*> instance) {
|
||||||
if (_hider != instance) {
|
if (_hider != instance) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -223,6 +223,7 @@ public:
|
||||||
MsgId msgId);
|
MsgId msgId);
|
||||||
|
|
||||||
bool notify_switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot, MsgId samePeerReplyTo);
|
bool notify_switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot, MsgId samePeerReplyTo);
|
||||||
|
void notify_showScheduledButtonChanged();
|
||||||
|
|
||||||
using FloatDelegate::floatPlayerAreaUpdated;
|
using FloatDelegate::floatPlayerAreaUpdated;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -353,6 +353,11 @@ historyScheduledToggle: IconButton(historyAttach) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
historyScheduledToggleEmpty: IconButton(historyAttach) {
|
||||||
|
icon: icon {{ "send_control_scheduled_no_dot", historyComposeIconFg }};
|
||||||
|
iconOver: icon {{ "send_control_scheduled_no_dot", historyComposeIconFgOver }};
|
||||||
|
iconPosition: point(-1px, -1px);
|
||||||
|
}
|
||||||
historyRecordVoiceFg: historyComposeIconFg;
|
historyRecordVoiceFg: historyComposeIconFg;
|
||||||
historyRecordVoiceFgOver: historyComposeIconFgOver;
|
historyRecordVoiceFgOver: historyComposeIconFgOver;
|
||||||
historyRecordVoiceFgInactive: attentionButtonFg;
|
historyRecordVoiceFgInactive: attentionButtonFg;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue