mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Fixed update of submit way in all opened windows.
This commit is contained in:
parent
07c5e6542b
commit
920484d540
8 changed files with 22 additions and 12 deletions
|
@ -258,7 +258,7 @@ QByteArray Settings::serialize() const {
|
|||
}
|
||||
stream
|
||||
<< qint32(_sendFilesWay.serialize())
|
||||
<< qint32(_sendSubmitWay)
|
||||
<< qint32(_sendSubmitWay.current())
|
||||
<< qint32(_includeMutedCounter ? 1 : 0)
|
||||
<< qint32(_countUnreadMessages ? 1 : 0)
|
||||
<< qint32(1) // legacy exe launch warning
|
||||
|
@ -421,7 +421,7 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
|||
qint32 soundOverridesCount = 0;
|
||||
base::flat_map<QString, QString> soundOverrides;
|
||||
qint32 sendFilesWay = _sendFilesWay.serialize();
|
||||
qint32 sendSubmitWay = static_cast<qint32>(_sendSubmitWay);
|
||||
qint32 sendSubmitWay = static_cast<qint32>(_sendSubmitWay.current());
|
||||
qint32 includeMutedCounter = _includeMutedCounter ? 1 : 0;
|
||||
qint32 countUnreadMessages = _countUnreadMessages ? 1 : 0;
|
||||
std::optional<QString> noWarningExtensions;
|
||||
|
|
|
@ -388,7 +388,11 @@ public:
|
|||
_sendSubmitWay = value;
|
||||
}
|
||||
[[nodiscard]] Ui::InputSubmitSettings sendSubmitWay() const {
|
||||
return _sendSubmitWay;
|
||||
return _sendSubmitWay.current();
|
||||
}
|
||||
[[nodiscard]] auto sendSubmitWayValue() const
|
||||
-> rpl::producer<Ui::InputSubmitSettings> {
|
||||
return _sendSubmitWay.value();
|
||||
}
|
||||
void setSoundOverride(const QString &key, const QString &path) {
|
||||
_soundOverrides.emplace(key, path);
|
||||
|
@ -966,7 +970,8 @@ private:
|
|||
Window::Theme::AccentColors _themesAccentColors;
|
||||
bool _lastSeenWarningSeen = false;
|
||||
Ui::SendFilesWay _sendFilesWay = Ui::SendFilesWay();
|
||||
Ui::InputSubmitSettings _sendSubmitWay = Ui::InputSubmitSettings();
|
||||
rpl::variable<Ui::InputSubmitSettings> _sendSubmitWay
|
||||
= Ui::InputSubmitSettings();
|
||||
base::flat_map<QString, QString> _soundOverrides;
|
||||
base::flat_set<QString> _noWarningExtensions;
|
||||
bool _ipRevealWarning = true;
|
||||
|
|
|
@ -661,6 +661,12 @@ HistoryWidget::HistoryWidget(
|
|||
updateHistoryGeometry();
|
||||
});
|
||||
}, lifetime());
|
||||
Core::App().settings().sendSubmitWayValue(
|
||||
) | rpl::start_with_next([=] {
|
||||
crl::on_main(this, [=] {
|
||||
updateFieldSubmitSettings();
|
||||
});
|
||||
}, lifetime());
|
||||
|
||||
session().data().channelDifferenceTooLong(
|
||||
) | rpl::filter([=](not_null<ChannelData*> channel) {
|
||||
|
|
|
@ -251,8 +251,6 @@ public:
|
|||
|
||||
void applyCloudDraft(History *history);
|
||||
|
||||
void updateFieldSubmitSettings();
|
||||
|
||||
void activate();
|
||||
void setInnerFocus();
|
||||
[[nodiscard]] rpl::producer<> cancelRequests() const {
|
||||
|
@ -380,6 +378,8 @@ private:
|
|||
void windowIsVisibleChanged();
|
||||
void saveFieldToHistoryLocalDraft();
|
||||
|
||||
void updateFieldSubmitSettings();
|
||||
|
||||
// Checks if we are too close to the top or to the bottom
|
||||
// in the scroll area and preloads history if needed.
|
||||
void preloadHistoryIfNeeded();
|
||||
|
|
|
@ -1528,6 +1528,11 @@ void ComposeControls::init() {
|
|||
saveFieldToHistoryLocalDraft();
|
||||
}, _wrap->lifetime());
|
||||
|
||||
Core::App().settings().sendSubmitWayValue(
|
||||
) | rpl::start_with_next([=] {
|
||||
updateSubmitSettings();
|
||||
}, _wrap->lifetime());
|
||||
|
||||
session().attachWebView().attachBotsUpdates(
|
||||
) | rpl::start_with_next([=] {
|
||||
updateAttachBotsMenu();
|
||||
|
|
|
@ -1211,10 +1211,6 @@ void MainWidget::clearBotStartToken(PeerData *peer) {
|
|||
}
|
||||
}
|
||||
|
||||
void MainWidget::ctrlEnterSubmitUpdated() {
|
||||
_history->updateFieldSubmitSettings();
|
||||
}
|
||||
|
||||
void MainWidget::showChooseReportMessages(
|
||||
not_null<PeerData*> peer,
|
||||
Ui::ReportReason reason,
|
||||
|
|
|
@ -175,7 +175,6 @@ public:
|
|||
|
||||
void clearBotStartToken(PeerData *peer);
|
||||
|
||||
void ctrlEnterSubmitUpdated();
|
||||
void setInnerFocus();
|
||||
|
||||
bool contentOverlapped(const QRect &globalRect);
|
||||
|
|
|
@ -875,7 +875,6 @@ void SetupMessages(
|
|||
groupSend->setChangedCallback([=](SendByType value) {
|
||||
Core::App().settings().setSendSubmitWay(value);
|
||||
Core::App().saveSettingsDelayed();
|
||||
controller->content()->ctrlEnterSubmitUpdated();
|
||||
});
|
||||
|
||||
Ui::AddSkip(inner, st::settingsCheckboxesSkip);
|
||||
|
|
Loading…
Add table
Reference in a new issue