diff --git a/NEWS.md b/NEWS.md
index afe847a0..f1f17bfc 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,6 @@
+Version 0.7.7
+ - change: "save" action will be enabled no matter contents in the current editor is modified or not
+
Version 0.7.6
- change: don't auto insert a new line when input an enter between '(' and ')' or between '[' and ']' (indent instead)
- enhancement: the line containing '}' will use the indents of the matching '{' line, instead of just unindent one level
diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro
index ef5cd25a..4edce9a7 100644
--- a/RedPandaIDE/RedPandaIDE.pro
+++ b/RedPandaIDE/RedPandaIDE.pro
@@ -83,7 +83,6 @@ SOURCES += \
iconsmanager.cpp \
main.cpp \
mainwindow.cpp \
- problems/problemcasevalidator.cpp \
qsynedit/CodeFolding.cpp \
qsynedit/Constants.cpp \
qsynedit/KeyStrokes.cpp \
@@ -158,7 +157,6 @@ HEADERS += \
platform.h \
problems/ojproblemset.h \
problems/problemcasevalidator.h \
- problems/problemcasevalidator.h \
project.h \
projectoptions.h \
projecttemplate.h \
diff --git a/RedPandaIDE/compiler/compilermanager.cpp b/RedPandaIDE/compiler/compilermanager.cpp
index 470cd48d..819f55c6 100644
--- a/RedPandaIDE/compiler/compilermanager.cpp
+++ b/RedPandaIDE/compiler/compilermanager.cpp
@@ -247,6 +247,7 @@ void CompilerManager::runProblem(const QString &filename, const QString &argumen
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();
}
@@ -262,6 +263,7 @@ void CompilerManager::runProblem(const QString &filename, const QString &argumen
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();
}
diff --git a/RedPandaIDE/compiler/ojproblemcasesrunner.cpp b/RedPandaIDE/compiler/ojproblemcasesrunner.cpp
index e8f6473f..a3dfedc2 100644
--- a/RedPandaIDE/compiler/ojproblemcasesrunner.cpp
+++ b/RedPandaIDE/compiler/ojproblemcasesrunner.cpp
@@ -62,6 +62,7 @@ void OJProblemCasesRunner::runCase(int index,POJProblemCase problemCase)
QByteArray readed;
while (true) {
process.waitForFinished(1000);
+ readed += process.readAll();
if (process.state()!=QProcess::Running) {
break;
}
@@ -73,7 +74,6 @@ void OJProblemCasesRunner::runCase(int index,POJProblemCase problemCase)
process.kill();
break;
}
- readed += process.readAll();
if (errorOccurred)
break;
}
diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp
index ddcc09f4..0c3f7ad6 100644
--- a/RedPandaIDE/mainwindow.cpp
+++ b/RedPandaIDE/mainwindow.cpp
@@ -216,7 +216,6 @@ MainWindow::MainWindow(QWidget *parent)
connect(ui->lstProblemCases->selectionModel(),
&QItemSelectionModel::currentRowChanged,
this, &MainWindow::onProblemCaseIndexChanged);
- ui->tabProblem->setVisible(false);
//files view
ui->treeFiles->setModel(&mFileSystemModel);
@@ -354,7 +353,7 @@ void MainWindow::updateEditorActions()
ui->actionPaste->setEnabled(!e->readOnly() && !QGuiApplication::clipboard()->text().isEmpty());
ui->actionRedo->setEnabled(e->canRedo());
ui->actionUndo->setEnabled(e->canUndo());
- ui->actionSave->setEnabled(e->modified());
+ ui->actionSave->setEnabled(!e->readOnly());
ui->actionSaveAs->setEnabled(true);
ui->actionExport_As_HTML->setEnabled(true);
ui->actionExport_As_RTF->setEnabled(true);
@@ -1096,7 +1095,7 @@ void MainWindow::runExecutable(const QString &exeName,const QString &filename,Ru
tr("Source file is not compiled.")
+"
"+tr("Compile now?"),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
- ui->actionCompile_Run->trigger();
+ doCompileRun(runType);
}
return;
} else {
@@ -1111,7 +1110,7 @@ void MainWindow::runExecutable(const QString &exeName,const QString &filename,Ru
tr("Source file is more recent than executable.")
+"
"+tr("Recompile now?"),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
- ui->actionCompile_Run->trigger();
+ doCompileRun(runType);
return;
}
} else {
@@ -1120,21 +1119,6 @@ void MainWindow::runExecutable(const QString &exeName,const QString &filename,Ru
}
}
}
- // Pause programs if they contain a console
-// if devData.ConsolePause and ProgramHasConsole(FileToRun) then begin
-// if fUseRunParams then
-// Parameters := '"' + FileToRun + '" ' + fRunParams
-// else
-// Parameters := '"' + FileToRun + '"';
-
-// FileToRun := devDirs.Exec + 'ConsolePauser.exe';
-// end else begin
-// if fUseRunParams then
-// Parameters := fRunParams
-// else
-// Parameters := '';
-// FileToRun := FileToRun;
-// end;
updateCompileActions();
QString params;
@@ -2545,13 +2529,11 @@ void MainWindow::onProblemSetIndexChanged(const QModelIndex ¤t, const QMod
// }
if (!idx.isValid()) {
ui->btnRemoveProblem->setEnabled(false);
- ui->tabProblem->setVisible(false);
} else {
ui->btnRemoveProblem->setEnabled(true);
POJProblem problem = mOJProblemSetModel.problem(idx.row());
mOJProblemModel.setProblem(problem);
ui->lblProblem->setText(problem->name);
- ui->tabProblem->setVisible(true);
openCloseBottomPanel(true);
ui->tabMessages->setCurrentWidget(ui->tabProblem);
}
@@ -2564,7 +2546,6 @@ void MainWindow::onProblemCaseIndexChanged(const QModelIndex ¤t, const QMo
POJProblemCase problemCase = mOJProblemModel.getCase(previous.row());
problemCase->input = ui->txtProblemCaseInput->toPlainText();
problemCase->expected = ui->txtProblemCaseExpected->toPlainText();
- problemCase->output = ui->txtProblemCaseOutput->toPlainText();
}
if (idx.isValid()) {
POJProblemCase problemCase = mOJProblemModel.getCase(idx.row());
@@ -3279,9 +3260,15 @@ void MainWindow::onCompileFinished(bool isCheckSyntax)
//run succession task if there aren't any errors
if (mCompileSuccessionTask && mCompilerManager->compileErrorCount()==0) {
switch (mCompileSuccessionTask->type) {
- case MainWindow::CompileSuccessionTaskType::Run:
+ case MainWindow::CompileSuccessionTaskType::RunNormal:
runExecutable(mCompileSuccessionTask->filename);
break;
+ case MainWindow::CompileSuccessionTaskType::RunProblemCases:
+ runExecutable(mCompileSuccessionTask->filename,QString(),RunType::ProblemCases);
+ break;
+ case MainWindow::CompileSuccessionTaskType::RunCurrentProblemCase:
+ runExecutable(mCompileSuccessionTask->filename,QString(),RunType::CurrentProblemCase);
+ break;
case MainWindow::CompileSuccessionTaskType::Debug:
debug();
break;
@@ -3598,9 +3585,7 @@ void MainWindow::on_tabMessages_tabBarDoubleClicked(int )
void MainWindow::on_actionCompile_Run_triggered()
{
- mCompileSuccessionTask = std::make_shared();
- mCompileSuccessionTask->type = CompileSuccessionTaskType::Run;
- compile();
+ doCompileRun(RunType::Normal);
}
void MainWindow::on_actionRebuild_triggered()
@@ -4688,6 +4673,22 @@ void MainWindow::clearIssues()
ui->tableIssues->clearIssues();
}
+void MainWindow::doCompileRun(RunType runType)
+{
+ mCompileSuccessionTask = std::make_shared();
+ switch (runType) {
+ case RunType::CurrentProblemCase:
+ mCompileSuccessionTask->type = CompileSuccessionTaskType::RunCurrentProblemCase;
+ break;
+ case RunType::ProblemCases:
+ mCompileSuccessionTask->type = CompileSuccessionTaskType::RunProblemCases;
+ break;
+ default:
+ mCompileSuccessionTask->type = CompileSuccessionTaskType::RunNormal;
+ }
+ compile();
+}
+
Ui::MainWindow *MainWindow::mainWidget() const
{
return ui;
diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h
index 941841d3..c3595f33 100644
--- a/RedPandaIDE/mainwindow.h
+++ b/RedPandaIDE/mainwindow.h
@@ -53,7 +53,9 @@ class MainWindow : public QMainWindow
enum class CompileSuccessionTaskType {
None,
- Run,
+ RunNormal,
+ RunProblemCases,
+ RunCurrentProblemCase,
Debug,
Profile
};
@@ -206,6 +208,7 @@ private:
void showSearchReplacePanel(bool show);
void setFilesViewRoot(const QString& path);
void clearIssues();
+ void doCompileRun(RunType runType);
private slots:
void onAutoSaveTimeout();
diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp
index 95ef811f..94eecb5e 100644
--- a/RedPandaIDE/settings.cpp
+++ b/RedPandaIDE/settings.cpp
@@ -2385,7 +2385,9 @@ void Settings::CompilerSets::loadSets()
.arg(pCurrentSet->name())
+"
"
+msg
- +"Would you like Red Panda C++ to remove them for you and add the default paths to the valid paths?
Leaving those directories will lead to problems during compilation.
Unless you know exactly what you're doing, it is recommended that you click Yes.",
+ +QObject::tr("Would you like Red Panda C++ to remove them for you and add the default paths to the valid paths?")
+ +"
"
+ +QObject::tr("Leaving those directories will lead to problems during compilation.
Unless you know exactly what you're doing, it is recommended that you click Yes."),
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) {
return;
}
diff --git a/RedPandaIDE/widgets/ojproblemsetmodel.cpp b/RedPandaIDE/widgets/ojproblemsetmodel.cpp
index ea32bb5c..5ed5de80 100644
--- a/RedPandaIDE/widgets/ojproblemsetmodel.cpp
+++ b/RedPandaIDE/widgets/ojproblemsetmodel.cpp
@@ -289,7 +289,7 @@ QVariant OJProblemModel::data(const QModelIndex &index, int role) const
case ProblemCaseTestState::Failed:
return QIcon(":/icons/images/newlook24/008-close.png");
case ProblemCaseTestState::Passed:
- return QIcon(":/icons/images/newlook24/007-bughelp.png");
+ return QIcon(":/icons/images/newlook24/007-bughlp.png");
case ProblemCaseTestState::Testing:
return QIcon(":/icons/images/newlook24/052-next.png");
default: