diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 59eeff83fa881cf65161d339d858af21c0371b0e..3539ce0f846d49cc931113408d4cef7461ab38f5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -124,6 +124,9 @@ SET(XTPCPP_SRCS ./gui/protein_list_view/proteinlistwindow.cpp ./gui/protein_list_view/proteintablemodel.cpp ./gui/protein_list_view/proteintableproxymodel.cpp + ./gui/ptm_island_list_view/ptmislandlistwindow.cpp + ./gui/ptm_island_list_view/ptmislandtablemodel.cpp + ./gui/ptm_island_list_view/ptmislandproxymodel.cpp ./gui/waiting_message_dialog/waitingmessagedialog.cpp ./gui/workerthread.cpp ) @@ -142,6 +145,7 @@ SET (GUI_UIS ./gui/project_view/project_view.ui ./gui/protein_list_view/protein_view.ui ./gui/protein_view/protein_detail_view.ui + ./gui/ptm_island_list_view/ptm_island_list_view.ui ./gui/waiting_message_dialog/waiting_message_dialog.ui ) @@ -165,6 +169,9 @@ SET(XTPCPP_MOC_HDRS ./gui/protein_list_view/proteintablemodel.h ./gui/protein_list_view/proteintableproxymodel.h ./gui/protein_view/proteinwindow.h + ./gui/ptm_island_list_view/ptmislandlistwindow.h + ./gui/ptm_island_list_view/ptmislandtablemodel.h + ./gui/ptm_island_list_view/ptmislandproxymodel.h ./gui/waiting_message_dialog/waitingmessagedialog.h ./gui/workerthread.h ) diff --git a/src/gui/protein_list_view/proteintablemodel.h b/src/gui/protein_list_view/proteintablemodel.h index 17f3b5d38c0c27b7afefe2ce4f07d1d36d3823f8..cdf1b33ef1bb49a32ecea038d3a5e866f9190f22 100644 --- a/src/gui/protein_list_view/proteintablemodel.h +++ b/src/gui/protein_list_view/proteintablemodel.h @@ -29,9 +29,6 @@ class ProteinListWindow; -class ProteinTableModel; - - class ProteinTableModel: public QAbstractTableModel { Q_OBJECT diff --git a/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp b/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp index 14959240ccf6824121db462edaec99de5b14af08..66fceaba792348319533efc3b08b9e6078081b2b 100644 --- a/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp +++ b/src/gui/ptm_island_list_view/ptmislandlistwindow.cpp @@ -29,12 +29,47 @@ #include "ptmislandlistwindow.h" -PtmIslandListWindow::PtmIslandListWindow(const PtmIslandListWindow& other) + +#include "ui_ptm_island_list_view.h" +#include "../mainwindow.h" +#include <QSettings> + + +PtmIslandListWindow::PtmIslandListWindow(ProjectWindow *parent): + QMainWindow(parent), + ui(new Ui::PtmIslandListWindow) { + _project_window = parent; + ui->setupUi(this); + /* + */ + _ptm_table_model_p = new PtmIslandTableModel(this); + + + _ptm_proxy_model_p = new PtmIslandProxyModel(this, _ptm_table_model_p); + _ptm_proxy_model_p->setSourceModel(_ptm_table_model_p); + _ptm_proxy_model_p->setDynamicSortFilter(true); + ui->ptm_island_tableview->setModel( _ptm_proxy_model_p ); + ui->ptm_island_tableview->setSortingEnabled(true); + + +#if QT_VERSION >= 0x050000 + // Qt5 code + /* + connect(&workerThread, &QThread::finished, worker, &QObject::deleteLater); + connect(this, &PtSpectrumViewer::operateMsDataFile, worker, &PwizLoaderThread::doMsDataFileLoad); + connect(worker, &PwizLoaderThread::msDataReady, this, &PtSpectrumViewer::handleMsDataFile); + */ +#else +// Qt4 code +#endif } PtmIslandListWindow::~PtmIslandListWindow() { } + +void PtmIslandListWindow::setIdentificationGroup(IdentificationGroup * p_identification_group) { +} diff --git a/src/gui/ptm_island_list_view/ptmislandlistwindow.h b/src/gui/ptm_island_list_view/ptmislandlistwindow.h index c81890bf6f5ae9eacbf99ea70c9432a07db4c116..6e30764bc43f33518d22218acb0d797da2b3ec91 100644 --- a/src/gui/ptm_island_list_view/ptmislandlistwindow.h +++ b/src/gui/ptm_island_list_view/ptmislandlistwindow.h @@ -32,6 +32,7 @@ #include <QMainWindow> #include "ptmislandtablemodel.h" #include "ptmislandproxymodel.h" +#include "../../core/identificationgroup.h" class ProjectWindow; @@ -48,32 +49,13 @@ public: ~PtmIslandListWindow(); void setIdentificationGroup(IdentificationGroup * p_identification_group); -public slots: - void doFocusReceived(bool has_focus); - void doIdentificationGroupGrouped(IdentificationGroup * p_identification_group); - - -protected slots: - void doNotValidHide(bool hide); - void doNotCheckedHide(bool hide); - void doNotGroupedHide(bool hide); - void doProxyLayoutChanged(); - void showContextMenu(const QPoint &); - void updateStatusBar(); - void onProteinSearchEdit(QString protein_search_string); - void doSearchOn(QString search_on); - -protected : - void askProteinDetailView(ProteinMatch * p_protein_match); - void askPeptideListView(ProteinMatch * p_protein_match); - private: IdentificationGroup * _p_identification_group=nullptr; - Ui::ProteinView *ui; - ProteinTableModel * _protein_table_model_p = nullptr; - ProteinTableProxyModel * _p_proxy_model = nullptr; + Ui::PtmIslandListWindow *ui; + PtmIslandTableModel * _ptm_table_model_p = nullptr; + PtmIslandProxyModel * _ptm_proxy_model_p = nullptr; ProjectWindow * _project_window; }; diff --git a/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp b/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp index 98a2a07f1efbb266319f8cfe4ffbdd487458beb3..c34250a012ee2917e28580773c1ce4ca2a762326 100644 --- a/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp +++ b/src/gui/ptm_island_list_view/ptmislandproxymodel.cpp @@ -29,9 +29,10 @@ #include "ptmislandproxymodel.h" -PtmIslandProxyModel::PtmIslandProxyModel(const PtmIslandProxyModel& other) +PtmIslandProxyModel::PtmIslandProxyModel(PtmIslandListWindow * p_ptm_island_list_window, PtmIslandTableModel* ptm_table_model_p) { - + _p_ptm_island_list_window = p_ptm_island_list_window; + _p_ptm_island_table_model = ptm_table_model_p; } PtmIslandProxyModel::~PtmIslandProxyModel() diff --git a/src/gui/ptm_island_list_view/ptmislandproxymodel.h b/src/gui/ptm_island_list_view/ptmislandproxymodel.h index dd5fe339004e4c136a6dcf795093454cbf0604b1..bac67e6cc2f352e3e7cf5578ccea9d454461c305 100644 --- a/src/gui/ptm_island_list_view/ptmislandproxymodel.h +++ b/src/gui/ptm_island_list_view/ptmislandproxymodel.h @@ -30,11 +30,22 @@ #ifndef PTMISLANDPROXYMODEL_H #define PTMISLANDPROXYMODEL_H -class PtmIslandProxyModel +#include <QAbstractTableModel> +#include <QSortFilterProxyModel> + + +class PtmIslandListWindow; +class PtmIslandTableModel; + +class PtmIslandProxyModel: public QSortFilterProxyModel { + Q_OBJECT public: - PtmIslandProxyModel(const PtmIslandProxyModel& other); + PtmIslandProxyModel(PtmIslandListWindow * p_ptm_island_list_window, PtmIslandTableModel* ptm_table_model_p); ~PtmIslandProxyModel(); +private: + PtmIslandListWindow * _p_ptm_island_list_window; + PtmIslandTableModel * _p_ptm_island_table_model; }; #endif // PTMISLANDPROXYMODEL_H diff --git a/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp b/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp index 5ea29559767fcb28dea1471cd55ca4d268af5c9d..d6026e5f7ddedd8670c6504389096e5a776f4454 100644 --- a/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp +++ b/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp @@ -28,8 +28,9 @@ ******************************************************************************/ #include "ptmislandtablemodel.h" +#include "ptmislandlistwindow.h" -PtmIslandTableModel::PtmIslandTableModel(const PtmIslandTableModel& other) +PtmIslandTableModel::PtmIslandTableModel(PtmIslandListWindow * p_ptm_island_list_window) { } @@ -38,3 +39,44 @@ PtmIslandTableModel::~PtmIslandTableModel() { } +void PtmIslandTableModel::setPtmGroupingExperiment(PtmGroupingExperiment * p_grp_ptm_experiment) { + qDebug() << "PtmIslandTableModel::setPtmGroupingExperiment begin "; + beginResetModel(); + _p_grp_ptm_experiment = p_grp_ptm_experiment; + + //emit headerDataChanged(Qt::Horizontal, 0,11); + //refresh(); + qDebug() << "PtmIslandTableModel::setPtmGroupingExperiment end "; + endResetModel(); +} + +int PtmIslandTableModel::rowCount(const QModelIndex &parent ) const { + //qDebug() << "ProteinTableModel::rowCount begin "; + if (_p_grp_ptm_experiment != nullptr) { + //qDebug() << "ProteinTableModel::rowCount(const QModelIndex &parent ) " << _p_identification_group->getProteinMatchList().size(); + return (int) _p_grp_ptm_experiment->getPtmIslandList().size(); + } + return 0; +} +int PtmIslandTableModel::columnCount(const QModelIndex &parent ) const { + //qDebug() << "ProteinTableModel::columnCount begin "; + if (_p_grp_ptm_experiment != nullptr) { + return 3; + } + return 0; +} +QVariant PtmIslandTableModel::headerData(int section, Qt::Orientation orientation, int role) const +{ + if (_p_grp_ptm_experiment == nullptr) return QVariant(); + if (orientation == Qt::Horizontal) + { + } + return QVariant(); +} +QVariant PtmIslandTableModel::data(const QModelIndex &index, int role ) const { + // generate a log message when this method gets called + if (_p_grp_ptm_experiment == nullptr) return QVariant(); + int row = index.row(); + int col = index.column(); + return QVariant(); +} diff --git a/src/gui/ptm_island_list_view/ptmislandtablemodel.h b/src/gui/ptm_island_list_view/ptmislandtablemodel.h index 7b933b98864cb655a0b85f02bf4fdcd12f7f9aa3..523770d6e1e5d05fbd66691d1ba40ef4b81e22e1 100644 --- a/src/gui/ptm_island_list_view/ptmislandtablemodel.h +++ b/src/gui/ptm_island_list_view/ptmislandtablemodel.h @@ -30,11 +30,26 @@ #ifndef PTMISLANDTABLEMODEL_H #define PTMISLANDTABLEMODEL_H -class PtmIslandTableModel +#include <QAbstractTableModel> +#include "../../grouping/ptm/ptmgroupingexperiment.h" + +class PtmIslandListWindow; +class PtmIslandTableModel: public QAbstractTableModel { + Q_OBJECT public: - PtmIslandTableModel(const PtmIslandTableModel& other); + PtmIslandTableModel(PtmIslandListWindow * p_ptm_island_list_window); + ~PtmIslandTableModel(); + + void setPtmGroupingExperiment(PtmGroupingExperiment * p_grp_ptm_experiment); + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override; + virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override; + virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const override; + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + +private : + PtmGroupingExperiment * _p_grp_ptm_experiment=nullptr; }; #endif // PTMISLANDTABLEMODEL_H