From f9d95989faf2127c814d5c2ea26a499811fc3b1d Mon Sep 17 00:00:00 2001 From: Olivier Langella <Olivier.Langella@moulon.inra.fr> Date: Mon, 27 Mar 2017 12:06:29 +0200 Subject: [PATCH] update grouping --- src/core/project.cpp | 4 +++- src/core/project.h | 2 ++ src/gui/project_view/projectwindow.cpp | 14 ++++++++++++++ src/gui/project_view/projectwindow.h | 4 +++- src/gui/protein_list_view/proteinlistwindow.cpp | 17 +++++++++++++++++ src/gui/protein_list_view/proteinlistwindow.h | 8 +++++++- src/gui/protein_list_view/proteintablemodel.cpp | 3 +-- 7 files changed, 47 insertions(+), 5 deletions(-) diff --git a/src/core/project.cpp b/src/core/project.cpp index b5b3940d..ecbb6f91 100644 --- a/src/core/project.cpp +++ b/src/core/project.cpp @@ -38,7 +38,9 @@ Project::~Project() it++; } } - +const GroupingType Project::getGroupingType() const { + return _grouping_type; +} PeptideStore & Project::getPeptideStore() { return _peptide_store; } diff --git a/src/core/project.h b/src/core/project.h index 2e98fc3c..677f54ad 100644 --- a/src/core/project.h +++ b/src/core/project.h @@ -53,6 +53,8 @@ public: * */ void updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters); void startGrouping(); + + const GroupingType getGroupingType() const; private : diff --git a/src/gui/project_view/projectwindow.cpp b/src/gui/project_view/projectwindow.cpp index f8245bed..a4e6afeb 100644 --- a/src/gui/project_view/projectwindow.cpp +++ b/src/gui/project_view/projectwindow.cpp @@ -64,7 +64,9 @@ ProjectWindow::~ProjectWindow() } void ProjectWindow::setDefaultProteinListWindow(ProteinListWindow* p_protein_list_window) { + qDebug() << "ProjectWindow::setDefaultProteinListWindow begin"; _p_current_protein_list_window = p_protein_list_window; + qDebug() << "ProjectWindow::setDefaultProteinListWindow end"; } void ProjectWindow::connectNewProteinListWindow() { @@ -82,6 +84,8 @@ void ProjectWindow::connectNewProteinListWindow() { #else // Qt4 code connect (_p_current_protein_list_window, SIGNAL(proteinMatchClicked(ProteinMatch *)), this,SLOT(doProteinMatchClicked(ProteinMatch *))); + connect (_p_current_protein_list_window, SIGNAL(identificationGroupEdited(IdentificationGroup *)), this,SLOT(doIdentificationGroupEdited(IdentificationGroup *))); + connect (this, SIGNAL(identificationGroupGrouped(IdentificationGroup *)), _p_current_protein_list_window,SLOT(doIdentificationGroupGrouped(IdentificationGroup *))); #endif @@ -89,6 +93,16 @@ void ProjectWindow::connectNewProteinListWindow() { } +void ProjectWindow::doIdentificationGroupEdited(IdentificationGroup * p_ident_group) { + qDebug() << "ProjectWindow::doIdentificationGroupEdited begin"; + p_ident_group->startGrouping(_project_sp.get()->getGroupingType()); + + + emit identificationGroupGrouped(p_ident_group); + + qDebug() << "ProjectWindow::doIdentificationGroupEdited end"; +} + void ProjectWindow::doProteinMatchClicked(ProteinMatch * protein_match) { PeptideListWindow * peptide_window = new PeptideListWindow(this); peptide_window->setProteinMatch(_project_sp.get(), protein_match); diff --git a/src/gui/project_view/projectwindow.h b/src/gui/project_view/projectwindow.h index 87eb657f..bba8045b 100644 --- a/src/gui/project_view/projectwindow.h +++ b/src/gui/project_view/projectwindow.h @@ -47,17 +47,19 @@ public: public slots: void doViewProteinList(IdentificationGroup* p_identification_group =nullptr); void doProteinMatchClicked(ProteinMatch * protein_match); + void doIdentificationGroupEdited(IdentificationGroup * p_identification_group); void setDefaultProteinListWindow(ProteinListWindow* p_protein_list_window); // void setColor(const QColor &color); // void setShape(Shape shape); signals: + void identificationGroupGrouped(IdentificationGroup * p_identification_group); //void peptideChanged(pappso::PeptideSp peptide); private : void connectNewProteinListWindow(); private: Ui::ProjectView *ui; - MainWindow * main_window; + MainWindow * main_window; std::list <ProteinListWindow *> _protein_list_window_collection; ProteinListWindow * _p_current_protein_list_window = nullptr; ProjectSp _project_sp; diff --git a/src/gui/protein_list_view/proteinlistwindow.cpp b/src/gui/protein_list_view/proteinlistwindow.cpp index b4eec221..1a888fac 100644 --- a/src/gui/protein_list_view/proteinlistwindow.cpp +++ b/src/gui/protein_list_view/proteinlistwindow.cpp @@ -84,6 +84,23 @@ ProteinListWindow::~ProteinListWindow() } +void ProteinListWindow::edited() { + qDebug() << "ProteinListWindow::edited begin"; + //emit dataChanged(index, index); + emit identificationGroupEdited(_p_identification_group); + updateStatusBar(); + + qDebug() << "ProteinListWindow::edited end"; +} + +void ProteinListWindow::doIdentificationGroupGrouped(IdentificationGroup * p_identification_group) { + qDebug() << "ProteinListWindow::doIdentificationGroupGrouped begin"; + if (_p_identification_group == p_identification_group) { + _p_proxy_model->setSourceModel(_protein_table_model_p); + updateStatusBar(); + } + qDebug() << "ProteinListWindow::doIdentificationGroupGrouped end"; +} void ProteinListWindow::setIdentificationGroup(IdentificationGroup * p_identification_group) { if (_p_identification_group != p_identification_group) { diff --git a/src/gui/protein_list_view/proteinlistwindow.h b/src/gui/protein_list_view/proteinlistwindow.h index 6bf3f442..cf9cbe34 100644 --- a/src/gui/protein_list_view/proteinlistwindow.h +++ b/src/gui/protein_list_view/proteinlistwindow.h @@ -38,22 +38,28 @@ class ProteinView; class ProteinListWindow: public QMainWindow { Q_OBJECT + friend ProteinTableModel; public: explicit ProteinListWindow(ProjectWindow * parent = 0); ~ProteinListWindow(); void setIdentificationGroup(IdentificationGroup * p_identification_group); void doubleclickOnproteinMatch(ProteinMatch * p_protein_match); - void updateStatusBar(); + + void edited(); public slots: void doFocusReceived(bool has_focus); + void doIdentificationGroupGrouped(IdentificationGroup * p_identification_group); //void peptideEdited(QString peptideStr); // void setColor(const QColor &color); // void setShape(Shape shape); signals: void proteinMatchClicked(ProteinMatch * p_protein_match); + void identificationGroupEdited(IdentificationGroup * p_identification_group); +protected : + void updateStatusBar(); private: IdentificationGroup * _p_identification_group; Ui::ProteinView *ui; diff --git a/src/gui/protein_list_view/proteintablemodel.cpp b/src/gui/protein_list_view/proteintablemodel.cpp index 8962a472..89306e95 100644 --- a/src/gui/protein_list_view/proteintablemodel.cpp +++ b/src/gui/protein_list_view/proteintablemodel.cpp @@ -233,8 +233,7 @@ void ProteinTableModel::onTableClicked(const QModelIndex &index) else { _p_identification_group->getProteinMatchList().at(row)->setChecked(true); } - //emit dataChanged(index, index); - _p_protein_list_window->updateStatusBar(); + _p_protein_list_window->edited(); } } -- GitLab