diff --git a/src/core/msrun.cpp b/src/core/msrun.cpp index cfd706e7d5442bbf0100bd505e5f88af64c48d1b..1c65d870b6a1d8ac6579a12c191362d23797c464 100644 --- a/src/core/msrun.cpp +++ b/src/core/msrun.cpp @@ -111,7 +111,17 @@ MsRun::findMsRunFile() // first look at the file path :) _msrun_reader_sp = getMsRunReaderSp(); if(_msrun_reader_sp != nullptr) - return true; + { + QFileInfo real_file(this->getFilename()); + if(real_file.exists()) + { + return true; + } + else + { + _msrun_reader_sp = nullptr; + } + } QFileInfo file_original(this->getFilename()); QString basename = file_original.baseName(); QString onlyfilename = file_original.fileName(); diff --git a/src/gui/export/export_masschroq_dialog/export_masschroq_dialog.ui b/src/gui/export/export_masschroq_dialog/export_masschroq_dialog.ui index 8e479dc82022a6044afbd8e54130a4bd74aa2ab3..cb5836ebb98e50330a93640e72ba04b9ef3dc4f0 100644 --- a/src/gui/export/export_masschroq_dialog/export_masschroq_dialog.ui +++ b/src/gui/export/export_masschroq_dialog/export_masschroq_dialog.ui @@ -202,7 +202,7 @@ </property> </widget> </item> - <item row="2" column="0"> + <item row="3" column="0"> <spacer name="verticalSpacer_3"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -252,6 +252,13 @@ </layout> </widget> </item> + <item row="2" column="0"> + <widget class="QLabel" name="msrunFilepathOkLabel"> + <property name="text"> + <string>TextLabel</string> + </property> + </widget> + </item> </layout> </widget> </widget> @@ -339,10 +346,27 @@ </hint> </hints> </connection> + <connection> + <sender>browseMsrunDirectoryButton</sender> + <signal>clicked()</signal> + <receiver>ExportMasschroqDialog</receiver> + <slot>doBrowseMsrunDirectory()</slot> + <hints> + <hint type="sourcelabel"> + <x>557</x> + <y>137</y> + </hint> + <hint type="destinationlabel"> + <x>787</x> + <y>184</y> + </hint> + </hints> + </connection> </connections> <slots> <slot>reject()</slot> <slot>accept()</slot> <slot>doCheckMsrunFilepath()</slot> + <slot>doBrowseMsrunDirectory()</slot> </slots> </ui> diff --git a/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.cpp b/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.cpp index a6b086e6c85ab13698aeaaf5c35b29f679f43b6e..7d7960342442061a31c26aba0514b4053cc44d89 100644 --- a/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.cpp +++ b/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.cpp @@ -45,6 +45,7 @@ ExportMasschroqDialog::ExportMasschroqDialog(QWidget *parent) this->setModal(true); ui->directorySelectWidget->setHidden(true); + ui->msrunFilepathOkLabel->setHidden(true); #if QT_VERSION >= 0x050000 // Qt5 code @@ -173,6 +174,7 @@ void ExportMasschroqDialog::doCheckMsrunFilepath() { + ui->msrunFilepathOkLabel->setHidden(true); bool is_ok = true; for(IdentificationDataSourceSp p_ident_data_source : mp_project->getIdentificationDataSourceStore() @@ -187,15 +189,23 @@ ExportMasschroqDialog::doCheckMsrunFilepath() else { is_ok = false; + } + if(!is_ok) + { ui->warningDirectoryLabel->setText( tr("%1 not found : Please choose the directory to look for this MS " - "run file.")); + "run file.") + .arg(msrun_sp.get()->getFilename())); ui->directorySelectWidget->setHidden(false); + break; } } if(is_ok) { ui->directorySelectWidget->setHidden(true); + + ui->msrunFilepathOkLabel->setText(tr("All MS run files found")); + ui->msrunFilepathOkLabel->setHidden(false); } } @@ -206,11 +216,15 @@ ExportMasschroqDialog::doBrowseMsrunDirectory() QSettings settings; QString path = settings.value("path/mzdatadir", "").toString(); QString filename = QFileDialog::getExistingDirectory( - this, tr("Save TSV files"), QString("%1").arg(path)); + this, tr("Choose directory to look for MS runs"), QString("%1").arg(path)); - QDir parent(filename); - parent.cdUp(); - settings.setValue("path/mzdatadir", parent.canonicalPath()); - qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " " - << parent.absolutePath(); + if(!filename.isEmpty()) + { + QDir parent(filename); + // parent.cdUp(); + settings.setValue("path/mzdatadir", parent.canonicalPath()); + doCheckMsrunFilepath(); + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " " + << parent.absolutePath(); + } }