diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 997cc17ad0f508ceca8dc213510cd90948252353..9e1f53ba7e352bb7be7fcef2b2fb1a9cc31e3f72 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -81,6 +81,7 @@ set(QTLIBS ${Qt5Xml_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Svg_LIBRARIES}) # (CMAKE_BINARY_DIR holds a path to the build directory, while INCLUDE_DIRECTORIES() works just like INCLUDEPATH from qmake) SET(XTPCPP_SRCS + ./gui/load_results_dialog/loadresultsdialog.cpp ./gui/mainwindow.cpp ./gui/peptide_detail_view/peptidewindow.cpp ./gui/peptide_detail_view/spectrum_widget/qspectrumwidget.cpp @@ -97,6 +98,7 @@ SET(XTPCPP_SRCS ) SET (GUI_UIS + ./gui/load_results_dialog/load_results_dialog.ui ./gui/main.ui ./gui/peptide_detail_view/peptide_detail_view.ui ./gui/peptide_list_view/peptide_view.ui @@ -109,6 +111,7 @@ SET (GUI_UIS SET(XTPCPP_MOC_HDRS + ./gui/load_results_dialog/loadresultsdialog.h ./gui/mainwindow.h ./gui/peptide_detail_view/peptidewindow.h ./gui/peptide_detail_view/spectrum_widget/qspectrumwidget.h @@ -148,3 +151,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) + diff --git a/src/gui/load_results_dialog/load_results_dialog.ui b/src/gui/load_results_dialog/load_results_dialog.ui new file mode 100644 index 0000000000000000000000000000000000000000..98de36a7eec19af2ed3a87207a3097b929e018b8 --- /dev/null +++ b/src/gui/load_results_dialog/load_results_dialog.ui @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>LoadResultsDialog</class> + <widget class="QWidget" name="LoadResultsDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>533</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QGroupBox" name="choose_files_groupbox"> + <property name="title"> + <string>Choose result files</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QListView" name="listView"/> + </item> + <item row="1" column="0"> + <widget class="QPushButton" name="add_files_button"> + <property name="text"> + <string>add files</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="filter_parameter_groupbox"> + <property name="title"> + <string>Peptide and protein filters</string> + </property> + <layout class="QVBoxLayout" name="filter_parameter_layout"/> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>add_files_button</sender> + <signal>clicked()</signal> + <receiver>LoadResultsDialog</receiver> + <slot>chooseFiles()</slot> + <hints> + <hint type="sourcelabel"> + <x>319</x> + <y>236</y> + </hint> + <hint type="destinationlabel"> + <x>550</x> + <y>264</y> + </hint> + </hints> + </connection> + </connections> + <slots> + <slot>chooseFiles()</slot> + </slots> +</ui> diff --git a/src/gui/load_results_dialog/loadresultsdialog.cpp b/src/gui/load_results_dialog/loadresultsdialog.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6a1a5f0e9dc6db55d097831f12f6bf533fbc1ce7 --- /dev/null +++ b/src/gui/load_results_dialog/loadresultsdialog.cpp @@ -0,0 +1,87 @@ + +/******************************************************************************* +* Copyright (c) 2017 Olivier Langella <olivier.langella@u-psud.fr>. +* +* This file is part of XTPcpp. +* +* XTPcpp is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* XTPcpp is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>. +* +* Contributors: +* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation +******************************************************************************/ +#include "loadresultsdialog.h" + +#include "ui_load_results_dialog.h" +#include <QDebug> +#include <QSettings> +#include <QFileDialog> +#include <QMessageBox> +#include <pappsomspp/pappsoexception.h> +#include "../project_view/automatic_filter_widget/automaticfilterwidget.h" + + +LoadResultsDialog::LoadResultsDialog(QWidget * parent): + QDialog(parent), + ui(new Ui::LoadResultsDialog) +{ + qDebug() << "LoadResultsDialog::LoadResultsDialog begin"; + ui->setupUi(this); + this->setModal(true); + + + AutomaticFilterWidget* p_automatic_filter_widget = new AutomaticFilterWidget(this); + ui->filter_parameter_layout->addWidget(p_automatic_filter_widget); +#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 + + qDebug() << "LoadResultsDialog::LoadResultsDialog end"; +} + +LoadResultsDialog::~LoadResultsDialog() +{ + delete ui; +} + + + +void LoadResultsDialog::chooseFiles() { + try { + QSettings settings; + QString default_location = settings.value("path/identificationfiles", "").toString(); + + QString filename = QFileDialog::getOpenFileName(this, + tr("Open XPIP File"), default_location, + tr("X!Tandem files (*.xml);;all files (*)")); + + if (filename.isEmpty()) { + return; + } + + settings.setValue("path/identificationfiles", QFileInfo(filename).absolutePath()); + + } + catch (pappso::PappsoException & error) { + //QMessageBox::warning(this, + // tr("Error choosing identification result files : %1").arg(error.qwhat()), error); + } +} diff --git a/src/gui/load_results_dialog/loadresultsdialog.h b/src/gui/load_results_dialog/loadresultsdialog.h new file mode 100644 index 0000000000000000000000000000000000000000..bec67ade96562b9a7fa762cde5b8fe487d200eca --- /dev/null +++ b/src/gui/load_results_dialog/loadresultsdialog.h @@ -0,0 +1,56 @@ + +/******************************************************************************* +* Copyright (c) 2017 Olivier Langella <olivier.langella@u-psud.fr>. +* +* This file is part of XTPcpp. +* +* XTPcpp is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* XTPcpp is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>. +* +* Contributors: +* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation +******************************************************************************/ + +#ifndef LOADRESULTSDIALOG_H +#define LOADRESULTSDIALOG_H + +#include "../../../core/automaticfilterparameters.h" +#include <QDialog> + + +namespace Ui { +class LoadResultsDialog; +} + +class ProjectWindow; + +class LoadResultsDialog : public QDialog +{ + Q_OBJECT + +public: + explicit LoadResultsDialog(QWidget * parent); + ~LoadResultsDialog(); + + +public slots: + void chooseFiles(); + +signals: + +private: + Ui::LoadResultsDialog *ui; + +}; + +#endif // LOADRESULTSDIALOG_H diff --git a/src/gui/main.ui b/src/gui/main.ui index df07ce845428161d0bbd53af12d07347f3a6f4f9..8c36b0b947867c06150e1f9cff2893583573db34 100644 --- a/src/gui/main.ui +++ b/src/gui/main.ui @@ -26,13 +26,14 @@ <x>0</x> <y>0</y> <width>463</width> - <height>25</height> + <height>23</height> </rect> </property> <widget class="QMenu" name="menuFile"> <property name="title"> <string>F&ile</string> </property> + <addaction name="actionLoad_results"/> <addaction name="actionLoad"/> </widget> <addaction name="menuFile"/> @@ -40,7 +41,12 @@ <widget class="QStatusBar" name="statusbar"/> <action name="actionLoad"> <property name="text"> - <string>&Load</string> + <string>&Load project</string> + </property> + </action> + <action name="actionLoad_results"> + <property name="text"> + <string>Load results</string> </property> </action> </widget> @@ -64,8 +70,25 @@ </hint> </hints> </connection> + <connection> + <sender>actionLoad_results</sender> + <signal>triggered()</signal> + <receiver>Main</receiver> + <slot>loadResults()</slot> + <hints> + <hint type="sourcelabel"> + <x>-1</x> + <y>-1</y> + </hint> + <hint type="destinationlabel"> + <x>231</x> + <y>191</y> + </hint> + </hints> + </connection> </connections> <slots> <slot>selectXpipFile()</slot> + <slot>loadResults()</slot> </slots> </ui> diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 920e5fd9367220c3c75549ed3adac27b59541990..d71adf1096a2bbcbc6e3c5169f031067d5f06cc1 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -135,7 +135,16 @@ void MainWindow::doProjectReady(ProjectSp project_sp) { void MainWindow::doProjectNotReady(QString error) { viewError(tr("Error while grouping :\n%1").arg(error)); } +void MainWindow::loadResults() { + if (_p_load_results_dialog == nullptr) { + _p_load_results_dialog = new LoadResultsDialog(this); + } + + _p_load_results_dialog->show(); + _p_load_results_dialog->raise(); + _p_load_results_dialog->activateWindow(); +} void MainWindow::selectXpipFile() { try { QSettings settings; @@ -157,3 +166,4 @@ void MainWindow::selectXpipFile() { } } + diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 96bb97e0e824af19afbb64bdc36cc027cfe87e50..a9d97fd3b120941fa1c5f82715297e1234a53268 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -37,6 +37,7 @@ #include "core/project.h" #include "files/xpipfile.h" #include "project_view/projectwindow.h" +#include "load_results_dialog/loadresultsdialog.h" @@ -73,6 +74,7 @@ public: ~MainWindow(); public slots: + void loadResults(); void selectXpipFile(); void doProjectReady(ProjectSp project_sp); void doProjectNotReady(QString error); @@ -98,6 +100,7 @@ private : ProjectSp _project_sp=nullptr; ProjectWindow * _project_window=nullptr; + LoadResultsDialog * _p_load_results_dialog=nullptr; }; diff --git a/src/gui/project_view/automatic_filter_widget/automaticfilterwidget.cpp b/src/gui/project_view/automatic_filter_widget/automaticfilterwidget.cpp index b1c3b6d494faa144abf6d0e4cea7d6d38e747eaf..f20f9ef8ea349f3a5d72add2221d2f8bd01a3bd4 100644 --- a/src/gui/project_view/automatic_filter_widget/automaticfilterwidget.cpp +++ b/src/gui/project_view/automatic_filter_widget/automaticfilterwidget.cpp @@ -28,26 +28,12 @@ #include <QDebug> -AutomaticFilterWidget::AutomaticFilterWidget(ProjectWindow * parent): +AutomaticFilterWidget::AutomaticFilterWidget(QWidget * parent): QWidget(parent), ui(new Ui::AutomaticFilterWidget) { qDebug() << "AutomaticFilterWidget::AutomaticFilterWidget begin"; - _p_project_window = parent; ui->setupUi(this); -#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 (this, SIGNAL(automaticFilterParametersChanged(AutomaticFilterParameters)), _p_project_window,SLOT(doAutomaticFilterParametersChanged(AutomaticFilterParameters))); - connect (_p_project_window, SIGNAL(identificationGroupGrouped(IdentificationGroup *)), this,SLOT(doIdentificationGroupGrouped(IdentificationGroup *))); -#endif qDebug() << "AutomaticFilterWidget::AutomaticFilterWidget end"; } diff --git a/src/gui/project_view/automatic_filter_widget/automaticfilterwidget.h b/src/gui/project_view/automatic_filter_widget/automaticfilterwidget.h index bdf8d65f1e54641847208e94c3ad17f56a8a6ca0..cfccc9add23b7ce59b8e2073ff1724a6e7a55ed7 100644 --- a/src/gui/project_view/automatic_filter_widget/automaticfilterwidget.h +++ b/src/gui/project_view/automatic_filter_widget/automaticfilterwidget.h @@ -32,14 +32,12 @@ namespace Ui { class AutomaticFilterWidget; } -class ProjectWindow; - class AutomaticFilterWidget : public QWidget { Q_OBJECT public: - explicit AutomaticFilterWidget(ProjectWindow * parent); + explicit AutomaticFilterWidget(QWidget * parent); ~AutomaticFilterWidget(); void setAutomaticFilterParameters(const AutomaticFilterParameters & params); @@ -57,7 +55,6 @@ signals: private: Ui::AutomaticFilterWidget *ui; - ProjectWindow *_p_project_window; bool _signal = true; AutomaticFilterParameters _parameters; diff --git a/src/gui/project_view/project_view.ui b/src/gui/project_view/project_view.ui index 0b44ea299c1afab674c97d3f390c2cc5447e885c..c2a73be55d855c4948107f534f81fc4913d62ef5 100644 --- a/src/gui/project_view/project_view.ui +++ b/src/gui/project_view/project_view.ui @@ -21,7 +21,7 @@ <bool>true</bool> </property> <property name="currentIndex"> - <number>1</number> + <number>0</number> </property> <widget class="QWidget" name="identifications"> <attribute name="title"> diff --git a/src/gui/project_view/projectwindow.cpp b/src/gui/project_view/projectwindow.cpp index 2d01e3e0c4582c3ce26b274177bb308fc11f33cc..bb0d790d4384e3a6ff8210c08353d4b2d8e090c9 100644 --- a/src/gui/project_view/projectwindow.cpp +++ b/src/gui/project_view/projectwindow.cpp @@ -45,6 +45,7 @@ ProjectWindow::ProjectWindow(MainWindow *parent): _p_automatic_filter_widget = new AutomaticFilterWidget(this); ui->filter_parameter_layout->addWidget(_p_automatic_filter_widget); + #if QT_VERSION >= 0x050000 // Qt5 code @@ -56,6 +57,8 @@ ProjectWindow::ProjectWindow(MainWindow *parent): #else // Qt4 code //connect (_protein_list_window, SIGNAL(proteinMatchClicked(ProteinMatch *)), this //,SLOT(doProteinMatchClicked(ProteinMatch *))); + connect (_p_automatic_filter_widget, SIGNAL(automaticFilterParametersChanged(AutomaticFilterParameters)), this,SLOT(doAutomaticFilterParametersChanged(AutomaticFilterParameters))); + connect (this, SIGNAL(identificationGroupGrouped(IdentificationGroup *)), _p_automatic_filter_widget,SLOT(doIdentificationGroupGrouped(IdentificationGroup *))); #endif /*