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

export spreadsheets to TSV files

parent 99ce9450
No related branches found
No related tags found
No related merge requests found
......@@ -205,7 +205,7 @@ MainWindow::doAcceptedExportSpreadsheetDialog()
this,
tr("Save ODS file"),
QString("%1/untitled.ods").arg(default_location),
tr("Open Document Spreadsheet (*.ods)"));
tr("Open Document Spreadsheet (*.ods);;tabulated text file (*.tsv)"));
if(filename.isEmpty())
{
......
......@@ -57,103 +57,177 @@ WorkerThread::WorkerThread(MainWindow *p_main_window)
#if QT_VERSION >= 0x050000
// Qt5 code
// worker message
connect(_p_work_monitor, &WorkMonitor::workerMessage, p_main_window,
connect(_p_work_monitor,
&WorkMonitor::workerMessage,
p_main_window,
&MainWindow::doDisplayLoadingMessage);
connect(_p_work_monitor, &WorkMonitor::workerMessagePercent, p_main_window,
connect(_p_work_monitor,
&WorkMonitor::workerMessagePercent,
p_main_window,
&MainWindow::doDisplayLoadingMessagePercent);
connect(_p_work_monitor, &WorkMonitor::workerAppendText, p_main_window,
connect(_p_work_monitor,
&WorkMonitor::workerAppendText,
p_main_window,
&MainWindow::doWorkerAppendText);
connect(_p_work_monitor, &WorkMonitor::workerSetText, p_main_window,
connect(_p_work_monitor,
&WorkMonitor::workerSetText,
p_main_window,
&MainWindow::doWorkerSetText);
connect(_p_work_monitor, &WorkMonitor::workerJobFinished, p_main_window,
connect(_p_work_monitor,
&WorkMonitor::workerJobFinished,
p_main_window,
&MainWindow::doDisplayJobFinished);
connect(p_main_window, &MainWindow::operateXpipFile, this,
connect(p_main_window,
&MainWindow::operateXpipFile,
this,
&WorkerThread::doXpipFileLoad);
connect(p_main_window, &MainWindow::operateWritingXpipFile, this,
connect(p_main_window,
&MainWindow::operateWritingXpipFile,
this,
&WorkerThread::doWritingXpipFile);
connect(this, &WorkerThread::projectReady, p_main_window,
connect(this,
&WorkerThread::projectReady,
p_main_window,
&MainWindow::doProjectReady);
connect(this, &WorkerThread::loadingResultsFinished, p_main_window,
connect(this,
&WorkerThread::loadingResultsFinished,
p_main_window,
&MainWindow::doLoadingResultsReady);
connect(p_main_window, &MainWindow::operateLoadingResults, this,
connect(p_main_window,
&MainWindow::operateLoadingResults,
this,
&WorkerThread::doLoadingResults);
connect(p_main_window, &MainWindow::operateRunningXtandem, this,
connect(p_main_window,
&MainWindow::operateRunningXtandem,
this,
&WorkerThread::doRunningXtandem);
connect(this, &WorkerThread::loadingMessage, p_main_window,
connect(this,
&WorkerThread::loadingMessage,
p_main_window,
&MainWindow::doDisplayLoadingMessage);
connect(this, &WorkerThread::projectNotReady, p_main_window,
connect(this,
&WorkerThread::projectNotReady,
p_main_window,
&MainWindow::doProjectNotReady);
// grouping
connect(p_main_window, &MainWindow::operateGrouping, this,
connect(p_main_window,
&MainWindow::operateGrouping,
this,
&WorkerThread::doGrouping);
connect(this, &WorkerThread::groupingFinished, p_main_window,
connect(this,
&WorkerThread::groupingFinished,
p_main_window,
&MainWindow::doGroupingFinished);
// masschroq write
connect(p_main_window, &MainWindow::operateWritingMassChroqFile, this,
connect(p_main_window,
&MainWindow::operateWritingMassChroqFile,
this,
&WorkerThread::doWritingMassChroqFile);
connect(p_main_window, &MainWindow::operateWritingMassChroqPrmFile, this,
connect(p_main_window,
&MainWindow::operateWritingMassChroqPrmFile,
this,
&WorkerThread::doWritingMassChroqPrmFile);
connect(p_main_window, &MainWindow::operateWritingMcqrSpectralCountFile, this,
connect(p_main_window,
&MainWindow::operateWritingMcqrSpectralCountFile,
this,
&WorkerThread::doWritingMcqrSpectralCountFile);
// protic write
connect(p_main_window, &MainWindow::operateWritingProticFile, this,
connect(p_main_window,
&MainWindow::operateWritingProticFile,
this,
&WorkerThread::doWritingProticFile);
// writing ODS file :
connect(p_main_window, &MainWindow::operateWritingOdsFile, this,
connect(p_main_window,
&MainWindow::operateWritingOdsFile,
this,
&WorkerThread::doWritingOdsFile);
connect(this, &WorkerThread::operationFailed, p_main_window,
connect(this,
&WorkerThread::operationFailed,
p_main_window,
&MainWindow::doOperationFailed);
connect(this, &WorkerThread::operationFinished, p_main_window,
connect(this,
&WorkerThread::operationFinished,
p_main_window,
&MainWindow::doOperationFinished);
#else
// Qt4 code
// worker message
connect(_p_work_monitor, SIGNAL(workerMessage(QString)), p_main_window,
connect(_p_work_monitor,
SIGNAL(workerMessage(QString)),
p_main_window,
SLOT(doDisplayLoadingMessage(QString)));
connect(_p_work_monitor, SIGNAL(workerMessage(QString, int)), p_main_window,
connect(_p_work_monitor,
SIGNAL(workerMessage(QString, int)),
p_main_window,
SLOT(doDisplayLoadingMessage(QString, int)));
connect(_p_work_monitor, SIGNAL(workerAppendText(char *)), p_main_window,
connect(_p_work_monitor,
SIGNAL(workerAppendText(char *)),
p_main_window,
SLOT(doWorkerAppendText(char *)));
connect(p_main_window, SIGNAL(operateXpipFile(QString)), this,
connect(p_main_window,
SIGNAL(operateXpipFile(QString)),
this,
SLOT(doXpipFileLoad(QString)));
connect(this, SIGNAL(projectReady(ProjectSp)), p_main_window,
connect(this,
SIGNAL(projectReady(ProjectSp)),
p_main_window,
SLOT(doProjectReady(ProjectSp)));
connect(
p_main_window,
SIGNAL(operateLoadingResults(bool, AutomaticFilterParameters, QStringList)),
this, SLOT(doLoadingResults(bool, AutomaticFilterParameters, QStringList)));
this,
SLOT(doLoadingResults(bool, AutomaticFilterParameters, QStringList)));
connect(p_main_window, SIGNAL(operateRunningXtandem(TandemRunBatch)), this,
connect(p_main_window,
SIGNAL(operateRunningXtandem(TandemRunBatch)),
this,
SLOT(doRunningXtandem(TandemRunBatch)));
connect(this, SIGNAL(loadingMessage(QString)), p_main_window,
connect(this,
SIGNAL(loadingMessage(QString)),
p_main_window,
SLOT(doDisplayLoadingMessage(QString)));
connect(this, SIGNAL(projectNotReady(QString)), p_main_window,
connect(this,
SIGNAL(projectNotReady(QString)),
p_main_window,
SLOT(doProjectNotReady(QString)));
// grouping
connect(p_main_window, SIGNAL(operateGrouping(ProjectSp)), this,
connect(p_main_window,
SIGNAL(operateGrouping(ProjectSp)),
this,
SLOT(doGrouping(ProjectSp)));
connect(this, SIGNAL(groupingFinished()), p_main_window,
connect(this,
SIGNAL(groupingFinished()),
p_main_window,
SLOT(doGroupingFinished()));
// masschroq write
connect(p_main_window,
SIGNAL(operateWritingMassChroqFile(QString, ProjectSp)), this,
SIGNAL(operateWritingMassChroqFile(QString, ProjectSp)),
this,
SLOT(doWritingMassChroqFile(QString, ProjectSp)));
// protic write
connect(p_main_window, SIGNAL(operateWritingProticFile(QString, ProjectSp)),
this, SLOT(doWritingProticFile(QString, ProjectSp)));
connect(p_main_window,
SIGNAL(operateWritingProticFile(QString, ProjectSp)),
this,
SLOT(doWritingProticFile(QString, ProjectSp)));
// writing ODS file :
connect(p_main_window, SIGNAL(operateWritingOdsFile(QString, ProjectSp)),
this, SLOT(doWritingOdsFile(QString, ProjectSp)));
connect(this, SIGNAL(operationFailed(QString)), p_main_window,
connect(p_main_window,
SIGNAL(operateWritingOdsFile(QString, ProjectSp)),
this,
SLOT(doWritingOdsFile(QString, ProjectSp)));
connect(this,
SIGNAL(operationFailed(QString)),
p_main_window,
SLOT(doOperationFailed(QString)));
connect(this, SIGNAL(operationFinished()), p_main_window,
connect(this,
SIGNAL(operationFinished()),
p_main_window,
SLOT(doOperationFinished()));
#endif
......@@ -170,34 +244,56 @@ WorkerThread::WorkerThread(ProjectWindow *p_project_window)
// Qt5 code
// worker message
connect(_p_work_monitor, &WorkMonitor::workerMessage, p_project_window,
connect(_p_work_monitor,
&WorkMonitor::workerMessage,
p_project_window,
&ProjectWindow::doDisplayLoadingMessage);
connect(_p_work_monitor, &WorkMonitor::workerMessagePercent, p_project_window,
connect(_p_work_monitor,
&WorkMonitor::workerMessagePercent,
p_project_window,
&ProjectWindow::doDisplayLoadingMessagePercent);
connect(this, &WorkerThread::loadingMessage, p_project_window,
connect(this,
&WorkerThread::loadingMessage,
p_project_window,
&ProjectWindow::doDisplayLoadingMessage);
// grouping
connect(p_project_window, &ProjectWindow::operateGrouping, this,
connect(p_project_window,
&ProjectWindow::operateGrouping,
this,
&WorkerThread::doGrouping);
connect(this, &WorkerThread::groupingFinished, p_project_window,
connect(this,
&WorkerThread::groupingFinished,
p_project_window,
&ProjectWindow::doGroupingFinished);
// PTM grouping on IdentificationGroup
connect(p_project_window, &ProjectWindow::operatePtmGroupingOnIdentification,
this, &WorkerThread::doPtmGroupingOnIdentification);
connect(this, &WorkerThread::ptmGroupingOnIdentificationFinished,
p_project_window, &ProjectWindow::refreshPtmGroup);
connect(p_project_window,
&ProjectWindow::operatePtmGroupingOnIdentification,
this,
&WorkerThread::doPtmGroupingOnIdentification);
connect(this,
&WorkerThread::ptmGroupingOnIdentificationFinished,
p_project_window,
&ProjectWindow::refreshPtmGroup);
// grouping on IdentificationGroup
connect(p_project_window, &ProjectWindow::operateGroupingOnIdentification,
this, &WorkerThread::doGroupingOnIdentification);
connect(this, &WorkerThread::groupingOnIdentificationFinished,
p_project_window, &ProjectWindow::refreshGroup);
connect(p_project_window,
&ProjectWindow::operateGroupingOnIdentification,
this,
&WorkerThread::doGroupingOnIdentification);
connect(this,
&WorkerThread::groupingOnIdentificationFinished,
p_project_window,
&ProjectWindow::refreshGroup);
connect(this, &WorkerThread::operationFailed, p_project_window,
connect(this,
&WorkerThread::operationFailed,
p_project_window,
&ProjectWindow::doOperationFailed);
connect(this, &WorkerThread::operationFinished, p_project_window,
connect(this,
&WorkerThread::operationFinished,
p_project_window,
&ProjectWindow::doOperationFinished);
#else
......@@ -205,27 +301,39 @@ WorkerThread::WorkerThread(ProjectWindow *p_project_window)
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
// worker message
connect(_p_work_monitor, SIGNAL(workerMessage(QString)), p_project_window,
connect(_p_work_monitor,
SIGNAL(workerMessage(QString)),
p_project_window,
SLOT(doDisplayLoadingMessage(QString)));
connect(_p_work_monitor, SIGNAL(workerMessage(QString, int)),
p_project_window, SLOT(doDisplayLoadingMessage(QString, int)));
connect(_p_work_monitor,
SIGNAL(workerMessage(QString, int)),
p_project_window,
SLOT(doDisplayLoadingMessage(QString, int)));
connect(this, SIGNAL(loadingMessage(QString)), p_project_window,
connect(this,
SIGNAL(loadingMessage(QString)),
p_project_window,
SLOT(doDisplayLoadingMessage(QString)));
// grouping
connect(p_project_window, SIGNAL(operateGrouping(ProjectSp)), this,
connect(p_project_window,
SIGNAL(operateGrouping(ProjectSp)),
this,
SLOT(doGrouping(ProjectSp)));
connect(this, SIGNAL(groupingFinished()), p_project_window,
connect(this,
SIGNAL(groupingFinished()),
p_project_window,
SLOT(doGroupingFinished()));
// PTM grouping on IdentificationGroup
connect(p_project_window,
SIGNAL(operatePtmGroupingOnIdentification(IdentificationGroup *)),
this, SLOT(doPtmGroupingOnIdentification(IdentificationGroup *)));
this,
SLOT(doPtmGroupingOnIdentification(IdentificationGroup *)));
connect(this,
SIGNAL(ptmGroupingOnIdentificationFinished(IdentificationGroup *)),
p_project_window, SLOT(refreshPtmGroup(IdentificationGroup *)));
p_project_window,
SLOT(refreshPtmGroup(IdentificationGroup *)));
// grouping on IdentificationGroup
connect(
......@@ -234,12 +342,18 @@ WorkerThread::WorkerThread(ProjectWindow *p_project_window)
operateGroupingOnIdentification(IdentificationGroup *, GroupingType)),
this,
SLOT(doGroupingOnIdentification(IdentificationGroup *, GroupingType)));
connect(this, SIGNAL(groupingOnIdentificationFinished(IdentificationGroup *)),
p_project_window, SLOT(refreshGroup(IdentificationGroup *)));
connect(this,
SIGNAL(groupingOnIdentificationFinished(IdentificationGroup *)),
p_project_window,
SLOT(refreshGroup(IdentificationGroup *)));
connect(this, SIGNAL(operationFailed(QString)), p_project_window,
connect(this,
SIGNAL(operationFailed(QString)),
p_project_window,
SLOT(doOperationFailed(QString)));
connect(this, SIGNAL(operationFinished()), p_project_window,
connect(this,
SIGNAL(operationFinished()),
p_project_window,
SLOT(doOperationFinished()));
#endif
......@@ -396,11 +510,25 @@ WorkerThread::doWritingOdsFile(QString filename, ProjectSp project_sp)
try
{
emit loadingMessage(tr("writing ODS file, please wait"));
OdsDocWriter writer(filename);
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ ;
QFileInfo file_info(filename);
CalcWriterInterface *p_writer = nullptr;
if(file_info.suffix() == "tsv")
{
emit loadingMessage(tr("writing TSV files, please wait"));
p_writer = new TsvDirectoryWriter (filename);
}
else
{
emit loadingMessage(tr("writing ODS file, please wait"));
p_writer = new OdsDocWriter(filename);
}
OdsExport export_ods(project_sp.get());
export_ods.write(&writer, _p_work_monitor);
writer.close();
export_ods.write(p_writer, _p_work_monitor);
p_writer->close();
delete p_writer;
emit operationFinished();
}
catch(pappso::PappsoException &error)
......@@ -579,14 +707,14 @@ WorkerThread::doRunningXtandem(TandemRunBatch tandem_run_batch)
if(use_htcondor)
{
TandemCondorProcess xt_process(_p_main_window, _p_work_monitor,
tandem_run_batch);
TandemCondorProcess xt_process(
_p_main_window, _p_work_monitor, tandem_run_batch);
xt_process.run();
}
else
{
TandemBatchProcess xt_process(_p_main_window, _p_work_monitor,
tandem_run_batch);
TandemBatchProcess xt_process(
_p_main_window, _p_work_monitor, tandem_run_batch);
xt_process.run();
}
......
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