summaryrefslogtreecommitdiffstats
path: root/src/kile/kileoutputwidget.cpp
blob: 55cf8e66712f9619ac8b460fa3be433d47865900 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/***************************************************************************
    begin                : Sun Dec 21 2003
    copyright            : (C) 2003 by Jeroen Wijnhout
    email                : Jeroen.Wijnhout@kdemail.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ****************************************************************************/
 
#include "kileoutputwidget.h"
#include "kiledebug.h"

namespace KileWidget
{
	Output::Output(TQWidget *tqparent, const char * name) : KTextEdit(tqparent, name)
	{
		setTextFormat(TQt::LogText);
	}

	Output::~Output()
	{}

	void Output::receive(const TQString & str)
	{
		static TQString line = "";

		//find newline symbol
		//only output if we have receive one or more
		//full lines of text
		int newLineAt = str.tqfindRev('\n');
		if ( newLineAt != -1 )
		{
			line += str.left(newLineAt); //don't copy the newline char
			line.tqreplace('<',"&lt;");
			line.tqreplace('>',"&gt;");
			append(line);
			line = str.mid(newLineAt + 1);	
		}
		else
			line += str;
	}
}

#include "kileoutputwidget.moc"