From 6ffc54c7b81bfef4978a8bb4b4e1066d31dcf10e Mon Sep 17 00:00:00 2001 From: Olivier Langella <olivier.langella@u-psud.fr> Date: Sat, 30 Sep 2017 07:46:45 +0200 Subject: [PATCH] new tandem preset dialog window --- src/CMakeLists.txt | 3 + .../edit_modifications/editmodifications.h | 6 +- .../edit_tandem_preset_dialog.ui | 116 ++++++++++++++++-- .../edittandempresetdialog.cpp | 56 +++++++++ .../edittandempresetdialog.h | 52 ++++++++ .../tandem_run_dialog/tandem_run_dialog.ui | 4 +- src/gui/tandem_run_dialog/tandemrundialog.cpp | 14 +++ src/gui/tandem_run_dialog/tandemrundialog.h | 3 + 8 files changed, 238 insertions(+), 16 deletions(-) create mode 100644 src/gui/edit_tandem_preset_dialog/edittandempresetdialog.cpp create mode 100644 src/gui/edit_tandem_preset_dialog/edittandempresetdialog.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index acd3ea5aa..b751680f9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -118,6 +118,7 @@ SET(XTPCPP_SRCS ./gui/choose_modification_dialog/choosemodificationdialog.cpp ./gui/edit_label_methods/editlabelmethods.cpp ./gui/edit_modifications/editmodifications.cpp + ./gui/edit_tandem_preset_dialog/edittandempresetdialog.cpp ./gui/export_spreadsheet_dialog/exportspreadsheetdialog.cpp ./gui/load_results_dialog/loadresultsdialog.cpp ./gui/mainwindow.cpp @@ -152,6 +153,7 @@ SET (GUI_UIS ./gui/choose_modification_dialog/choose_modification_dialog.ui ./gui/edit_label_methods/edit_label_methods.ui ./gui/edit_modifications/edit_modifications.ui + ./gui/edit_tandem_preset_dialog/edit_tandem_preset_dialog.ui ./gui/export_spreadsheet_dialog/export_spreadsheet_dialog.ui ./gui/load_results_dialog/load_results_dialog.ui ./gui/main.ui @@ -173,6 +175,7 @@ SET(XTPCPP_MOC_HDRS ./gui/choose_modification_dialog/choosemodificationdialog.h ./gui/edit_label_methods/editlabelmethods.h ./gui/edit_modifications/editmodifications.h + ./gui/edit_tandem_preset_dialog/edittandempresetdialog.h ./gui/export_spreadsheet_dialog/exportspreadsheetdialog.h ./gui/load_results_dialog/loadresultsdialog.h ./gui/mainwindow.h diff --git a/src/gui/edit_modifications/editmodifications.h b/src/gui/edit_modifications/editmodifications.h index 530502214..04a6dce6c 100644 --- a/src/gui/edit_modifications/editmodifications.h +++ b/src/gui/edit_modifications/editmodifications.h @@ -43,10 +43,10 @@ public: explicit EditModifications(ProjectWindow * parent = 0); ~EditModifications(); - + void setProjectSp(ProjectSp project_sp); - - public slots: + +public slots: void ItemClicked (QModelIndex index ); void ItemDoubleClicked (QModelIndex index ); private slots: diff --git a/src/gui/edit_tandem_preset_dialog/edit_tandem_preset_dialog.ui b/src/gui/edit_tandem_preset_dialog/edit_tandem_preset_dialog.ui index af1cf9576..6269edd18 100644 --- a/src/gui/edit_tandem_preset_dialog/edit_tandem_preset_dialog.ui +++ b/src/gui/edit_tandem_preset_dialog/edit_tandem_preset_dialog.ui @@ -14,7 +14,7 @@ <enum>Qt::CustomContextMenu</enum> </property> <property name="windowTitle"> - <string>Labeling methods editor</string> + <string>X!Tandem preset editor</string> </property> <layout class="QVBoxLayout" name="verticalLayout_2"> <item> @@ -27,6 +27,39 @@ </property> </widget> </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QComboBox" name="preset_combo_box"/> + </item> + <item> + <widget class="QPushButton" name="pushButton_5"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>New</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pushButton_6"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Preset directory</string> + </property> + </widget> + </item> + </layout> + </item> <item> <widget class="QWidget" name="widget" native="true"> <layout class="QGridLayout" name="gridLayout"> @@ -39,13 +72,22 @@ <property name="currentIndex"> <number>0</number> </property> - <widget class="QWidget" name="tab"> + <widget class="QWidget" name="spectrum_tab"> <attribute name="title"> <string>Spectrum</string> </attribute> <layout class="QVBoxLayout" name="verticalLayout_4"> <item> <widget class="QScrollArea" name="scrollArea"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="horizontalScrollBarPolicy"> + <enum>Qt::ScrollBarAsNeeded</enum> + </property> <property name="widgetResizable"> <bool>true</bool> </property> @@ -54,8 +96,8 @@ <rect> <x>0</x> <y>0</y> - <width>551</width> - <height>161</height> + <width>567</width> + <height>198</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_3"> @@ -128,13 +170,10 @@ </property> </widget> </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="spinBox"/> - </item> <item row="3" column="2"> <widget class="QPushButton" name="pushButton_4"> <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -144,9 +183,6 @@ </property> </widget> </item> - <item row="2" column="1"> - <widget class="QSpinBox" name="spinBox_2"/> - </item> <item row="3" column="1"> <widget class="QComboBox" name="comboBox_2"> <item> @@ -175,6 +211,12 @@ </property> </widget> </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="lineEdit"/> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="lineEdit_2"/> + </item> </layout> </item> <item> @@ -200,6 +242,58 @@ <attribute name="title"> <string>Protein</string> </attribute> + <layout class="QVBoxLayout" name="verticalLayout_5"> + <item> + <widget class="QScrollArea" name="scrollArea_2"> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="scrollAreaWidgetContents_2"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>98</width> + <height>72</height> + </rect> + </property> + <layout class="QVBoxLayout" name="verticalLayout_6"> + <item> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>TextLabel</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>TextLabel</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </widget> + </item> + </layout> </widget> </widget> <widget class="QPlainTextEdit" name="plainTextEdit"/> diff --git a/src/gui/edit_tandem_preset_dialog/edittandempresetdialog.cpp b/src/gui/edit_tandem_preset_dialog/edittandempresetdialog.cpp new file mode 100644 index 000000000..037662a12 --- /dev/null +++ b/src/gui/edit_tandem_preset_dialog/edittandempresetdialog.cpp @@ -0,0 +1,56 @@ +/** + * \file gui/edit_tandem_preset_dialog/edittandempresetdialog.cpp + * \date 30/9/2017 + * \author Olivier Langella + * \brief edit tandem preset dialog + */ + +/******************************************************************************* +* 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 "edittandempresetdialog.h" +#include <QDebug> + +#include "ui_edit_tandem_preset_dialog.h" + + +EditTandemPresetDialog::EditTandemPresetDialog(QWidget * parent): + QDialog(parent), + ui(new Ui::EditTandemPresetView) +{ + qDebug() << "EditTandemPresetDialog::EditTandemPresetDialog begin"; + ui->setupUi(this); + this->setModal(true); + +#if QT_VERSION >= 0x050000 + // Qt5 code +#else +// Qt4 code + +#endif + qDebug() << "EditTandemPresetDialog::EditTandemPresetDialog end"; +} + +EditTandemPresetDialog::~EditTandemPresetDialog() +{ + delete ui; +} diff --git a/src/gui/edit_tandem_preset_dialog/edittandempresetdialog.h b/src/gui/edit_tandem_preset_dialog/edittandempresetdialog.h new file mode 100644 index 000000000..cacea1c52 --- /dev/null +++ b/src/gui/edit_tandem_preset_dialog/edittandempresetdialog.h @@ -0,0 +1,52 @@ +/** + * \file gui/edit_tandem_preset_dialog/edittandempresetdialog.h + * \date 30/9/2017 + * \author Olivier Langella + * \brief edit tandem preset dialog + */ + +/******************************************************************************* +* 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 EDITTANDEMPRESETDIALOG_H +#define EDITTANDEMPRESETDIALOG_H + +#include<QDialog> + +namespace Ui { +class EditTandemPresetView; +} + +class EditTandemPresetDialog: public QDialog +{ + Q_OBJECT + +public: + explicit EditTandemPresetDialog(QWidget * parent); + ~EditTandemPresetDialog(); + + +private: + Ui::EditTandemPresetView *ui; +}; + +#endif // EDITTANDEMPRESETDIALOG_H diff --git a/src/gui/tandem_run_dialog/tandem_run_dialog.ui b/src/gui/tandem_run_dialog/tandem_run_dialog.ui index 79fa385b9..6d1ffcbb8 100644 --- a/src/gui/tandem_run_dialog/tandem_run_dialog.ui +++ b/src/gui/tandem_run_dialog/tandem_run_dialog.ui @@ -369,7 +369,7 @@ <sender>pushButton_7</sender> <signal>clicked()</signal> <receiver>TandemRunDialog</receiver> - <slot>selectPresetDirectory()</slot> + <slot>editPresets()</slot> <hints> <hint type="sourcelabel"> <x>541</x> @@ -390,6 +390,6 @@ <slot>selectMzFiles()</slot> <slot>selectOutputDirectory()</slot> <slot>setPresetName(QString)</slot> - <slot>selectPresetDirectory()</slot> + <slot>editPresets()</slot> </slots> </ui> diff --git a/src/gui/tandem_run_dialog/tandemrundialog.cpp b/src/gui/tandem_run_dialog/tandemrundialog.cpp index 2a6ff3ebc..be03ed1bc 100644 --- a/src/gui/tandem_run_dialog/tandemrundialog.cpp +++ b/src/gui/tandem_run_dialog/tandemrundialog.cpp @@ -139,6 +139,18 @@ void TandemRunDialog::selectPresetDirectory() { // tr("Error choosing identification result files : %1").arg(error.qwhat()), error); } } + +void TandemRunDialog::editPresets() { + QSettings settings; + QString default_preset_location = settings.value("path/tandemrun_preset_directory", "").toString(); + + + if (_p_preset_dialog == nullptr) { + _p_preset_dialog = new EditTandemPresetDialog(this); + } + _p_preset_dialog->show(); + +} void TandemRunDialog::selectOutputDirectory() { try { QSettings settings; @@ -218,3 +230,5 @@ TandemRunBatch TandemRunDialog::getTandemRunBatch() const { tandem_run_batch._number_of_threads = ui->thread_spin_box->value(); return tandem_run_batch; } + + diff --git a/src/gui/tandem_run_dialog/tandemrundialog.h b/src/gui/tandem_run_dialog/tandemrundialog.h index 83944614e..c56b958ef 100644 --- a/src/gui/tandem_run_dialog/tandemrundialog.h +++ b/src/gui/tandem_run_dialog/tandemrundialog.h @@ -33,6 +33,7 @@ #include <QDialog> #include <QStringListModel> #include "../../core/tandem_run/tandemrunbatch.h" +#include "../edit_tandem_preset_dialog/edittandempresetdialog.h" namespace Ui { class TandemRunDialog; @@ -55,6 +56,7 @@ public slots: void selectMzFiles(); void selectOutputDirectory(); void selectPresetDirectory(); + void editPresets(); void setPresetName(QString preset_name); signals: @@ -62,6 +64,7 @@ private: void fillPresetComboBox(); private: Ui::TandemRunDialog *ui; + EditTandemPresetDialog * _p_preset_dialog=nullptr; QStringListModel * _p_fasta_file_list; QStringListModel * _p_mz_file_list; QString _previous_preset_file; -- GitLab