1、重构”繁忙“效果控件和应用;
2、添加后台任务列表类
This commit is contained in:
parent
3a8825beb9
commit
c16358d8a7
|
|
@ -56,7 +56,7 @@ TwoDSpectralCompliance::TwoDSpectralCompliance(QWidget* parent)
|
||||||
layout->addWidget(this->_plot);
|
layout->addWidget(this->_plot);
|
||||||
setupPlot();
|
setupPlot();
|
||||||
createFloatingInfoWidget();
|
createFloatingInfoWidget();
|
||||||
_busy_indicator = new BusyIndicator(this);
|
_busy_indicator = new BusyIndicatorWidget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
TwoDSpectralCompliance::~TwoDSpectralCompliance()
|
TwoDSpectralCompliance::~TwoDSpectralCompliance()
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ class QwtPlotPicker;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class ScatterPlotItem;
|
class ScatterPlotItem;
|
||||||
class BusyIndicator;
|
class BusyIndicatorWidget;
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class TwoDSpectralCompliance;
|
class TwoDSpectralCompliance;
|
||||||
}
|
}
|
||||||
|
|
@ -102,7 +102,7 @@ private:
|
||||||
|
|
||||||
QPoint m_dragPosition;
|
QPoint m_dragPosition;
|
||||||
bool m_dragging = false;
|
bool m_dragging = false;
|
||||||
BusyIndicator* _busy_indicator = nullptr;
|
BusyIndicatorWidget* _busy_indicator = nullptr;
|
||||||
|
|
||||||
// 保存全局轴范围(用于重置放大)
|
// 保存全局轴范围(用于重置放大)
|
||||||
double m_globalXMin = 0.0, m_globalXMax = 0.0;
|
double m_globalXMin = 0.0, m_globalXMax = 0.0;
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ AntiConformEnergySpectrumView::AntiConformEnergySpectrumView(QWidget* parent)
|
||||||
_curve->setPen(QPen(QColor(23, 229, 238), 2));
|
_curve->setPen(QPen(QColor(23, 229, 238), 2));
|
||||||
_plot->AddCurve(_curve);
|
_plot->AddCurve(_curve);
|
||||||
|
|
||||||
_busy_indicator = new BusyIndicator(this);
|
_busy_indicator = new BusyIndicatorWidget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiConformEnergySpectrumView::~AntiConformEnergySpectrumView()
|
AntiConformEnergySpectrumView::~AntiConformEnergySpectrumView()
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
class QMenu;
|
class QMenu;
|
||||||
class CustomQwtPlot;
|
class CustomQwtPlot;
|
||||||
class QwtPlotCurve;
|
class QwtPlotCurve;
|
||||||
class BusyIndicator;
|
class BusyIndicatorWidget;
|
||||||
|
|
||||||
class AntiConformEnergySpectrumView : public MeasureAnalysisView {
|
class AntiConformEnergySpectrumView : public MeasureAnalysisView {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
@ -28,7 +28,7 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMenu* _menu = nullptr;
|
QMenu* _menu = nullptr;
|
||||||
BusyIndicator* _busy_indicator = nullptr;
|
BusyIndicatorWidget* _busy_indicator = nullptr;
|
||||||
CustomQwtPlot* _plot = nullptr;
|
CustomQwtPlot* _plot = nullptr;
|
||||||
QwtPlotCurve* _curve = nullptr;
|
QwtPlotCurve* _curve = nullptr;
|
||||||
QString _data_filename;
|
QString _data_filename;
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,29 @@
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
BusyIndicator::BusyIndicator(QWidget* parent)
|
BusyIndicator::BusyIndicator(QWidget* parent)
|
||||||
|
: QLabel { parent }
|
||||||
|
{
|
||||||
|
_busy_movie = new QMovie(":gif/BusyIndicator.gif"); // 转圈 GIF
|
||||||
|
_busy_movie->setScaledSize(QSize(50, 50));
|
||||||
|
this->setMovie(_busy_movie);
|
||||||
|
_busy_movie->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BusyIndicator::Start()
|
||||||
|
{
|
||||||
|
_busy_movie->start();
|
||||||
|
// this->setVisible(true);
|
||||||
|
// this->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BusyIndicator::Stop()
|
||||||
|
{
|
||||||
|
_busy_movie->stop();
|
||||||
|
// this->setVisible(false);
|
||||||
|
// this->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
BusyIndicatorWidget::BusyIndicatorWidget(QWidget* parent)
|
||||||
: QWidget { parent }
|
: QWidget { parent }
|
||||||
{
|
{
|
||||||
setAttribute(Qt::WA_TransparentForMouseEvents);
|
setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
|
|
@ -25,14 +48,14 @@ BusyIndicator::BusyIndicator(QWidget* parent)
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BusyIndicator::Start()
|
void BusyIndicatorWidget::Start()
|
||||||
{
|
{
|
||||||
_busy_movie->start();
|
_busy_movie->start();
|
||||||
this->setVisible(true);
|
this->setVisible(true);
|
||||||
this->update();
|
this->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BusyIndicator::Stop()
|
void BusyIndicatorWidget::Stop()
|
||||||
{
|
{
|
||||||
_busy_movie->stop();
|
_busy_movie->stop();
|
||||||
this->setVisible(false);
|
this->setVisible(false);
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,11 @@
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
class QMovie;
|
class QMovie;
|
||||||
|
|
||||||
class BusyIndicator : public QWidget
|
class BusyIndicator : public QLabel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
@ -17,4 +18,15 @@ private:
|
||||||
QMovie* _busy_movie;
|
QMovie* _busy_movie;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class BusyIndicatorWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit BusyIndicatorWidget(QWidget *parent = nullptr);
|
||||||
|
void Start();
|
||||||
|
void Stop();
|
||||||
|
private:
|
||||||
|
QMovie* _busy_movie;
|
||||||
|
};
|
||||||
|
|
||||||
#endif // BUSYINDICATOR_H
|
#endif // BUSYINDICATOR_H
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ CoincidenceEventTimeView::CoincidenceEventTimeView(QWidget *parent) :
|
||||||
_curve->setPen(QPen(QColor(23, 229, 238), 2));
|
_curve->setPen(QPen(QColor(23, 229, 238), 2));
|
||||||
_plot->AddCurve(_curve);
|
_plot->AddCurve(_curve);
|
||||||
|
|
||||||
_busy_indicator = new BusyIndicator(this);
|
_busy_indicator = new BusyIndicatorWidget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoincidenceEventTimeView::~CoincidenceEventTimeView()
|
CoincidenceEventTimeView::~CoincidenceEventTimeView()
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
class CustomQwtPlot;
|
class CustomQwtPlot;
|
||||||
class QwtPlotCurve;
|
class QwtPlotCurve;
|
||||||
class BusyIndicator;
|
class BusyIndicatorWidget;
|
||||||
|
|
||||||
class CoincidenceEventTimeView : public MeasureAnalysisView
|
class CoincidenceEventTimeView : public MeasureAnalysisView
|
||||||
{
|
{
|
||||||
|
|
@ -25,7 +25,7 @@ private:
|
||||||
private slots:
|
private slots:
|
||||||
void onActionPlotConfigure();
|
void onActionPlotConfigure();
|
||||||
private:
|
private:
|
||||||
BusyIndicator* _busy_indicator = nullptr;
|
BusyIndicatorWidget* _busy_indicator = nullptr;
|
||||||
CustomQwtPlot* _plot = nullptr;
|
CustomQwtPlot* _plot = nullptr;
|
||||||
QwtPlotCurve* _curve = nullptr;
|
QwtPlotCurve* _curve = nullptr;
|
||||||
QStringList _data_filenames;
|
QStringList _data_filenames;
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ ConformToTheEnergySpectrum::ConformToTheEnergySpectrum(QWidget *parent) :
|
||||||
_curve->setPen(QPen(QColor(23, 229, 238), 2));
|
_curve->setPen(QPen(QColor(23, 229, 238), 2));
|
||||||
_plot->AddCurve(_curve);
|
_plot->AddCurve(_curve);
|
||||||
|
|
||||||
_busy_indicator = new BusyIndicator(this);
|
_busy_indicator = new BusyIndicatorWidget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConformToTheEnergySpectrum::~ConformToTheEnergySpectrum()
|
ConformToTheEnergySpectrum::~ConformToTheEnergySpectrum()
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
class QMenu;
|
class QMenu;
|
||||||
class CustomQwtPlot;
|
class CustomQwtPlot;
|
||||||
class QwtPlotCurve;
|
class QwtPlotCurve;
|
||||||
class BusyIndicator;
|
class BusyIndicatorWidget;
|
||||||
|
|
||||||
class ConformToTheEnergySpectrum : public MeasureAnalysisView
|
class ConformToTheEnergySpectrum : public MeasureAnalysisView
|
||||||
{
|
{
|
||||||
|
|
@ -29,7 +29,7 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMenu* _menu = nullptr;
|
QMenu* _menu = nullptr;
|
||||||
BusyIndicator* _busy_indicator = nullptr;
|
BusyIndicatorWidget* _busy_indicator = nullptr;
|
||||||
CustomQwtPlot* _plot = nullptr;
|
CustomQwtPlot* _plot = nullptr;
|
||||||
QwtPlotCurve* _curve = nullptr;
|
QwtPlotCurve* _curve = nullptr;
|
||||||
QStringList _data_filenames;
|
QStringList _data_filenames;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ CountRateAnalysisView::CountRateAnalysisView(QWidget *parent) :
|
||||||
this->setViewType(PlotFrame);
|
this->setViewType(PlotFrame);
|
||||||
|
|
||||||
this->_menu = new QMenu(this);
|
this->_menu = new QMenu(this);
|
||||||
_busy_indicator = new BusyIndicator(this);
|
_busy_indicator = new BusyIndicatorWidget(this);
|
||||||
|
|
||||||
InitUi();
|
InitUi();
|
||||||
setupMenu();
|
setupMenu();
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#include "MeasureAnalysisView.h"
|
#include "MeasureAnalysisView.h"
|
||||||
|
|
||||||
class CustomQwtPlot;
|
class CustomQwtPlot;
|
||||||
class BusyIndicator;
|
class BusyIndicatorWidget;
|
||||||
class QMenu;
|
class QMenu;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
|
@ -41,7 +41,7 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::CountRateAnalysisView *ui;
|
Ui::CountRateAnalysisView *ui;
|
||||||
BusyIndicator* _busy_indicator = nullptr;
|
BusyIndicatorWidget* _busy_indicator = nullptr;
|
||||||
CustomQwtPlot *plot;
|
CustomQwtPlot *plot;
|
||||||
QMenu* _menu = nullptr;
|
QMenu* _menu = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,36 @@
|
||||||
using namespace DataProcessWorkPool;
|
using namespace DataProcessWorkPool;
|
||||||
using namespace io;
|
using namespace io;
|
||||||
|
|
||||||
|
DataProcessTaskList* DataProcessTaskList::_s_instance = nullptr;
|
||||||
|
|
||||||
|
DataProcessTaskList *DataProcessTaskList::Instance()
|
||||||
|
{
|
||||||
|
if (!_s_instance) {
|
||||||
|
_s_instance = new DataProcessTaskList();
|
||||||
|
}
|
||||||
|
return _s_instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
DataProcessTaskList::~DataProcessTaskList()
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataProcessTaskList::InserTask(DataProcessTask* task)
|
||||||
|
{
|
||||||
|
_task_list.insert(task->GetTaskName(), task);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataProcessTaskList::RemoveTask(const QString &task_name)
|
||||||
|
{
|
||||||
|
_task_list.remove(task_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataProcessTaskList::Clear()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DataProcessTask::SetFinishedNotifier(QObject* finished_notifier, const char* finished_process, const QString& project_name)
|
void DataProcessTask::SetFinishedNotifier(QObject* finished_notifier, const char* finished_process, const QString& project_name)
|
||||||
{
|
{
|
||||||
|
|
@ -65,7 +95,13 @@ void DataProcessTask::run()
|
||||||
if (!IsValidSetWorkParameters()) {
|
if (!IsValidSetWorkParameters()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DataProcessTaskList::Instance()->InserTask(this);
|
||||||
|
|
||||||
bool task_ok = processTask();
|
bool task_ok = processTask();
|
||||||
|
|
||||||
|
DataProcessTaskList::Instance()->RemoveTask(this->GetTaskName());
|
||||||
|
|
||||||
if ((GetFinishedNotifier() != nullptr) && (GetFinishedNotifierProcess() != nullptr)) {
|
if ((GetFinishedNotifier() != nullptr) && (GetFinishedNotifierProcess() != nullptr)) {
|
||||||
QMetaObject::invokeMethod(
|
QMetaObject::invokeMethod(
|
||||||
_finished_notifier,
|
_finished_notifier,
|
||||||
|
|
@ -103,6 +139,11 @@ bool ParticleDataTask::processTask()
|
||||||
return processEveryChannelParticleData();
|
return processEveryChannelParticleData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString &EveryChannelParticleCountDataTask::GetTaskName()
|
||||||
|
{
|
||||||
|
return QStringLiteral(u"[%1]通道粒子计数统计处理").arg(this->GetProjectName());
|
||||||
|
}
|
||||||
|
|
||||||
void EveryChannelParticleCountDataTask::SetAllChannelCountResultDir(const QString& dir_path)
|
void EveryChannelParticleCountDataTask::SetAllChannelCountResultDir(const QString& dir_path)
|
||||||
{
|
{
|
||||||
this->_all_ch_count_dir = dir_path;
|
this->_all_ch_count_dir = dir_path;
|
||||||
|
|
@ -226,6 +267,11 @@ bool EveryChannelParticleCountDataTask::processEveryChannelParticleData()
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
const QString &ParticleDataSortTask::GetTaskName()
|
||||||
|
{
|
||||||
|
return QStringLiteral(u"[%1]粒子数据按时间排序处理").arg(this->GetProjectName());
|
||||||
|
}
|
||||||
|
|
||||||
void ParticleDataSortTask::SetSortedResultDir(const QString& sorted_result_dir)
|
void ParticleDataSortTask::SetSortedResultDir(const QString& sorted_result_dir)
|
||||||
{
|
{
|
||||||
this->_sorted_result_dir = sorted_result_dir;
|
this->_sorted_result_dir = sorted_result_dir;
|
||||||
|
|
@ -455,6 +501,11 @@ bool ParticleDataSortByMinimysTask::processEveryChannelParticleData()
|
||||||
return ret_ok;
|
return ret_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString &CoincidenceEventAnalysisTask::GetTaskName()
|
||||||
|
{
|
||||||
|
return QStringLiteral(u"[%1]粒子数据符合处理").arg(this->GetProjectName());
|
||||||
|
}
|
||||||
|
|
||||||
bool CoincidenceEventAnalysisTask::processTask()
|
bool CoincidenceEventAnalysisTask::processTask()
|
||||||
{
|
{
|
||||||
const QString& project_name = GetProjectName();
|
const QString& project_name = GetProjectName();
|
||||||
|
|
@ -533,6 +584,11 @@ bool CoincidenceEventAnalysisTask::processTask()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString &AutoFindPeaksTask::GetTaskName()
|
||||||
|
{
|
||||||
|
return QStringLiteral(u"[%1]粒子通道计数谱自动寻峰处理").arg(this->GetProjectName());
|
||||||
|
}
|
||||||
|
|
||||||
void AutoFindPeaksTask::SetAnalysisType(AnalysisType analysis_type)
|
void AutoFindPeaksTask::SetAnalysisType(AnalysisType analysis_type)
|
||||||
{
|
{
|
||||||
this->_analysis_type = analysis_type;
|
this->_analysis_type = analysis_type;
|
||||||
|
|
@ -631,6 +687,11 @@ bool AutoFindPeaksTask::processTask()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString &ChannelEnergyScaleFittingTask::GetTaskName()
|
||||||
|
{
|
||||||
|
return QStringLiteral(u"[%1]能量刻度拟合处理").arg(this->GetProjectName());
|
||||||
|
}
|
||||||
|
|
||||||
void ChannelEnergyScaleFittingTask::SetData(const FitDataMap& channel_energy_scale_fit_data_map, const QMap<QString, int>& fit_degree_map)
|
void ChannelEnergyScaleFittingTask::SetData(const FitDataMap& channel_energy_scale_fit_data_map, const QMap<QString, int>& fit_degree_map)
|
||||||
{
|
{
|
||||||
this->_channel_energy_scale_fit_data_map = channel_energy_scale_fit_data_map;
|
this->_channel_energy_scale_fit_data_map = channel_energy_scale_fit_data_map;
|
||||||
|
|
@ -717,6 +778,11 @@ bool ChannelEnergyScaleFittingTask::processTask()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString &EnergyScaleParticleDataTask::GetTaskName()
|
||||||
|
{
|
||||||
|
return QStringLiteral(u"[%1]粒子数据能量刻度处理").arg(this->GetProjectName());
|
||||||
|
}
|
||||||
|
|
||||||
bool EnergyScaleParticleDataTask::processTask()
|
bool EnergyScaleParticleDataTask::processTask()
|
||||||
{
|
{
|
||||||
const QString& project_name = GetProjectName();
|
const QString& project_name = GetProjectName();
|
||||||
|
|
@ -779,6 +845,11 @@ bool EnergyScaleParticleDataTask::processTask()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString &EnergyCountProcessTask::GetTaskName()
|
||||||
|
{
|
||||||
|
return QStringLiteral(u"[%1]粒子能量计数统计处理").arg(this->GetProjectName());
|
||||||
|
}
|
||||||
|
|
||||||
bool EnergyCountProcessTask::processTask()
|
bool EnergyCountProcessTask::processTask()
|
||||||
{
|
{
|
||||||
const QString& project_name = GetProjectName();
|
const QString& project_name = GetProjectName();
|
||||||
|
|
@ -859,6 +930,11 @@ bool EnergyCountProcessTask::processTask()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString &EnergyScaleCoincidenceDataTask::GetTaskName()
|
||||||
|
{
|
||||||
|
return QStringLiteral(u"[%1]粒子符合数据能量刻度处理").arg(this->GetProjectName());
|
||||||
|
}
|
||||||
|
|
||||||
bool EnergyScaleCoincidenceDataTask::processTask()
|
bool EnergyScaleCoincidenceDataTask::processTask()
|
||||||
{
|
{
|
||||||
const QString& project_name = GetProjectName();
|
const QString& project_name = GetProjectName();
|
||||||
|
|
@ -946,6 +1022,11 @@ bool EnergyScaleCoincidenceDataTask::processTask()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString &EnergyScaleaAntiCoincidenceDataTask::GetTaskName()
|
||||||
|
{
|
||||||
|
return QStringLiteral(u"[%1]粒子反符合数据能量刻度处理").arg(this->GetProjectName());
|
||||||
|
}
|
||||||
|
|
||||||
bool EnergyScaleaAntiCoincidenceDataTask::processTask()
|
bool EnergyScaleaAntiCoincidenceDataTask::processTask()
|
||||||
{
|
{
|
||||||
const QString& project_name = GetProjectName();
|
const QString& project_name = GetProjectName();
|
||||||
|
|
@ -1020,3 +1101,4 @@ bool EnergyScaleaAntiCoincidenceDataTask::processTask()
|
||||||
LOG_INFO(info);
|
LOG_INFO(info);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ namespace DataProcessWorkPool
|
||||||
class DataProcessTask : public QRunnable
|
class DataProcessTask : public QRunnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
virtual const QString& GetTaskName() = 0;
|
||||||
|
|
||||||
void SetFinishedNotifier(QObject* finished_notifier, const char* finished_process, const QString& project_name);
|
void SetFinishedNotifier(QObject* finished_notifier, const char* finished_process, const QString& project_name);
|
||||||
const QString& GetProjectName() const;
|
const QString& GetProjectName() const;
|
||||||
const char* GetFinishedNotifierProcess() const;
|
const char* GetFinishedNotifierProcess() const;
|
||||||
|
|
@ -39,6 +41,24 @@ namespace DataProcessWorkPool
|
||||||
QVariant _task_result_data;
|
QVariant _task_result_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class DataProcessTaskList
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static DataProcessTaskList* Instance();
|
||||||
|
virtual ~DataProcessTaskList();
|
||||||
|
void InserTask(DataProcessTask *task);
|
||||||
|
void RemoveTask(const QString& task_name);
|
||||||
|
void Clear();
|
||||||
|
signals:
|
||||||
|
void taskInserted();
|
||||||
|
void taskRemoved(const QString& task_name);
|
||||||
|
private:
|
||||||
|
explicit DataProcessTaskList() {}
|
||||||
|
static DataProcessTaskList* _s_instance;
|
||||||
|
private:
|
||||||
|
QMap<QString, DataProcessTask*> _task_list;
|
||||||
|
};
|
||||||
|
|
||||||
class ParticleDataTask : public DataProcessTask
|
class ParticleDataTask : public DataProcessTask
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -58,6 +78,7 @@ namespace DataProcessWorkPool
|
||||||
class EveryChannelParticleCountDataTask : public ParticleDataTask
|
class EveryChannelParticleCountDataTask : public ParticleDataTask
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
const QString& GetTaskName();
|
||||||
void SetAllChannelCountResultDir(const QString& dir_path);
|
void SetAllChannelCountResultDir(const QString& dir_path);
|
||||||
const QString& GetAllChannelCountResultDir() const;
|
const QString& GetAllChannelCountResultDir() const;
|
||||||
void SetEveryChannelCountResultDir(const QString&dir_path);
|
void SetEveryChannelCountResultDir(const QString&dir_path);
|
||||||
|
|
@ -74,6 +95,7 @@ namespace DataProcessWorkPool
|
||||||
class ParticleDataSortTask : public ParticleDataTask
|
class ParticleDataSortTask : public ParticleDataTask
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
const QString& GetTaskName();
|
||||||
void SetSortedResultDir(const QString& sorted_result_dir);
|
void SetSortedResultDir(const QString& sorted_result_dir);
|
||||||
const QString& GetSortedResultDir() const;
|
const QString& GetSortedResultDir() const;
|
||||||
|
|
||||||
|
|
@ -91,12 +113,16 @@ namespace DataProcessWorkPool
|
||||||
|
|
||||||
class CoincidenceEventAnalysisTask : public DataProcessTask
|
class CoincidenceEventAnalysisTask : public DataProcessTask
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
const QString& GetTaskName();
|
||||||
private:
|
private:
|
||||||
virtual bool processTask() override;
|
virtual bool processTask() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AutoFindPeaksTask : public DataProcessTask {
|
class AutoFindPeaksTask : public DataProcessTask
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
|
const QString& GetTaskName();
|
||||||
void SetAnalysisType(AnalysisType analysis_type);
|
void SetAnalysisType(AnalysisType analysis_type);
|
||||||
void SetDataFileList(const QMap<QString, QVariant>& data_files_set);
|
void SetDataFileList(const QMap<QString, QVariant>& data_files_set);
|
||||||
void SetResultDir(const QString& result_dir);
|
void SetResultDir(const QString& result_dir);
|
||||||
|
|
@ -111,10 +137,12 @@ namespace DataProcessWorkPool
|
||||||
int _step_win_width = 7;
|
int _step_win_width = 7;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ChannelEnergyScaleFittingTask : public DataProcessTask {
|
class ChannelEnergyScaleFittingTask : public DataProcessTask
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
typedef QMap<QString, QMap<int, QList<double> > > FitDataMap;
|
typedef QMap<QString, QMap<int, QList<double> > > FitDataMap;
|
||||||
public:
|
public:
|
||||||
|
const QString& GetTaskName();
|
||||||
void SetData(const FitDataMap& channel_energy_scale_fit_data_map, const QMap<QString, int>& fit_degree_map);
|
void SetData(const FitDataMap& channel_energy_scale_fit_data_map, const QMap<QString, int>& fit_degree_map);
|
||||||
void SetResultDir(const QString& result_dir);
|
void SetResultDir(const QString& result_dir);
|
||||||
virtual bool IsValidSetWorkParameters() const override;
|
virtual bool IsValidSetWorkParameters() const override;
|
||||||
|
|
@ -128,24 +156,32 @@ namespace DataProcessWorkPool
|
||||||
|
|
||||||
class EnergyScaleParticleDataTask : public DataProcessTask
|
class EnergyScaleParticleDataTask : public DataProcessTask
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
const QString& GetTaskName();
|
||||||
private:
|
private:
|
||||||
virtual bool processTask() override;
|
virtual bool processTask() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EnergyCountProcessTask : public DataProcessTask
|
class EnergyCountProcessTask : public DataProcessTask
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
const QString& GetTaskName();
|
||||||
private:
|
private:
|
||||||
virtual bool processTask() override;
|
virtual bool processTask() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EnergyScaleCoincidenceDataTask : public DataProcessTask
|
class EnergyScaleCoincidenceDataTask : public DataProcessTask
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
const QString& GetTaskName();
|
||||||
private:
|
private:
|
||||||
virtual bool processTask() override;
|
virtual bool processTask() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EnergyScaleaAntiCoincidenceDataTask : public DataProcessTask
|
class EnergyScaleaAntiCoincidenceDataTask : public DataProcessTask
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
const QString& GetTaskName();
|
||||||
private:
|
private:
|
||||||
virtual bool processTask() override;
|
virtual bool processTask() override;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ class CustomQwtPlot;
|
||||||
class CustomQwtPlotXaxisSelector;
|
class CustomQwtPlotXaxisSelector;
|
||||||
class QwtPlotPicker;
|
class QwtPlotPicker;
|
||||||
class QwtPlotCurve;
|
class QwtPlotCurve;
|
||||||
class BusyIndicator;
|
class BusyIndicatorWidget;
|
||||||
|
|
||||||
class EnergyCountPeakFitView : public MeasureAnalysisView {
|
class EnergyCountPeakFitView : public MeasureAnalysisView {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@
|
||||||
#include "GlobalDefine.h"
|
#include "GlobalDefine.h"
|
||||||
#include "DeviceParamsManagerDlg.h"
|
#include "DeviceParamsManagerDlg.h"
|
||||||
#include "NuclideLib.h"
|
#include "NuclideLib.h"
|
||||||
|
#include <QListWidget>
|
||||||
|
#include <QDesktopWidget>
|
||||||
|
|
||||||
using namespace ads;
|
using namespace ads;
|
||||||
|
|
||||||
|
|
@ -91,6 +93,7 @@ MainWindow::MainWindow(QWidget* parent)
|
||||||
|
|
||||||
initMainWindow();
|
initMainWindow();
|
||||||
initAction();
|
initAction();
|
||||||
|
initStatusBar();
|
||||||
|
|
||||||
this->applyStyleSheet();
|
this->applyStyleSheet();
|
||||||
_s_main_win = this;
|
_s_main_win = this;
|
||||||
|
|
@ -302,6 +305,20 @@ void MainWindow::initAction()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::initStatusBar()
|
||||||
|
{
|
||||||
|
_w_watcher_list = new QListWidget(this);
|
||||||
|
_w_watcher_list->setWindowFlags(Qt::ToolTip | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
|
||||||
|
QPalette palette = _w_watcher_list->palette();
|
||||||
|
palette.setColor(QPalette::Base, Qt::gray);
|
||||||
|
_w_watcher_list->setPalette(palette);
|
||||||
|
_w_watcher_list->setAutoFillBackground(true);
|
||||||
|
|
||||||
|
_btn_task_watcher = new QPushButton(QStringLiteral(u"后台任务监视"), _status_bar);
|
||||||
|
_status_bar->addPermanentWidget(_btn_task_watcher);
|
||||||
|
connect(_btn_task_watcher, &QPushButton::clicked, this, &MainWindow::onShowBackgroundTaskList);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::applyStyleSheet()
|
void MainWindow::applyStyleSheet()
|
||||||
{
|
{
|
||||||
// #ifdef ENABLE_DEBUG
|
// #ifdef ENABLE_DEBUG
|
||||||
|
|
@ -367,8 +384,53 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
||||||
QMainWindow::closeEvent(event);
|
QMainWindow::closeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::moveEvent(QMoveEvent *event)
|
||||||
|
{
|
||||||
|
QMainWindow::moveEvent(event);
|
||||||
|
if (this->_w_watcher_list->isVisible()) {
|
||||||
|
onShowBackgroundTaskList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::on_action_nuclideLib_triggered()
|
void MainWindow::on_action_nuclideLib_triggered()
|
||||||
{
|
{
|
||||||
NuclideLibManage *nuclidelib = new NuclideLibManage();
|
NuclideLibManage *nuclidelib = new NuclideLibManage();
|
||||||
nuclidelib->show();
|
nuclidelib->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::onShowBackgroundTaskList()
|
||||||
|
{
|
||||||
|
this->updateGeometry();
|
||||||
|
this->_btn_task_watcher->updateGeometry();
|
||||||
|
|
||||||
|
this->_w_watcher_list->adjustSize();
|
||||||
|
QSize pop_size = this->_w_watcher_list->size();
|
||||||
|
|
||||||
|
QPoint btn_top_teft = this->_btn_task_watcher->mapToGlobal(QPoint(0, 0));
|
||||||
|
int btn_width = this->_btn_task_watcher->width();
|
||||||
|
// int btn_height = this->_btn_task_watcher->height();
|
||||||
|
|
||||||
|
int x = btn_top_teft.x() + btn_width - pop_size.width() - 2;
|
||||||
|
int y = btn_top_teft.y() - pop_size.height() - 6;
|
||||||
|
|
||||||
|
// QRect screen_rect = QApplication::desktop()->availableGeometry(this);
|
||||||
|
// if (x < screen_rect.left() + 6)
|
||||||
|
// x = screen_rect.left();
|
||||||
|
// if (x + pop_size.width() > screen_rect.right())
|
||||||
|
// x = screen_rect.right() - pop_size.width();
|
||||||
|
// if (y < screen_rect.top())
|
||||||
|
// y = btn_top_teft.y() + btn_height + 6;
|
||||||
|
|
||||||
|
this->_w_watcher_list->move(x, y);
|
||||||
|
this->_w_watcher_list->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::resizeEvent(QResizeEvent *event)
|
||||||
|
{
|
||||||
|
QMainWindow::resizeEvent(event);
|
||||||
|
if (this->_w_watcher_list->isVisible()) {
|
||||||
|
onShowBackgroundTaskList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ class CDockWidget;
|
||||||
}
|
}
|
||||||
class QPlainTextEdit;
|
class QPlainTextEdit;
|
||||||
class MeasureAnalysisTreeView;
|
class MeasureAnalysisTreeView;
|
||||||
|
class QListWidget;
|
||||||
|
class QPushButton;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow
|
||||||
|
|
@ -45,6 +47,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void initMainWindow();
|
void initMainWindow();
|
||||||
void initAction();
|
void initAction();
|
||||||
|
void initStatusBar();
|
||||||
void applyStyleSheet();
|
void applyStyleSheet();
|
||||||
void closeProject(const QString &project_name);
|
void closeProject(const QString &project_name);
|
||||||
|
|
||||||
|
|
@ -54,14 +57,19 @@ signals:
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent(QShowEvent* event) override;
|
virtual void showEvent(QShowEvent* event) override;
|
||||||
virtual void closeEvent(QCloseEvent* event) override;
|
virtual void closeEvent(QCloseEvent* event) override;
|
||||||
|
virtual void moveEvent(QMoveEvent* event) override;
|
||||||
|
virtual void resizeEvent(QResizeEvent* event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_action_nuclideLib_triggered();
|
void on_action_nuclideLib_triggered();
|
||||||
|
void onShowBackgroundTaskList();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMutex _mutex_info_output;
|
QMutex _mutex_info_output;
|
||||||
QPlainTextEdit* _plain_edit_info_output;
|
QPlainTextEdit* _plain_edit_info_output;
|
||||||
QStatusBar* _status_bar;
|
QStatusBar* _status_bar;
|
||||||
|
QPushButton* _btn_task_watcher;
|
||||||
|
QListWidget* _w_watcher_list;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ ParticleInjectTimeAnalysisView::ParticleInjectTimeAnalysisView(QWidget *parent)
|
||||||
this->_menu = new QMenu(this);
|
this->_menu = new QMenu(this);
|
||||||
setupMenu();
|
setupMenu();
|
||||||
|
|
||||||
_busy_indicator = new BusyIndicator(this);
|
_busy_indicator = new BusyIndicatorWidget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleInjectTimeAnalysisView::~ParticleInjectTimeAnalysisView()
|
ParticleInjectTimeAnalysisView::~ParticleInjectTimeAnalysisView()
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
class CustomQwtPlot;
|
class CustomQwtPlot;
|
||||||
class QwtPlotCurve;
|
class QwtPlotCurve;
|
||||||
class BusyIndicator;
|
class BusyIndicatorWidget;
|
||||||
class QMenu;
|
class QMenu;
|
||||||
|
|
||||||
class ParticleInjectTimeAnalysisView : public MeasureAnalysisView
|
class ParticleInjectTimeAnalysisView : public MeasureAnalysisView
|
||||||
|
|
@ -27,7 +27,7 @@ protected:
|
||||||
virtual void showEvent(QShowEvent* e) override final;
|
virtual void showEvent(QShowEvent* e) override final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BusyIndicator* _busy_indicator = nullptr;
|
BusyIndicatorWidget* _busy_indicator = nullptr;
|
||||||
CustomQwtPlot *_plot = nullptr;
|
CustomQwtPlot *_plot = nullptr;
|
||||||
QwtPlotCurve *_curve = nullptr;
|
QwtPlotCurve *_curve = nullptr;
|
||||||
QMenu* _menu = nullptr;
|
QMenu* _menu = nullptr;
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ ParticleTimeDifferenceView::ParticleTimeDifferenceView(QWidget *parent)
|
||||||
this->_menu = new QMenu(this);
|
this->_menu = new QMenu(this);
|
||||||
setupMenu();
|
setupMenu();
|
||||||
|
|
||||||
_busy_indicator = new BusyIndicator(this);
|
_busy_indicator = new BusyIndicatorWidget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleTimeDifferenceView::~ParticleTimeDifferenceView()
|
ParticleTimeDifferenceView::~ParticleTimeDifferenceView()
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ class QMenu;
|
||||||
class CustomQwtPlot;
|
class CustomQwtPlot;
|
||||||
class CustomQwtPlotXaxisSelector;
|
class CustomQwtPlotXaxisSelector;
|
||||||
class QwtPlotHistogram;
|
class QwtPlotHistogram;
|
||||||
class BusyIndicator;
|
class BusyIndicatorWidget;
|
||||||
|
|
||||||
class ParticleTimeDifferenceView : public MeasureAnalysisView
|
class ParticleTimeDifferenceView : public MeasureAnalysisView
|
||||||
{
|
{
|
||||||
|
|
@ -33,7 +33,7 @@ protected:
|
||||||
virtual void showEvent(QShowEvent* e) override final;
|
virtual void showEvent(QShowEvent* e) override final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BusyIndicator* _busy_indicator = nullptr;
|
BusyIndicatorWidget* _busy_indicator = nullptr;
|
||||||
CustomQwtPlot* _plot = nullptr;
|
CustomQwtPlot* _plot = nullptr;
|
||||||
QMenu* _menu = nullptr;
|
QMenu* _menu = nullptr;
|
||||||
QDialog* _curve_show_setting_dlg = nullptr;
|
QDialog* _curve_show_setting_dlg = nullptr;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user