work save

This commit is contained in:
royqh1979@gmail.com 2021-08-01 12:02:28 +08:00
parent 7de6e6fd8b
commit 3ff9a6dafe
3 changed files with 28 additions and 14 deletions

View File

@ -45,7 +45,7 @@ void Debugger::start()
mReader->setDebuggerPath(debuggerPath); mReader->setDebuggerPath(debuggerPath);
connect(mReader, &QThread::finished,this,&Debugger::clearUpReader); connect(mReader, &QThread::finished,this,&Debugger::clearUpReader);
connect(mReader, &DebugReader::parseFinished,this,&Debugger::syncFinishedParsing,Qt::BlockingQueuedConnection); connect(mReader, &DebugReader::parseFinished,this,&Debugger::syncFinishedParsing,Qt::BlockingQueuedConnection);
connect(mReader, &DebugReader::changeDebugConsoleLastLine,this,&Debugger::onChangeDebugConsoleLastline,Qt::BlockingQueuedConnection); connect(mReader, &DebugReader::changeDebugConsoleLastLine,this,&Debugger::onChangeDebugConsoleLastline);
connect(mReader, &DebugReader::addLocalWithLinebreak,this,&Debugger::onAddLocalWithLinebreak); connect(mReader, &DebugReader::addLocalWithLinebreak,this,&Debugger::onAddLocalWithLinebreak);
connect(mReader, &DebugReader::addLocalWithoutLinebreak,this,&Debugger::onAddLocalWithoutLinebreak); connect(mReader, &DebugReader::addLocalWithoutLinebreak,this,&Debugger::onAddLocalWithoutLinebreak);
connect(mReader, &DebugReader::clearLocals,this,&Debugger::onClearLocals); connect(mReader, &DebugReader::clearLocals,this,&Debugger::onClearLocals);
@ -89,6 +89,8 @@ void Debugger::clearUpReader()
for(PWatchVar var:mWatchModel->watchVars()) { for(PWatchVar var:mWatchModel->watchVars()) {
invalidateWatchVar(var); invalidateWatchVar(var);
} }
pMainWindow->updateEditorActions();
} }
} }

View File

@ -154,6 +154,13 @@ void MainWindow::updateEditorActions()
ui->actionRun->setEnabled(false); ui->actionRun->setEnabled(false);
ui->actionRebuild->setEnabled(false); ui->actionRebuild->setEnabled(false);
ui->actionStop_Execution->setEnabled(false); ui->actionStop_Execution->setEnabled(false);
ui->actionDebug->setEnabled(false);
ui->actionStep_Over->setEnabled(false);
ui->actionStep_Into->setEnabled(false);
ui->actionStep_Out->setEnabled(false);
ui->actionContinue->setEnabled(false);
ui->actionRun_To_Cursor->setEnabled(false);
} else { } else {
ui->actionAuto_Detect->setEnabled(true); ui->actionAuto_Detect->setEnabled(true);
ui->actionEncode_in_ANSI->setEnabled(true); ui->actionEncode_in_ANSI->setEnabled(true);
@ -184,18 +191,26 @@ void MainWindow::updateEditorActions()
void MainWindow::updateCompileActions() void MainWindow::updateCompileActions()
{ {
if (mCompilerManager->compiling()|| mCompilerManager->running()) { if (mCompilerManager->compiling() || mCompilerManager->running() || mDebugger->executing()) {
ui->actionCompile->setEnabled(false); ui->actionCompile->setEnabled(false);
ui->actionCompile_Run->setEnabled(false); ui->actionCompile_Run->setEnabled(false);
ui->actionRun->setEnabled(false); ui->actionRun->setEnabled(false);
ui->actionRebuild->setEnabled(false); ui->actionRebuild->setEnabled(false);
ui->actionDebug->setEnabled(false);
} else { } else {
ui->actionCompile->setEnabled(true); ui->actionCompile->setEnabled(true);
ui->actionCompile_Run->setEnabled(true); ui->actionCompile_Run->setEnabled(true);
ui->actionRun->setEnabled(true); ui->actionRun->setEnabled(true);
ui->actionRebuild->setEnabled(true); ui->actionRebuild->setEnabled(true);
ui->actionDebug->setEnabled(true);
} }
ui->actionStop_Execution->setEnabled(mCompilerManager->running()); ui->actionStep_Into->setEnabled(mDebugger->executing());
ui->actionStep_Out->setEnabled(mDebugger->executing());
ui->actionStep_Over->setEnabled(mDebugger->executing());
ui->actionContinue->setEnabled(mDebugger->executing());
ui->actionRun_To_Cursor->setEnabled(mDebugger->executing());
ui->actionStop_Execution->setEnabled(mCompilerManager->running() || mDebugger->executing());
} }
void MainWindow::updateEditorColorSchemes() void MainWindow::updateEditorColorSchemes()
@ -677,6 +692,7 @@ void MainWindow::debug()
break; break;
} }
updateEditorActions();
// Add library folders // Add library folders
for (QString dir:compilerSet->libDirs()) { for (QString dir:compilerSet->libDirs()) {
@ -1253,6 +1269,7 @@ void MainWindow::on_actionRebuild_triggered()
void MainWindow::on_actionStop_Execution_triggered() void MainWindow::on_actionStop_Execution_triggered()
{ {
mCompilerManager->stopRun(); mCompilerManager->stopRun();
mDebugger->stop();
} }
void MainWindow::on_actionDebug_triggered() void MainWindow::on_actionDebug_triggered()
@ -1316,8 +1333,7 @@ void MainWindow::on_actionStep_Over_triggered()
mDebugger->updateDebugInfo(); mDebugger->updateDebugInfo();
// if (CPUForm) then // if (CPUForm) then
// CPUForm.UpdateInfo; // CPUForm.UpdateInfo;
//WatchView.Items.EndUpdate(); mDebugger->refreshWatchVars();
//fDebugger.RefreshWatchVars;
} }
} }
@ -1330,8 +1346,7 @@ void MainWindow::on_actionStep_Into_triggered()
mDebugger->updateDebugInfo(); mDebugger->updateDebugInfo();
// if (CPUForm) then // if (CPUForm) then
// CPUForm.UpdateInfo; // CPUForm.UpdateInfo;
//WatchView.Items.EndUpdate(); mDebugger->refreshWatchVars();
//fDebugger.RefreshWatchVars;
} }
} }
@ -1345,8 +1360,7 @@ void MainWindow::on_actionStep_Out_triggered()
mDebugger->updateDebugInfo(); mDebugger->updateDebugInfo();
// if (CPUForm) then // if (CPUForm) then
// CPUForm.UpdateInfo; // CPUForm.UpdateInfo;
//WatchView.Items.EndUpdate(); mDebugger->refreshWatchVars();
//fDebugger.RefreshWatchVars;
} }
} }
@ -1363,8 +1377,7 @@ void MainWindow::on_actionRun_To_Cursor_triggered()
mDebugger->updateDebugInfo(); mDebugger->updateDebugInfo();
// if (CPUForm) then // if (CPUForm) then
// CPUForm.UpdateInfo; // CPUForm.UpdateInfo;
//WatchView.Items.EndUpdate(); mDebugger->refreshWatchVars();
//fDebugger.RefreshWatchVars;
} }
} }
@ -1379,8 +1392,7 @@ void MainWindow::on_actionContinue_triggered()
mDebugger->updateDebugInfo(); mDebugger->updateDebugInfo();
// if (CPUForm) then // if (CPUForm) then
// CPUForm.UpdateInfo; // CPUForm.UpdateInfo;
//WatchView.Items.EndUpdate(); mDebugger->refreshWatchVars();
//fDebugger.RefreshWatchVars;
} }
} }

View File

@ -140,7 +140,7 @@
</widget> </widget>
<widget class="QWidget" name="EditorPanel" native="true"> <widget class="QWidget" name="EditorPanel" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>2</horstretch> <horstretch>2</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>