|
@@ -12,6 +12,10 @@
|
|
#include "registryManager/registrymanager.h"
|
|
#include "registryManager/registrymanager.h"
|
|
#include "ui_blastopepage.h"
|
|
#include "ui_blastopepage.h"
|
|
|
|
|
|
|
|
+const int ColIndexBlastStatus = 7;
|
|
|
|
+const int ColIndexProgressBar = 8;
|
|
|
|
+const int ColIndexOpBtn = 9;
|
|
|
|
+
|
|
BlastOpePage::BlastOpePage(QWidget *parent)
|
|
BlastOpePage::BlastOpePage(QWidget *parent)
|
|
: QWidget(parent), ui(new Ui::BlastOpePage), dao(DatabaseManager::getInstance().getDatabase()) {
|
|
: QWidget(parent), ui(new Ui::BlastOpePage), dao(DatabaseManager::getInstance().getDatabase()) {
|
|
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
|
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
|
@@ -28,7 +32,7 @@ void BlastOpePage::showCountDownWidget(QString uuid, const QString &topic, const
|
|
|
|
|
|
countdownWidget->move(x, y);
|
|
countdownWidget->move(x, y);
|
|
countdownWidget->show();
|
|
countdownWidget->show();
|
|
- firingWidget *widget = uuidWidgetMap.value(uuid);
|
|
|
|
|
|
+ firingWidget *widget = firingWidgetByUuid.value(uuid);
|
|
|
|
|
|
if (widget) {
|
|
if (widget) {
|
|
connect(
|
|
connect(
|
|
@@ -239,9 +243,9 @@ void BlastOpePage::initPagination() {
|
|
RefreshData();
|
|
RefreshData();
|
|
}
|
|
}
|
|
|
|
|
|
-void BlastOpePage::RefreshData() { loadDataFromSource(currentPage, pageSize); }
|
|
|
|
|
|
+void BlastOpePage::RefreshData() { loadDataAndDrawTable(currentPage, pageSize); }
|
|
|
|
|
|
-void BlastOpePage::loadDataFromSource(int currentPage, int pageSize) {
|
|
|
|
|
|
+void BlastOpePage::loadDataAndDrawTable(int currentPage, int pageSize) {
|
|
PaginatedHProjectResult result = dao.getAllHProjectsByOpera(currentPage, pageSize);
|
|
PaginatedHProjectResult result = dao.getAllHProjectsByOpera(currentPage, pageSize);
|
|
QList<QSharedPointer<HProject>> projectList = result.projects;
|
|
QList<QSharedPointer<HProject>> projectList = result.projects;
|
|
totalCount = result.totalCount;
|
|
totalCount = result.totalCount;
|
|
@@ -250,9 +254,15 @@ void BlastOpePage::loadDataFromSource(int currentPage, int pageSize) {
|
|
model = new QStandardItemModel(this);
|
|
model = new QStandardItemModel(this);
|
|
|
|
|
|
headers = {
|
|
headers = {
|
|
- {"选择", ""}, // 新增选择列
|
|
|
|
- {"工程名称", "name"}, {"操作员", "operatorName"}, {"爆破员", "blasterName"}, {"井下地址", "addressPath"},
|
|
|
|
- {"雷管数量", "detSum"}, {"起爆器数量", "blastCount"}, {"起爆状态", "blastStatus"}, {"进度", ""},
|
|
|
|
|
|
+ {"选择", ""},
|
|
|
|
+ {"工程名称", "name"},
|
|
|
|
+ {"操作员", "operatorName"},
|
|
|
|
+ {"爆破员", "blasterName"},
|
|
|
|
+ {"井下地址", "addressPath"},
|
|
|
|
+ {"雷管数量", "detSum"},
|
|
|
|
+ {"起爆器数量", "blastCount"},
|
|
|
|
+ {"起爆状态", "blastStatus"},
|
|
|
|
+ {"进度", ""},
|
|
{"操作", ""},
|
|
{"操作", ""},
|
|
};
|
|
};
|
|
|
|
|
|
@@ -285,15 +295,7 @@ void BlastOpePage::loadDataFromSource(int currentPage, int pageSize) {
|
|
|
|
|
|
if (prop == "blastStatus") {
|
|
if (prop == "blastStatus") {
|
|
QString statusText;
|
|
QString statusText;
|
|
- if (value.toString() == BlastStatus::Created) {
|
|
|
|
- statusText = "未 注 册";
|
|
|
|
- item = new QStandardItem(statusText);
|
|
|
|
- item->setForeground(QColor("#e7c66b"));
|
|
|
|
- } else if (value.toString() == BlastStatus::Registered) {
|
|
|
|
- statusText = "待安全确认";
|
|
|
|
- item = new QStandardItem(statusText);
|
|
|
|
- item->setForeground(QColor("#f3a361"));
|
|
|
|
- } else if (value.toString() == BlastStatus::SafeChecked) {
|
|
|
|
|
|
+ if (value.toString() == BlastStatus::SafeChecked) {
|
|
statusText = "待起爆";
|
|
statusText = "待起爆";
|
|
item = new QStandardItem(statusText);
|
|
item = new QStandardItem(statusText);
|
|
item->setForeground(QColor("#f3a3k'k1"));
|
|
item->setForeground(QColor("#f3a3k'k1"));
|
|
@@ -334,6 +336,7 @@ void BlastOpePage::loadDataFromSource(int currentPage, int pageSize) {
|
|
ui->tableView->verticalHeader()->setDefaultSectionSize(50);
|
|
ui->tableView->verticalHeader()->setDefaultSectionSize(50);
|
|
|
|
|
|
for (int row = 0; row < projectList.size(); ++row) {
|
|
for (int row = 0; row < projectList.size(); ++row) {
|
|
|
|
+ // 初始化progressBars
|
|
int progressCol = headers.size() - 2; //
|
|
int progressCol = headers.size() - 2; //
|
|
QProgressBar *progressBar1 = new QProgressBar(ui->tableView);
|
|
QProgressBar *progressBar1 = new QProgressBar(ui->tableView);
|
|
progressBar1->setRange(0, 100); // 设置范围为0到100
|
|
progressBar1->setRange(0, 100); // 设置范围为0到100
|
|
@@ -383,12 +386,15 @@ void BlastOpePage::loadDataFromSource(int currentPage, int pageSize) {
|
|
ui->tableView->setIndexWidget(progressIndex, progressBarContainer);
|
|
ui->tableView->setIndexWidget(progressIndex, progressBarContainer);
|
|
}
|
|
}
|
|
int col = headers.size() - 1;
|
|
int col = headers.size() - 1;
|
|
- // 创建一个按钮
|
|
|
|
|
|
+
|
|
|
|
+ // 创建操作按钮
|
|
QWidget *widget = new QWidget(ui->tableView);
|
|
QWidget *widget = new QWidget(ui->tableView);
|
|
QPushButton *button = new QPushButton(widget);
|
|
QPushButton *button = new QPushButton(widget);
|
|
button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
|
|
+ // 添加button disable时样式为灰色
|
|
|
|
+ button->setStyleSheet("QPushButton:disabled { background-color: #d3d3d3; color: gray; }");
|
|
|
|
|
|
- QModelIndex statusIndex = model->index(row, propMap.key("blastStatus"));
|
|
|
|
|
|
+ QModelIndex statusIndex = model->index(row, ColIndexBlastStatus);
|
|
if (statusIndex.isValid()) {
|
|
if (statusIndex.isValid()) {
|
|
QString blastStatus = model->data(statusIndex).toString();
|
|
QString blastStatus = model->data(statusIndex).toString();
|
|
if (blastStatus == "待起爆") {
|
|
if (blastStatus == "待起爆") {
|
|
@@ -414,7 +420,7 @@ void BlastOpePage::loadDataFromSource(int currentPage, int pageSize) {
|
|
// 切换页数
|
|
// 切换页数
|
|
void BlastOpePage::PageChanged(int page) {
|
|
void BlastOpePage::PageChanged(int page) {
|
|
currentPage = page;
|
|
currentPage = page;
|
|
- loadDataFromSource(currentPage, pageSize);
|
|
|
|
|
|
+ loadDataAndDrawTable(currentPage, pageSize);
|
|
}
|
|
}
|
|
|
|
|
|
void BlastOpePage::onComboBoxIndexChanged(int index) {
|
|
void BlastOpePage::onComboBoxIndexChanged(int index) {
|
|
@@ -422,7 +428,7 @@ void BlastOpePage::onComboBoxIndexChanged(int index) {
|
|
int value = variant.toInt();
|
|
int value = variant.toInt();
|
|
pageSize = value;
|
|
pageSize = value;
|
|
currentPage = 1;
|
|
currentPage = 1;
|
|
- loadDataFromSource(currentPage, pageSize);
|
|
|
|
|
|
+ loadDataAndDrawTable(currentPage, pageSize);
|
|
}
|
|
}
|
|
|
|
|
|
void BlastOpePage::updateProgressBar(int firingStage, int row) {
|
|
void BlastOpePage::updateProgressBar(int firingStage, int row) {
|
|
@@ -432,12 +438,12 @@ void BlastOpePage::updateProgressBar(int firingStage, int row) {
|
|
QProgressBar *progressBar3 = progressBars[row].bar3;
|
|
QProgressBar *progressBar3 = progressBars[row].bar3;
|
|
switch (firingStage) {
|
|
switch (firingStage) {
|
|
case FiringStages::QuickTesting:
|
|
case FiringStages::QuickTesting:
|
|
- // 组网状态
|
|
|
|
|
|
+ // 起爆检测状态
|
|
progressBar1->setRange(0, 0); // 设置范围为0到100
|
|
progressBar1->setRange(0, 0); // 设置范围为0到100
|
|
progressBar1->setValue(0);
|
|
progressBar1->setValue(0);
|
|
break;
|
|
break;
|
|
case FiringStages::QuickTestFinished:
|
|
case FiringStages::QuickTestFinished:
|
|
- // 组网完成
|
|
|
|
|
|
+ // 起爆检测完成
|
|
progressBar1->setRange(0, 100); // 设置范围为0到100
|
|
progressBar1->setRange(0, 100); // 设置范围为0到100
|
|
progressBar1->setValue(100);
|
|
progressBar1->setValue(100);
|
|
break;
|
|
break;
|
|
@@ -461,7 +467,7 @@ void BlastOpePage::updateProgressBar(int firingStage, int row) {
|
|
progressBar3->setRange(0, 100); // 设置范围为0到100
|
|
progressBar3->setRange(0, 100); // 设置范围为0到100
|
|
progressBar3->setValue(100);
|
|
progressBar3->setValue(100);
|
|
break;
|
|
break;
|
|
- case FiringStages::NotStarted:
|
|
|
|
|
|
+ case FiringStages::Starting:
|
|
progressBar1->setRange(0, 100);
|
|
progressBar1->setRange(0, 100);
|
|
progressBar1->setValue(0);
|
|
progressBar1->setValue(0);
|
|
progressBar2->setRange(0, 100);
|
|
progressBar2->setRange(0, 100);
|
|
@@ -475,53 +481,54 @@ void BlastOpePage::updateProgressBar(int firingStage, int row) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// update tableView's fields about firing stage
|
|
void BlastOpePage::onFiringStageUpdated(int stage, int row) {
|
|
void BlastOpePage::onFiringStageUpdated(int stage, int row) {
|
|
|
|
+ // update blast status item
|
|
QModelIndex firingStatusItem = model->index(row, 7);
|
|
QModelIndex firingStatusItem = model->index(row, 7);
|
|
if (firingStatusItem.isValid()) {
|
|
if (firingStatusItem.isValid()) {
|
|
QColor customColor;
|
|
QColor customColor;
|
|
QFont boldFont;
|
|
QFont boldFont;
|
|
boldFont.setBold(true);
|
|
boldFont.setBold(true);
|
|
switch (stage) {
|
|
switch (stage) {
|
|
- case FiringStages::NotStarted:
|
|
|
|
|
|
+ case FiringStages::Starting:
|
|
model->setData(firingStatusItem, "待起爆");
|
|
model->setData(firingStatusItem, "待起爆");
|
|
customColor = QColor("#44035b");
|
|
customColor = QColor("#44035b");
|
|
model->setData(firingStatusItem, customColor, Qt::ForegroundRole);
|
|
model->setData(firingStatusItem, customColor, Qt::ForegroundRole);
|
|
model->setData(firingStatusItem, boldFont, Qt::FontRole);
|
|
model->setData(firingStatusItem, boldFont, Qt::FontRole);
|
|
break;
|
|
break;
|
|
case FiringStages::QuickTesting:
|
|
case FiringStages::QuickTesting:
|
|
- model->setData(firingStatusItem, "组 网 中 ...");
|
|
|
|
|
|
+ model->setData(firingStatusItem, "起爆检测中...");
|
|
customColor = QColor("#44035b");
|
|
customColor = QColor("#44035b");
|
|
model->setData(firingStatusItem, customColor, Qt::ForegroundRole);
|
|
model->setData(firingStatusItem, customColor, Qt::ForegroundRole);
|
|
model->setData(firingStatusItem, boldFont, Qt::FontRole);
|
|
model->setData(firingStatusItem, boldFont, Qt::FontRole);
|
|
break;
|
|
break;
|
|
case FiringStages::QuickTestFinished:
|
|
case FiringStages::QuickTestFinished:
|
|
- model->setData(firingStatusItem, "组 网 完 成");
|
|
|
|
|
|
+ model->setData(firingStatusItem, "检测完成");
|
|
customColor = QColor("#404185");
|
|
customColor = QColor("#404185");
|
|
model->setData(firingStatusItem, customColor, Qt::ForegroundRole);
|
|
model->setData(firingStatusItem, customColor, Qt::ForegroundRole);
|
|
break;
|
|
break;
|
|
case FiringStages::NetCharging:
|
|
case FiringStages::NetCharging:
|
|
- model->setData(firingStatusItem, "充 电 中 ...");
|
|
|
|
|
|
+ model->setData(firingStatusItem, "充电中 ...");
|
|
customColor = QColor("#31688e");
|
|
customColor = QColor("#31688e");
|
|
model->setData(firingStatusItem, customColor, Qt::ForegroundRole);
|
|
model->setData(firingStatusItem, customColor, Qt::ForegroundRole);
|
|
break;
|
|
break;
|
|
case FiringStages::NetChargingFinished:
|
|
case FiringStages::NetChargingFinished:
|
|
- model->setData(firingStatusItem, "充 电 完 成");
|
|
|
|
|
|
+ model->setData(firingStatusItem, "充电完成");
|
|
customColor = QColor("#1f918d");
|
|
customColor = QColor("#1f918d");
|
|
model->setData(firingStatusItem, customColor, Qt::ForegroundRole);
|
|
model->setData(firingStatusItem, customColor, Qt::ForegroundRole);
|
|
break;
|
|
break;
|
|
case FiringStages::Blasting:
|
|
case FiringStages::Blasting:
|
|
- model->setData(firingStatusItem, "起 爆 中 ...");
|
|
|
|
|
|
+ model->setData(firingStatusItem, "起爆中...");
|
|
customColor = QColor("#38b775");
|
|
customColor = QColor("#38b775");
|
|
model->setData(firingStatusItem, customColor, Qt::ForegroundRole);
|
|
model->setData(firingStatusItem, customColor, Qt::ForegroundRole);
|
|
- updateOpBtn(6, row); // 更新按钮
|
|
|
|
break;
|
|
break;
|
|
case FiringStages::BlastFinished:
|
|
case FiringStages::BlastFinished:
|
|
- model->setData(firingStatusItem, "起 爆 完 成");
|
|
|
|
|
|
+ model->setData(firingStatusItem, "起爆完成");
|
|
customColor = QColor("#90d543");
|
|
customColor = QColor("#90d543");
|
|
model->setData(firingStatusItem, customColor, Qt::ForegroundRole);
|
|
model->setData(firingStatusItem, customColor, Qt::ForegroundRole);
|
|
break;
|
|
break;
|
|
- case FiringStages::PendingTrigger:
|
|
|
|
- model->setData(firingStatusItem, "按 下 双 建 起 爆 ...");
|
|
|
|
|
|
+ case FiringStages::PendingTriggerButtonClick:
|
|
|
|
+ model->setData(firingStatusItem, "按下双键起爆...");
|
|
customColor = QColor("#8e620");
|
|
customColor = QColor("#8e620");
|
|
model->setData(firingStatusItem, customColor, Qt::ForegroundRole);
|
|
model->setData(firingStatusItem, customColor, Qt::ForegroundRole);
|
|
break;
|
|
break;
|
|
@@ -529,10 +536,13 @@ void BlastOpePage::onFiringStageUpdated(int stage, int row) {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ updateProgressBar(stage, row);
|
|
|
|
+ updateOpBtnStage(stage, row);
|
|
}
|
|
}
|
|
|
|
|
|
void BlastOpePage::handleSingleBlastButtonClick(int row, QPushButton *button) {
|
|
void BlastOpePage::handleSingleBlastButtonClick(int row, QPushButton *button) {
|
|
- QStandardItem *uuidItem = model->item(row, 10);
|
|
|
|
|
|
+ QStandardItem *uuidItem = model->item(row, ColIndexOpBtn);
|
|
QString uuid;
|
|
QString uuid;
|
|
if (uuidItem) {
|
|
if (uuidItem) {
|
|
QVariant uuidVariant = uuidItem->data(Qt::UserRole);
|
|
QVariant uuidVariant = uuidItem->data(Qt::UserRole);
|
|
@@ -545,9 +555,7 @@ void BlastOpePage::handleSingleBlastButtonClick(int row, QPushButton *button) {
|
|
button->setMinimumWidth(80);
|
|
button->setMinimumWidth(80);
|
|
button->setText(stopBlastButtonTxt);
|
|
button->setText(stopBlastButtonTxt);
|
|
firingWidget *widget = new firingWidget(row, false, uuid);
|
|
firingWidget *widget = new firingWidget(row, false, uuid);
|
|
- connect(widget, &firingWidget::updateBlastStatus, this, &BlastOpePage::updateProgressBar);
|
|
|
|
connect(widget, &firingWidget::updateBlastStatus, this, &BlastOpePage::onFiringStageUpdated);
|
|
connect(widget, &firingWidget::updateBlastStatus, this, &BlastOpePage::onFiringStageUpdated);
|
|
- connect(widget, &firingWidget::updateButton, this, &BlastOpePage::updateOpBtn);
|
|
|
|
connect(widget, &firingWidget::countdown, this, &BlastOpePage::showCountDownWidget);
|
|
connect(widget, &firingWidget::countdown, this, &BlastOpePage::showCountDownWidget);
|
|
connect(widget, &firingWidget::updateProjectStatus, this, &BlastOpePage::handlerUpdateProjectStatus);
|
|
connect(widget, &firingWidget::updateProjectStatus, this, &BlastOpePage::handlerUpdateProjectStatus);
|
|
connect(widget, &firingWidget::closeFiring, this, &BlastOpePage::destroyFiringWidget);
|
|
connect(widget, &firingWidget::closeFiring, this, &BlastOpePage::destroyFiringWidget);
|
|
@@ -556,39 +564,72 @@ void BlastOpePage::handleSingleBlastButtonClick(int row, QPushButton *button) {
|
|
}
|
|
}
|
|
|
|
|
|
widget->setAttribute(Qt::WA_DeleteOnClose);
|
|
widget->setAttribute(Qt::WA_DeleteOnClose);
|
|
- uuidWidgetMap.insert(uuid, widget);
|
|
|
|
|
|
+ firingWidgetByUuid.insert(uuid, widget);
|
|
|
|
|
|
} else if (button->text() == stopBlastButtonTxt) {
|
|
} else if (button->text() == stopBlastButtonTxt) {
|
|
- firingWidget *widget = uuidWidgetMap.value(uuid);
|
|
|
|
|
|
+ firingWidget *widget = firingWidgetByUuid.value(uuid);
|
|
if (widget) {
|
|
if (widget) {
|
|
- widget->cancelBlasting();
|
|
|
|
|
|
+ widget->sendCancelFiringMsg();
|
|
}
|
|
}
|
|
|
|
+ button->setText("...");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void BlastOpePage::updateOpBtn(int status, int row) {
|
|
|
|
- qDebug() << "statusButton:" << status;
|
|
|
|
- QModelIndex index = model->index(row, 8);
|
|
|
|
- if (index.isValid()) {
|
|
|
|
- QWidget *widget = ui->tableView->indexWidget(index);
|
|
|
|
- if (widget) {
|
|
|
|
- QPushButton *button = widget->findChild<QPushButton *>();
|
|
|
|
- if (button) {
|
|
|
|
- // 使用样式表设置图标居中
|
|
|
|
- button->setStyleSheet(
|
|
|
|
- "QPushButton {"
|
|
|
|
- " padding: 0px;"
|
|
|
|
- " border: none;"
|
|
|
|
- " background-color: transparent;"
|
|
|
|
- "}");
|
|
|
|
-
|
|
|
|
- // 添加图标,假设图标文件名为 blast.svg,并且该文件存在于项目资源中
|
|
|
|
- QIcon icon(":/icons/icons/svg/blast.svg");
|
|
|
|
- button->setText("");
|
|
|
|
- button->setIcon(icon);
|
|
|
|
- button->setIconSize(QSize(32, 32));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+void BlastOpePage::updateOpBtnStage(int stage, int row) {
|
|
|
|
+ QModelIndex index = model->index(row, ColIndexOpBtn);
|
|
|
|
+ if (!index.isValid()) {
|
|
|
|
+ Logger::getInstance().error(QString("can not get updateOpBtnStage index %1").arg(row));
|
|
|
|
+ RefreshData();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ QWidget *widget = ui->tableView->indexWidget(index);
|
|
|
|
+ QPushButton *button = widget->findChild<QPushButton *>();
|
|
|
|
+ if (!button) {
|
|
|
|
+ Logger::getInstance().error(QString("can not find button in row %1").arg(row));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ switch (stage) {
|
|
|
|
+ case FiringStages::Starting:
|
|
|
|
+ button->setText(stopBlastButtonTxt);
|
|
|
|
+ button->setDisabled(true);
|
|
|
|
+ break;
|
|
|
|
+ case FiringStages::QuickTesting:
|
|
|
|
+ button->setEnabled(true);
|
|
|
|
+ break;
|
|
|
|
+ case FiringStages::QuickTestFinished:
|
|
|
|
+ button->setEnabled(true);
|
|
|
|
+ break;
|
|
|
|
+ case FiringStages::NetCharging:
|
|
|
|
+ button->setEnabled(true);
|
|
|
|
+ break;
|
|
|
|
+ case FiringStages::NetChargingFinished:
|
|
|
|
+ button->setEnabled(true);
|
|
|
|
+ break;
|
|
|
|
+ case FiringStages::PendingTriggerButtonClick:
|
|
|
|
+ button->setText(stopBlastButtonTxt);
|
|
|
|
+ button->setEnabled(true);
|
|
|
|
+ break;
|
|
|
|
+ case FiringStages::Blasting:
|
|
|
|
+ button->setDisabled(true);
|
|
|
|
+ button->setText("...");
|
|
|
|
+ break;
|
|
|
|
+ case FiringStages::BlastFinished:
|
|
|
|
+ button->setDisabled(true);
|
|
|
|
+ button->setText("");
|
|
|
|
+ // 使用样式表设置图标居中
|
|
|
|
+ button->setStyleSheet(
|
|
|
|
+ "QPushButton {"
|
|
|
|
+ " padding: 0px;"
|
|
|
|
+ " border: none;"
|
|
|
|
+ " background-color: transparent;"
|
|
|
|
+ "}");
|
|
|
|
+ button->setIcon(QIcon(":/icons/icons/svg/blast.svg"));
|
|
|
|
+ button->setIconSize(QSize(32, 32));
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ button->setEnabled(false);
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -597,12 +638,14 @@ void BlastOpePage::handlerUpdateProjectStatus(QString uuid, const QString &newSt
|
|
}
|
|
}
|
|
|
|
|
|
void BlastOpePage::destroyFiringWidget(const QString &uuid) {
|
|
void BlastOpePage::destroyFiringWidget(const QString &uuid) {
|
|
- firingWidget *widget = uuidWidgetMap.value(uuid);
|
|
|
|
|
|
+ firingWidget *widget = firingWidgetByUuid.value(uuid);
|
|
if (widget) {
|
|
if (widget) {
|
|
- widget->close(); // 关闭窗口
|
|
|
|
- widget->deleteLater(); // 释放内存
|
|
|
|
- uuidWidgetMap.remove(uuid); // 从映射中移除
|
|
|
|
|
|
+ widget->close(); // 关闭窗口
|
|
|
|
+ widget->deleteLater(); // 释放内存
|
|
|
|
+ widget->disconnect(); // 断开信号连接
|
|
|
|
+ firingWidgetByUuid.remove(uuid); // 从映射中移除
|
|
}
|
|
}
|
|
|
|
+ RefreshData();
|
|
}
|
|
}
|
|
|
|
|
|
// 槽函数,当 item 状态改变时触发
|
|
// 槽函数,当 item 状态改变时触发
|
|
@@ -647,23 +690,21 @@ void BlastOpePage::on_btnSelect_clicked() {
|
|
int row = it.key();
|
|
int row = it.key();
|
|
QString uuid = it.value();
|
|
QString uuid = it.value();
|
|
firingWidget *widgetSelect = new firingWidget(row, true, uuid);
|
|
firingWidget *widgetSelect = new firingWidget(row, true, uuid);
|
|
- QModelIndex index = model->index(row, 9);
|
|
|
|
|
|
+ QModelIndex index = model->index(row, ColIndexOpBtn);
|
|
if (index.isValid()) {
|
|
if (index.isValid()) {
|
|
QWidget *widgetButton = ui->tableView->indexWidget(index);
|
|
QWidget *widgetButton = ui->tableView->indexWidget(index);
|
|
if (widgetButton) {
|
|
if (widgetButton) {
|
|
QPushButton *button = widgetButton->findChild<QPushButton *>();
|
|
QPushButton *button = widgetButton->findChild<QPushButton *>();
|
|
- button->setText("取消起爆流程");
|
|
|
|
|
|
+ button->setText(stopBlastButtonTxt);
|
|
|
|
+ button->setDisabled(true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// 信号连接
|
|
// 信号连接
|
|
- connect(widgetSelect, &firingWidget::updateBlastStatus, this, &BlastOpePage::updateProgressBar);
|
|
|
|
connect(widgetSelect, &firingWidget::updateBlastStatus, this, &BlastOpePage::onFiringStageUpdated);
|
|
connect(widgetSelect, &firingWidget::updateBlastStatus, this, &BlastOpePage::onFiringStageUpdated);
|
|
- connect(widgetSelect, &firingWidget::selectSignal, this, &BlastOpePage::setBatchBlastTrigger);
|
|
|
|
- connect(widgetSelect, &firingWidget::updateButton, this, &BlastOpePage::updateOpBtn);
|
|
|
|
|
|
+ connect(widgetSelect, &firingWidget::batchFiringSignal, this, &BlastOpePage::setBatchBlastTrigger);
|
|
connect(widgetSelect, &firingWidget::updateProjectStatus, this, &BlastOpePage::handlerUpdateProjectStatus);
|
|
connect(widgetSelect, &firingWidget::updateProjectStatus, this, &BlastOpePage::handlerUpdateProjectStatus);
|
|
connect(widgetSelect, &firingWidget::closeFiring, this, &BlastOpePage::destroyBatchFiringWidget);
|
|
connect(widgetSelect, &firingWidget::closeFiring, this, &BlastOpePage::destroyBatchFiringWidget);
|
|
- widgetSelect->show();
|
|
|
|
widgetSelect->setAttribute(Qt::WA_DeleteOnClose);
|
|
widgetSelect->setAttribute(Qt::WA_DeleteOnClose);
|
|
uuidWidgetSMap.insert(uuid, widgetSelect);
|
|
uuidWidgetSMap.insert(uuid, widgetSelect);
|
|
|
|
|
|
@@ -758,11 +799,13 @@ void BlastOpePage::destroyBatchFiringWidget(const QString &uuid) {
|
|
uuidWidgetSMap.remove(uuid);
|
|
uuidWidgetSMap.remove(uuid);
|
|
}
|
|
}
|
|
for (int row = 0; row < model->rowCount(); ++row) {
|
|
for (int row = 0; row < model->rowCount(); ++row) {
|
|
|
|
+ // 恢复 checkbox 可选
|
|
QStandardItem *item = model->item(row, 0);
|
|
QStandardItem *item = model->item(row, 0);
|
|
if (item) {
|
|
if (item) {
|
|
Qt::ItemFlags flags = item->flags();
|
|
Qt::ItemFlags flags = item->flags();
|
|
- flags &= ~Qt::ItemIsEnabled; // 去除 ItemIsEnabled 标志位
|
|
|
|
|
|
+ flags |= Qt::ItemIsEnabled;
|
|
item->setFlags(flags);
|
|
item->setFlags(flags);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ RefreshData();
|
|
}
|
|
}
|