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