itom 1.0.14
|
00001 /* ******************************************************************** 00002 itom software 00003 URL: http://www.uni-stuttgart.de/ito 00004 Copyright (C) 2013, Institut für Technische Optik (ITO), 00005 Universität Stuttgart, Germany 00006 00007 This file is part of itom. 00008 00009 itom is free software; you can redistribute it and/or modify it 00010 under the terms of the GNU Library General Public Licence as published by 00011 the Free Software Foundation; either version 2 of the Licence, or (at 00012 your option) any later version. 00013 00014 itom is distributed in the hope that it will be useful, but 00015 WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library 00017 General Public Licence for more details. 00018 00019 You should have received a copy of the GNU Library General Public License 00020 along with itom. If not, see <http://www.gnu.org/licenses/>. 00021 *********************************************************************** */ 00022 00023 #ifndef BREAKPOINTMODEL_H 00024 #define BREAKPOINTMODEL_H 00025 00026 #include "../common/sharedStructures.h" 00027 00028 #include <qabstractitemmodel.h> 00029 #include <qlist.h> 00030 00031 #include <qstring.h> 00032 #include <QDebug> 00033 00034 using namespace ito; 00035 00037 00041 struct BreakPointItem 00042 { 00044 BreakPointItem(): filename(""), lineno(-1), enabled(true), temporary(false), conditioned(false), condition(""), ignoreCount(0), pythonDbgBpNumber(-1) {}; 00045 QString filename; 00046 int lineno; 00047 bool enabled; 00048 bool temporary; 00049 bool conditioned; 00050 QString condition; 00051 int ignoreCount; 00052 int pythonDbgBpNumber; 00053 }; 00054 00055 00056 00057 class BreakPointModel : public QAbstractItemModel 00058 { 00059 Q_OBJECT 00060 00061 public: 00062 BreakPointModel(); 00063 ~BreakPointModel(); 00064 00065 QVariant data(const QModelIndex &index, int role) const; 00066 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; 00067 QModelIndex parent(const QModelIndex &index) const; 00068 int rowCount(const QModelIndex &parent = QModelIndex()) const; 00069 int columnCount(const QModelIndex &parent = QModelIndex()) const; 00070 00071 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; 00072 00073 RetVal addBreakPoint(BreakPointItem bp); 00074 RetVal deleteBreakPoint(QModelIndex index); 00075 RetVal deleteBreakPoints(QModelIndexList indizes); 00076 00077 QModelIndex getFirstBreakPointIndex(const QString filename, int lineNo) const; 00078 QModelIndexList getBreakPointIndizes(const QString filename, int lineNo) const; 00079 QModelIndexList getBreakPointIndizes(const QString filename) const; 00080 00081 BreakPointItem getBreakPoint(const QString filename, int lineNo) const; 00082 BreakPointItem getBreakPoint(const QModelIndex index) const; 00083 QList<BreakPointItem> getBreakPoints(const QModelIndexList indizes) const; 00084 00085 RetVal changeBreakPoint(const QModelIndex index, BreakPointItem bp, bool emitBreakPointChanged = true); 00086 RetVal changeBreakPoints(const QModelIndexList indizes, QList<BreakPointItem> bps, bool emitBreakPointChanged = true); 00087 00088 QList<BreakPointItem> const getBreakpoints() { return m_breakpoints; }; 00089 00090 RetVal resetAllPyBpNumbers(); 00091 RetVal setPyBpNumber(int row, int pyBpNumber); 00092 00093 protected: 00094 00095 private: 00096 00098 static inline bool compareRow(QModelIndex a, QModelIndex b) { return a.row()>b.row(); }; 00099 00100 QList<BreakPointItem> m_breakpoints; 00101 QList<QString> m_headers; 00102 QList<QVariant> m_alignment; 00104 signals: 00105 void breakPointAdded(BreakPointItem bp, int row); 00106 void breakPointDeleted(QString filename, int lineNo, int pyBpNumber); 00107 void breakPointChanged(BreakPointItem oldBp, BreakPointItem newBp); 00108 }; 00109 00110 00111 #endif