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

new work progress monitoring system

parent e3b7d22b
No related branches found
No related tags found
No related merge requests found
......@@ -129,6 +129,7 @@ SET(XTPCPP_SRCS
./gui/ptm_island_list_view/ptmislandproxymodel.cpp
./gui/waiting_message_dialog/waitingmessagedialog.cpp
./gui/workerthread.cpp
./utils/workmonitor.cpp
)
SET (GUI_UIS
......@@ -174,6 +175,7 @@ SET(XTPCPP_MOC_HDRS
./gui/ptm_island_list_view/ptmislandproxymodel.h
./gui/waiting_message_dialog/waitingmessagedialog.h
./gui/workerthread.h
./utils/workmonitor.h
)
......
......@@ -129,6 +129,12 @@ void MainWindow::doDisplayLoadingMessage(QString message) {
_p_waiting_message_dialog->message(message);
ui->statusbar->showMessage(message);
}
void MainWindow::doDisplayLoadingMessage(QString message, int value) {
qDebug() << "MainWindow::doDisplayLoadingMessage " << message << " " << value;
_p_waiting_message_dialog->message(message, value);
ui->statusbar->showMessage(message);
}
void MainWindow::doActionQuit() {
qDebug() << "MainWindow::doActionQuit begin";
this->close();
......
......@@ -64,6 +64,7 @@ public slots:
void doActionSpreadsheet();
void doActionModifications();
void doDisplayLoadingMessage(QString message);
void doDisplayLoadingMessage(QString message, int value);
void doProjectReady(ProjectSp project_sp);
void doProjectNotReady(QString error);
void doAcceptedLoadResultDialog();
......
......@@ -41,6 +41,8 @@
WorkerThread::WorkerThread(MainWindow * p_main_window)
{
qDebug() << "WorkerThread::WorkerThread begin MainWindow";
_p_work_monitor = new WorkMonitor();
#if QT_VERSION >= 0x050000
// Qt5 code
......@@ -51,6 +53,9 @@ WorkerThread::WorkerThread(MainWindow * p_main_window)
*/
#else
// Qt4 code
//worker message
connect(_p_work_monitor, SIGNAL(workerMessage(QString)), p_main_window,SLOT(doDisplayLoadingMessage(QString)));
connect(_p_work_monitor, SIGNAL(workerMessage(QString, int)), p_main_window,SLOT(doDisplayLoadingMessage(QString, int)));
connect(p_main_window, SIGNAL(operateXpipFile(QString)), this,SLOT(doXpipFileLoad(QString)));
connect(this, SIGNAL(projectReady(ProjectSp)), p_main_window,SLOT(doProjectReady(ProjectSp)));
......
......@@ -34,6 +34,7 @@
#include <QCloseEvent>
#include "../core/automaticfilterparameters.h"
#include "../core/project.h"
#include "../utils/workmonitor.h"
class MainWindow;
class ProjectWindow;
......@@ -73,6 +74,9 @@ signals:
void ptmGroupingOnIdentificationFinished(IdentificationGroup * p_identification_group);
void operationFinished();
void operationFailed(QString error);
private:
WorkMonitor * _p_work_monitor;
};
#endif // WORKERTHREAD_H
/**
* \file utils/workmonitor.cpp
* \date 10/6/2017
* \author Olivier Langella
* \brief monitoring progress in any worker thread
*/
/*******************************************************************************
* Copyright (c) 2017 Olivier Langella <Olivier.Langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
* XTPcpp is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* XTPcpp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@u-psud.fr> - initial API and implementation
******************************************************************************/
#include "workmonitor.h"
void WorkMonitor::message(const QString & message) {
emit workerMessage(message);
}
void WorkMonitor::message(const QString & message, int value) {
emit workerMessage(message,value);
}
/**
* \file utils/workmonitor.h
* \date 10/6/2017
* \author Olivier Langella
* \brief monitoring progress in any worker thread
*/
/*******************************************************************************
* Copyright (c) 2017 Olivier Langella <Olivier.Langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
* XTPcpp is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* XTPcpp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@u-psud.fr> - initial API and implementation
******************************************************************************/
#ifndef WORKMONITOR_H
#define WORKMONITOR_H
#include <QObject>
class WorkMonitorInterface
{
public:
virtual void message(const QString & message) = 0;
virtual void message(const QString & message, int value) = 0;
};
class WorkMonitor: public QObject, WorkMonitorInterface
{
Q_OBJECT
public:
void message(const QString & message) override;
void message(const QString & message, int value) override;
signals:
void workerMessage(QString message);
void workerMessage(QString message, int value);
};
#endif // WORKMONITOR_H
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