4
* $Id: log.cpp,v 1.18 2001/05/13 01:55:26 gebauer Exp $
5
* Copyright (C) 1997 Bernd Wuebben
6
* wuebben@math.cornel.edu
9
* This program is free software; you can redistribute it and/or
10
* modify it under the terms of the GNU Library General Public
11
* License as published by the Free Software Foundation; either
12
* version 2 of the License, or (at your option) any later version.
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
* Library General Public License for more details.
19
* You should have received a copy of the GNU Library General Public
20
* License along with this program; if not, write to the Free
21
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31
LogWindow::LogWindow(QWidget *parent, const char *name)
32
: QWidget(parent, name)
34
setCaption(i18n("Info Window"));
36
text_window = new QMultiLineEdit(this,"logwindow");
37
text_window->setFocusPolicy ( QWidget::NoFocus );
38
text_window->setReadOnly( TRUE );
39
text_window->setUndoEnabled( FALSE );
40
//text_window->setMaxLineLength( 24 );
41
text_window->setMaxLines( 110 ); // text_window->numRows() ??
43
stringlist = new QStringList;
45
sltimer = new QTimer(this);
46
connect(sltimer,SIGNAL(timeout()),this,SLOT(updatewindow()));
52
LogWindow::~LogWindow() {
55
void LogWindow::updatewindow(){
57
static int line = 0, col = 0;
62
if (stringlist->count() != 0){
64
text_window->setAutoUpdate(FALSE);
66
for ( QStringList::Iterator it = stringlist->begin();
67
it != stringlist->end();
70
/* after a string starting with "~", don't start a new line --gl */
71
static int tildaflag = 0;
80
if (tildaflag && len) {
81
text_window->insertAt(s, line, col);
85
if (line > 100) text_window->removeLine(0);
87
text_window->insertLine(s,line);
90
tildaflag = futuretilda;
92
text_window->setAutoUpdate(TRUE);
94
text_window->setCursorPosition(line+1,0,FALSE);
95
text_window->repaint(FALSE);
103
void LogWindow::insertStr(const QString &string){
105
//if(string.find("Lyric:",0,TRUE) != -1)
108
if(string.find("MIDI file",0,TRUE) != -1){
109
stringlist->append(" ");
112
stringlist->append(string);
115
sltimer->start(10,TRUE); // sinlge shot TRUE
120
void LogWindow::clear(){
124
text_window->clear();
130
void LogWindow::resizeEvent(QResizeEvent* ){
135
text_window->resize(w, h);