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