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

Merge branch 'master' into 'master'

Master

See merge request xtpcpp!3
parents f7c02895 e19228ed
No related branches found
No related tags found
No related merge requests found
......@@ -108,12 +108,13 @@ EditTandemPresetDialog::newTandemParameters(
const TandemParameters &tandem_params)
{
_tandem_params = tandem_params;
QSettings settings;
_preset_directory =
settings.value("path/tandemrun_preset_directory", "").toString();
_p_tandem_preset_file = new TandemParametersFile(QString("%1/temp.xml").arg(_preset_directory));
_p_tandem_preset_file =
new TandemParametersFile(QString("%1/temp.xml").arg(_preset_directory));
fillPresetComboBox();
populate();
}
......@@ -174,16 +175,26 @@ EditTandemPresetDialog::doSelectDir()
void
EditTandemPresetDialog::doSave()
{
readUi();
if(_p_tandem_preset_file == nullptr)
try
{
throw pappso::PappsoException(
QObject::tr("_p_tandem_preset_file == nullptr"));
readUi();
if(_p_tandem_preset_file == nullptr)
{
throw pappso::PappsoException(
QObject::tr("_p_tandem_preset_file == nullptr"));
}
_p_tandem_preset_file->setDirectory(QDir(_preset_directory));
_p_tandem_preset_file->setTandemParameters(_tandem_params);
fillPresetComboBox();
populate();
}
catch(pappso::PappsoException &error)
{
QMessageBox::warning(
this,
tr("Error :"),
tr("Error saving parameter file : %1\n").arg(error.qwhat()));
}
_p_tandem_preset_file->setDirectory(QDir(_preset_directory));
_p_tandem_preset_file->setTandemParameters(_tandem_params);
fillPresetComboBox();
populate();
}
void
......
......@@ -31,7 +31,6 @@
bool
MsIdentificationTableMsRunStatisticsHandler::shouldStop()
{
qDebug() << "RRRRRR test";
QMutexLocker locker(&m_mutex);
return true;
}
......@@ -101,7 +100,6 @@ MsIdListWorkerStatus::getStatus(
return WorkerStatus::Waiting;
}
return WorkerStatus::Waiting;
}
void
......
......@@ -40,7 +40,7 @@ class MsIdentificationTableMsRunStatisticsHandler :public MsRunStatisticsHandler
unsigned long getTotalCount() const;
bool shouldStop() override;
virtual bool shouldStop() override;
void requireStop(bool stop);
......
......@@ -44,15 +44,11 @@ void
MsIdListWorkerThread::doComputeMsNumber(
IdentificationDataSourceSp identificationDataSource)
{
// while(currentHandler->get(). == false)
// {
emit MsNumberComputing(identificationDataSource);
if(identificationDataSource->getMsRunSp()->findMsRunFile())
{
identificationDataSource->getMsRunSp()->checkMsRunStatistics();
}
identificationDataSource->getMsRunSp()->freeMsRunReaderSp();
emit MsNumberComputed();
// }
}
......@@ -33,7 +33,6 @@
class ProjectWindow;
// http://doc.qt.io/qt-4.8/qt-itemviews-chart-mainwindow-cpp.html
namespace Ui
{
class MsIdentificationView;
......
......@@ -41,11 +41,11 @@ MsIdentificationTableModel::MsIdentificationTableModel(
p_worker->moveToThread(&m_ms_id_list_thread);
m_ms_id_list_thread.start();
msp_workerStatus = std::make_shared<MsIdListWorkerStatus>(p_worker);
mp_movie = new QMovie("/home/trenne/Documents/graph/iconWait.gif");
mp_movie->start();
mp_movie->setScaledSize(QSize(20, 20));
connect(p_worker,
&MsIdListWorkerThread::MsNumberComputed,
this,
......@@ -120,8 +120,6 @@ MsIdentificationTableModel::getDescription(msIdentificationListColumn column)
const QString
MsIdentificationTableModel::getTitle(std::int8_t column)
{
qDebug() << "MsIdentificationTableModel::getTitle begin " << column;
switch(column)
{
......@@ -158,6 +156,18 @@ MsIdentificationTableModel::getTitle(std::int8_t column)
case(std::int8_t)msIdentificationListColumn::nb_ms_2:
return "Number of ms2";
break;
case(std::int8_t)msIdentificationListColumn::nb_ms_3:
return "Number of ms3";
break;
case(std::int8_t)msIdentificationListColumn::nb_tic_1:
return "Number of TIC 1";
break;
case(std::int8_t)msIdentificationListColumn::nb_tic_2:
return "Number of TIC 2 ";
break;
case(std::int8_t)msIdentificationListColumn::nb_tic_3:
return "Number of TIC 3";
break;
}
return "";
}
......@@ -203,6 +213,18 @@ MsIdentificationTableModel::getDescription(std::int8_t column)
case(std::int8_t)msIdentificationListColumn::nb_ms_2:
return "Number of ms2 spectra";
break;
case(std::int8_t)msIdentificationListColumn::nb_ms_3:
return "Number of ms3 spectra";
break;
case(std::int8_t)msIdentificationListColumn::nb_tic_1:
return "Number of TIC 1";
break;
case(std::int8_t)msIdentificationListColumn::nb_tic_2:
return "Number of TIC 2 ";
break;
case(std::int8_t)msIdentificationListColumn::nb_tic_3:
return "Number of TIC 3";
break;
}
return "";
}
......@@ -217,14 +239,13 @@ MsIdentificationTableModel::headerData(int section,
switch(role)
{
case Qt::DisplayRole:
qDebug() << section;
// qDebug() << section;
return QVariant(getTitle(section));
break;
case Qt::ToolTipRole:
return QVariant(getDescription(section));
break;
case Qt::SizeHintRole:
qDebug() << section;
return QSize(getColumnWidth(section), 40);
break;
}
......@@ -255,6 +276,9 @@ MsIdentificationTableModel::getColumnWidth(int column)
case(int)msIdentificationListColumn::nbr_unique:
return 160;
break;
case(int)msIdentificationListColumn::engine_name:
return 160;
break;
}
return 120;
}
......@@ -303,7 +327,10 @@ MsIdentificationTableModel::data(const QModelIndex &index, int role) const
if(col == (std::int8_t)msIdentificationListColumn::engine_name)
{
return QVariant(m_identificationDataSourceSpList.at(row)
->getIdentificationEngineName());
->getIdentificationEngineName() +
" " +
m_identificationDataSourceSpList.at(row)
->getIdentificationEngineVersion());
}
if(col == (std::int8_t)msIdentificationListColumn::id_msrun_id)
{
......@@ -346,63 +373,35 @@ MsIdentificationTableModel::data(const QModelIndex &index, int role) const
}
if(col == (std::int8_t)msIdentificationListColumn::nb_ms_1)
{
QVariant nb_ms1 =
m_identificationDataSourceSpList.at(row)
->getMsRunSp()
->getMsRunStatistics(MsRunStatistics::total_spectra_ms1);
if(nb_ms1.isNull())
{
WorkerStatus temp = msp_workerStatus.get()->getStatus(
m_identificationDataSourceSpList.at(row));
if(temp == WorkerStatus::Running)
{
return QVariant("");
}
else if(temp == WorkerStatus::Waiting)
{
return QVariant("Wait");
}
else
{
return QVariant("Error");
}
}
else
{
return nb_ms1;
}
return QVariant("Wait");
return getMsRunStatisticsNumber(row,
MsRunStatistics::total_spectra_ms1);
}
if(col == (std::int8_t)msIdentificationListColumn::nb_ms_2)
{
QVariant nb_ms2 =
m_identificationDataSourceSpList.at(row)
->getMsRunSp()
->getMsRunStatistics(MsRunStatistics::total_spectra_ms2);
if(nb_ms2.isNull())
{
WorkerStatus temp = msp_workerStatus.get()->getStatus(
m_identificationDataSourceSpList.at(row));
if(temp == WorkerStatus::Running)
{
return QVariant("");
}
else if(temp == WorkerStatus::Waiting)
{
return QVariant("Wait");
}
else
{
return QVariant("Error");
}
}
else
{
return nb_ms2;
}
return getMsRunStatisticsNumber(row,
MsRunStatistics::total_spectra_ms2);
}
if(col == (std::int8_t)msIdentificationListColumn::nb_ms_3)
{
return getMsRunStatisticsNumber(row,
MsRunStatistics::total_spectra_ms3);
}
if(col == (std::int8_t)msIdentificationListColumn::nb_tic_1)
{
return getMsRunStatisticsNumber(row,
MsRunStatistics::tic_spectra_ms1);
}
if(col == (std::int8_t)msIdentificationListColumn::nb_tic_2)
{
return getMsRunStatisticsNumber(row,
MsRunStatistics::tic_spectra_ms2);
}
if(col == (std::int8_t)msIdentificationListColumn::nb_tic_3)
{
return getMsRunStatisticsNumber(row,
MsRunStatistics::tic_spectra_ms3);
}
case Qt::ToolTipRole:
if(col == (std::int8_t)msIdentificationListColumn::id_file)
{
......@@ -418,43 +417,90 @@ MsIdentificationTableModel::data(const QModelIndex &index, int role) const
->getFileName());
}
return QVariant();
case Qt::DecorationRole:
if(col == (std::int8_t)msIdentificationListColumn::nb_ms_1)
{
QVariant nb_ms1 =
m_identificationDataSourceSpList.at(row)
->getMsRunSp()
->getMsRunStatistics(MsRunStatistics::total_spectra_ms1);
if(nb_ms1.isNull())
{
WorkerStatus temp = msp_workerStatus.get()->getStatus(
m_identificationDataSourceSpList.at(row));
if(temp == WorkerStatus::Running)
{
return mp_movie->currentImage();
}
}
return showMsRunStatisticsStatus(
row, MsRunStatistics::total_spectra_ms1);
}
if(col == (std::int8_t)msIdentificationListColumn::nb_ms_2)
{
QVariant nb_ms1 =
m_identificationDataSourceSpList.at(row)
->getMsRunSp()
->getMsRunStatistics(MsRunStatistics::total_spectra_ms2);
if(nb_ms1.isNull())
{
WorkerStatus temp = msp_workerStatus.get()->getStatus(
m_identificationDataSourceSpList.at(row));
if(temp == WorkerStatus::Running)
{
return mp_movie->currentImage();
}
}
return showMsRunStatisticsStatus(
row, MsRunStatistics::total_spectra_ms2);
}
if(col == (std::int8_t)msIdentificationListColumn::nb_ms_3)
{
return showMsRunStatisticsStatus(
row, MsRunStatistics::total_spectra_ms3);
}
if(col == (std::int8_t)msIdentificationListColumn::nb_tic_1)
{
return showMsRunStatisticsStatus(row,
MsRunStatistics::tic_spectra_ms1);
}
return QVariant();
if(col == (std::int8_t)msIdentificationListColumn::nb_tic_2)
{
return showMsRunStatisticsStatus(row,
MsRunStatistics::tic_spectra_ms2);
}
if(col == (std::int8_t)msIdentificationListColumn::nb_tic_3)
{
return showMsRunStatisticsStatus(row,
MsRunStatistics::tic_spectra_ms3);
}
return QVariant();
}
return QVariant();
}
QVariant
MsIdentificationTableModel::getMsRunStatisticsNumber(
int row, MsRunStatistics column) const
{
QVariant nb_ms =
m_identificationDataSourceSpList.at(row)->getMsRunSp()->getMsRunStatistics(
column);
if(nb_ms.isNull())
{
WorkerStatus temp = msp_workerStatus.get()->getStatus(
m_identificationDataSourceSpList.at(row));
if(temp == WorkerStatus::Running)
{
return QVariant("");
}
else if(temp == WorkerStatus::Waiting)
{
return QVariant("Wait");
}
else
{
return QVariant("Error");
}
}
else
{
return nb_ms;
}
}
QVariant
MsIdentificationTableModel::showMsRunStatisticsStatus(
int row, MsRunStatistics column) const
{
QVariant nb_ms =
m_identificationDataSourceSpList.at(row)->getMsRunSp()->getMsRunStatistics(
column);
if(nb_ms.isNull())
{
WorkerStatus temp = msp_workerStatus.get()->getStatus(
m_identificationDataSourceSpList.at(row));
if(temp == WorkerStatus::Running)
{
return mp_movie->currentImage();
}
}
return QVariant();
}
......
......@@ -48,8 +48,12 @@ enum class msIdentificationListColumn : std::int8_t
percent_assign = 7, ///< percent of assignation
id_msrun_id = 8, ///< identification of MsRunId
nb_ms_1 = 9, ///< number of ms1
nb_ms_2 = 10, ///< number of ms1
last = 11, ///< get list size
nb_ms_2 = 10, ///< number of ms2
nb_ms_3 = 11, ///< number of ms1
nb_tic_1 = 12, ///< number of ms2
nb_tic_2 = 13, ///< number of ms1
nb_tic_3 = 14, ///< number of ms2
last = 15, ///< get list size
};
class MsIdentificationListWindow;
......@@ -68,8 +72,6 @@ class MsIdentificationTableModel : public QAbstractTableModel
headerData(int section, Qt::Orientation orientation, int role) const override;
virtual QVariant data(const QModelIndex &index,
int role = Qt::DisplayRole) const override;
void paint(QPainter* painter, IdentificationDataSourceSp identificationDataSource,
const QModelIndex& index) const;
static const QString getTitle(msIdentificationListColumn column);
static const QString getDescription(msIdentificationListColumn column);
......@@ -77,8 +79,10 @@ void paint(QPainter* painter, IdentificationDataSourceSp identificationDataSourc
static const QString getDescription(std::int8_t column);
static msIdentificationListColumn
getMsIdentificationListColumn(std::int8_t column);
QVariant getMsRunStatisticsNumber(int row, MsRunStatistics column) const;
QVariant showMsRunStatisticsStatus(int row, MsRunStatistics column) const;
void setIdentificationDataSourceSpList(
std::vector<IdentificationDataSourceSp> &identificationDataSourceSpList);
......
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