diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a019b1b1a119878ac3a27d921edd6180ed0acbe0..2f5d3bbcbd1ad87ee62ba85c8dbcb6dc0359f458 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 c5700f620e37883bf70e5dbad5d92bdb698f23ef..06c18052406314931047d7cac872193012dcfe59 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 fa20726ad3309e77fe09101c31fa634ad776bdd6..d770c8fbd79ed8c3204bf8de774a511803a481b0 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 4e5f707c60375c870fb2cb961a108b3bcaa374e6..00348a5aa4bd3e33301b2a5a02c380b8ad212068 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 342110d720bde3f2575ef19849d54fbb56f9b93f..268939d4f252c5bb861d79f36c4a552de5d6c105 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 3a64371f67c4e3245ea4066e62f944f427fb641d..04f3680880871e9509fc0d842e678bc8d7fe36d9 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 455bec3fee9a3bb99326e11f155d7835e9dcea5f..c0bd5932cfcd7918c183bd039e491bbc1a073ff7 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 aa8e4b393e5e37ed2928a39bba07da6c10dbbe42..2fc6f334f1244f90604edd65800baa46ee8e9781 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 467e8378cba658f26e10d4f20b9f77ca7ff73ad2..f3c024c93f900c2b3010be02e182ccd0ede6089a 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