diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 15653c620541bc4b60dec060ff32411dab3e2d2e..340489cf446a4e823dd623a1c2a93e45eb2d1e0d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -29,8 +29,8 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Xml_EXECUTABLE_COMPILE_FLAGS} ${Qt5 #sudo apt-get install libpappsomspp-dev #FIND_PACKAGE( Pappsomspp REQUIRED ) -# SET (PAPPSOMSPP_DIR "/home/olivier/eclipse/git/pappsomspp") - SET (PAPPSOMSPP_DIR "/home/langella/developpement/git/pappsomspp") + SET (PAPPSOMSPP_DIR "/home/olivier/eclipse/git/pappsomspp") +# SET (PAPPSOMSPP_DIR "/home/langella/developpement/git/pappsomspp") SET (PAPPSOMSPP_INCLUDE_DIR "${PAPPSOMSPP_DIR}/src") SET (PAPPSOMSPP_QT4_LIBRARY "${PAPPSOMSPP_DIR}/cbuild/src/libpappsomspp-qt4.so") diff --git a/src/gui/protein_list_view/protein_view.ui b/src/gui/protein_list_view/protein_view.ui index 9510f463f1ca2f5a43d6124e102eee5bf47ff8f1..e3bdbe0d052490a695a8d5b152095e5d0fa69a48 100644 --- a/src/gui/protein_list_view/protein_view.ui +++ b/src/gui/protein_list_view/protein_view.ui @@ -61,12 +61,66 @@ <x>0</x> <y>0</y> <width>826</width> - <height>23</height> + <height>25</height> </rect> </property> </widget> <widget class="QStatusBar" name="statusbar"/> </widget> <resources/> - <connections/> + <connections> + <connection> + <sender>hideNotValidCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>ProteinView</receiver> + <slot>doNotValidHide(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>245</x> + <y>53</y> + </hint> + <hint type="destinationlabel"> + <x>839</x> + <y>171</y> + </hint> + </hints> + </connection> + <connection> + <sender>hideNotCheckedCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>ProteinView</receiver> + <slot>doNotCheckedHide(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>482</x> + <y>47</y> + </hint> + <hint type="destinationlabel"> + <x>920</x> + <y>269</y> + </hint> + </hints> + </connection> + <connection> + <sender>hideNotGroupedCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>ProteinView</receiver> + <slot>doNotGroupedHide(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>688</x> + <y>57</y> + </hint> + <hint type="destinationlabel"> + <x>1079</x> + <y>360</y> + </hint> + </hints> + </connection> + </connections> + <slots> + <slot>doNotValidHide(bool)</slot> + <slot>doNotCheckedHide(bool)</slot> + <slot>doNotGroupedHide(bool)</slot> + </slots> </ui> diff --git a/src/gui/protein_list_view/proteinlistwindow.cpp b/src/gui/protein_list_view/proteinlistwindow.cpp index 1a888fac7ade4bd0fb698b525cb0aa35158932dd..cd7b08edf07dc4f6f31200c7876454b7aadf7c41 100644 --- a/src/gui/protein_list_view/proteinlistwindow.cpp +++ b/src/gui/protein_list_view/proteinlistwindow.cpp @@ -25,6 +25,7 @@ #include "ui_protein_view.h" #include "../mainwindow.h" +#include <QSettings> ProteinListWindow::ProteinListWindow(ProjectWindow *parent): @@ -35,7 +36,6 @@ ProteinListWindow::ProteinListWindow(ProjectWindow *parent): ui->setupUi(this); /* */ - _protein_table_model_p = new ProteinTableModel(this); @@ -45,6 +45,22 @@ ProteinListWindow::ProteinListWindow(ProjectWindow *parent): ui->tableView->setModel( _p_proxy_model ); ui->tableView->setSortingEnabled(true); + QSettings settings; + bool hide = settings.value("proteinview/hidenotvalid", "true").toBool(); + if (hide) { + ui->hideNotValidCheckBox->setCheckState(Qt::Checked); + } + _protein_table_model_p->hideNotValid(hide); + hide = settings.value("proteinview/hidenotchecked", "false").toBool(); + if (hide) { + ui->hideNotCheckedCheckBox->setCheckState(Qt::Checked); + } + _protein_table_model_p->hideNotChecked(hide); + hide = settings.value("proteinview/hidenotgrouped", "false").toBool(); + if (hide) { + ui->hideNotGroupedCheckBox->setCheckState(Qt::Checked); + } + _protein_table_model_p->hideNotGrouped(settings.value("proteinview/hidenotgrouped", "false").toBool()); #if QT_VERSION >= 0x050000 @@ -92,7 +108,28 @@ void ProteinListWindow::edited() { qDebug() << "ProteinListWindow::edited end"; } +void ProteinListWindow::doNotValidHide(bool hide) { + qDebug() << "ProteinListWindow::doNotValidHide begin"; + _protein_table_model_p->hideNotValid(hide); + QSettings settings; + settings.setValue("proteinview/hidenotvalid", QString("%1").arg(hide)); + qDebug() << "ProteinListWindow::doNotValidHide end"; +} +void ProteinListWindow::doNotCheckedHide(bool hide) { + qDebug() << "ProteinListWindow::doNotCheckedHide begin"; + _protein_table_model_p->hideNotChecked(hide); + QSettings settings; + settings.setValue("proteinview/hidenotchecked", QString("%1").arg(hide)); + qDebug() << "ProteinListWindow::doNotCheckedHide end"; +} +void ProteinListWindow::doNotGroupedHide(bool hide) { + qDebug() << "ProteinListWindow::doNotGroupedHide begin"; + _protein_table_model_p->hideNotGrouped(hide); + QSettings settings; + settings.setValue("proteinview/hidenotgrouped", QString("%1").arg(hide)); + qDebug() << "ProteinListWindow::doNotGroupedHide end"; +} void ProteinListWindow::doIdentificationGroupGrouped(IdentificationGroup * p_identification_group) { qDebug() << "ProteinListWindow::doIdentificationGroupGrouped begin"; 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 cf9cbe34a2213dc91d6303642241baff6e361eb3..cae8a57c04cbbd63b87561afed7c583e5c744980 100644 --- a/src/gui/protein_list_view/proteinlistwindow.h +++ b/src/gui/protein_list_view/proteinlistwindow.h @@ -58,6 +58,10 @@ signals: void proteinMatchClicked(ProteinMatch * p_protein_match); void identificationGroupEdited(IdentificationGroup * p_identification_group); +protected slots: + void doNotValidHide(bool hide); + void doNotCheckedHide(bool hide); + void doNotGroupedHide(bool hide); protected : void updateStatusBar(); private: diff --git a/src/gui/protein_list_view/proteintablemodel.cpp b/src/gui/protein_list_view/proteintablemodel.cpp index 04c02c5f7601f19cdcfb33fbac34f72d5b64ef78..1ed92c2fa5047e2f46190208777cd5bfaabc9805 100644 --- a/src/gui/protein_list_view/proteintablemodel.cpp +++ b/src/gui/protein_list_view/proteintablemodel.cpp @@ -45,7 +45,6 @@ void ProteinTableProxyModel::onTableClicked(const QModelIndex &index) qDebug() << "ProteinTableProxyModel::onTableClicked begin " << this->mapToSource(index).row(); _protein_table_model_p->onTableClicked(this->mapToSource(index)); } - void ProteinTableProxyModel::onTableDoubleClicked(const QModelIndex &index) { qDebug() << "ProteinTableProxyModel::onTableDoubleClicked begin " << index.row(); @@ -99,7 +98,27 @@ ProteinTableModel::ProteinTableModel(ProteinListWindow * p_protein_list_window) //emit dataChanged(topLeft, topLeft); } +void ProteinTableModel::refresh() { + qDebug() << "ProteinTableModel::refresh begin "; + QModelIndex topLeft = createIndex(0,0); + QModelIndex bottomRight = createIndex(rowCount(),columnCount()); + emit dataChanged(topLeft, bottomRight); + qDebug() << "ProteinTableModel::refresh end "; +} + +void ProteinTableModel::hideNotValid(bool hide) { + _hide_not_valid = hide; + refresh(); +} +void ProteinTableModel::hideNotChecked(bool hide) { + _hide_not_checked = hide; + refresh(); +} +void ProteinTableModel::hideNotGrouped(bool hide) { + _hide_not_grouped = hide; + refresh(); +} void ProteinTableModel::onProteinSearchEdit(QString protein_search_string) { qDebug() << "ProteinTableModel::onProteinSearchEdit begin " << protein_search_string; _protein_search_string = protein_search_string; @@ -265,8 +284,25 @@ bool ProteinTableModel::acceptRow(int source_row) { return false; } } - if (protein_match->isValid()) { - //return true; + if (_hide_not_valid) { + if (! protein_match->isValid()) { + return false; + } + } + if (_hide_not_checked) { + if (! protein_match->isChecked()) { + return false; + } + } + if (_hide_not_grouped) { + pappso::GrpProtein * p_grp_prot = protein_match->getGrpProteinSp().get(); + if (p_grp_prot == nullptr) { + return false; + } + if (p_grp_prot->getGroupingId().isEmpty()) { + return false; + } } + return true; } diff --git a/src/gui/protein_list_view/proteintablemodel.h b/src/gui/protein_list_view/proteintablemodel.h index 53f642e95f0a8a5df066eaa4fa816714106ff5a1..3cbb134dcf91f08803192a9d2332576fdc513335 100644 --- a/src/gui/protein_list_view/proteintablemodel.h +++ b/src/gui/protein_list_view/proteintablemodel.h @@ -64,15 +64,25 @@ public: void setIdentificationGroup(IdentificationGroup * p_identification_group); bool acceptRow(int source_row); + + void hideNotValid(bool hide); + void hideNotChecked(bool hide); + void hideNotGrouped(bool hide); public slots: void onTableClicked(const QModelIndex &index); void onTableDoubleClicked(const QModelIndex &index); void onProteinSearchEdit(QString protein_search_string); + +private : + void refresh(); private : IdentificationGroup * _p_identification_group = nullptr; ProteinListWindow * _p_protein_list_window; QString _protein_search_string; + bool _hide_not_valid = true; + bool _hide_not_checked = true; + bool _hide_not_grouped = true; }; #endif // PROTEINTABLEMODEL_H