[Kst] kdeextragear-2/kst/kst
Andrew Walker
arwalker at sumusltd.com
Fri Mar 26 19:42:15 CET 2004
CVS commit by arwalker:
Added Kst version informatoin to the email text.
Added labels for the different message types.
M +25 -19 kstdebug.cpp 1.7
M +1 -0 kstdebug.h 1.7
M +2 -2 kstdebugdialog_i.cpp 1.3
M +4 -0 kstlogtable.cpp 1.2
--- kdeextragear-2/kst/kst/kstdebug.cpp #1.6:1.7
@@ -18,4 +18,5 @@
#include "kstdatasource.h"
#include "kstdebug.h"
+#include "kstversion.h"
#include <kapplication.h>
@@ -66,31 +63,40 @@ void KstDebug::clear() {
}
-void KstDebug::getText(QString& body) {
- unsigned int i;
-
- body += i18n("Kst log:\n");
+QString KstDebug::getLabel(LogLevel level) const {
+ QString str;
- for( i=0; i<_messages.count(); i++ ) {
- switch (_messages[i].level) {
+ switch (level) {
case Notice:
- body += i18n("%1 Notice: %2").arg(_messages[i].date.toString()).arg(_messages[i].msg);
+ str = i18n("Notice");
break;
case Warning:
- body += i18n("%1 Warning: %2").arg(_messages[i].date.toString()).arg(_messages[i].msg);
+ str = i18n("Warning");
break;
case Error:
- body += i18n("%1 Error: %2").arg(_messages[i].date.toString()).arg(_messages[i].msg);
+ str = i18n("Error");
break;
case Debug:
- body += i18n("%1 Debug: %2").arg(_messages[i].date.toString()).arg(_messages[i].msg);
+ str = i18n("Debug");
break;
default:
- body += i18n("%1 %2").arg(_messages[i].date.toString()).arg(_messages[i].msg);
+ str = i18n("Other");
break;
}
- body += '\n';
+
+ return str;
+}
+
+void KstDebug::getText(QString& body) {
+ unsigned int i;
+
+ body += i18n("Kst version %1\n\n\n").arg(KSTVERSION);
+
+ body += i18n("Kst log:\n");
+
+ for( i=0; i<_messages.count(); i++ ) {
+ body += i18n("%1 %2: %3\n").arg(_messages[i].date.toString()).arg(getLabel(_messages[i].level)).arg(_messages[i].msg);
}
- body += i18n("\n\n\nData-source plugins:");
+ body += i18n("\n\nData-source plugins:");
QStringList dsp = dataSourcePlugins();
for (QStringList::ConstIterator it = dsp.begin(); it != dsp.end(); ++it) {
@@ -98,5 +104,5 @@ void KstDebug::getText(QString& body) {
body += *it;
}
- body += "\n\n\n";
+ body += "\n\n";
}
--- kdeextragear-2/kst/kst/kstdebugdialog_i.cpp #1.2:1.3
@@ -64,4 +64,5 @@ KstDebugDialogI::KstDebugDialogI(QWidget
: DebugDialog(parent, name, modal, fl ) {
QStringList labels;
+ int i;
_table = new KstLogTable( TabPage, "_table" );
@@ -79,6 +80,4 @@ KstDebugDialogI::KstDebugDialogI(QWidget
if( _table->numCols( ) != 3 ) {
- int i;
-
for( i=0; i<_table->numCols( ); ) {
_table->removeColumn( 0 );
@@ -92,4 +91,5 @@ KstDebugDialogI::KstDebugDialogI(QWidget
_table->setColumnLabels( labels );
_table->setReadOnly( true );
+ _table->setRowMovingEnabled( false );
connect(KstDebug::self(), SIGNAL(logAdded()), this, SLOT(logAdded()));
--- kdeextragear-2/kst/kst/kstdebug.h #1.6:1.7
@@ -44,4 +44,5 @@ class KstDebug : public QObject {
QValueList<LogMessage>* messages( ) { return &_messages; }
QStringList dataSourcePlugins() const;
+ QString getLabel(LogLevel level) const;
void getText(QString& body);
--- kdeextragear-2/kst/kst/kstlogtable.cpp #1.1:1.2
@@ -86,4 +86,8 @@ void KstLogTable::paintCell( QPainter* p
break;
}
+ painter->drawText( iHeight+2*iMargin, 0,
+ cr.width()-iHeight-2*iMargin, cr.height(),
+ AlignLeft,
+ _debug->getLabel((*(_debug->messages()))[row].level));
}
else if( col == 1 ) {
More information about the Kst
mailing list