- fix: mainwindow action's short cut doesn't work, if the action is not in menu or toolbar
- fix: when run all cases for a problem, processing of output is slow
This commit is contained in:
parent
f298cc7b47
commit
002f9d4805
1
NEWS.md
1
NEWS.md
|
@ -6,6 +6,7 @@ Red Panda C++ Version 0.14.0
|
||||||
- fix: code folding calcuation not correct when some codes are folded and editing after them
|
- fix: code folding calcuation not correct when some codes are folded and editing after them
|
||||||
- enhancement: code completion ui redesigned
|
- enhancement: code completion ui redesigned
|
||||||
- fix: mainwindow action's short cut doesn't work, if the action is not in menu or toolbar
|
- fix: mainwindow action's short cut doesn't work, if the action is not in menu or toolbar
|
||||||
|
- fix: when run all cases for a problem, processing of output is slow
|
||||||
|
|
||||||
Red Panda C++ Version 0.13.4
|
Red Panda C++ Version 0.13.4
|
||||||
- fix: when copy comments, don't auto indent
|
- fix: when copy comments, don't auto indent
|
||||||
|
|
|
@ -325,7 +325,7 @@ void CompilerManager::runProblem(const QString &filename, const QString &argumen
|
||||||
connect(mRunner, &Runner::runErrorOccurred, pMainWindow ,&MainWindow::onRunErrorOccured);
|
connect(mRunner, &Runner::runErrorOccurred, pMainWindow ,&MainWindow::onRunErrorOccured);
|
||||||
connect(execRunner, &OJProblemCasesRunner::caseStarted, pMainWindow, &MainWindow::onOJProblemCaseStarted);
|
connect(execRunner, &OJProblemCasesRunner::caseStarted, pMainWindow, &MainWindow::onOJProblemCaseStarted);
|
||||||
connect(execRunner, &OJProblemCasesRunner::caseFinished, pMainWindow, &MainWindow::onOJProblemCaseFinished);
|
connect(execRunner, &OJProblemCasesRunner::caseFinished, pMainWindow, &MainWindow::onOJProblemCaseFinished);
|
||||||
connect(execRunner, &OJProblemCasesRunner::newOutputLineGetted, pMainWindow, &MainWindow::onOJProblemCaseNewOutputLineGetted);
|
connect(execRunner, &OJProblemCasesRunner::newOutputGetted, pMainWindow, &MainWindow::onOJProblemCaseNewOutputGetted);
|
||||||
mRunner->start();
|
mRunner->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,10 +79,10 @@ void OJProblemCasesRunner::runCase(int index,POJProblemCase problemCase)
|
||||||
}
|
}
|
||||||
QByteArray readed;
|
QByteArray readed;
|
||||||
QByteArray buffer;
|
QByteArray buffer;
|
||||||
QStringList outputLines;
|
QByteArray output;
|
||||||
while (true) {
|
while (true) {
|
||||||
process.waitForFinished(100);
|
process.waitForFinished(100);
|
||||||
readed = process.readAll();
|
readed = process.read(5001);
|
||||||
buffer += readed;
|
buffer += readed;
|
||||||
if (process.state()!=QProcess::Running) {
|
if (process.state()!=QProcess::Running) {
|
||||||
break;
|
break;
|
||||||
|
@ -97,30 +97,15 @@ void OJProblemCasesRunner::runCase(int index,POJProblemCase problemCase)
|
||||||
}
|
}
|
||||||
if (errorOccurred)
|
if (errorOccurred)
|
||||||
break;
|
break;
|
||||||
QList<QByteArray> lines = splitByteArrayToLines(buffer);
|
if (buffer.length()>5000) {
|
||||||
// qDebug()<<"----do buffer----";
|
emit newOutputGetted(problemCase->getId(),QString::fromLocal8Bit(buffer));
|
||||||
// qDebug()<<readed;
|
output.append(buffer);
|
||||||
// qDebug()<<buffer;
|
buffer.clear();
|
||||||
// qDebug()<<lines.count();
|
|
||||||
if (lines.count()>=2) {
|
|
||||||
for (int i=0;i<lines.count()-1;i++) {
|
|
||||||
QString line = QString::fromLocal8Bit(lines[i]);
|
|
||||||
emit newOutputLineGetted(problemCase->getId(),line);
|
|
||||||
outputLines.append(line);
|
|
||||||
}
|
|
||||||
buffer = lines.last();
|
|
||||||
while (buffer.endsWith('\0')) {
|
|
||||||
buffer.remove(buffer.length()-1,1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buffer += process.readAll();
|
if (process.state() == QProcess::ProcessState::NotRunning)
|
||||||
QList<QByteArray> lines = splitByteArrayToLines(buffer);
|
buffer += process.readAll();
|
||||||
for (int i=0;i<lines.count();i++) {
|
output.append(buffer);
|
||||||
QString line = QString::fromLocal8Bit(lines[i]);
|
|
||||||
emit newOutputLineGetted(problemCase->getId(),line);
|
|
||||||
outputLines.append(line);
|
|
||||||
}
|
|
||||||
if (errorOccurred) {
|
if (errorOccurred) {
|
||||||
//qDebug()<<"process error:"<<process.error();
|
//qDebug()<<"process error:"<<process.error();
|
||||||
switch (process.error()) {
|
switch (process.error()) {
|
||||||
|
@ -144,7 +129,7 @@ void OJProblemCasesRunner::runCase(int index,POJProblemCase problemCase)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
problemCase->output = linesToText(outputLines);
|
problemCase->output = QString::fromLocal8Bit(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OJProblemCasesRunner::run()
|
void OJProblemCasesRunner::run()
|
||||||
|
|
|
@ -32,7 +32,7 @@ public:
|
||||||
signals:
|
signals:
|
||||||
void caseStarted(const QString& id, int current, int total);
|
void caseStarted(const QString& id, int current, int total);
|
||||||
void caseFinished(const QString& id, int current, int total);
|
void caseFinished(const QString& id, int current, int total);
|
||||||
void newOutputLineGetted(const QString&id, const QString& newOutputLine);
|
void newOutputGetted(const QString&id, const QString& newOutputLine);
|
||||||
private:
|
private:
|
||||||
void runCase(int index, POJProblemCase problemCase);
|
void runCase(int index, POJProblemCase problemCase);
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -3117,9 +3117,9 @@ void MainWindow::onProblemCaseIndexChanged(const QModelIndex ¤t, const QMo
|
||||||
POJProblemCase problemCase = mOJProblemModel.getCase(idx.row());
|
POJProblemCase problemCase = mOJProblemModel.getCase(idx.row());
|
||||||
if (problemCase) {
|
if (problemCase) {
|
||||||
ui->btnRemoveProblemCase->setEnabled(true);
|
ui->btnRemoveProblemCase->setEnabled(true);
|
||||||
ui->txtProblemCaseInput->setText(problemCase->input);
|
ui->txtProblemCaseInput->setPlainText(problemCase->input);
|
||||||
ui->txtProblemCaseInput->setReadOnly(false);
|
ui->txtProblemCaseInput->setReadOnly(false);
|
||||||
ui->txtProblemCaseExpected->setText(problemCase->expected);
|
ui->txtProblemCaseExpected->setPlainText(problemCase->expected);
|
||||||
ui->txtProblemCaseExpected->setReadOnly(false);
|
ui->txtProblemCaseExpected->setReadOnly(false);
|
||||||
updateProblemCaseOutput(problemCase);
|
updateProblemCaseOutput(problemCase);
|
||||||
return;
|
return;
|
||||||
|
@ -4081,9 +4081,9 @@ void MainWindow::onOJProblemCaseFinished(const QString& id, int current, int tot
|
||||||
updateProblemTitle();
|
updateProblemTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onOJProblemCaseNewOutputLineGetted(const QString &, const QString &line)
|
void MainWindow::onOJProblemCaseNewOutputGetted(const QString &, const QString &line)
|
||||||
{
|
{
|
||||||
ui->txtProblemCaseOutput->append(line);
|
ui->txtProblemCaseOutput->appendPlainText(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::cleanUpCPUDialog()
|
void MainWindow::cleanUpCPUDialog()
|
||||||
|
@ -5519,7 +5519,7 @@ void MainWindow::doCompileRun(RunType runType)
|
||||||
void MainWindow::updateProblemCaseOutput(POJProblemCase problemCase)
|
void MainWindow::updateProblemCaseOutput(POJProblemCase problemCase)
|
||||||
{
|
{
|
||||||
ui->txtProblemCaseOutput->clear();
|
ui->txtProblemCaseOutput->clear();
|
||||||
ui->txtProblemCaseOutput->setText(problemCase->output);
|
ui->txtProblemCaseOutput->setPlainText(problemCase->output);
|
||||||
if (problemCase->testState == ProblemCaseTestState::Failed) {
|
if (problemCase->testState == ProblemCaseTestState::Failed) {
|
||||||
QStringList output = textToLines(problemCase->output);
|
QStringList output = textToLines(problemCase->output);
|
||||||
QStringList expected = textToLines(problemCase->expected);
|
QStringList expected = textToLines(problemCase->expected);
|
||||||
|
@ -5666,7 +5666,6 @@ void MainWindow::on_actionExport_As_HTML_triggered()
|
||||||
|
|
||||||
void MainWindow::on_actionMove_To_Other_View_triggered()
|
void MainWindow::on_actionMove_To_Other_View_triggered()
|
||||||
{
|
{
|
||||||
qDebug()<<"test";
|
|
||||||
Editor * editor = mEditorList->getEditor();
|
Editor * editor = mEditorList->getEditor();
|
||||||
if (editor) {
|
if (editor) {
|
||||||
mEditorList->swapEditor(editor);
|
mEditorList->swapEditor(editor);
|
||||||
|
|
|
@ -194,7 +194,7 @@ public slots:
|
||||||
void onRunProblemFinished();
|
void onRunProblemFinished();
|
||||||
void onOJProblemCaseStarted(const QString& id, int current, int total);
|
void onOJProblemCaseStarted(const QString& id, int current, int total);
|
||||||
void onOJProblemCaseFinished(const QString& id, int current, int total);
|
void onOJProblemCaseFinished(const QString& id, int current, int total);
|
||||||
void onOJProblemCaseNewOutputLineGetted(const QString& id, const QString& line);
|
void onOJProblemCaseNewOutputGetted(const QString& id, const QString& line);
|
||||||
void cleanUpCPUDialog();
|
void cleanUpCPUDialog();
|
||||||
void onDebugCommandInput(const QString& command);
|
void onDebugCommandInput(const QString& command);
|
||||||
void onDebugEvaluateInput();
|
void onDebugEvaluateInput();
|
||||||
|
|
|
@ -506,7 +506,7 @@
|
||||||
<enum>QTabWidget::South</enum>
|
<enum>QTabWidget::South</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>5</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
|
@ -1348,33 +1348,24 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="1">
|
||||||
<widget class="QTextEdit" name="txtProblemCaseInput">
|
<widget class="QPlainTextEdit" name="txtProblemCaseOutput">
|
||||||
<property name="lineWrapMode">
|
<property name="lineWrapMode">
|
||||||
<enum>QTextEdit::NoWrap</enum>
|
<enum>QPlainTextEdit::NoWrap</enum>
|
||||||
</property>
|
|
||||||
<property name="acceptRichText">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="0">
|
||||||
<widget class="QTextEdit" name="txtProblemCaseOutput">
|
<widget class="QPlainTextEdit" name="txtProblemCaseInput">
|
||||||
<property name="lineWrapMode">
|
<property name="lineWrapMode">
|
||||||
<enum>QTextEdit::NoWrap</enum>
|
<enum>QPlainTextEdit::NoWrap</enum>
|
||||||
</property>
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="1" column="2">
|
||||||
<widget class="QTextEdit" name="txtProblemCaseExpected">
|
<widget class="QPlainTextEdit" name="txtProblemCaseExpected">
|
||||||
<property name="lineWrapMode">
|
<property name="lineWrapMode">
|
||||||
<enum>QTextEdit::NoWrap</enum>
|
<enum>QPlainTextEdit::NoWrap</enum>
|
||||||
</property>
|
|
||||||
<property name="acceptRichText">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Reference in New Issue