better handling of log messages (internal stuff only)
authorMarcus Eggenberger <egs@quassel-irc.org>
Sat, 1 Nov 2008 17:12:12 +0000 (18:12 +0100)
committerMarcus Eggenberger <egs@quassel-irc.org>
Sat, 1 Nov 2008 17:12:12 +0000 (18:12 +0100)
src/client/client.cpp
src/client/client.h
src/qtui/debuglogwidget.cpp
src/qtui/debuglogwidget.h

index f981040..ca008e9 100644 (file)
@@ -421,7 +421,8 @@ void Client::logMessage(QtMsgType type, const char *msg) {
     Quassel::logFatalMessage(msg);
     return;
   }
     Quassel::logFatalMessage(msg);
     return;
   }
-  instance()->_debugLog << prefix << ": " << msg << "\n";
-  emit instance()->logUpdated();
+  QString msgString = QString("%1: %3\n").arg(prefix, msg);
+  instance()->_debugLog << msgString;
+  emit instance()->logUpdated(msgString);
 }
 
 }
 
index 52133b6..9f881d1 100644 (file)
@@ -152,7 +152,7 @@ signals:
 
   void newClientSyncer(ClientSyncer *);
 
 
   void newClientSyncer(ClientSyncer *);
 
-  void logUpdated();
+  void logUpdated(const QString &msg);
 
 public slots:
   //void selectBuffer(Buffer *);
 
 public slots:
   //void selectBuffer(Buffer *);
index 15b1c5c..a4c6db0 100644 (file)
@@ -27,12 +27,14 @@ DebugLogWidget::DebugLogWidget(QWidget *parent)
 {
   ui.setupUi(this);
   setAttribute(Qt::WA_DeleteOnClose, true);
 {
   ui.setupUi(this);
   setAttribute(Qt::WA_DeleteOnClose, true);
-  logUpdated();
-  connect(Client::instance(), SIGNAL(logUpdated()), this, SLOT(logUpdated()));
+  ui.textEdit->setPlainText(Client::debugLog());
+  connect(Client::instance(), SIGNAL(logUpdated(const QString &)), this, SLOT(logUpdated(const QString &)));
   ui.textEdit->setReadOnly(true);
 }
 
   ui.textEdit->setReadOnly(true);
 }
 
-void DebugLogWidget::logUpdated() {
-  ui.textEdit->setPlainText(Client::debugLog());
+void DebugLogWidget::logUpdated(const QString &msg) {
+  ui.textEdit->moveCursor(QTextCursor::End);
+  ui.textEdit->insertPlainText(msg);
+  ui.textEdit->moveCursor(QTextCursor::End);
 }
 
 }
 
index 476a80a..fb1c482 100644 (file)
@@ -30,7 +30,7 @@ public:
   DebugLogWidget(QWidget *parent = 0);
 
 private slots:
   DebugLogWidget(QWidget *parent = 0);
 
 private slots:
-  void logUpdated();
+  void logUpdated(const QString &msg);
 
 private:
   Ui::DebugLogWidget ui;
 
 private:
   Ui::DebugLogWidget ui;