Commit ac500f8e authored by Langella Olivier's avatar Langella Olivier
Browse files

Merge branch 'renne' into 'master'

Add a message to select mgf or tdf in tandem run dialog #41

See merge request !42
parents ab438668 dd6b2502
......@@ -26,9 +26,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-156</y>
<y>-123</y>
<width>541</width>
<height>704</height>
<height>671</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
......@@ -117,7 +117,7 @@
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>X!Tandem memory requirement (MB)</string>
<string>X!Tandem memor&amp;y requirement (MB)</string>
</property>
</widget>
</item>
......@@ -291,37 +291,6 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_rd">
<item>
<spacer name="horizontalSpacer_7">
<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="QRadioButton" name="radioButton">
<property name="text">
<string>use MGF file</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_2">
<property name="text">
<string>use TDF file</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
......
......@@ -64,7 +64,6 @@ TandemRunDialog::TandemRunDialog(QWidget *parent)
settings.value("condor/tmp_dir", QStandardPaths::TempLocation);
#if QT_VERSION >= 0x050000
// Qt5 code
#else
......@@ -403,6 +402,7 @@ TandemRunDialog::selectTdfFolder()
{
try
{
// Input select folders
QSettings settings;
QString default_tdf_location =
settings.value("path/tandemrun_tdf_directory", "/").toString();
......@@ -431,22 +431,76 @@ TandemRunDialog::selectTdfFolder()
QFileInfo(directories_names[0]).absolutePath());
directories_names.pop_front();
}
for(QString directory_name : directories_names)
// Input select wich type between mgf and TDF
QMessageBox msgBox;
QPushButton *mgf_button =
msgBox.addButton(tr("MGF file"), QMessageBox::ActionRole);
QPushButton *tdf_button =
msgBox.addButton(tr("TDF file"), QMessageBox::ActionRole);
msgBox.addButton(QMessageBox::Discard);
msgBox.setText("Which file do you want to use ?");
msgBox.setInformativeText("Choose between MGF and TDF format");
msgBox.setDefaultButton(QMessageBox::Discard);
msgBox.exec();
if(msgBox.clickedButton() == mgf_button)
{
// qDebug() << directory_name+"/analysis.tdf";
if(!QFileInfo(directory_name + "/analysis.tdf").exists())
// Use the MGF file for identification
for(QString &directory_name : directories_names)
{
throw pappso::PappsoException(
tr(
"The directory %1/ does not contain the mandatory analysis.tdf "
"file")
.arg(directory_name));
QDir dir = QDir(directory_name);
QStringList filters;
filters << "*.mgf";
dir.setNameFilters(filters);
QFileInfoList results = dir.entryInfoList(dir.nameFilters());
qDebug() << results;
if(results.size() == 0)
{
throw pappso::PappsoException(
tr("The directory %1/ does not contain the mandatory "
"mgf file")
.arg(directory_name));
}
else if(results.size() > 1)
{
throw pappso::PappsoException(
tr("The directory %1/ contains multiple mgf files\nPlease "
"correct the ambigous situation\n")
.arg(directory_name));
}
else
{
directory_name = results[0].absoluteFilePath();
}
}
QStringList file_list = _p_mz_file_list->stringList();
file_list.append(directories_names);
_p_mz_file_list->setStringList(file_list);
}
else if(msgBox.clickedButton() == tdf_button)
{
// Use analysis.tdf file for identification
for(QString &directory_name : directories_names)
{
directory_name = directory_name + "/analysis.tdf";
if(!QFileInfo(directory_name).exists())
{
throw pappso::PappsoException(
tr("The directory %1/ does not contain the mandatory "
"analysis.tdf file")
.arg(directory_name));
}
}
QStringList file_list = _p_mz_file_list->stringList();
file_list.append(directories_names);
_p_mz_file_list->setStringList(file_list);
QStringList file_list = _p_mz_file_list->stringList();
file_list.append(directories_names);
_p_mz_file_list->setStringList(file_list);
}
}
catch(pappso::PappsoException &error)
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment