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

display progress messages from tandemRunWrapper

parent d0b295e0
......@@ -32,7 +32,6 @@
#include <QTemporaryDir>
#include <pappsomspp/pappsoexception.h>
#include <pappsomspp/exception/exceptionnotfound.h>
#include <pappsomspp/processing/tandemwrapper/tandemwrapperrun.h>
#include <pappsomspp/processing/filters/filterchargedeconvolution.h>
#include "../../files/tandemparametersfile.h"
#include "../../utils/utils.h"
......@@ -427,9 +426,16 @@ TandemBatchProcess::runOne(const QString &mz_file)
QDir().mkdir(tmpDirOption);
}
pappso::TandemWrapperRun tandem_run(
_tandem_run_batch._tandem_bin_path, tmpDirOption);
mp_tandemWrapperRun = &tandem_run;
connect(mp_tandemWrapperRun,
&pappso::TandemWrapperRun::tandemProgressMessage,
this,
&TandemBatchProcess::tandemWrapperRunProgressMessage);
tandem_run.run(xml_input_file.fileName(), outputStream, errorStream);
......@@ -489,3 +495,21 @@ TandemBatchProcess::readyReadStandardError()
// qDebug();
_p_monitor->appendText(m_xtProcess->readAllStandardError().data());
}
void
TandemBatchProcess::tandemWrapperRunProgressMessage(QString message)
{
qDebug() << message;
m_tmpMessage = message;
_p_monitor->appendQString(m_tmpMessage);
if(shouldIstop())
{
if(mp_tandemWrapperRun != nullptr)
{
mp_tandemWrapperRun->killXtandemProcess();
throw pappso::PappsoException(
QObject::tr("X!Tandem stopped by the user processing %1 sample")
.arg(m_currentMzFile));
}
}
}
......@@ -32,6 +32,7 @@
#include <QXmlStreamWriter>
#include <QObject>
#include "../../gui/mainwindow.h"
#include <pappsomspp/processing/tandemwrapper/tandemwrapperrun.h>
class TandemBatchProcess : public QObject
{
......@@ -50,10 +51,11 @@ class TandemBatchProcess : public QObject
virtual void prepareXmlDatabaseFile();
bool shouldIstop();
private slots:
void readyReadStandardOutput();
void readyReadStandardError();
void tandemWrapperRunProgressMessage(QString message);
private:
void runOne(const QString &mz_file);
......@@ -68,6 +70,8 @@ class TandemBatchProcess : public QObject
private:
QTemporaryFile _tmp_database_file;
MainWindow *_p_main_window = nullptr;
QProcess *m_xtProcess = nullptr;
QProcess *m_xtProcess = nullptr;
QString m_currentMzFile;
pappso::TandemWrapperRun *mp_tandemWrapperRun = nullptr;
QString m_tmpMessage;
};
......@@ -211,17 +211,24 @@ MainWindow::doWorkerAppendText(const char *text)
{
_p_waiting_message_dialog->appendText(text);
}
void
MainWindow::doWorkerAppendQString(QString message)
{
_p_waiting_message_dialog->appendText(message);
}
void
MainWindow::doActionQuit()
{
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
qDebug();
this->close();
}
void
MainWindow::doAcceptedExportSpreadsheetDialog()
{
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
qDebug();
try
{
QString format = this->_p_export_spreadsheet_dialog->getExportFormat();
......@@ -249,8 +256,7 @@ MainWindow::doAcceptedExportSpreadsheetDialog()
QDir parent(filename);
parent.cdUp();
settings.setValue("path/export_ods", parent.canonicalPath());
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
<< parent.absolutePath();
qDebug() << parent.absolutePath();
}
if(filename.isEmpty())
{
......@@ -303,7 +309,7 @@ MainWindow::doAcceptedLoadResultDialog()
showWaitingMessage(tr("Loading files"));
emit operateLoadingResults(is_individual, param, file_list);
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
qDebug();
}
void
......
......@@ -96,6 +96,7 @@ class MainWindow : public QMainWindow
void doDisplayJobFinished(QString message);
void doDisplayJobCanceled(QString message);
void doWorkerAppendText(const char *);
void doWorkerAppendQString(QString message);
void doWorkerSetText(QString);
void doProjectReady(ProjectSp project_sp);
void doLoadingResultsReady(ProjectSp project_sp);
......
......@@ -113,6 +113,19 @@ WaitingMessageDialog::appendText(const char *text)
ui->console_plaintextedit->insertPlainText(text);
}
void
WaitingMessageDialog::appendText(const QString &message)
{
QMutexLocker mutex_locker(&_mutex);
ui->console_plaintextedit->setHidden(false);
// ui->console_plaintextedit->appendText(text);
ui->console_plaintextedit->moveCursor(QTextCursor::End);
ui->console_plaintextedit->insertPlainText(message);
}
void
WaitingMessageDialog::setText(const QString text)
{
......
......@@ -48,6 +48,7 @@ class WaitingMessageDialog : public QDialog
void message(const QString &message);
void message(const QString &message, int progress_value);
void appendText(const char *text);
void appendText(const QString & message);
void setText(const QString text);
void showEvent(QShowEvent *event);
void hideEvent(QHideEvent *event);
......
......@@ -74,6 +74,10 @@ WorkerThread::WorkerThread(MainWindow *p_main_window)
&WorkMonitor::workerAppendText,
p_main_window,
&MainWindow::doWorkerAppendText);
connect(_p_work_monitor,
&WorkMonitor::workerAppendQString,
p_main_window,
&MainWindow::doWorkerAppendQString);
connect(_p_work_monitor,
&WorkMonitor::workerSetText,
p_main_window,
......
......@@ -87,6 +87,12 @@ WorkMonitor::appendText(const char *p_char)
emit workerAppendText(p_char);
}
void
WorkMonitor::appendQString(const QString &message)
{
emit workerAppendQString(message);
}
void
WorkMonitor::setText(const QString text)
{
......
......@@ -40,6 +40,7 @@ class WorkMonitorInterface
virtual void message(const QString &message, int value) = 0;
virtual void setProgressMaximumValue(int max_value) = 0;
virtual void appendText(const char *p_char) = 0;
virtual void appendQString(const QString &message) = 0;
virtual void setText(const QString text) = 0;
};
......@@ -54,6 +55,7 @@ class WorkMonitor : public QObject, public WorkMonitorInterface
void message(const QString &message, int value) override;
void setProgressMaximumValue(int max_value) override;
void appendText(const char *p_char) override;
void appendQString(const QString &message) override;
void setText(const QString text) override;
signals:
......@@ -62,6 +64,7 @@ class WorkMonitor : public QObject, public WorkMonitorInterface
void workerMessage(QString message);
void workerMessagePercent(QString message, int value);
void workerAppendText(const char *p_char);
void workerAppendQString(QString message);
void workerSetText(QString text);
private:
......
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