Automatic applying of scheduled change

This commit is contained in:
Eric Kotato 2019-10-10 23:51:46 +03:00
parent c55c606af6
commit 5a784a360b
7 changed files with 18 additions and 0 deletions

View file

@ -229,6 +229,10 @@ bool skipPaintEvent(QWidget *widget, QPaintEvent *event) {
namespace Notify { namespace Notify {
void showScheduledButtonChanged() {
if (MainWidget *m = App::main()) m->notify_showScheduledButtonChanged();
}
void userIsBotChanged(UserData *user) { void userIsBotChanged(UserData *user) {
if (MainWidget *m = App::main()) m->notify_userIsBotChanged(user); if (MainWidget *m = App::main()) m->notify_userIsBotChanged(user);
} }

View file

@ -105,6 +105,7 @@ enum ClipStopperType {
namespace Notify { namespace Notify {
void showScheduledButtonChanged();
void userIsBotChanged(UserData *user); void userIsBotChanged(UserData *user);
void botCommandsChanged(UserData *user); void botCommandsChanged(UserData *user);

View file

@ -1465,6 +1465,12 @@ void HistoryWidget::notify_userIsBotChanged(UserData *user) {
} }
} }
void HistoryWidget::notify_showScheduledButtonChanged() {
refreshScheduledToggle();
updateControlsVisibility();
updateControlsGeometry();
}
void HistoryWidget::setupShortcuts() { void HistoryWidget::setupShortcuts() {
Shortcuts::Requests( Shortcuts::Requests(
) | rpl::filter([=] { ) | rpl::filter([=] {

View file

@ -266,6 +266,7 @@ public:
void notify_inlineKeyboardMoved(const HistoryItem *item, int oldKeyboardTop, int newKeyboardTop); void notify_inlineKeyboardMoved(const HistoryItem *item, int oldKeyboardTop, int newKeyboardTop);
bool notify_switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot, MsgId samePeerReplyTo); bool notify_switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot, MsgId samePeerReplyTo);
void notify_userIsBotChanged(UserData *user); void notify_userIsBotChanged(UserData *user);
void notify_showScheduledButtonChanged();
~HistoryWidget(); ~HistoryWidget();

View file

@ -770,6 +770,10 @@ void MainWidget::notify_userIsBotChanged(UserData *bot) {
_history->notify_userIsBotChanged(bot); _history->notify_userIsBotChanged(bot);
} }
void MainWidget::notify_showScheduledButtonChanged() {
_history->notify_showScheduledButtonChanged();
}
void MainWidget::notify_historyMuteUpdated(History *history) { void MainWidget::notify_historyMuteUpdated(History *history) {
_dialogs->notify_historyMuteUpdated(history); _dialogs->notify_historyMuteUpdated(history);
} }

View file

@ -289,6 +289,7 @@ public:
void notify_inlineKeyboardMoved(const HistoryItem *item, int oldKeyboardTop, int newKeyboardTop); void notify_inlineKeyboardMoved(const HistoryItem *item, int oldKeyboardTop, int newKeyboardTop);
bool notify_switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot, MsgId samePeerReplyTo); bool notify_switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot, MsgId samePeerReplyTo);
void notify_userIsBotChanged(UserData *bot); void notify_userIsBotChanged(UserData *bot);
void notify_showScheduledButtonChanged();
void notify_historyMuteUpdated(History *history); void notify_historyMuteUpdated(History *history);
void closeBothPlayers(); void closeBothPlayers();

View file

@ -90,6 +90,7 @@ void SetupKotatoChats(not_null<Ui::VerticalLayout*> container) {
return (enabled != cAlwaysShowScheduled()); return (enabled != cAlwaysShowScheduled());
}) | rpl::start_with_next([](bool enabled) { }) | rpl::start_with_next([](bool enabled) {
cSetAlwaysShowScheduled(enabled); cSetAlwaysShowScheduled(enabled);
Notify::showScheduledButtonChanged();
}, container->lifetime()); }, container->lifetime());
AddSkip(container); AddSkip(container);