Skip to content
Snippets Groups Projects
Commit 2ff2145d authored by Langella Olivier's avatar Langella Olivier
Browse files

checking MS run file path completed

parent 020e9b46
No related branches found
No related tags found
No related merge requests found
......@@ -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();
......
......@@ -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>
......@@ -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();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment