|
|
|
|
@ -157,12 +157,10 @@ nmSubWndMain::nmSubWndMain(QWidget *parent, QString sExt) :
|
|
|
|
|
m_bPendingResultWidgetRefresh = false;
|
|
|
|
|
m_bPendingResultCompletionMessage = false;
|
|
|
|
|
m_bPendingResultWindowReady = false;
|
|
|
|
|
m_nPendingResultPebiCount = -1;
|
|
|
|
|
m_nPendingResultSolveTimeMs = -1;
|
|
|
|
|
m_bSolverResultCompletionPending = false;
|
|
|
|
|
m_bPendingSolverSucceeded = false;
|
|
|
|
|
m_bPendingSolverInputChanged = false;
|
|
|
|
|
m_nPendingSolverPebiCount = -1;
|
|
|
|
|
m_nPendingSolverTimeMs = -1;
|
|
|
|
|
m_bSolverStartPending = false;
|
|
|
|
|
m_bSolverCancelRequested = false;
|
|
|
|
|
@ -1881,7 +1879,6 @@ void nmSubWndMain::continueSolverInputCapture()
|
|
|
|
|
m_pSolverFitting = nullptr;
|
|
|
|
|
} else {
|
|
|
|
|
scheduleSolverResultCompletion(false,
|
|
|
|
|
-1,
|
|
|
|
|
-1,
|
|
|
|
|
bInputChanged,
|
|
|
|
|
sFailureReason);
|
|
|
|
|
@ -2089,7 +2086,6 @@ bool nmSubWndMain::mergeAnaResultToFitting()
|
|
|
|
|
m_pPendingResultFitting = nullptr;
|
|
|
|
|
m_bPendingResultCompletionMessage = false;
|
|
|
|
|
m_bPendingResultWindowReady = false;
|
|
|
|
|
m_nPendingResultPebiCount = -1;
|
|
|
|
|
m_nPendingResultSolveTimeMs = -1;
|
|
|
|
|
|
|
|
|
|
if(pInstance->getGridType() == NM_Grid_PEBI) {
|
|
|
|
|
@ -2186,14 +2182,11 @@ void nmSubWndMain::showPendingSolverResultCompletion()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const bool bResultWindowReady = m_bPendingResultWindowReady;
|
|
|
|
|
const int nPebiCount = m_nPendingResultPebiCount;
|
|
|
|
|
const int nSolveTimeMs = m_nPendingResultSolveTimeMs;
|
|
|
|
|
m_bPendingResultCompletionMessage = false;
|
|
|
|
|
m_bPendingResultWindowReady = false;
|
|
|
|
|
m_nPendingResultPebiCount = -1;
|
|
|
|
|
m_nPendingResultSolveTimeMs = -1;
|
|
|
|
|
showSolverResultCompletion(bResultWindowReady,
|
|
|
|
|
nPebiCount,
|
|
|
|
|
nSolveTimeMs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -2427,7 +2420,6 @@ bool nmSubWndMain::on_calculationFinished(
|
|
|
|
|
|
|
|
|
|
void nmSubWndMain::scheduleSolverResultCompletion(
|
|
|
|
|
bool bSucceeded,
|
|
|
|
|
int nPebiCount,
|
|
|
|
|
int nSolveTimeMs,
|
|
|
|
|
bool bInputChanged,
|
|
|
|
|
const QString& sFailureReason)
|
|
|
|
|
@ -2437,7 +2429,6 @@ void nmSubWndMain::scheduleSolverResultCompletion(
|
|
|
|
|
m_bPendingSolverSucceeded = bSucceeded;
|
|
|
|
|
m_bPendingSolverInputChanged = bInputChanged;
|
|
|
|
|
m_sPendingSolverFailureReason = sFailureReason;
|
|
|
|
|
m_nPendingSolverPebiCount = nPebiCount;
|
|
|
|
|
m_nPendingSolverTimeMs = nSolveTimeMs;
|
|
|
|
|
|
|
|
|
|
// 当前完成信号栈只登记后续工作;隐藏和结果刷新各占一轮独立事件。
|
|
|
|
|
@ -2461,13 +2452,11 @@ void nmSubWndMain::completePendingSolverResult()
|
|
|
|
|
const bool bSucceeded = m_bPendingSolverSucceeded;
|
|
|
|
|
const bool bInputChanged = m_bPendingSolverInputChanged;
|
|
|
|
|
const QString sFailureReason = m_sPendingSolverFailureReason;
|
|
|
|
|
const int nPebiCount = m_nPendingSolverPebiCount;
|
|
|
|
|
const int nSolveTimeMs = m_nPendingSolverTimeMs;
|
|
|
|
|
m_bSolverResultCompletionPending = false;
|
|
|
|
|
m_bPendingSolverSucceeded = false;
|
|
|
|
|
m_bPendingSolverInputChanged = false;
|
|
|
|
|
m_sPendingSolverFailureReason.clear();
|
|
|
|
|
m_nPendingSolverPebiCount = -1;
|
|
|
|
|
m_nPendingSolverTimeMs = -1;
|
|
|
|
|
|
|
|
|
|
bool bResultWindowReady = false;
|
|
|
|
|
@ -2494,11 +2483,9 @@ void nmSubWndMain::completePendingSolverResult()
|
|
|
|
|
m_bPendingResultWidgetRefresh) {
|
|
|
|
|
// 首次结果页尚未填充,最终提示必须等页面真实创建结果返回后再显示。
|
|
|
|
|
m_bPendingResultCompletionMessage = true;
|
|
|
|
|
m_nPendingResultPebiCount = nPebiCount;
|
|
|
|
|
m_nPendingResultSolveTimeMs = nSolveTimeMs;
|
|
|
|
|
} else if(bSucceeded) {
|
|
|
|
|
showSolverResultCompletion(bResultWindowReady,
|
|
|
|
|
nPebiCount,
|
|
|
|
|
nSolveTimeMs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -2511,14 +2498,21 @@ void nmSubWndMain::completePendingSolverResult()
|
|
|
|
|
|
|
|
|
|
void nmSubWndMain::showSolverResultCompletion(
|
|
|
|
|
bool bResultWindowReady,
|
|
|
|
|
int nPebiCount,
|
|
|
|
|
int nSolveTimeMs)
|
|
|
|
|
{
|
|
|
|
|
if(bResultWindowReady && nPebiCount >= 0 && nSolveTimeMs >= 0) {
|
|
|
|
|
QMessageBox::information(this, tr("Solver completed"),
|
|
|
|
|
tr("Grid count: %1\nSolve time: %2 ms")
|
|
|
|
|
.arg(nPebiCount)
|
|
|
|
|
.arg(nSolveTimeMs));
|
|
|
|
|
// 完成提示只显示 DLL 返回的本次求解耗时。
|
|
|
|
|
if(bResultWindowReady && nSolveTimeMs >= 0) {
|
|
|
|
|
QMessageBox oMessageBox(QMessageBox::Information, tr("Solver completed"),
|
|
|
|
|
tr("Solve time: %1 ms").arg(nSolveTimeMs),
|
|
|
|
|
QMessageBox::Ok, this);
|
|
|
|
|
// 单行耗时在提示区域水平、垂直居中,与左侧图标对齐。
|
|
|
|
|
QLabel* pMessageLabel = oMessageBox.findChild<QLabel*>("qt_msgbox_label");
|
|
|
|
|
if(pMessageLabel != nullptr) {
|
|
|
|
|
pMessageLabel->setAlignment(Qt::AlignCenter);
|
|
|
|
|
pMessageLabel->setMinimumHeight(
|
|
|
|
|
oMessageBox.iconPixmap().height());
|
|
|
|
|
}
|
|
|
|
|
oMessageBox.exec();
|
|
|
|
|
} else if(!bResultWindowReady) {
|
|
|
|
|
QMessageBox::warning(
|
|
|
|
|
this,
|
|
|
|
|
@ -2536,7 +2530,6 @@ void nmSubWndMain::on_solverTaskFinished(bool isSuccessed)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int nPebiCount = pTask != nullptr ? pTask->getPebiCount() : -1;
|
|
|
|
|
int nSolveTimeMs = pTask != nullptr ? pTask->getSolveTimeMs() : -1;
|
|
|
|
|
const bool bCancelled = pTask->wasCancelled();
|
|
|
|
|
QString sFailureReason = pTask->getFailureReason();
|
|
|
|
|
@ -2575,7 +2568,6 @@ void nmSubWndMain::on_solverTaskFinished(bool isSuccessed)
|
|
|
|
|
m_bSolverCancelRequested = false;
|
|
|
|
|
} else {
|
|
|
|
|
scheduleSolverResultCompletion(isSuccessed,
|
|
|
|
|
nPebiCount,
|
|
|
|
|
nSolveTimeMs,
|
|
|
|
|
bInputChanged,
|
|
|
|
|
sFailureReason);
|
|
|
|
|
|