diff --git a/NEWS.md b/NEWS.md index 1feefba6..ff191d4c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -9,6 +9,7 @@ Red Panda C++ Version 1.0.9 - fix: the hiding state of the tools output panel is not correctly saved - enhancement: add "toggle explorer panel" and "toggle messages panel" in "view" menu - fix: cursor is wrongly positioned when insert code snippets that don't have placeholders + - fix: "run current cases" dosen't correctly display real output Red Panda C++ Version 1.0.8 - enhancement: auto complete '#undef' diff --git a/RedPandaIDE/compiler/compilermanager.cpp b/RedPandaIDE/compiler/compilermanager.cpp index ce680768..144b7ebd 100644 --- a/RedPandaIDE/compiler/compilermanager.cpp +++ b/RedPandaIDE/compiler/compilermanager.cpp @@ -289,27 +289,21 @@ void CompilerManager::run(const QString &filename, const QString &arguments, con mRunner->start(); } + void CompilerManager::runProblem(const QString &filename, const QString &arguments, const QString &workDir, POJProblemCase problemCase) { QMutexLocker locker(&mRunnerMutex); - if (mRunner!=nullptr) { - return; - } + doRunProblem(filename, arguments, workDir, QVector {problemCase}); - OJProblemCasesRunner * execRunner = new OJProblemCasesRunner(filename,arguments,workDir,problemCase); - mRunner = execRunner; - connect(mRunner, &Runner::finished, this ,&CompilerManager::onRunnerTerminated); - connect(mRunner, &Runner::finished, mRunner ,&Runner::deleteLater); - connect(mRunner, &Runner::finished, pMainWindow ,&MainWindow::onRunProblemFinished); - connect(mRunner, &Runner::runErrorOccurred, pMainWindow ,&MainWindow::onRunErrorOccured); - connect(execRunner, &OJProblemCasesRunner::caseStarted, pMainWindow, &MainWindow::onOJProblemCaseStarted); - connect(execRunner, &OJProblemCasesRunner::caseFinished, pMainWindow, &MainWindow::onOJProblemCaseFinished); - mRunner->start(); } -void CompilerManager::runProblem(const QString &filename, const QString &arguments, const QString &workDir, QVector problemCases) +void CompilerManager::runProblem(const QString &filename, const QString &arguments, const QString &workDir, const QVector& problemCases) { QMutexLocker locker(&mRunnerMutex); + doRunProblem(filename, arguments, workDir, problemCases); +} +void CompilerManager::doRunProblem(const QString &filename, const QString &arguments, const QString &workDir, const QVector& problemCases) +{ if (mRunner!=nullptr) { return; } @@ -318,6 +312,7 @@ void CompilerManager::runProblem(const QString &filename, const QString &argumen if (pSettings->executor().enableCaseTimeout()) execRunner->setExecTimeout(pSettings->executor().caseTimeout()); connect(mRunner, &Runner::finished, this ,&CompilerManager::onRunnerTerminated); + connect(mRunner, &Runner::finished, mRunner ,&Runner::deleteLater); connect(mRunner, &Runner::finished, pMainWindow ,&MainWindow::onRunProblemFinished); connect(mRunner, &Runner::runErrorOccurred, pMainWindow ,&MainWindow::onRunErrorOccured); connect(execRunner, &OJProblemCasesRunner::caseStarted, pMainWindow, &MainWindow::onOJProblemCaseStarted); diff --git a/RedPandaIDE/compiler/compilermanager.h b/RedPandaIDE/compiler/compilermanager.h index 153f6879..df350a63 100644 --- a/RedPandaIDE/compiler/compilermanager.h +++ b/RedPandaIDE/compiler/compilermanager.h @@ -44,7 +44,7 @@ public: void checkSyntax(const QString&filename, const QByteArray& encoding, const QString& content, std::shared_ptr project); void run(const QString& filename, const QString& arguments, const QString& workDir); void runProblem(const QString& filename, const QString& arguments, const QString& workDir, POJProblemCase problemCase); - void runProblem(const QString& filename, const QString& arguments, const QString& workDir, QVector problemCases); + void runProblem(const QString& filename, const QString& arguments, const QString& workDir, const QVector &problemCases); void stopRun(); void stopAllRunners(); void stopPausing(); @@ -63,6 +63,7 @@ signals: void signalStopAllRunners(); private slots: + void doRunProblem(const QString& filename, const QString& arguments, const QString& workDir, const QVector &problemCases); void onRunnerTerminated(); void onRunnerPausing(); void onCompileFinished();