mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #4440
ezavod (1): fix(ui): add date message before info messages
This commit is contained in:
commit
98a01dfefc
@ -402,9 +402,7 @@ ChatMessage::Ptr GenericChatForm::createMessage(const ToxPk& author, const QStri
|
|||||||
bool isSelf = author == core->getSelfId().getPublicKey();
|
bool isSelf = author == core->getSelfId().getPublicKey();
|
||||||
QString authorStr = isSelf ? core->getUsername() : resolveToxPk(author);
|
QString authorStr = isSelf ? core->getUsername() : resolveToxPk(author);
|
||||||
if (getLatestDate() != QDate::currentDate()) {
|
if (getLatestDate() != QDate::currentDate()) {
|
||||||
const Settings& s = Settings::getInstance();
|
addSystemDateMessage();
|
||||||
QString dateText = QDate::currentDate().toString(s.getDateFormat());
|
|
||||||
addSystemInfoMessage(dateText, ChatMessage::INFO, QDateTime());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatMessage::Ptr msg;
|
ChatMessage::Ptr msg;
|
||||||
@ -553,10 +551,23 @@ void GenericChatForm::onChatMessageFontChanged(const QFont& font)
|
|||||||
void GenericChatForm::addSystemInfoMessage(const QString& message, ChatMessage::SystemMessageType type,
|
void GenericChatForm::addSystemInfoMessage(const QString& message, ChatMessage::SystemMessageType type,
|
||||||
const QDateTime& datetime)
|
const QDateTime& datetime)
|
||||||
{
|
{
|
||||||
|
if (getLatestDate() != QDate::currentDate()) {
|
||||||
|
addSystemDateMessage();
|
||||||
|
}
|
||||||
|
|
||||||
previousId = ToxPk();
|
previousId = ToxPk();
|
||||||
insertChatMessage(ChatMessage::createChatInfoMessage(message, type, datetime));
|
insertChatMessage(ChatMessage::createChatInfoMessage(message, type, datetime));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GenericChatForm::addSystemDateMessage()
|
||||||
|
{
|
||||||
|
const Settings& s = Settings::getInstance();
|
||||||
|
QString dateText = QDate::currentDate().toString(s.getDateFormat());
|
||||||
|
|
||||||
|
previousId = ToxPk();
|
||||||
|
insertChatMessage(ChatMessage::createChatInfoMessage(dateText, ChatMessage::INFO, QDateTime()));
|
||||||
|
}
|
||||||
|
|
||||||
void GenericChatForm::clearChatArea()
|
void GenericChatForm::clearChatArea()
|
||||||
{
|
{
|
||||||
clearChatArea(true);
|
clearChatArea(true);
|
||||||
|
@ -101,6 +101,7 @@ protected slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
void addSystemDateMessage();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ChatMessage::Ptr createMessage(const ToxPk& author, const QString& message,
|
ChatMessage::Ptr createMessage(const ToxPk& author, const QString& message,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user