mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
feat: implement showMessageSeconds
This commit is contained in:
parent
45497bc444
commit
9aafbddee3
3 changed files with 18 additions and 1 deletions
|
@ -23,6 +23,7 @@ namespace AyuSettings {
|
|||
rpl::variable<QString> editedMarkReactive;
|
||||
rpl::variable<bool> showGhostToggleInDrawerReactive;
|
||||
rpl::variable<int> showPeerIdReactive;
|
||||
rpl::variable<bool> showMessageSecondsReactive;
|
||||
|
||||
rpl::variable<bool> ghostModeEnabled;
|
||||
|
||||
|
@ -64,6 +65,7 @@ namespace AyuSettings {
|
|||
editedMarkReactive = settings->editedMark;
|
||||
showGhostToggleInDrawerReactive = settings->showGhostToggleInDrawer;
|
||||
showPeerIdReactive = settings->showPeerId;
|
||||
showMessageSecondsReactive = settings->showMessageSeconds;
|
||||
|
||||
ghostModeEnabled = !settings->sendReadPackets && !settings->sendOnlinePackets;
|
||||
}
|
||||
|
@ -160,6 +162,11 @@ namespace AyuSettings {
|
|||
showPeerIdReactive = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showMessageSeconds(bool val) {
|
||||
showMessageSeconds = val;
|
||||
showMessageSecondsReactive = val;
|
||||
}
|
||||
|
||||
rpl::producer<bool> get_sendReadPacketsReactive() {
|
||||
return sendReadPacketsReactive.value();
|
||||
}
|
||||
|
@ -208,6 +215,10 @@ namespace AyuSettings {
|
|||
return showPeerIdReactive.value();
|
||||
}
|
||||
|
||||
rpl::producer<bool> get_showMessageSeconds() {
|
||||
return showMessageSecondsReactive.value();
|
||||
}
|
||||
|
||||
rpl::producer<bool> get_ghostModeEnabled() {
|
||||
return ghostModeEnabled.value();
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@ namespace AyuSettings {
|
|||
* showPeerId = 2 means ID shown as for Bot API devs (-100)
|
||||
*/
|
||||
showPeerId = 2;
|
||||
|
||||
showMessageSeconds = false;
|
||||
}
|
||||
|
||||
QS_SERIALIZABLE
|
||||
|
@ -66,6 +68,8 @@ namespace AyuSettings {
|
|||
|
||||
QS_FIELD(int, showPeerId)
|
||||
|
||||
QS_FIELD(bool, showMessageSeconds)
|
||||
|
||||
public:
|
||||
void set_sendReadPackets(bool val);
|
||||
void set_sendOnlinePackets(bool val);
|
||||
|
@ -83,6 +87,7 @@ namespace AyuSettings {
|
|||
void set_editedMark(QString val);
|
||||
void set_showGhostToggleInDrawer(bool val);
|
||||
void set_showPeerId(int val);
|
||||
void set_showMessageSeconds(bool val);
|
||||
};
|
||||
|
||||
AyuGramSettings &getInstance();
|
||||
|
@ -102,6 +107,7 @@ namespace AyuSettings {
|
|||
rpl::producer<QString> get_editedMarkReactive();
|
||||
rpl::producer<QString> get_showGhostToggleInDrawer();
|
||||
rpl::producer<int> get_showPeerId();
|
||||
rpl::producer<bool> get_showMessageSeconds();
|
||||
|
||||
// computed fields
|
||||
rpl::producer<bool> get_ghostModeEnabled();
|
||||
|
|
|
@ -472,7 +472,7 @@ void BottomInfo::layoutDateText() {
|
|||
const auto prefix = !author.isEmpty() ? (author == settings->deletedMark ? u" "_q : u", "_q) : QString();
|
||||
const auto date = edited + QLocale().toString(
|
||||
_data.date.time(),
|
||||
QLocale::ShortFormat);
|
||||
settings->showMessageSeconds ? QLocale::LongFormat : QLocale::ShortFormat);
|
||||
const auto afterAuthor = prefix + date;
|
||||
const auto afterAuthorWidth = st::msgDateFont->width(afterAuthor);
|
||||
const auto authorWidth = st::msgDateFont->width(author);
|
||||
|
|
Loading…
Add table
Reference in a new issue