Warning, file /sdk/cervisia/watchersmodel.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * Copyright (c) 2007 Christian Loose <christian.loose@kdemail.net> 0003 * 0004 * This program is free software; you can redistribute it and/or modify 0005 * it under the terms of the GNU General Public License as published by 0006 * the Free Software Foundation; either version 2 of the License, or 0007 * (at your option) any later version. 0008 * 0009 * This program is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0012 * GNU General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU General Public License 0015 * along with this program; if not, write to the Free Software 0016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0017 */ 0018 0019 #ifndef WATCHERSMODEL_H 0020 #define WATCHERSMODEL_H 0021 0022 #include <QAbstractTableModel> 0023 #include <QSortFilterProxyModel> 0024 0025 struct WatchersEntry { 0026 QString file; 0027 QString watcher; 0028 bool edit; 0029 bool unedit; 0030 bool commit; 0031 }; 0032 0033 class WatchersModel : public QAbstractTableModel 0034 { 0035 Q_OBJECT 0036 0037 enum Columns { FileColumn = 0, WatcherColumn, EditColumn, UneditColumn, CommitColumn }; 0038 0039 public: 0040 explicit WatchersModel(const QStringList &data, QObject *parent = nullptr); 0041 0042 int columnCount(const QModelIndex &parent = QModelIndex()) const override; 0043 int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0044 0045 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 0046 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; 0047 0048 private: 0049 void parseData(const QStringList &data); 0050 0051 QList<WatchersEntry> m_list; 0052 }; 0053 0054 class WatchersSortModel : public QSortFilterProxyModel 0055 { 0056 public: 0057 explicit WatchersSortModel(QObject *parent = nullptr); 0058 0059 protected: 0060 bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; 0061 }; 0062 0063 #endif