Compare commits
No commits in common. "8ba3063a84684f19b1766c53039d65dd4a5ae9a9" and "93225c466e0805f2f15ebd2ef5b5ac7f2870d782" have entirely different histories.
8ba3063a84
...
93225c466e
|
|
@ -118,7 +118,6 @@ void MainWindow::initMainWindow()
|
||||||
|
|
||||||
// Set central widget
|
// Set central widget
|
||||||
MeasureAnalysisHistoryForm* measure_analysis_history_form = new MeasureAnalysisHistoryForm;
|
MeasureAnalysisHistoryForm* measure_analysis_history_form = new MeasureAnalysisHistoryForm;
|
||||||
connect(this, &MainWindow::newProject, measure_analysis_history_form, &MeasureAnalysisHistoryForm::onUpdateNewHistoryProject);
|
|
||||||
CDockWidget* central_dock_widget = _dock_manager->createDockWidget(QStringLiteral(u"测量分析记录"));
|
CDockWidget* central_dock_widget = _dock_manager->createDockWidget(QStringLiteral(u"测量分析记录"));
|
||||||
central_dock_widget->setWidget(measure_analysis_history_form);
|
central_dock_widget->setWidget(measure_analysis_history_form);
|
||||||
// central_dock_widget->setFeature(ads::CDockWidget::AllDockWidgetFeatures, true);
|
// central_dock_widget->setFeature(ads::CDockWidget::AllDockWidgetFeatures, true);
|
||||||
|
|
@ -157,9 +156,6 @@ void MainWindow::initAction()
|
||||||
if (QDialog::Accepted == new_measure_analysis_dlg.exec()) {
|
if (QDialog::Accepted == new_measure_analysis_dlg.exec()) {
|
||||||
ProjectList* project_list_model = ProjectList::Instance();
|
ProjectList* project_list_model = ProjectList::Instance();
|
||||||
auto project_model = project_list_model->GetCurrentProjectModel();
|
auto project_model = project_list_model->GetCurrentProjectModel();
|
||||||
|
|
||||||
emit newProject(project_model->GetProjectName());
|
|
||||||
|
|
||||||
const QString& all_channel_particle_data_filename = project_model->GetAllChannelParticleDataFilename();
|
const QString& all_channel_particle_data_filename = project_model->GetAllChannelParticleDataFilename();
|
||||||
if (!all_channel_particle_data_filename.isEmpty()) {
|
if (!all_channel_particle_data_filename.isEmpty()) {
|
||||||
const QString& all_ch_count_dir = project_model->GetProjectDir();
|
const QString& all_ch_count_dir = project_model->GetProjectDir();
|
||||||
|
|
|
||||||
|
|
@ -49,9 +49,6 @@ private:
|
||||||
void applyStyleSheet();
|
void applyStyleSheet();
|
||||||
void closeProject(const QString &project_name);
|
void closeProject(const QString &project_name);
|
||||||
|
|
||||||
signals:
|
|
||||||
void newProject(const QString &project_name);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void closeEvent(QCloseEvent* event) override;
|
virtual void closeEvent(QCloseEvent* event) override;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,6 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QFileSystemWatcher>
|
|
||||||
#include "GlobalDefine.h"
|
|
||||||
|
|
||||||
MeasureAnalysisHistoryForm::MeasureAnalysisHistoryForm(QWidget* parent)
|
MeasureAnalysisHistoryForm::MeasureAnalysisHistoryForm(QWidget* parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
|
|
@ -13,19 +11,16 @@ MeasureAnalysisHistoryForm::MeasureAnalysisHistoryForm(QWidget* parent)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
ui->linedit_query->setPlaceholderText(QStringLiteral(u"请输入查询测量分析项目名称的关键字"));
|
|
||||||
|
|
||||||
ui->tablew_history->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
ui->tablew_history->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||||
ui->tablew_history->horizontalHeader()->setSectionResizeMode(
|
ui->tablew_history->horizontalHeader()->setSectionResizeMode(
|
||||||
ui->tablew_history->columnCount() - 1, QHeaderView::Stretch);
|
ui->tablew_history->columnCount() - 1, QHeaderView::Stretch);
|
||||||
ui->tablew_history->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
ui->tablew_history->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
|
|
||||||
connect(ui->linedit_query, &QLineEdit::textChanged , this, &MeasureAnalysisHistoryForm::onQueryHistory);
|
connect(ui->btn_query, &QPushButton::clicked, this, &MeasureAnalysisHistoryForm::onQueryHistory);
|
||||||
connect(ui->btn_remove, &QPushButton::clicked, this, &MeasureAnalysisHistoryForm::onRemoveSelectedProject);
|
connect(ui->btn_remove, &QPushButton::clicked, this, &MeasureAnalysisHistoryForm::onRemoveSelectedProject);
|
||||||
connect(ui->btn_select_all, &QPushButton::clicked, this, &MeasureAnalysisHistoryForm::onAllSelect);
|
connect(ui->btn_select_all, &QPushButton::clicked, this, &MeasureAnalysisHistoryForm::onAllSelect);
|
||||||
connect(ui->btn_reverse, &QPushButton::clicked, this, &MeasureAnalysisHistoryForm::onReverseSelect);
|
connect(ui->btn_reverse, &QPushButton::clicked, this, &MeasureAnalysisHistoryForm::onReverseSelect);
|
||||||
connect(ui->tablew_history, &QTableWidget::cellDoubleClicked, this, &MeasureAnalysisHistoryForm::onTableCellDoubleClicked);
|
connect(ui->tablew_history, &QTableWidget::cellDoubleClicked, this, &MeasureAnalysisHistoryForm::onTableCellDoubleClicked);
|
||||||
connect(ProjectList::Instance(), &MeasureAnalysisProjectModelList::removedProjectModel, this, &MeasureAnalysisHistoryForm::onUpdateCloseHistoryProject);
|
|
||||||
|
|
||||||
loadHistoryInfo();
|
loadHistoryInfo();
|
||||||
}
|
}
|
||||||
|
|
@ -69,9 +64,6 @@ void MeasureAnalysisHistoryForm::loadHistoryInfo()
|
||||||
ui->tablew_history->setItem(row, 2, new QTableWidgetItem(spectrum_type_name));
|
ui->tablew_history->setItem(row, 2, new QTableWidgetItem(spectrum_type_name));
|
||||||
const QString& is_std_source = project_model.GetIsStdSource() ? QStringLiteral(u"是") : QStringLiteral(u"否");
|
const QString& is_std_source = project_model.GetIsStdSource() ? QStringLiteral(u"是") : QStringLiteral(u"否");
|
||||||
ui->tablew_history->setItem(row, 3, new QTableWidgetItem(is_std_source));
|
ui->tablew_history->setItem(row, 3, new QTableWidgetItem(is_std_source));
|
||||||
ui->tablew_history->setItem(row, 4, new QTableWidgetItem());
|
|
||||||
ui->tablew_history->setItem(row, 5, new QTableWidgetItem());
|
|
||||||
ui->tablew_history->setItem(row, 6, new QTableWidgetItem());
|
|
||||||
ui->tablew_history->setItem(row, 7, new QTableWidgetItem(project_model.GetDescriptionInfo()));
|
ui->tablew_history->setItem(row, 7, new QTableWidgetItem(project_model.GetDescriptionInfo()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -80,13 +72,6 @@ void MeasureAnalysisHistoryForm::loadHistoryInfo()
|
||||||
void MeasureAnalysisHistoryForm::onQueryHistory()
|
void MeasureAnalysisHistoryForm::onQueryHistory()
|
||||||
{
|
{
|
||||||
const QString& query_text = ui->linedit_query->text();
|
const QString& query_text = ui->linedit_query->text();
|
||||||
for (int row = 0; row < ui->tablew_history->rowCount(); ++row) {
|
|
||||||
QTableWidgetItem* item = ui->tablew_history->item(row, 0);
|
|
||||||
if (item) {
|
|
||||||
bool b_match = item->text().contains(query_text);
|
|
||||||
ui->tablew_history->setRowHidden(row, !b_match);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeasureAnalysisHistoryForm::onAllSelect()
|
void MeasureAnalysisHistoryForm::onAllSelect()
|
||||||
|
|
@ -126,29 +111,16 @@ void MeasureAnalysisHistoryForm::onReverseSelect()
|
||||||
|
|
||||||
void MeasureAnalysisHistoryForm::onRemoveSelectedProject()
|
void MeasureAnalysisHistoryForm::onRemoveSelectedProject()
|
||||||
{
|
{
|
||||||
QMap<int, QString> selected_project_list;
|
|
||||||
auto row_count = ui->tablew_history->rowCount();
|
auto row_count = ui->tablew_history->rowCount();
|
||||||
for (int row = row_count - 1; row >= 0; --row) {
|
for (int row = row_count - 1; row >= 0; --row) {
|
||||||
if (Qt::Checked == ui->tablew_history->item(row, 0)->checkState()) {
|
if (Qt::Checked == ui->tablew_history->item(row, 0)->checkState()) {
|
||||||
const QString& project_filename = ui->tablew_history->item(row, 0)->data(Qt::UserRole).toString();
|
const QString& project_filename = ui->tablew_history->item(row, 0)->data(Qt::UserRole).toString();
|
||||||
selected_project_list[row] = project_filename;
|
QFileInfo project_file_info(project_filename);
|
||||||
|
const QString& project_dir_path = project_file_info.absoluteDir().absolutePath();
|
||||||
|
QDir(project_dir_path).removeRecursively();
|
||||||
|
ui->tablew_history->removeRow(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (selected_project_list.isEmpty()) {
|
|
||||||
QMessageBox::information(this, QStringLiteral(u"确认"), QStringLiteral(u"请选择想要删除的测量分析项目!"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (QMessageBox::No == QMessageBox::question(this, QStringLiteral(u"确认"), QStringLiteral(u"是否删除选择的测量分析项目?"))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (int row : selected_project_list.keys()) {
|
|
||||||
QFileInfo project_file_info(selected_project_list.value(row));
|
|
||||||
const QString& project_dir_path = project_file_info.absoluteDir().absolutePath();
|
|
||||||
QDir(project_dir_path).removeRecursively();
|
|
||||||
QDir(project_dir_path).rmdir(project_dir_path);
|
|
||||||
ui->tablew_history->removeRow(row);
|
|
||||||
LOG_INFO(QStringLiteral(u"测量分析项目\"%1\"已经删除.").arg(project_file_info.baseName()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeasureAnalysisHistoryForm::onTableCellDoubleClicked(int row, int column)
|
void MeasureAnalysisHistoryForm::onTableCellDoubleClicked(int row, int column)
|
||||||
|
|
@ -180,51 +152,12 @@ void MeasureAnalysisHistoryForm::onTableCellDoubleClicked(int row, int column)
|
||||||
bool loaded = ProjectList::Instance()->AddProjectModel(model);
|
bool loaded = ProjectList::Instance()->AddProjectModel(model);
|
||||||
if (loaded) {
|
if (loaded) {
|
||||||
item->setCheckState(Qt::Unchecked);
|
item->setCheckState(Qt::Unchecked);
|
||||||
item->setFlags(item->flags() & ~(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable));
|
item->setFlags(item->flags() & ~Qt::ItemIsUserCheckable);
|
||||||
int row = item->row();
|
|
||||||
for (int col = 1; col < ui->tablew_history->columnCount(); ++col) {
|
|
||||||
QTableWidgetItem* other_item = ui->tablew_history->item(row, col);
|
|
||||||
if (other_item) {
|
|
||||||
other_item->setFlags(other_item->flags() & ~(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
item->setFlags(item->flags() | Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
|
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||||
int row = item->row();
|
|
||||||
for (int col = 1; col < ui->tablew_history->columnCount(); ++col) {
|
|
||||||
QTableWidgetItem* other_item = ui->tablew_history->item(row, col);
|
|
||||||
if (other_item) {
|
|
||||||
other_item->setFlags(other_item->flags() | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
emit openProject(project_filename);
|
emit openProject(project_filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeasureAnalysisHistoryForm::onUpdateCloseHistoryProject(const QString &project_name)
|
|
||||||
{
|
|
||||||
for (int row = 0; row < ui->tablew_history->rowCount(); ++row) {
|
|
||||||
QTableWidgetItem* item = ui->tablew_history->item(row, 0);
|
|
||||||
if (item) {
|
|
||||||
if (project_name == item->text()) {
|
|
||||||
item->setFlags(item->flags() | Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
|
|
||||||
int row = item->row();
|
|
||||||
for (int col = 1; col < ui->tablew_history->columnCount(); ++col) {
|
|
||||||
QTableWidgetItem* other_item = ui->tablew_history->item(row, col);
|
|
||||||
if (other_item) {
|
|
||||||
other_item->setFlags(other_item->flags() | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MeasureAnalysisHistoryForm::onUpdateNewHistoryProject(const QString &project_name)
|
|
||||||
{
|
|
||||||
Q_UNUSED(project_name);
|
|
||||||
loadHistoryInfo();
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,6 @@ private slots:
|
||||||
void onReverseSelect();
|
void onReverseSelect();
|
||||||
void onRemoveSelectedProject();
|
void onRemoveSelectedProject();
|
||||||
void onTableCellDoubleClicked(int row, int column);
|
void onTableCellDoubleClicked(int row, int column);
|
||||||
void onUpdateCloseHistoryProject(const QString& project_name);
|
|
||||||
public slots:
|
|
||||||
void onUpdateNewHistoryProject(const QString& project_name);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void openProject(const QString& project_filename);
|
void openProject(const QString& project_filename);
|
||||||
|
|
|
||||||
|
|
@ -53,35 +53,19 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_query_title">
|
<widget class="QLabel" name="label_query_title">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>测量分析查询:</string>
|
<string>模糊查询:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="linedit_query">
|
<widget class="QLineEdit" name="linedit_query"/>
|
||||||
<property name="maxLength">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
<property name="clearButtonEnabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<widget class="QPushButton" name="btn_query">
|
||||||
<property name="orientation">
|
<property name="text">
|
||||||
<enum>Qt::Horizontal</enum>
|
<string>查询</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
</widget>
|
||||||
<enum>QSizePolicy::Preferred</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="btn_select_all">
|
<widget class="QPushButton" name="btn_select_all">
|
||||||
|
|
@ -109,7 +93,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTableWidget" name="tablew_history">
|
<widget class="QTableWidget" name="tablew_history">
|
||||||
<property name="focusPolicy">
|
<property name="focusPolicy">
|
||||||
<enum>Qt::StrongFocus</enum>
|
<enum>Qt::NoFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="contextMenuPolicy">
|
<property name="contextMenuPolicy">
|
||||||
<enum>Qt::DefaultContextMenu</enum>
|
<enum>Qt::DefaultContextMenu</enum>
|
||||||
|
|
|
||||||
|
|
@ -517,7 +517,6 @@ bool MeasureAnalysisProjectModelList::RmProjectModel(const QString& project_name
|
||||||
const QString& project_name = project_model->GetProjectName();
|
const QString& project_name = project_model->GetProjectName();
|
||||||
SetCurrentProjectModel(project_name);
|
SetCurrentProjectModel(project_name);
|
||||||
}
|
}
|
||||||
emit removedProjectModel(project_name);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -146,9 +146,6 @@ private slots:
|
||||||
void onCoincidenceProcessFinished(bool ok, const QString& project_name, const QVariant& data);
|
void onCoincidenceProcessFinished(bool ok, const QString& project_name, const QVariant& data);
|
||||||
void onEnergyScaleCoincidenceDataFinished(bool ok, const QString& project_name, const QVariant& data);
|
void onEnergyScaleCoincidenceDataFinished(bool ok, const QString& project_name, const QVariant& data);
|
||||||
|
|
||||||
signals:
|
|
||||||
void removedProjectModel(const QString& project_name);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void intiProjectNodeStruce(MeasureAnalysisProjectModel *pro_model);
|
void intiProjectNodeStruce(MeasureAnalysisProjectModel *pro_model);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,6 @@ void NewMeasureAnalysisDlg::onNewProjectFromFileFinished(bool ok, const QString&
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
project_dir.removeRecursively();
|
project_dir.removeRecursively();
|
||||||
project_dir.rmdir(project_dir_path);
|
|
||||||
const QString& data_file_path = ui->lineEdit_filename->property("data_file_path").toString();
|
const QString& data_file_path = ui->lineEdit_filename->property("data_file_path").toString();
|
||||||
QMessageBox::warning(this, QStringLiteral(u"警告"), QStringLiteral(u"粒子数据%1异常,创建测量分析项目失败!").arg(data_file_path));
|
QMessageBox::warning(this, QStringLiteral(u"警告"), QStringLiteral(u"粒子数据%1异常,创建测量分析项目失败!").arg(data_file_path));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user