mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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<QString> editedMarkReactive;
|
||||||
rpl::variable<bool> showGhostToggleInDrawerReactive;
|
rpl::variable<bool> showGhostToggleInDrawerReactive;
|
||||||
rpl::variable<int> showPeerIdReactive;
|
rpl::variable<int> showPeerIdReactive;
|
||||||
|
rpl::variable<bool> showMessageSecondsReactive;
|
||||||
|
|
||||||
rpl::variable<bool> ghostModeEnabled;
|
rpl::variable<bool> ghostModeEnabled;
|
||||||
|
|
||||||
|
@ -64,6 +65,7 @@ namespace AyuSettings {
|
||||||
editedMarkReactive = settings->editedMark;
|
editedMarkReactive = settings->editedMark;
|
||||||
showGhostToggleInDrawerReactive = settings->showGhostToggleInDrawer;
|
showGhostToggleInDrawerReactive = settings->showGhostToggleInDrawer;
|
||||||
showPeerIdReactive = settings->showPeerId;
|
showPeerIdReactive = settings->showPeerId;
|
||||||
|
showMessageSecondsReactive = settings->showMessageSeconds;
|
||||||
|
|
||||||
ghostModeEnabled = !settings->sendReadPackets && !settings->sendOnlinePackets;
|
ghostModeEnabled = !settings->sendReadPackets && !settings->sendOnlinePackets;
|
||||||
}
|
}
|
||||||
|
@ -160,6 +162,11 @@ namespace AyuSettings {
|
||||||
showPeerIdReactive = val;
|
showPeerIdReactive = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AyuGramSettings::set_showMessageSeconds(bool val) {
|
||||||
|
showMessageSeconds = val;
|
||||||
|
showMessageSecondsReactive = val;
|
||||||
|
}
|
||||||
|
|
||||||
rpl::producer<bool> get_sendReadPacketsReactive() {
|
rpl::producer<bool> get_sendReadPacketsReactive() {
|
||||||
return sendReadPacketsReactive.value();
|
return sendReadPacketsReactive.value();
|
||||||
}
|
}
|
||||||
|
@ -208,6 +215,10 @@ namespace AyuSettings {
|
||||||
return showPeerIdReactive.value();
|
return showPeerIdReactive.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpl::producer<bool> get_showMessageSeconds() {
|
||||||
|
return showMessageSecondsReactive.value();
|
||||||
|
}
|
||||||
|
|
||||||
rpl::producer<bool> get_ghostModeEnabled() {
|
rpl::producer<bool> get_ghostModeEnabled() {
|
||||||
return ghostModeEnabled.value();
|
return ghostModeEnabled.value();
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,8 @@ namespace AyuSettings {
|
||||||
* showPeerId = 2 means ID shown as for Bot API devs (-100)
|
* showPeerId = 2 means ID shown as for Bot API devs (-100)
|
||||||
*/
|
*/
|
||||||
showPeerId = 2;
|
showPeerId = 2;
|
||||||
|
|
||||||
|
showMessageSeconds = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QS_SERIALIZABLE
|
QS_SERIALIZABLE
|
||||||
|
@ -66,6 +68,8 @@ namespace AyuSettings {
|
||||||
|
|
||||||
QS_FIELD(int, showPeerId)
|
QS_FIELD(int, showPeerId)
|
||||||
|
|
||||||
|
QS_FIELD(bool, showMessageSeconds)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void set_sendReadPackets(bool val);
|
void set_sendReadPackets(bool val);
|
||||||
void set_sendOnlinePackets(bool val);
|
void set_sendOnlinePackets(bool val);
|
||||||
|
@ -83,6 +87,7 @@ namespace AyuSettings {
|
||||||
void set_editedMark(QString val);
|
void set_editedMark(QString val);
|
||||||
void set_showGhostToggleInDrawer(bool val);
|
void set_showGhostToggleInDrawer(bool val);
|
||||||
void set_showPeerId(int val);
|
void set_showPeerId(int val);
|
||||||
|
void set_showMessageSeconds(bool val);
|
||||||
};
|
};
|
||||||
|
|
||||||
AyuGramSettings &getInstance();
|
AyuGramSettings &getInstance();
|
||||||
|
@ -102,6 +107,7 @@ namespace AyuSettings {
|
||||||
rpl::producer<QString> get_editedMarkReactive();
|
rpl::producer<QString> get_editedMarkReactive();
|
||||||
rpl::producer<QString> get_showGhostToggleInDrawer();
|
rpl::producer<QString> get_showGhostToggleInDrawer();
|
||||||
rpl::producer<int> get_showPeerId();
|
rpl::producer<int> get_showPeerId();
|
||||||
|
rpl::producer<bool> get_showMessageSeconds();
|
||||||
|
|
||||||
// computed fields
|
// computed fields
|
||||||
rpl::producer<bool> get_ghostModeEnabled();
|
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 prefix = !author.isEmpty() ? (author == settings->deletedMark ? u" "_q : u", "_q) : QString();
|
||||||
const auto date = edited + QLocale().toString(
|
const auto date = edited + QLocale().toString(
|
||||||
_data.date.time(),
|
_data.date.time(),
|
||||||
QLocale::ShortFormat);
|
settings->showMessageSeconds ? QLocale::LongFormat : QLocale::ShortFormat);
|
||||||
const auto afterAuthor = prefix + date;
|
const auto afterAuthor = prefix + date;
|
||||||
const auto afterAuthorWidth = st::msgDateFont->width(afterAuthor);
|
const auto afterAuthorWidth = st::msgDateFont->width(afterAuthor);
|
||||||
const auto authorWidth = st::msgDateFont->width(author);
|
const auto authorWidth = st::msgDateFont->width(author);
|
||||||
|
|
Loading…
Add table
Reference in a new issue