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

tweaked ChatLog::getSelectedText

*Actions are copied as "*name action*"
*SystemInfoMessages are not copied
This commit is contained in:
krepa098 2015-01-14 20:31:40 +01:00
parent 3478a5c794
commit a0693c2fc9
3 changed files with 10 additions and 8 deletions

View File

@ -524,8 +524,11 @@ QString ChatLog::getSelectedText() const
QString out; QString out;
QString lastSender; QString lastSender;
for(int i=selFirstRow; i<=selLastRow && i>=0 && i<lines.size(); ++i) for(int i=selFirstRow; i<=selLastRow; ++i)
{ {
if(lines[i]->content[1]->getText().isEmpty())
continue;
if(lastSender != lines[i]->content[0]->getText() && !lines[i]->content[0]->getText().isEmpty()) if(lastSender != lines[i]->content[0]->getText() && !lines[i]->content[0]->getText().isEmpty())
{ {
//author changed //author changed
@ -534,7 +537,9 @@ QString ChatLog::getSelectedText() const
} }
out += lines[i]->content[1]->getText(); out += lines[i]->content[1]->getText();
out += "\n\n";
if(i != selLastRow)
out += "\n";
} }
return out; return out;

View File

@ -56,8 +56,8 @@ ChatMessage::Ptr ChatMessage::createChatMessage(const QString &sender, const QSt
text = "<div class=alert>" + text + "</div>"; text = "<div class=alert>" + text + "</div>";
} }
msg->addColumn(new Text(isAction ? "<div class=action>*</div>" : 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(isAction ? "<div class=action>*</div>" : 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, rawMessage), ColumnFormat(1.0, ColumnFormat::VariableSize)); 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)); msg->addColumn(new Spinner(QSizeF(16, 16)), ColumnFormat(TIME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right));
if(!date.isNull()) 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 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)); msg->addColumn(new Text(date.toString(Settings::getInstance().getTimestampFormat()), Style::getFont(Style::Big)), ColumnFormat(TIME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right));
return msg; return msg;

View File

@ -52,9 +52,6 @@ void Text::setText(const QString& txt)
text = txt; text = txt;
dirty = true; dirty = true;
if(rawText.isEmpty())
rawText = txt;
ensureIntegrity(); ensureIntegrity();
freeResources(); freeResources();
} }