From fbb938fb84acd92b4eb5031f8d9276a98d1bee67 Mon Sep 17 00:00:00 2001 From: Olivier Langella <olivier.langella@u-psud.fr> Date: Tue, 3 Oct 2017 14:06:48 +0200 Subject: [PATCH] edit preset signals and slots --- src/core/tandem_run/tandemparameters.cpp | 3 + src/core/tandem_run/tandemparameters.h | 1 + src/files/tandemparametersfile.cpp | 4 + src/files/tandemparametersfile.h | 1 + .../edit_tandem_preset_dialog.ui | 247 ++++++++++++++---- .../edittandempresetdialog.cpp | 12 +- 6 files changed, 210 insertions(+), 58 deletions(-) diff --git a/src/core/tandem_run/tandemparameters.cpp b/src/core/tandem_run/tandemparameters.cpp index ad4311750..df34f9b6a 100644 --- a/src/core/tandem_run/tandemparameters.cpp +++ b/src/core/tandem_run/tandemparameters.cpp @@ -75,6 +75,9 @@ void TandemParameters::setParamLabelValue(const QString & label, const QString & void TandemParameters::setMethodName(const QString & method) { _method_name = method; } +const QString & TandemParameters::getMethodName() const { + return _method_name; +} const QMap<QString, QString> & TandemParameters::getMapLabelValue() const { return _map_label_value; } diff --git a/src/core/tandem_run/tandemparameters.h b/src/core/tandem_run/tandemparameters.h index d96065fce..0d8d6df3f 100644 --- a/src/core/tandem_run/tandemparameters.h +++ b/src/core/tandem_run/tandemparameters.h @@ -42,6 +42,7 @@ public: const QString & getValue(const QString & label) const; void setMethodName(const QString & method); + const QString & getMethodName() const; void setParamLabelValue(const QString & label, const QString & value); const QMap<QString, QString> & getMapLabelValue() const; private: diff --git a/src/files/tandemparametersfile.cpp b/src/files/tandemparametersfile.cpp index fdcb10163..b7feb48b0 100644 --- a/src/files/tandemparametersfile.cpp +++ b/src/files/tandemparametersfile.cpp @@ -58,6 +58,10 @@ const QString TandemParametersFile::getFilename() const { const QString TandemParametersFile::getAbsoluteFilePath() const { return _param_source.absoluteFilePath(); } +bool TandemParametersFile::exists() const +{ + return _param_source.exists(); +} void TandemParametersFile::setTandemParameters(const TandemParameters & parameters) const { diff --git a/src/files/tandemparametersfile.h b/src/files/tandemparametersfile.h index 7fe448582..e2eae4937 100644 --- a/src/files/tandemparametersfile.h +++ b/src/files/tandemparametersfile.h @@ -46,6 +46,7 @@ public: const QString getMethodName() const; const QString getFilename() const; const QString getAbsoluteFilePath() const; + bool exists() const; /** @brief read tandem parameters from XML file */ 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 5f52c53be..dfe307f74 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 @@ -9,8 +9,8 @@ <rect> <x>0</x> <y>0</y> - <width>1000</width> - <height>580</height> + <width>1441</width> + <height>730</height> </rect> </property> <property name="minimumSize"> @@ -50,7 +50,7 @@ </sizepolicy> </property> <property name="text"> - <string>New</string> + <string>Load</string> </property> </widget> </item> @@ -70,13 +70,34 @@ </layout> </item> <item> - <widget class="QWidget" name="widget" native="true"> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="1"> - <widget class="QSplitter" name="splitter"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> + <widget class="QSplitter" name="splitter"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <widget class="QWidget" name="widget_2" native="true"> + <layout class="QVBoxLayout" name="verticalLayout_7"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLineEdit" name="method_name_line_edit"/> + </item> + <item> + <widget class="QPushButton" name="pushButton"> + <property name="text"> + <string>Copy</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="save"> + <property name="text"> + <string>Save</string> + </property> + </widget> + </item> + </layout> + </item> + <item> <widget class="QTabWidget" name="tabWidget"> <property name="currentIndex"> <number>0</number> @@ -111,8 +132,8 @@ <rect> <x>0</x> <y>0</y> - <width>656</width> - <height>198</height> + <width>1125</width> + <height>289</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_3"> @@ -271,8 +292,8 @@ <rect> <x>0</x> <y>0</y> - <width>98</width> - <height>72</height> + <width>1125</width> + <height>289</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_6"> @@ -314,23 +335,10 @@ </layout> </widget> </widget> - <widget class="QTextEdit" name="doc_plain_text_edit"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>200</width> - <height>0</height> - </size> - </property> - </widget> - </widget> - </item> - </layout> + </item> + </layout> + </widget> + <widget class="QTextEdit" name="doc_plain_text_edit"/> </widget> </item> <item> @@ -392,8 +400,8 @@ <slot>reject()</slot> <hints> <hint type="sourcelabel"> - <x>777</x> - <y>498</y> + <x>1338</x> + <y>654</y> </hint> <hint type="destinationlabel"> <x>881</x> @@ -408,8 +416,8 @@ <slot>accept()</slot> <hints> <hint type="sourcelabel"> - <x>863</x> - <y>498</y> + <x>1429</x> + <y>654</y> </hint> <hint type="destinationlabel"> <x>879</x> @@ -424,12 +432,28 @@ <slot>doHelp()</slot> <hints> <hint type="sourcelabel"> - <x>556</x> - <y>227</y> + <x>1086</x> + <y>307</y> </hint> <hint type="destinationlabel"> - <x>949</x> - <y>153</y> + <x>1728</x> + <y>321</y> + </hint> + </hints> + </connection> + <connection> + <sender>save</sender> + <signal>clicked()</signal> + <receiver>EditTandemPresetView</receiver> + <slot>doSave()</slot> + <hints> + <hint type="sourcelabel"> + <x>1134</x> + <y>175</y> + </hint> + <hint type="destinationlabel"> + <x>1542</x> + <y>134</y> </hint> </hints> </connection> @@ -440,12 +464,12 @@ <slot>doHelp()</slot> <hints> <hint type="sourcelabel"> - <x>573</x> - <y>262</y> + <x>1102</x> + <y>368</y> </hint> <hint type="destinationlabel"> - <x>936</x> - <y>272</y> + <x>720</x> + <y>364</y> </hint> </hints> </connection> @@ -456,12 +480,12 @@ <slot>doHelp()</slot> <hints> <hint type="sourcelabel"> - <x>564</x> - <y>296</y> + <x>1112</x> + <y>434</y> </hint> <hint type="destinationlabel"> - <x>952</x> - <y>297</y> + <x>1181</x> + <y>866</y> </hint> </hints> </connection> @@ -472,23 +496,136 @@ <slot>doHelp()</slot> <hints> <hint type="sourcelabel"> - <x>566</x> - <y>331</y> + <x>1091</x> + <y>494</y> + </hint> + <hint type="destinationlabel"> + <x>1037</x> + <y>901</y> + </hint> + </hints> + </connection> + <connection> + <sender>pushButton</sender> + <signal>clicked()</signal> + <receiver>EditTandemPresetView</receiver> + <slot>doCopy()</slot> + <hints> + <hint type="sourcelabel"> + <x>1017</x> + <y>186</y> + </hint> + <hint type="destinationlabel"> + <x>707</x> + <y>1103</y> + </hint> + </hints> + </connection> + <connection> + <sender>parent_ion_window_unit_combo_box</sender> + <signal>activated(QString)</signal> + <receiver>EditTandemPresetView</receiver> + <slot>doEdit(QString)</slot> + <hints> + <hint type="sourcelabel"> + <x>939</x> + <y>319</y> + </hint> + <hint type="destinationlabel"> + <x>400</x> + <y>897</y> + </hint> + </hints> + </connection> + <connection> + <sender>parent_ion_lower_window_edit</sender> + <signal>textChanged(QString)</signal> + <receiver>EditTandemPresetView</receiver> + <slot>doEdit(QString)</slot> + <hints> + <hint type="sourcelabel"> + <x>846</x> + <y>363</y> + </hint> + <hint type="destinationlabel"> + <x>464</x> + <y>1032</y> + </hint> + </hints> + </connection> + <connection> + <sender>parent_ion_upper_window_edit</sender> + <signal>textChanged(QString)</signal> + <receiver>EditTandemPresetView</receiver> + <slot>doEdit(QString)</slot> + <hints> + <hint type="sourcelabel"> + <x>932</x> + <y>435</y> + </hint> + <hint type="destinationlabel"> + <x>798</x> + <y>842</y> + </hint> + </hints> + </connection> + <connection> + <sender>anticipate_carbon_combo_box</sender> + <signal>activated(QString)</signal> + <receiver>EditTandemPresetView</receiver> + <slot>doEdit(QString)</slot> + <hints> + <hint type="sourcelabel"> + <x>980</x> + <y>477</y> + </hint> + <hint type="destinationlabel"> + <x>970</x> + <y>797</y> + </hint> + </hints> + </connection> + <connection> + <sender>pushButton_5</sender> + <signal>clicked()</signal> + <receiver>EditTandemPresetView</receiver> + <slot>doLoad()</slot> + <hints> + <hint type="sourcelabel"> + <x>1154</x> + <y>84</y> + </hint> + <hint type="destinationlabel"> + <x>1737</x> + <y>106</y> + </hint> + </hints> + </connection> + <connection> + <sender>pushButton_6</sender> + <signal>clicked()</signal> + <receiver>EditTandemPresetView</receiver> + <slot>doSelectDir()</slot> + <hints> + <hint type="sourcelabel"> + <x>1273</x> + <y>87</y> </hint> <hint type="destinationlabel"> - <x>994</x> - <y>332</y> + <x>1796</x> + <y>138</y> </hint> </hints> </connection> </connections> <slots> - <slot>doNotValidHide(bool)</slot> - <slot>doNotCheckedHide(bool)</slot> - <slot>doNotGroupedHide(bool)</slot> + <slot>doCopy()</slot> + <slot>doEdit(QString)</slot> + <slot>doLoad()</slot> <slot>doHelp()</slot> - <slot>doActionReplace()</slot> + <slot>doSave()</slot> <slot>reject()</slot> <slot>accept()</slot> + <slot>doSelectDir()</slot> </slots> </ui> diff --git a/src/gui/edit_tandem_preset_dialog/edittandempresetdialog.cpp b/src/gui/edit_tandem_preset_dialog/edittandempresetdialog.cpp index 4a9725fd3..8e58775df 100644 --- a/src/gui/edit_tandem_preset_dialog/edittandempresetdialog.cpp +++ b/src/gui/edit_tandem_preset_dialog/edittandempresetdialog.cpp @@ -60,10 +60,14 @@ EditTandemPresetDialog::~EditTandemPresetDialog() } void EditTandemPresetDialog::setTandemParametersFiles(const TandemParametersFile & tandem_preset_file) { - _p_tandem_preset_file = new TandemParametersFile( tandem_preset_file); - + + if (tandem_preset_file.exists()) { + _p_tandem_preset_file = new TandemParametersFile( tandem_preset_file); + } else { + _p_tandem_preset_file = new TandemParametersFile(":/tandem/ressources/model/QExactive_analysis_FDR_nosemi.xml"); + } _tandem_params = _p_tandem_preset_file->getTandemParameters(); - + populate(); } @@ -90,6 +94,7 @@ void EditTandemPresetDialog::doHelp() { } void EditTandemPresetDialog::readUi() { + _tandem_params.setParamLabelValue("spectrum, parent monoisotopic mass error units", ui->parent_ion_window_unit_combo_box->itemData(ui->parent_ion_window_unit_combo_box->currentIndex()).toString()); _tandem_params.setParamLabelValue("spectrum, parent monoisotopic mass error minus", ui->parent_ion_lower_window_edit->text()); @@ -100,6 +105,7 @@ void EditTandemPresetDialog::readUi() { } void EditTandemPresetDialog::populate() { + ui->method_name_line_edit->setText(_tandem_params.getMethodName()); /* * <note type="input" label="spectrum, parent monoisotopic mass error units">ppm</note> * */ -- GitLab