From a0693c2fc9135d7f76aa461f4847844cc0577a63 Mon Sep 17 00:00:00 2001 From: krepa098 Date: Wed, 14 Jan 2015 20:31:40 +0100 Subject: [PATCH] tweaked ChatLog::getSelectedText *Actions are copied as "*name action*" *SystemInfoMessages are not copied --- src/chatlog/chatlog.cpp | 9 +++++++-- src/chatlog/chatmessage.cpp | 6 +++--- src/chatlog/content/text.cpp | 3 --- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/chatlog/chatlog.cpp b/src/chatlog/chatlog.cpp index f1d690b8b..e3968e9a4 100644 --- a/src/chatlog/chatlog.cpp +++ b/src/chatlog/chatlog.cpp @@ -524,8 +524,11 @@ QString ChatLog::getSelectedText() const QString out; QString lastSender; - for(int i=selFirstRow; i<=selLastRow && i>=0 && icontent[1]->getText().isEmpty()) + continue; + if(lastSender != lines[i]->content[0]->getText() && !lines[i]->content[0]->getText().isEmpty()) { //author changed @@ -534,7 +537,9 @@ QString ChatLog::getSelectedText() const } out += lines[i]->content[1]->getText(); - out += "\n\n"; + + if(i != selLastRow) + out += "\n"; } return out; diff --git a/src/chatlog/chatmessage.cpp b/src/chatlog/chatmessage.cpp index 4e55cea2d..3a475ff59 100644 --- a/src/chatlog/chatmessage.cpp +++ b/src/chatlog/chatmessage.cpp @@ -56,8 +56,8 @@ ChatMessage::Ptr ChatMessage::createChatMessage(const QString &sender, const QSt text = "
" + text + "
"; } - msg->addColumn(new Text(isAction ? "
*
" : sender, isMe ? Style::getFont(Style::BigBold) : Style::getFont(Style::Big), isAction ? false : true), ColumnFormat(NAME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right)); - msg->addColumn(new Text(text, Style::getFont(Style::Big), false, rawMessage), ColumnFormat(1.0, ColumnFormat::VariableSize)); + msg->addColumn(new Text(isAction ? "
*
" : sender, isMe ? Style::getFont(Style::BigBold) : Style::getFont(Style::Big), isAction ? false : true, sender), ColumnFormat(NAME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right)); + msg->addColumn(new Text(text, Style::getFont(Style::Big), false, isAction ? QString("*%1 %2*").arg(sender, rawMessage) : rawMessage), ColumnFormat(1.0, ColumnFormat::VariableSize)); msg->addColumn(new Spinner(QSizeF(16, 16)), ColumnFormat(TIME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right)); if(!date.isNull()) @@ -79,7 +79,7 @@ ChatMessage::Ptr ChatMessage::createChatInfoMessage(const QString &rawMessage, S } msg->addColumn(new Image(QSizeF(16, 16), img), ColumnFormat(NAME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right)); - msg->addColumn(new Text(rawMessage, Style::getFont(Style::Big), false, rawMessage), ColumnFormat(1.0, ColumnFormat::VariableSize, ColumnFormat::Center)); + msg->addColumn(new Text(rawMessage, Style::getFont(Style::Big), false, ""), ColumnFormat(1.0, ColumnFormat::VariableSize, ColumnFormat::Center)); msg->addColumn(new Text(date.toString(Settings::getInstance().getTimestampFormat()), Style::getFont(Style::Big)), ColumnFormat(TIME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right)); return msg; diff --git a/src/chatlog/content/text.cpp b/src/chatlog/content/text.cpp index 0a591b27a..85fbec7fd 100644 --- a/src/chatlog/content/text.cpp +++ b/src/chatlog/content/text.cpp @@ -52,9 +52,6 @@ void Text::setText(const QString& txt) text = txt; dirty = true; - if(rawText.isEmpty()) - rawText = txt; - ensureIntegrity(); freeResources(); }