- fix: "run current cases" dosen't correctly display real output

This commit is contained in:
Roy Qu 2022-05-26 21:22:07 +08:00
parent fbdd268484
commit e920d230df
3 changed files with 11 additions and 14 deletions

View File

@ -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'

View File

@ -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<POJProblemCase> {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<POJProblemCase> problemCases)
void CompilerManager::runProblem(const QString &filename, const QString &arguments, const QString &workDir, const QVector<POJProblemCase>& problemCases)
{
QMutexLocker locker(&mRunnerMutex);
doRunProblem(filename, arguments, workDir, problemCases);
}
void CompilerManager::doRunProblem(const QString &filename, const QString &arguments, const QString &workDir, const QVector<POJProblemCase>& 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);

View File

@ -44,7 +44,7 @@ public:
void checkSyntax(const QString&filename, const QByteArray& encoding, const QString& content, std::shared_ptr<Project> 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<POJProblemCase> problemCases);
void runProblem(const QString& filename, const QString& arguments, const QString& workDir, const QVector<POJProblemCase> &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<POJProblemCase> &problemCases);
void onRunnerTerminated();
void onRunnerPausing();
void onCompileFinished();