From 39ec86b51fcdee67de9c17056e35fa376f265e27 Mon Sep 17 00:00:00 2001 From: Olivier Langella <Olivier.Langella@moulon.inra.fr> Date: Tue, 28 Mar 2017 22:43:43 +0200 Subject: [PATCH] first protein detail window --- src/CMakeLists.txt | 7 ++-- src/gui/project_view/projectwindow.cpp | 41 +++++++++++++++++++ src/gui/project_view/projectwindow.h | 5 +++ .../protein_list_view/proteinlistwindow.cpp | 7 +++- src/gui/protein_list_view/proteinlistwindow.h | 4 +- .../protein_list_view/proteintablemodel.cpp | 3 ++ src/gui/protein_view/protein_detail_view.ui | 23 +++++++---- src/gui/protein_view/proteinwindow.cpp | 16 ++++---- src/gui/protein_view/proteinwindow.h | 9 ++++ 9 files changed, 95 insertions(+), 20 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a019b1b1..2f5d3bbc 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") @@ -107,6 +107,7 @@ SET(XTPCPP_MOC_HDRS ./gui/project_view/projectwindow.h ./gui/protein_list_view/proteinlistwindow.h ./gui/protein_list_view/proteintablemodel.h + ./gui/protein_view/proteinwindow.h ) @@ -131,4 +132,4 @@ TARGET_LINK_LIBRARIES(xtpcpp ${PAPPSOMSPP_QT4_LIBRARY} ${Pwiz_LIBRARY} ${ODSSTRE INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/xtpcpp DESTINATION bin) -#configure_file (${CMAKE_SOURCE_DIR}/templates/share/applications/pt-peptideviewer.desktop.cmake ${CMAKE_BINARY_DIR}/templates/share/applications/pt-peptideviewer.desktop) \ No newline at end of file +#configure_file (${CMAKE_SOURCE_DIR}/templates/share/applications/pt-peptideviewer.desktop.cmake ${CMAKE_BINARY_DIR}/templates/share/applications/pt-peptideviewer.desktop) diff --git a/src/gui/project_view/projectwindow.cpp b/src/gui/project_view/projectwindow.cpp index c5700f62..06c18052 100644 --- a/src/gui/project_view/projectwindow.cpp +++ b/src/gui/project_view/projectwindow.cpp @@ -84,6 +84,7 @@ void ProjectWindow::connectNewProteinListWindow() { #else // Qt4 code connect (_p_current_protein_list_window, SIGNAL(proteinMatchClicked(ProteinMatch *)), this,SLOT(doViewPeptideList(ProteinMatch *))); + connect (_p_current_protein_list_window, SIGNAL(proteinMatchDoubleClicked(ProteinMatch *)), this,SLOT(doViewProteinDetail(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 *))); @@ -93,6 +94,28 @@ void ProjectWindow::connectNewProteinListWindow() { } +void ProjectWindow::connectNewProteinDetailWindow() { + qDebug() << "ProjectWindow::connectNewProteinDetailWindow begin"; + _p_current_protein_detail_window = new ProteinWindow(this); + _protein_detail_window_collection.push_back(_p_current_protein_detail_window); + +#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 + //connect (_p_current_peptide_list_window, SIGNAL(proteinMatchClicked(ProteinMatch *)), this,SLOT(doViewPeptideList(ProteinMatch *))); + +#endif + + qDebug() << "ProjectWindow::connectNewProteinDetailWindow end"; + +} + void ProjectWindow::connectNewPeptideListWindow() { qDebug() << "ProjectWindow::connectNewPeptideListWindow begin"; _p_current_peptide_list_window = new PeptideListWindow(this); @@ -145,6 +168,24 @@ void ProjectWindow::doViewPeptideList(ProteinMatch * protein_match) { qDebug() << "ProjectWindow::doViewPeptideList end"; } +void ProjectWindow::doViewProteinDetail(ProteinMatch * protein_match) { + + + qDebug() << "ProjectWindow::doViewProteinDetail begin"; + if (_protein_detail_window_collection.size() == 0) { + connectNewProteinDetailWindow(); + } + Qt::KeyboardModifiers modifier = QApplication::keyboardModifiers(); + if (modifier == Qt::ControlModifier) { + connectNewProteinDetailWindow(); + } + + + _p_current_protein_detail_window->setProteinMatch(protein_match); + _p_current_protein_detail_window->show(); + qDebug() << "ProjectWindow::doViewProteinDetail end"; +} + void ProjectWindow::doViewProteinList(IdentificationGroup* p_identification_group) { qDebug() << "ProjectWindow::doViewProteinList begin"; if (p_identification_group == nullptr) { diff --git a/src/gui/project_view/projectwindow.h b/src/gui/project_view/projectwindow.h index fa20726a..d770c8fb 100644 --- a/src/gui/project_view/projectwindow.h +++ b/src/gui/project_view/projectwindow.h @@ -28,6 +28,7 @@ #include "../../core/project.h" #include "../protein_list_view/proteinlistwindow.h" #include "../peptide_list_view/peptidelistwindow.h" +#include "../protein_view/proteinwindow.h" class MainWindow; @@ -48,6 +49,7 @@ public: public slots: void doViewProteinList(IdentificationGroup* p_identification_group =nullptr); void doViewPeptideList(ProteinMatch * protein_match); + void doViewProteinDetail(ProteinMatch * protein_match); void doIdentificationGroupEdited(IdentificationGroup * p_identification_group); void setDefaultProteinListWindow(ProteinListWindow* p_protein_list_window); // void setColor(const QColor &color); @@ -59,6 +61,7 @@ signals: private : void connectNewProteinListWindow(); void connectNewPeptideListWindow(); + void connectNewProteinDetailWindow(); private: Ui::ProjectView *ui; MainWindow * main_window; @@ -66,6 +69,8 @@ private: ProteinListWindow * _p_current_protein_list_window = nullptr; std::list <PeptideListWindow *> _peptide_list_window_collection; PeptideListWindow * _p_current_peptide_list_window = nullptr; + std::list <ProteinWindow *> _protein_detail_window_collection; + ProteinWindow * _p_current_protein_detail_window = nullptr; ProjectSp _project_sp; diff --git a/src/gui/protein_list_view/proteinlistwindow.cpp b/src/gui/protein_list_view/proteinlistwindow.cpp index 4e5f707c..00348a5a 100644 --- a/src/gui/protein_list_view/proteinlistwindow.cpp +++ b/src/gui/protein_list_view/proteinlistwindow.cpp @@ -95,10 +95,15 @@ void ProteinListWindow::showAccessionColumn(bool show) { ui->tableView->setColumnHidden(2,!show); } -void ProteinListWindow::doubleclickOnproteinMatch(ProteinMatch * p_protein_match) { + +void ProteinListWindow::clickOnproteinMatch(ProteinMatch * p_protein_match) { emit proteinMatchClicked(p_protein_match); //updateStatusBar(); } +void ProteinListWindow::doubleclickOnproteinMatch(ProteinMatch * p_protein_match) { + emit proteinMatchDoubleClicked(p_protein_match); + //updateStatusBar(); +} void ProteinListWindow::doFocusReceived(bool has_focus) { if (has_focus ) { qDebug() << "ProteinListWindow::doFocusReceived begin"; diff --git a/src/gui/protein_list_view/proteinlistwindow.h b/src/gui/protein_list_view/proteinlistwindow.h index 342110d7..268939d4 100644 --- a/src/gui/protein_list_view/proteinlistwindow.h +++ b/src/gui/protein_list_view/proteinlistwindow.h @@ -44,7 +44,6 @@ public: explicit ProteinListWindow(ProjectWindow * parent = 0); ~ProteinListWindow(); void setIdentificationGroup(IdentificationGroup * p_identification_group); - void doubleclickOnproteinMatch(ProteinMatch * p_protein_match); void edited(); @@ -56,6 +55,7 @@ public slots: // void setShape(Shape shape); signals: void proteinMatchClicked(ProteinMatch * p_protein_match); + void proteinMatchDoubleClicked(ProteinMatch * p_protein_match); void identificationGroupEdited(IdentificationGroup * p_identification_group); @@ -68,6 +68,8 @@ protected slots: void showAccessionColumn(bool show); protected : void updateStatusBar(); + void doubleclickOnproteinMatch(ProteinMatch * p_protein_match); + void clickOnproteinMatch(ProteinMatch * p_protein_match); diff --git a/src/gui/protein_list_view/proteintablemodel.cpp b/src/gui/protein_list_view/proteintablemodel.cpp index 3a64371f..04f36808 100644 --- a/src/gui/protein_list_view/proteintablemodel.cpp +++ b/src/gui/protein_list_view/proteintablemodel.cpp @@ -289,6 +289,9 @@ void ProteinTableModel::onTableClicked(const QModelIndex &index) } _p_protein_list_window->edited(); } + else { + _p_protein_list_window->clickOnproteinMatch(_p_identification_group->getProteinMatchList().at(row)); + } } void ProteinTableModel::onTableDoubleClicked(const QModelIndex &index) diff --git a/src/gui/protein_view/protein_detail_view.ui b/src/gui/protein_view/protein_detail_view.ui index 455bec3f..c0bd5932 100644 --- a/src/gui/protein_view/protein_detail_view.ui +++ b/src/gui/protein_view/protein_detail_view.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>ProteinDetailWindow</class> - <widget class="QMainWindow" name="ProteinDetailWindow"> + <class>ProteinDetailView</class> + <widget class="QMainWindow" name="ProteinDetailView"> <property name="geometry"> <rect> <x>0</x> @@ -11,7 +11,7 @@ </rect> </property> <property name="windowTitle"> - <string>MainWindow</string> + <string>Protein details</string> </property> <widget class="QWidget" name="centralwidget"> <layout class="QGridLayout" name="gridLayout"> @@ -25,15 +25,24 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>167</height> + </size> + </property> <property name="text"> <string>TextLabel</string> </property> + <property name="wordWrap"> + <bool>true</bool> + </property> </widget> </item> <item> - <widget class="QLabel" name="sequenceLabel"> - <property name="text"> - <string>TextLabel</string> + <widget class="QPlainTextEdit" name="sequenceTextEdit"> + <property name="lineWrapMode"> + <enum>QPlainTextEdit::WidgetWidth</enum> </property> </widget> </item> @@ -47,7 +56,7 @@ <x>0</x> <y>0</y> <width>609</width> - <height>23</height> + <height>25</height> </rect> </property> </widget> diff --git a/src/gui/protein_view/proteinwindow.cpp b/src/gui/protein_view/proteinwindow.cpp index aa8e4b39..2fc6f334 100644 --- a/src/gui/protein_view/proteinwindow.cpp +++ b/src/gui/protein_view/proteinwindow.cpp @@ -22,6 +22,8 @@ ******************************************************************************/ #include "proteinwindow.h" +#include "../project_view/projectwindow.h" +#include "ui_protein_detail_view.h" ProteinWindow::ProteinWindow(ProjectWindow *parent): QMainWindow(parent), @@ -41,19 +43,17 @@ ProteinWindow::ProteinWindow(ProjectWindow *parent): */ #else // Qt4 code - connect(ui->tableView, SIGNAL(clicked(const QModelIndex &)), _p_proxy_model, SLOT(onTableClicked(const QModelIndex &))); - connect(ui->tableView, SIGNAL(doubleClicked(const QModelIndex &)), _p_proxy_model, SLOT(onTableDoubleClicked(const QModelIndex &))); - connect(ui->proteinSearchEdit, SIGNAL(textChanged(QString)), _protein_table_model_p, SLOT(onProteinSearchEdit(QString))); - - - connect( this, SIGNAL( focusReceived(bool) ),this, SLOT(doFocusReceived(bool)) ); - connect(ui->centralwidget, SIGNAL(customContextMenuRequested(const QPoint &)), - this, SLOT(showContextMenu(const QPoint &))); //connect(_protein_table_model_p, SIGNAL(layoutChanged()), this, SLOT(updateStatusBar())); #endif } ProteinWindow::~ProteinWindow() { + delete ui; +} +void ProteinWindow::setProteinMatch(ProteinMatch * p_protein_match) { + ui->descriptionLabel->setText(p_protein_match->getProteinXtpSp().get()->getAccession()); + //ui->sequenceLabel->setText(p_protein_match->getProteinXtpSp().get()->getSequence()); + ui->sequenceTextEdit->setPlainText(p_protein_match->getProteinXtpSp().get()->getSequence()); } diff --git a/src/gui/protein_view/proteinwindow.h b/src/gui/protein_view/proteinwindow.h index 467e8378..f3c024c9 100644 --- a/src/gui/protein_view/proteinwindow.h +++ b/src/gui/protein_view/proteinwindow.h @@ -25,6 +25,10 @@ #define PROTEINWINDOW_H #include <QMainWindow> +#include <QTextDocument> +#include "../../core/proteinmatch.h" + +class ProjectWindow; namespace Ui { class ProteinDetailView; @@ -37,6 +41,11 @@ public: explicit ProteinWindow(ProjectWindow * parent = 0); ~ProteinWindow(); + void setProteinMatch(ProteinMatch * p_protein_match); +private: + Ui::ProteinDetailView *ui; + QTextDocument sequence_text; + }; #endif // PROTEINWINDOW_H -- GitLab