From bc97948be7a8f02a64b900e8ac7b8ab1901f0e78 Mon Sep 17 00:00:00 2001 From: krepa098 Date: Sun, 4 Jan 2015 20:24:56 +0100 Subject: [PATCH] changed output of ChatLog::toPlainText --- src/chatlog/chatlog.cpp | 11 +---------- src/chatlog/content/text.cpp | 3 +++ src/chatlog/content/text.h | 2 +- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/chatlog/chatlog.cpp b/src/chatlog/chatlog.cpp index 1c0271992..a6bb68c71 100644 --- a/src/chatlog/chatlog.cpp +++ b/src/chatlog/chatlog.cpp @@ -445,19 +445,10 @@ QString ChatLog::getSelectedText() const QString ChatLog::toPlainText() const { QString out; - QString lastSender; for(ChatLine::Ptr l : lines) { - if(lastSender != l->content[0]->getText() && !l->content[0]->getText().isEmpty()) - { - //author changed - out += l->content[0]->getText() + ":\n"; - lastSender = l->content[0]->getText(); - } - - out += l->content[1]->getText(); - out += "\n\n"; + out += QString("|%1 @%2|\n%3\n\n").arg(l->getContent(0)->getText(),l->getContent(2)->getText(),l->getContent(1)->getText()); } return out; diff --git a/src/chatlog/content/text.cpp b/src/chatlog/content/text.cpp index 7f7334ed2..af7fb53e8 100644 --- a/src/chatlog/content/text.cpp +++ b/src/chatlog/content/text.cpp @@ -52,6 +52,9 @@ void Text::setText(const QString& txt) text = txt; dirty = true; + if(rawText.isEmpty()) + rawText = txt; + ensureIntegrity(); freeResources(); } diff --git a/src/chatlog/content/text.h b/src/chatlog/content/text.h index 05c6cd017..a99a9516e 100644 --- a/src/chatlog/content/text.h +++ b/src/chatlog/content/text.h @@ -27,7 +27,7 @@ class CustomTextDocument; class Text : public ChatLineContent { public: - Text(const QString& txt = "", QFont font = QFont(), bool enableElide = false, const QString& rawText = ""); + Text(const QString& txt = "", QFont font = QFont(), bool enableElide = false, const QString& rawText = QString()); virtual ~Text(); void setText(const QString& txt);