1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix: correct format log files

- correct format of "save chat log"
 - add date like in chat
 - correct type dialog for export dialog
This commit is contained in:
pkev 2018-04-23 15:06:23 +03:00 committed by Anthony Bilinski
parent ba983ae175
commit ee0d4bb880
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
3 changed files with 9 additions and 9 deletions

View File

@ -124,7 +124,7 @@ ChatMessage::Ptr ChatMessage::createChatInfoMessage(const QString& rawMessage,
msg->addColumn(new Image(QSize(18, 18), img),
ColumnFormat(NAME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right));
msg->addColumn(new Text("<b>" + text + "</b>", baseFont, false, ""),
msg->addColumn(new Text("<b>" + text + "</b>", baseFont, false, text),
ColumnFormat(1.0, ColumnFormat::VariableSize, ColumnFormat::Left));
msg->addColumn(new Timestamp(date, Settings::getInstance().getTimestampFormat(), baseFont),
ColumnFormat(TIME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right));

View File

@ -1087,11 +1087,12 @@ void ChatForm::onExportChat()
QString buffer;
for (const auto& it : msgs) {
QString timestamp = it.timestamp.toString();
QString timestamp = it.timestamp.time().toString("hh:mm:ss");
QString datestamp = it.timestamp.date().toString("yyyy-MM-dd");
ToxPk authorPk(ToxId(it.sender).getPublicKey());
QString author = getMsgAuthorDispName(authorPk, it.dispName);
QString line = QString("%1\t%2\t%3\n").arg(timestamp, author, it.message);
QString line = QString("%1\t%2\t%3\t%4\n").arg(datestamp, timestamp, author, it.message);
buffer = buffer % line;
}
file.write(buffer.toUtf8());

View File

@ -494,17 +494,16 @@ void GenericChatForm::onSaveLogClicked()
for (ChatLine::Ptr l : lines) {
Timestamp* rightCol = qobject_cast<Timestamp*>(l->getContent(2));
if (!rightCol)
break;
ChatLineContent* middleCol = l->getContent(1);
ChatLineContent* leftCol = l->getContent(0);
QString timestamp = rightCol->getTime().isNull() ? tr("Not sent") : rightCol->getText();
QString nick = leftCol->getText();
QString nick = leftCol->getText().isNull() ? tr("[System message]") : leftCol->getText();
QString msg = middleCol->getText();
plainText += QString("[%2] %1\n%3\n\n").arg(nick, timestamp, msg);
QString timestamp = (rightCol == nullptr) ? tr("Not sent") : rightCol->getText();
plainText += QString("%1\t%3\t%2\n").arg(nick, timestamp, msg);
}
file.write(plainText.toUtf8());