处理已知bug
This commit is contained in:
parent
73d4544880
commit
c113ae5fa8
|
|
@ -10,7 +10,6 @@ EnergyScaleDataModel::EnergyScaleDataModel(const QString& filename) : _data_file
|
||||||
|
|
||||||
EnergyScaleDataModel::~EnergyScaleDataModel()
|
EnergyScaleDataModel::~EnergyScaleDataModel()
|
||||||
{
|
{
|
||||||
SaveData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnergyScaleDataModel::SetDataFilename(const QString& filename)
|
void EnergyScaleDataModel::SetDataFilename(const QString& filename)
|
||||||
|
|
@ -18,6 +17,11 @@ void EnergyScaleDataModel::SetDataFilename(const QString& filename)
|
||||||
_data_filename = filename;
|
_data_filename = filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString &EnergyScaleDataModel::GetDataFilename() const
|
||||||
|
{
|
||||||
|
return _data_filename;
|
||||||
|
}
|
||||||
|
|
||||||
bool EnergyScaleDataModel::LoadData()
|
bool EnergyScaleDataModel::LoadData()
|
||||||
{
|
{
|
||||||
QFile json_file(_data_filename);
|
QFile json_file(_data_filename);
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ public:
|
||||||
~EnergyScaleDataModel();
|
~EnergyScaleDataModel();
|
||||||
|
|
||||||
void SetDataFilename(const QString& filename);
|
void SetDataFilename(const QString& filename);
|
||||||
|
const QString& GetDataFilename() const;
|
||||||
|
|
||||||
bool LoadData();
|
bool LoadData();
|
||||||
bool SaveData();
|
bool SaveData();
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,20 @@
|
||||||
|
|
||||||
using namespace ads;
|
using namespace ads;
|
||||||
|
|
||||||
QMutex MainWindow::_s_mutex_info_output;
|
MainWindow* MainWindow::_s_main_win = nullptr;
|
||||||
QPlainTextEdit* MainWindow::_s_plain_edit_info_output = nullptr;
|
|
||||||
QStatusBar* MainWindow::_s_status_bar = nullptr;
|
|
||||||
|
|
||||||
void MainWindow::OutputInfo(OutputInfoType out_type, const QString& ouput_info)
|
void MainWindow::OutputInfo(OutputInfoType out_type, const QString& ouput_info)
|
||||||
|
{
|
||||||
|
|
||||||
|
QMetaObject::invokeMethod(_s_main_win, "onOutputInfo", Qt::QueuedConnection, Q_ARG(int, int(out_type)), Q_ARG(QString, ouput_info));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::ShowStatusBarMsg(const QString& msg)
|
||||||
|
{
|
||||||
|
QMetaObject::invokeMethod(_s_main_win, "onShowStatusBarMsg", Qt::QueuedConnection, Q_ARG(QString, msg));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onOutputInfo(int out_type, const QString &ouput_info)
|
||||||
{
|
{
|
||||||
if (!ouput_info.isEmpty()) {
|
if (!ouput_info.isEmpty()) {
|
||||||
QStringList list_str_out_type = {
|
QStringList list_str_out_type = {
|
||||||
|
|
@ -52,25 +61,25 @@ void MainWindow::OutputInfo(OutputInfoType out_type, const QString& ouput_info)
|
||||||
.arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"))
|
.arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"))
|
||||||
.arg(list_str_out_type.at(int(out_type)))
|
.arg(list_str_out_type.at(int(out_type)))
|
||||||
.arg(ouput_info);
|
.arg(ouput_info);
|
||||||
// QTextCharFormat cur_fmt, fmt;
|
QTextCharFormat cur_fmt, fmt;
|
||||||
// fmt.setForeground(QBrush(list_color_out_type.at(out_type)));
|
fmt.setForeground(QBrush(list_color_out_type.at(out_type)));
|
||||||
_s_mutex_info_output.lock();
|
_mutex_info_output.lock();
|
||||||
// cur_fmt = _s_plain_edit_info_output->currentCharFormat();
|
cur_fmt = _plain_edit_info_output->currentCharFormat();
|
||||||
// _s_plain_edit_info_output->mergeCurrentCharFormat(fmt);
|
_plain_edit_info_output->mergeCurrentCharFormat(fmt);
|
||||||
_s_plain_edit_info_output->appendPlainText(ouput_text);
|
_plain_edit_info_output->appendPlainText(ouput_text);
|
||||||
// _s_plain_edit_info_output->setCurrentCharFormat(cur_fmt);
|
_plain_edit_info_output->setCurrentCharFormat(cur_fmt);
|
||||||
// QScrollBar* scrollbar = _s_plain_edit_info_output->verticalScrollBar();
|
QScrollBar* scrollbar = _plain_edit_info_output->verticalScrollBar();
|
||||||
// if (scrollbar) {
|
if (scrollbar) {
|
||||||
// scrollbar->setSliderPosition(scrollbar->maximum());
|
scrollbar->setSliderPosition(scrollbar->maximum());
|
||||||
// }
|
}
|
||||||
_s_plain_edit_info_output->update();
|
_plain_edit_info_output->update();
|
||||||
_s_mutex_info_output.unlock();
|
_mutex_info_output.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ShowStatusBarMsg(const QString& msg)
|
void MainWindow::onShowStatusBarMsg(const QString &msg)
|
||||||
{
|
{
|
||||||
_s_status_bar->showMessage(msg);
|
_status_bar->showMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget* parent)
|
MainWindow::MainWindow(QWidget* parent)
|
||||||
|
|
@ -78,12 +87,13 @@ MainWindow::MainWindow(QWidget* parent)
|
||||||
, ui(new Ui::MainWindow)
|
, ui(new Ui::MainWindow)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
_s_status_bar = ui->statusbar;
|
_status_bar = ui->statusbar;
|
||||||
|
|
||||||
initMainWindow();
|
initMainWindow();
|
||||||
initAction();
|
initAction();
|
||||||
|
|
||||||
this->applyStyleSheet();
|
this->applyStyleSheet();
|
||||||
|
_s_main_win = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
|
@ -128,10 +138,10 @@ void MainWindow::initMainWindow()
|
||||||
_menu_view_analysis_view_list = ui->menu_view->addMenu(QStringLiteral(u"分析视图列表"));
|
_menu_view_analysis_view_list = ui->menu_view->addMenu(QStringLiteral(u"分析视图列表"));
|
||||||
|
|
||||||
// 构建日志输出视图
|
// 构建日志输出视图
|
||||||
_s_plain_edit_info_output = new QPlainTextEdit;
|
_plain_edit_info_output = new QPlainTextEdit;
|
||||||
_s_plain_edit_info_output->setReadOnly(true);
|
_plain_edit_info_output->setReadOnly(true);
|
||||||
ads::CDockWidget* dockw_info_output = new ads::CDockWidget(QStringLiteral(u"信息输出"));
|
ads::CDockWidget* dockw_info_output = new ads::CDockWidget(QStringLiteral(u"信息输出"));
|
||||||
dockw_info_output->setWidget(_s_plain_edit_info_output);
|
dockw_info_output->setWidget(_plain_edit_info_output);
|
||||||
dockw_info_output->setMinimumSizeHintMode(ads::CDockWidget::MinimumSizeHintFromContentMinimumSize);
|
dockw_info_output->setMinimumSizeHintMode(ads::CDockWidget::MinimumSizeHintFromContentMinimumSize);
|
||||||
_dock_manager->addDockWidget(ads::DockWidgetArea::BottomDockWidgetArea, dockw_info_output);
|
_dock_manager->addDockWidget(ads::DockWidgetArea::BottomDockWidgetArea, dockw_info_output);
|
||||||
ui->menu_view->addAction(dockw_info_output->toggleViewAction());
|
ui->menu_view->addAction(dockw_info_output->toggleViewAction());
|
||||||
|
|
|
||||||
|
|
@ -30,13 +30,14 @@ public:
|
||||||
eDebug
|
eDebug
|
||||||
};
|
};
|
||||||
Q_ENUM(OutputInfoType)
|
Q_ENUM(OutputInfoType)
|
||||||
public slots:
|
public:
|
||||||
static void OutputInfo(OutputInfoType out_type, const QString& ouput_info);
|
static void OutputInfo(OutputInfoType out_type, const QString& ouput_info);
|
||||||
static void ShowStatusBarMsg(const QString& msg);
|
static void ShowStatusBarMsg(const QString& msg);
|
||||||
|
public slots:
|
||||||
|
void onOutputInfo(int out_type, const QString& ouput_info);
|
||||||
|
void onShowStatusBarMsg(const QString& msg);
|
||||||
private:
|
private:
|
||||||
static QMutex _s_mutex_info_output;
|
static MainWindow* _s_main_win;
|
||||||
static QPlainTextEdit* _s_plain_edit_info_output;
|
|
||||||
static QStatusBar* _s_status_bar;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow(QWidget *parent = nullptr);
|
MainWindow(QWidget *parent = nullptr);
|
||||||
|
|
@ -51,6 +52,11 @@ private:
|
||||||
protected:
|
protected:
|
||||||
virtual void closeEvent(QCloseEvent* event) override;
|
virtual void closeEvent(QCloseEvent* event) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QMutex _mutex_info_output;
|
||||||
|
QPlainTextEdit* _plain_edit_info_output;
|
||||||
|
QStatusBar* _status_bar;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
ads::CDockManager* _dock_manager { nullptr };
|
ads::CDockManager* _dock_manager { nullptr };
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ BatchEnergyScaleDialog::BatchEnergyScaleDialog(QWidget* parent)
|
||||||
this->setWindowModality(Qt::WindowModal);
|
this->setWindowModality(Qt::WindowModal);
|
||||||
this->setModal(false);
|
this->setModal(false);
|
||||||
|
|
||||||
ui->tablew_process_data->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
ui->tablew_process_data->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||||
ui->tablew_process_data->horizontalHeader()->setSectionResizeMode(
|
ui->tablew_process_data->horizontalHeader()->setSectionResizeMode(
|
||||||
ui->tablew_process_data->columnCount() - 1, QHeaderView::ResizeToContents);
|
ui->tablew_process_data->columnCount() - 1, QHeaderView::ResizeToContents);
|
||||||
ui->tablew_process_data->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
ui->tablew_process_data->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
|
|
@ -343,13 +343,12 @@ void BatchEnergyScaleDialog::applyEnergyScaleFitResultData()
|
||||||
}
|
}
|
||||||
QDir project_dir(project_model->GetProjectDir());
|
QDir project_dir(project_model->GetProjectDir());
|
||||||
const QString& energy_scale_data_filename = project_dir.filePath(QStringLiteral(u"能量刻度.json"));
|
const QString& energy_scale_data_filename = project_dir.filePath(QStringLiteral(u"能量刻度.json"));
|
||||||
QDir result_dir(this->_workspace);
|
const QString& energy_scale_result_filename = this->_energy_scale_data_model->GetDataFilename();
|
||||||
const QString& energy_scale_result_filename = result_dir.filePath(QStringLiteral(u"多通道能量刻度拟合.json"));
|
|
||||||
if (QFile::copy(energy_scale_result_filename, energy_scale_data_filename)) {
|
if (QFile::copy(energy_scale_result_filename, energy_scale_data_filename)) {
|
||||||
project_model->SetEnergyScaleFilename(energy_scale_data_filename);
|
project_model->SetEnergyScaleFilename(energy_scale_data_filename);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
QMessageBox::warning(this, QStringLiteral(u"警告"), QStringLiteral(u"不能应用非完整的能量刻度!"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -430,13 +430,20 @@ MeasureAnalysisProjectModelList::~MeasureAnalysisProjectModelList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeasureAnalysisProjectModelList::AddProjectModel(MeasureAnalysisProjectModel* model)
|
bool MeasureAnalysisProjectModelList::AddProjectModel(MeasureAnalysisProjectModel* model)
|
||||||
{
|
{
|
||||||
|
bool ok = true;
|
||||||
const QString& project_name = model->GetProjectName();
|
const QString& project_name = model->GetProjectName();
|
||||||
|
if (!_project_models.contains(project_name)) {
|
||||||
_project_models[project_name] = model;
|
_project_models[project_name] = model;
|
||||||
intiProjectNodeStruce(model);
|
intiProjectNodeStruce(model);
|
||||||
SetCurrentProjectModel(project_name);
|
SetCurrentProjectModel(project_name);
|
||||||
model->SaveProjectModel();
|
model->SaveProjectModel();
|
||||||
|
} else {
|
||||||
|
delete model;
|
||||||
|
ok &= false;
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MeasureAnalysisProjectModelList::RmProjectModel(const QString& project_name)
|
bool MeasureAnalysisProjectModelList::RmProjectModel(const QString& project_name)
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ public:
|
||||||
static MeasureAnalysisProjectModelList* Instance();
|
static MeasureAnalysisProjectModelList* Instance();
|
||||||
virtual ~MeasureAnalysisProjectModelList();
|
virtual ~MeasureAnalysisProjectModelList();
|
||||||
|
|
||||||
void AddProjectModel(MeasureAnalysisProjectModel* model);
|
bool AddProjectModel(MeasureAnalysisProjectModel* model);
|
||||||
bool RmProjectModel(const QString& project_name);
|
bool RmProjectModel(const QString& project_name);
|
||||||
|
|
||||||
MeasureAnalysisProjectModel* GetProjectModel(const QString& project_name);
|
MeasureAnalysisProjectModel* GetProjectModel(const QString& project_name);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user