Source Code (Use browser search to find items of interest.)

Class Index

kmidi'LogWindow (./kdemultimedia/kmidi/log.h:35)

class LogWindow : public QWidget {

Q_OBJECT

public:
  LogWindow(QWidget *parent=0, const char *name=0);
  ~LogWindow();

  void insertStr(const QString &);
  void clear();

private slots:
  void updatewindow();

private:
  void resizeEvent(QResizeEvent *e);

private:

  bool timerset;
  QTimer *sltimer;
  QStrList *stringlist;
  QMultiLineEdit *text_window;

};

kmidi'LogWindow::LogWindow() (./kdemultimedia/kmidi/log.cpp:31)

LogWindow::LogWindow(QWidget *parent, const char *name)
  : QWidget(parent, name)
{
  setCaption(i18n("Info Window"));

  text_window = new QMultiLineEdit(this,"logwindow");
  text_window->setFocusPolicy ( QWidget::NoFocus );
  text_window->setReadOnly( TRUE );
  text_window->setUndoEnabled( FALSE );
  //text_window->setMaxLineLength( 24 );
  text_window->setMaxLines( 110 ); // text_window->numRows() ??

  stringlist = new QStrList(TRUE); // deep copies
  stringlist->setAutoDelete(TRUE);

  sltimer = new QTimer(this);
  connect(sltimer,SIGNAL(timeout()),this,SLOT(updatewindow()));
  timerset = false;

}



kmidi'LogWindow::~LogWindow() (./kdemultimedia/kmidi/log.cpp:53)

LogWindow::~LogWindow() {
}


kmidi'LogWindow::updatewindow() (./kdemultimedia/kmidi/log.cpp:56)

void LogWindow::updatewindow(){

  static int line = 0, col = 0;
  timerset = false;



  if (stringlist->count() != 0){

    text_window->setAutoUpdate(FALSE);

    for(stringlist->first();stringlist->current();stringlist->next()){
      /* after a string starting with "~", don't start a new line --gl */
	static int tildaflag = 0;
	int futuretilda, len;
	char *s = stringlist->current();
	if (*s == '~') {
	    futuretilda = 1;
	    s++;
	}
	else futuretilda = 0;
	len = strlen(s);
	if (tildaflag && len) {
	    text_window->insertAt(s, line, col);
	    col += len;
	}
	else {
	    if (line > 100) text_window->removeLine(0);
	    else line++;
	    text_window->insertLine(s,line);
	    col = len;
	}
	tildaflag = futuretilda;
    }
    text_window->setAutoUpdate(TRUE);

    text_window->setCursorPosition(line+1,0,FALSE);
    text_window->repaint(FALSE);

    stringlist->clear();

  }

}


kmidi'LogWindow::insertStr() (./kdemultimedia/kmidi/log.cpp:101)

void LogWindow::insertStr(const QString &string){

  //if(string.find("Lyric:",0,TRUE) != -1)
  //  return;
  
  if(string.find("MIDI file",0,TRUE) != -1){
    stringlist->append(" ");
  }
 
  stringlist->append(string);
 
  if(!timerset){
    sltimer->start(10,TRUE); // sinlge shot TRUE
    timerset = true;
  }

}

kmidi'LogWindow::clear() (./kdemultimedia/kmidi/log.cpp:118)

void LogWindow::clear(){

  if(text_window){
    
    text_window->clear();

  }

}


kmidi'LogWindow::resizeEvent() (./kdemultimedia/kmidi/log.cpp:128)

void LogWindow::resizeEvent(QResizeEvent* ){

  int w = width() ;
  int h = height();

  text_window->resize(w, h);
}