work save

This commit is contained in:
royqh1979@gmail.com 2021-08-20 12:43:01 +08:00
parent 9f3d50d6a2
commit 2eeea0eb6d
3 changed files with 10 additions and 6 deletions

View File

@ -24,23 +24,24 @@ Debugger::Debugger(QObject *parent) : QObject(parent)
mLeftPageIndexBackup = -1;
}
void Debugger::start()
bool Debugger::start()
{
Settings::PCompilerSet compilerSet = pSettings->compilerSets().defaultSet();
if (!compilerSet) {
QMessageBox::critical(pMainWindow,
tr("No compiler set"),
tr("No compiler set is configured.")+tr("Can't start debugging."));
return;
return false;
}
mExecuting = true;
QString debuggerPath = compilerSet->debugger();
QFile debuggerProgram(debuggerPath);
if (!debuggerProgram.exists()) {
mExecuting = false;
QMessageBox::critical(pMainWindow,
tr("Debugger not exists"),
tr("Can''t find debugger in : \"%1\"").arg(debuggerPath));
return;
return false;
}
mReader = new DebugReader(this);
mReader->setDebuggerPath(debuggerPath);
@ -56,6 +57,7 @@ void Debugger::start()
pMainWindow->updateAppTitle();
//Application.HintHidePause := 5000;
return true;
}
void Debugger::stop() {
if (mExecuting) {

View File

@ -167,7 +167,7 @@ class Debugger : public QObject
public:
explicit Debugger(QObject *parent = nullptr);
// Play/pause
void start();
bool start();
void sendCommand(const QString& command, const QString& params,
bool updateWatch = true,
bool showInConsole = false,

View File

@ -666,7 +666,8 @@ void MainWindow::debug()
// filepath := fProject.Executable;
// fDebugger.Start;
// if (!mDebugger->start())
// return;
// fDebugger.SendCommand('file', '"' + StringReplace(filepath, '\', '/', [rfReplaceAll]) + '"');
// if fProject.Options.typ = dptDyn then
@ -756,7 +757,8 @@ void MainWindow::debug()
prepareDebugger();
mDebugger->setUseUTF8(e->fileEncoding() == ENCODING_UTF8 || e->fileEncoding() == ENCODING_UTF8_BOM);
mDebugger->start();
if (!mDebugger->start())
return;
mDebugger->sendCommand("file", QString("\"%1\"").arg(debugFile.filePath().replace('\\','/')));
}
break;