[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Mon Mar 8 20:52:04 CET 2004
CVS commit by staikos:
allow log updates in realtime
M +3 -1 debugdialog.ui.h 1.2
M +14 -7 kstdebug.cpp 1.2
M +7 -2 kstdebug.h 1.3
--- kdeextragear-2/kst/kst/debugdialog.ui.h #1.1:1.2
@@ -17,4 +17,7 @@ void DebugDialog::init()
_buildInfo->setText(i18n("<h1>Kst</h1> version %1").arg(KSTVERSION));
+ _log->setText(KstDebug::self()->logString());
+
+ connect(KstDebug::self(), SIGNAL(logAdded(const QString&)), _log, SLOT(append(const QString&)));
}
@@ -22,5 +25,4 @@ void DebugDialog::init()
void DebugDialog::show()
{
- _log->setText(KstDebug::self()->logString());
_log->scrollToBottom();
--- kdeextragear-2/kst/kst/kstdebug.cpp #1.1:1.2
@@ -50,24 +50,31 @@ QStringList KstDebug::dataSourcePlugins(
void KstDebug::log(const QString& msg, LogLevel level) {
+ QString m;
+
switch (level) {
case Notice:
- _log += i18n("%1 Notice: %2\n").arg(QDateTime::currentDateTime().toString()).arg(msg);
+ m = i18n("%1 Notice: %2\n").arg(QDateTime::currentDateTime().toString()).arg(msg);
break;
case Warning:
- _log += i18n("%1 Warning: %2\n").arg(QDateTime::currentDateTime().toString()).arg(msg);
+ m = i18n("%1 Warning: %2\n").arg(QDateTime::currentDateTime().toString()).arg(msg);
break;
case Error:
- _log += i18n("%1 Error: %2\n").arg(QDateTime::currentDateTime().toString()).arg(msg);
+ m = i18n("%1 Error: %2\n").arg(QDateTime::currentDateTime().toString()).arg(msg);
break;
case Debug:
- _log += i18n("%1 Debug: %2\n").arg(QDateTime::currentDateTime().toString()).arg(msg);
+ m = i18n("%1 Debug: %2\n").arg(QDateTime::currentDateTime().toString()).arg(msg);
break;
default:
- _log += QDateTime::currentDateTime().toString();
- _log += msg;
- _log += '\n';
+ m = QDateTime::currentDateTime().toString();
+ m += msg;
+ m += '\n';
+ break;
}
+
+ _log += m;
+ emit logAdded(m);
}
+#include "kstdebug.moc"
// vim: ts=2 sw=2 et
--- kdeextragear-2/kst/kst/kstdebug.h #1.2:1.3
@@ -19,4 +19,5 @@
#define KSTDEBUG_H
+#include <qobject.h>
#include <qstring.h>
#include <qstringlist.h>
@@ -25,5 +26,7 @@
-class KstDebug {
+class KstDebug : public QObject {
+ Q_OBJECT
+
friend class KStaticDeleter<KstDebug>;
@@ -37,5 +40,7 @@ class KstDebug {
QStringList dataSourcePlugins() const;
- //dataSources
+ signals:
+ void logAdded(const QString&);
+
private:
KstDebug();
More information about the Kst
mailing list