1 /** 2 * UGENE - Integrated Bioinformatics Tools. 3 * Copyright (C) 2008-2021 UniPro <ugene@unipro.ru> 4 * http://ugene.net 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version 2 9 * of the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 * MA 02110-1301, USA. 20 */ 21 22 #ifndef _U2_INVESTIGATION_DATA_MODEL_H_ 23 #define _U2_INVESTIGATION_DATA_MODEL_H_ 24 25 #include <QAbstractTableModel> 26 #include <QBitArray> 27 28 #include <U2Lang/Port.h> 29 #include <U2Lang/WorkflowInvestigationData.h> 30 31 namespace U2 { 32 33 using namespace Workflow; 34 35 // the class is intended to enhance the performance 36 // of the workflow debugging investigations tools, i.e. 37 // the table containing the content of workflow workers' messages 38 39 class InvestigationDataModel : public QAbstractTableModel { 40 Q_OBJECT 41 public: 42 InvestigationDataModel(const Workflow::Link *bus, QObject *parent = nullptr); 43 ~InvestigationDataModel(); 44 45 int rowCount(const QModelIndex &parent = QModelIndex()) const; 46 int columnCount(const QModelIndex &parent = QModelIndex()) const; 47 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; 48 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) 49 const; 50 Qt::ItemFlags flags(const QModelIndex &index) const; 51 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::DisplayRole); 52 bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::DisplayRole); 53 bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex()); 54 bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex()); 55 bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()); 56 bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()); 57 58 // the returning value is the count of rows which data is cached 59 int loadedRowCount() const; 60 bool isAnyColumnHidden() const; 61 void showAllHiddenColumns(); 62 int getAbsoluteNumberOfVisibleColumn(int column) const; 63 void setColumnsVisibility(const QBitArray &columns); 64 QBitArray getColumnsVisibility() const; 65 66 signals: 67 void si_investigationRequested(const Workflow::Link *bus, int messageNumber = 0) const; 68 void si_countOfMessagesRequested(const Workflow::Link *bus) const; 69 void si_columnsVisibilityRequested() const; 70 71 private: 72 int getVisibleNumberOfAbsoluteColumn(int column) const; 73 74 const Workflow::Link *investigatedLink; 75 WorkflowInvestigationData cachedData; 76 int countOfRows; 77 QBitArray hiddenColumns; 78 }; 79 80 } // namespace U2 81 82 #endif // _U2_INVESTIGATION_DATA_MODEL_H_ 83