Adopted --debugbufferswitches and --debugmodel to cliparser.
authorSebastian Goth <seezer@roath.org>
Wed, 16 Jul 2008 22:30:56 +0000 (00:30 +0200)
committerSebastian Goth <seezer@roath.org>
Wed, 16 Jul 2008 22:57:30 +0000 (00:57 +0200)
src/client/buffermodel.cpp
src/client/treemodel.cpp
src/common/main.cpp

index b67a447..a03ae5b 100644 (file)
@@ -23,6 +23,8 @@
 #include "networkmodel.h"
 #include "mappedselectionmodel.h"
 #include "buffer.h"
 #include "networkmodel.h"
 #include "mappedselectionmodel.h"
 #include "buffer.h"
+#include "global.h"
+
 #include <QAbstractItemView>
 
 BufferModel::BufferModel(NetworkModel *parent)
 #include <QAbstractItemView>
 
 BufferModel::BufferModel(NetworkModel *parent)
@@ -30,7 +32,7 @@ BufferModel::BufferModel(NetworkModel *parent)
     _selectionModelSynchronizer(this)
 {
   setSourceModel(parent);
     _selectionModelSynchronizer(this)
 {
   setSourceModel(parent);
-  if(QCoreApplication::instance()->arguments().contains("--debugbufferswitches")) {
+  if(Global::parser.isSet("debugbufferswitches")) {
     connect(_selectionModelSynchronizer.selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
            this, SLOT(debug_currentChanged(const QModelIndex &, const QModelIndex &)));
   }
     connect(_selectionModelSynchronizer.selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
            this, SLOT(debug_currentChanged(const QModelIndex &, const QModelIndex &)));
   }
index c61cf9e..2a71576 100644 (file)
@@ -19,6 +19,7 @@
  ***************************************************************************/
 
 #include "treemodel.h"
  ***************************************************************************/
 
 #include "treemodel.h"
+#include "global.h"
 
 #include <QDebug>
 #include <QCoreApplication>
 
 #include <QDebug>
 #include <QCoreApplication>
@@ -317,7 +318,7 @@ TreeModel::TreeModel(const QList<QVariant> &data, QObject *parent)
   rootItem = new SimpleTreeItem(data, 0);
   connectItem(rootItem);
 
   rootItem = new SimpleTreeItem(data, 0);
   connectItem(rootItem);
 
-  if(QCoreApplication::instance()->arguments().contains("--debugmodel")) {
+  if(Global::parser.isSet("debugmodel")) {
     connect(this, SIGNAL(rowsAboutToBeInserted(const QModelIndex &, int, int)),
            this, SLOT(debug_rowsAboutToBeInserted(const QModelIndex &, int, int)));
     connect(this, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)),
     connect(this, SIGNAL(rowsAboutToBeInserted(const QModelIndex &, int, int)),
            this, SLOT(debug_rowsAboutToBeInserted(const QModelIndex &, int, int)));
     connect(this, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)),
index f51f6b2..bac4308 100644 (file)
@@ -89,6 +89,8 @@ int main(int argc, char **argv) {
 #endif // BUILD_QTUI
 #ifndef BUILD_CORE
 // put client-only arguments here
 #endif // BUILD_QTUI
 #ifndef BUILD_CORE
 // put client-only arguments here
+  Global::parser.addSwitch("debugbufferswitches",0,"Enables debugging for bufferswitches");
+  Global::parser.addSwitch("debugmodel",0,"Enables debugging for models");
 #endif // BUILD_QTCORE
 // put shared client&core arguments here
   Global::parser.addSwitch("debug",'d',"Enable debug output");
 #endif // BUILD_QTCORE
 // put shared client&core arguments here
   Global::parser.addSwitch("debug",'d',"Enable debug output");