← Back to team overview

ayatana-commits team mailing list archive

[Branch ~agateau/plasma-indicatordisplay/trunk] Rev 82: Prettify model dump

 

------------------------------------------------------------
revno: 82
committer: Aurelien Gateau <aurelien.gateau@xxxxxxxxxxxxx>
branch nick: plasma-indicatordisplay
timestamp: Tue 2009-09-15 15:48:42 +0200
message:
  Prettify model dump
modified:
  src/indicatordisplay.cpp
  src/modeldump.cpp


--
lp:plasma-indicatordisplay
https://code.launchpad.net/~agateau/plasma-indicatordisplay/trunk

Your team ayatana-commits is subscribed to branch lp:plasma-indicatordisplay.
To unsubscribe from this branch go to https://code.launchpad.net/~agateau/plasma-indicatordisplay/trunk/+edit-subscription.
=== modified file 'src/indicatordisplay.cpp'
--- src/indicatordisplay.cpp	2009-09-15 12:16:56 +0000
+++ src/indicatordisplay.cpp	2009-09-15 13:48:42 +0000
@@ -271,12 +271,15 @@
 void IndicatorDisplay::dumpModels()
 {
     RoleDumperHash hash;
-    hash.insert(Qt::UserRole + 1, new PointerRoleDumper<QIndicate::Listener::Server>("server"));
-    hash.insert(Qt::UserRole + 2, new PointerRoleDumper<QIndicate::Listener::Indicator>("indicator"));
+    hash.insert(Qt::DisplayRole, new SimpleRoleDumper("display"));
+    hash.insert(Qt::DecorationRole, new SimpleRoleDumper("decoration"));
     hash.insert(ListenerModel::ServerTypeRole, new SimpleRoleDumper("type"));
     hash.insert(ListenerModel::IndicatorCountRole, new SimpleRoleDumper("count"));
     hash.insert(ListenerModel::IndicatorDateTimeRole, new SimpleRoleDumper("time"));
     hash.insert(ListenerModel::IndicatorDrawAttentionRole, new SimpleRoleDumper("attention"));
+    hash.insert(Qt::UserRole + 1, new PointerRoleDumper<QIndicate::Listener::Server>("server"));
+    hash.insert(Qt::UserRole + 2, new PointerRoleDumper<QIndicate::Listener::Indicator>("indicator"));
+    hash.insert(Qt::UserRole + 3, new SimpleRoleDumper("outdated"));
     qDebug();
     qDebug() << "## mSourceModel";
     dump(hash, mSourceModel);

=== modified file 'src/modeldump.cpp'
--- src/modeldump.cpp	2009-08-07 17:00:25 +0000
+++ src/modeldump.cpp	2009-09-15 13:48:42 +0000
@@ -20,7 +20,7 @@
 {
     for (int row=0; row < model->rowCount(parent); ++row) {
         QModelIndex index = model->index(row, 0, parent);
-        QString line = QString(depth, ' ') + QString::number(row) + ' ' + index.data().toString() + " |";
+        QString line = QString(depth, ' ') + QString::number(row) + '.';
 
         QMap<int, QVariant> data = model->itemData(index);
         QMapIterator<int, QVariant> it(data);
@@ -35,7 +35,7 @@
                 role = QString::number(it.key());
                 value = it.value().toString();
             }
-            line += QString(" %1:%2").arg(role).arg(value);
+            line += QString(" %1:%2;").arg(role).arg(value);
         }
         qDebug() << qPrintable(line);
         if (model->hasChildren(index)) {