diff --git a/src/gui/load_results_dialog/loadresultsdialog.h b/src/gui/load_results_dialog/loadresultsdialog.h index 08717ae827c0c8a9848b52bcfd108e009bbec960..7c12455affdbc8d7735467fed341e5d63aaae507 100644 --- a/src/gui/load_results_dialog/loadresultsdialog.h +++ b/src/gui/load_results_dialog/loadresultsdialog.h @@ -45,7 +45,6 @@ public: AutomaticFilterParameters getAutomaticFilterParameters() const; QStringList getFileList() const; bool isIndividual() const; - public slots: void chooseFiles(); void clearFileList(); diff --git a/src/gui/tandem_run_dialog/tandem_run_dialog.ui b/src/gui/tandem_run_dialog/tandem_run_dialog.ui index e69e7c46fdf57d434db94aebe766cde98ea2a486..7944fe4494ffefcba6a52017967175b1dcbca68b 100644 --- a/src/gui/tandem_run_dialog/tandem_run_dialog.ui +++ b/src/gui/tandem_run_dialog/tandem_run_dialog.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>573</width> - <height>559</height> + <height>609</height> </rect> </property> <property name="windowTitle"> @@ -21,7 +21,7 @@ </property> <layout class="QHBoxLayout" name="horizontalLayout_6"> <item> - <widget class="QLabel" name="label_2"> + <widget class="QLabel" name="tandem_bin_label"> <property name="text"> <string>TextLabel</string> </property> @@ -55,10 +55,30 @@ <property name="title"> <string>Choose presets</string> </property> - <layout class="QHBoxLayout" name="horizontalLayout_3"> + <layout class="QHBoxLayout" name="horizontalLayout_7"> <item> <widget class="QComboBox" name="preset_combobox"/> </item> + <item> + <spacer name="horizontalSpacer_6"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="pushButton_7"> + <property name="text"> + <string>edit</string> + </property> + </widget> + </item> </layout> </widget> </item> @@ -148,7 +168,7 @@ </property> <layout class="QHBoxLayout" name="horizontalLayout_4"> <item> - <widget class="QLabel" name="label"> + <widget class="QLabel" name="output_directory_label"> <property name="text"> <string>TextLabel</string> </property> @@ -220,7 +240,7 @@ <hints> <hint type="sourcelabel"> <x>550</x> - <y>447</y> + <y>310</y> </hint> <hint type="destinationlabel"> <x>550</x> @@ -236,7 +256,7 @@ <hints> <hint type="sourcelabel"> <x>476</x> - <y>548</y> + <y>598</y> </hint> <hint type="destinationlabel"> <x>568</x> @@ -252,7 +272,7 @@ <hints> <hint type="sourcelabel"> <x>562</x> - <y>548</y> + <y>598</y> </hint> <hint type="destinationlabel"> <x>648</x> @@ -267,8 +287,8 @@ <slot>clearFileList()</slot> <hints> <hint type="sourcelabel"> - <x>434</x> - <y>441</y> + <x>464</x> + <y>310</y> </hint> <hint type="destinationlabel"> <x>606</x> @@ -276,11 +296,77 @@ </hint> </hints> </connection> + <connection> + <sender>add_files_button</sender> + <signal>clicked()</signal> + <receiver>TandemRunDialog</receiver> + <slot>selectFastaFiles()</slot> + <hints> + <hint type="sourcelabel"> + <x>505</x> + <y>302</y> + </hint> + <hint type="destinationlabel"> + <x>630</x> + <y>331</y> + </hint> + </hints> + </connection> + <connection> + <sender>pushButton_3</sender> + <signal>clicked()</signal> + <receiver>TandemRunDialog</receiver> + <slot>selectMzFiles()</slot> + <hints> + <hint type="sourcelabel"> + <x>536</x> + <y>451</y> + </hint> + <hint type="destinationlabel"> + <x>613</x> + <y>450</y> + </hint> + </hints> + </connection> + <connection> + <sender>pushButton_5</sender> + <signal>clicked()</signal> + <receiver>TandemRunDialog</receiver> + <slot>selectOutputDirectory()</slot> + <hints> + <hint type="sourcelabel"> + <x>531</x> + <y>537</y> + </hint> + <hint type="destinationlabel"> + <x>651</x> + <y>519</y> + </hint> + </hints> + </connection> + <connection> + <sender>preset_combobox</sender> + <signal>currentIndexChanged(QString)</signal> + <receiver>TandemRunDialog</receiver> + <slot>setPresetName(QString)</slot> + <hints> + <hint type="sourcelabel"> + <x>64</x> + <y>149</y> + </hint> + <hint type="destinationlabel"> + <x>603</x> + <y>172</y> + </hint> + </hints> + </connection> </connections> <slots> - <slot>chooseFiles()</slot> <slot>reject()</slot> <slot>accept()</slot> - <slot>clearFileList()</slot> + <slot>selectFastaFiles()</slot> + <slot>selectMzFiles()</slot> + <slot>selectOutputDirectory()</slot> + <slot>setPresetName(QString)</slot> </slots> </ui> diff --git a/src/gui/tandem_run_dialog/tandemrundialog.cpp b/src/gui/tandem_run_dialog/tandemrundialog.cpp index c49262afe079d222172a45b8450c15da0e480d75..c00b0d5241689d9b6051f4ff98a7707308b51581 100644 --- a/src/gui/tandem_run_dialog/tandemrundialog.cpp +++ b/src/gui/tandem_run_dialog/tandemrundialog.cpp @@ -44,7 +44,10 @@ TandemRunDialog::TandemRunDialog(QWidget * parent): ui->setupUi(this); this->setModal(true); _p_fasta_file_list = new QStringListModel(); - + _p_mz_file_list = new QStringListModel(); + ui->fasta_file_listview->setModel(_p_fasta_file_list); + ui->mz_file_listview->setModel(_p_mz_file_list); + #if QT_VERSION >= 0x050000 // Qt5 code /* @@ -56,28 +59,112 @@ TandemRunDialog::TandemRunDialog(QWidget * parent): // Qt4 code #endif - + reset(); + fillPresetComboBox(); qDebug() << "TandemRunDialog::TandemRunDialog end"; } TandemRunDialog::~TandemRunDialog() { delete ui; + delete _p_fasta_file_list; + delete _p_mz_file_list; +} +void TandemRunDialog::setPresetName(QString preset_name) { + QSettings settings; + settings.setValue("tandem/preset_name", preset_name); +} +void TandemRunDialog::fillPresetComboBox() { + ui->preset_combobox->clear(); + QSettings settings; + QString default_preset_location = settings.value("path/tandemrun_preset_directory", "").toString(); + QString default_preset_name = settings.value("tandem/preset_name", "").toString(); + + QDir preset_dir(default_preset_location); + QStringList filters; + filters << "*.xml"; + preset_dir.setNameFilters(filters); + for (QFileInfo file_info: preset_dir.entryInfoList() ) { + ui->preset_combobox->addItem(file_info.baseName(), QVariant(file_info.absoluteFilePath())); + } + int index = ui->preset_combobox->findText(default_preset_name); + if ( index != -1 ) { // -1 for not found + ui->preset_combobox->setCurrentIndex(index); + } + +} +void TandemRunDialog::reset() { + QSettings settings; + QString default_output_location = settings.value("path/identificationfiles", "").toString(); + QString tandem_bin_path = settings.value("path/tandem_bin", "/usr/bin/tandem").toString(); + + ui->output_directory_label->setText(default_output_location); + ui->tandem_bin_label->setText(tandem_bin_path); + + _p_fasta_file_list->stringList().clear(); + _p_mz_file_list->stringList().clear(); + /* + if (filenames.size() > 0) { + settings.setValue("path/identificationfiles", QFileInfo(filenames[0]).absolutePath()); + }*/ +} + +void TandemRunDialog::selectOutputDirectory() { + try { + QSettings settings; + QString default_output_location = settings.value("path/identificationfiles", "").toString(); + + QString directory = QFileDialog::getExistingDirectory(this,tr("Choose output directory"),default_output_location ); + + if (!directory.isEmpty()) { + settings.setValue("path/identificationfiles", directory); + ui->output_directory_label->setText(directory); + } + + + } + catch (pappso::PappsoException & error) { + //QMessageBox::warning(this, + // tr("Error choosing identification result files : %1").arg(error.qwhat()), error); + } } void TandemRunDialog::selectFastaFiles() { try { QSettings settings; - QString default_location = settings.value("path/tandemrun_fastafiles_directory", "").toString(); + QString default_fasta_location = settings.value("path/tandemrun_fastafiles_directory", "").toString(); - QStringList filenames = QFileDialog::getOpenFileNames(this,tr("FASTA files"),default_location, + QStringList filenames = QFileDialog::getOpenFileNames(this,tr("FASTA files"),default_fasta_location, tr("FASTA files (*.fasta);;all files (*)") ); if (filenames.size() > 0) { settings.setValue("path/tandemrun_fastafiles_directory", QFileInfo(filenames[0]).absolutePath()); } - _p_fasta_file_list->setStringList(filenames); - ui->fasta_file_listview->setModel(_p_fasta_file_list); + QStringList file_list = _p_fasta_file_list->stringList(); + file_list.append(filenames); + _p_fasta_file_list->setStringList(file_list); + + } + catch (pappso::PappsoException & error) { + //QMessageBox::warning(this, + // tr("Error choosing identification result files : %1").arg(error.qwhat()), error); + } +} + +void TandemRunDialog::selectMzFiles() { + try { + QSettings settings; + QString default_mz_location = settings.value("path/tandemrun_mzfiles_directory", "").toString(); + + QStringList filenames = QFileDialog::getOpenFileNames(this,tr("select peak list files"),default_mz_location, + tr("mz files (*.mzXML *.mzML *.mgf);;all files (*)") ); + + if (filenames.size() > 0) { + settings.setValue("path/tandemrun_mzfiles_directory", QFileInfo(filenames[0]).absolutePath()); + } + QStringList file_list = _p_mz_file_list->stringList(); + file_list.append(filenames); + _p_mz_file_list->setStringList(file_list); } catch (pappso::PappsoException & error) { diff --git a/src/gui/tandem_run_dialog/tandemrundialog.h b/src/gui/tandem_run_dialog/tandemrundialog.h index a47f2913ff66b88597b4e3910807cbe86917e468..199854b2ad1487f29fe552e474f7ff18445a13cc 100644 --- a/src/gui/tandem_run_dialog/tandemrundialog.h +++ b/src/gui/tandem_run_dialog/tandemrundialog.h @@ -45,13 +45,20 @@ public: explicit TandemRunDialog(QWidget * parent); ~TandemRunDialog(); + void reset(); public slots: -void selectFastaFiles(); + void selectFastaFiles(); + void selectMzFiles(); + void selectOutputDirectory(); + void setPresetName(QString preset_name); signals: +private: + void fillPresetComboBox(); private: Ui::TandemRunDialog *ui; QStringListModel * _p_fasta_file_list; + QStringListModel * _p_mz_file_list; };