mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
changed output of ChatLog::toPlainText
This commit is contained in:
parent
27e967b67e
commit
bc97948be7
|
@ -445,19 +445,10 @@ QString ChatLog::getSelectedText() const
|
||||||
QString ChatLog::toPlainText() const
|
QString ChatLog::toPlainText() const
|
||||||
{
|
{
|
||||||
QString out;
|
QString out;
|
||||||
QString lastSender;
|
|
||||||
|
|
||||||
for(ChatLine::Ptr l : lines)
|
for(ChatLine::Ptr l : lines)
|
||||||
{
|
{
|
||||||
if(lastSender != l->content[0]->getText() && !l->content[0]->getText().isEmpty())
|
out += QString("|%1 @%2|\n%3\n\n").arg(l->getContent(0)->getText(),l->getContent(2)->getText(),l->getContent(1)->getText());
|
||||||
{
|
|
||||||
//author changed
|
|
||||||
out += l->content[0]->getText() + ":\n";
|
|
||||||
lastSender = l->content[0]->getText();
|
|
||||||
}
|
|
||||||
|
|
||||||
out += l->content[1]->getText();
|
|
||||||
out += "\n\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
|
|
|
@ -52,6 +52,9 @@ void Text::setText(const QString& txt)
|
||||||
text = txt;
|
text = txt;
|
||||||
dirty = true;
|
dirty = true;
|
||||||
|
|
||||||
|
if(rawText.isEmpty())
|
||||||
|
rawText = txt;
|
||||||
|
|
||||||
ensureIntegrity();
|
ensureIntegrity();
|
||||||
freeResources();
|
freeResources();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ class CustomTextDocument;
|
||||||
class Text : public ChatLineContent
|
class Text : public ChatLineContent
|
||||||
{
|
{
|
||||||
public:
|
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();
|
virtual ~Text();
|
||||||
|
|
||||||
void setText(const QString& txt);
|
void setText(const QString& txt);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user