00001
00005 #ifndef TABLEMODEL_H
00006 #define TABLEMODEL_H
00007
00008 #include <QAbstractTableModel>
00009 #include <QPair>
00010 #include <QList>
00011 #include <QTimer>
00012 #include <string>
00013 #include "process.h"
00014 #include "previewwindow.h"
00015 #include "processextractor.h"
00016
00017 class TableModel : public QAbstractTableModel
00018 {
00019 Q_OBJECT
00020 QTimer *timer;
00021 public:
00022 TableModel(QObject *parent=0);
00023 TableModel(QList< Process > listofPairs, QObject *parent=0);
00024 ~TableModel();
00025
00026 std::string lsof_pid;
00027 PreviewWindow fileList;
00028
00029 int rowCount(const QModelIndex &parent) const;
00030 int columnCount(const QModelIndex &parent) const;
00031 QVariant data(const QModelIndex &index, int role) const;
00032 QVariant headerData(int section, Qt::Orientation orientation, int role) const;
00033 Qt::ItemFlags flags(const QModelIndex &index) const;
00034 bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole);
00035 bool insertRows(int position, int rows, const QModelIndex &index=QModelIndex());
00036 bool removeRows(int position, int rows, const QModelIndex &index=QModelIndex());
00037 bool refillRows(const QModelIndex &index=QModelIndex());
00038 QList< Process > getList();
00039 private slots:
00040 void refreshTable();
00041 void rowSelected(QModelIndex index);
00042
00043 private:
00044 QList< Process > listOfProcesses;
00045 };
00047
00048 #endif