- enhancement: Don't add "-g3" option when generate assembely.
- enhancement: Generate assembly is not correctly disabled when current file is not C/C++.
This commit is contained in:
parent
efc7af7f46
commit
fc07b4dcd4
3
NEWS.md
3
NEWS.md
|
@ -13,6 +13,9 @@ Red Panda C++ Version 2.7
|
||||||
- enhancement: Export FPS (free problem set) files.
|
- enhancement: Export FPS (free problem set) files.
|
||||||
- enhancement: Run all cases button not correct disabled when no case exits.
|
- enhancement: Run all cases button not correct disabled when no case exits.
|
||||||
- enhancement: Speed up remove problems.
|
- enhancement: Speed up remove problems.
|
||||||
|
- fix: "Compile" button disabled after app start with an empty new file.
|
||||||
|
- enhancement: Don't add "-g3" option when generate assembely.
|
||||||
|
- enhancement: Generate assembly is not correctly disabled when current file is not C/C++.
|
||||||
|
|
||||||
Red Panda C++ Version 2.6
|
Red Panda C++ Version 2.6
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#define CC_CMD_OPT_USE_PIPE "cc_cmd_opt_use_pipe"
|
#define CC_CMD_OPT_USE_PIPE "cc_cmd_opt_use_pipe"
|
||||||
|
|
||||||
#define COMPILER_OPTION_ON "on"
|
#define COMPILER_OPTION_ON "on"
|
||||||
|
#define COMPILER_OPTION_OFF ""
|
||||||
|
|
||||||
enum class CompilerSetType {
|
enum class CompilerSetType {
|
||||||
RELEASE,
|
RELEASE,
|
||||||
|
|
|
@ -36,8 +36,10 @@ FileCompiler::FileCompiler(const QString &filename, const QByteArray &encoding,
|
||||||
bool FileCompiler::prepareForCompile()
|
bool FileCompiler::prepareForCompile()
|
||||||
{
|
{
|
||||||
Settings::CompilerSet::CompilationStage oldStage = compilerSet()->compilationStage();
|
Settings::CompilerSet::CompilationStage oldStage = compilerSet()->compilationStage();
|
||||||
auto action = finally([this,oldStage]{
|
QString oldDebugOptionValue = compilerSet()->getCompileOptionValue(CC_CMD_OPT_DEBUG_INFO);
|
||||||
|
auto action = finally([this,oldStage,oldDebugOptionValue]{
|
||||||
compilerSet()->setCompilationStage(oldStage);
|
compilerSet()->setCompilationStage(oldStage);
|
||||||
|
compilerSet()->setCompileOption(CC_CMD_OPT_DEBUG_INFO,oldDebugOptionValue);
|
||||||
});
|
});
|
||||||
Settings::CompilerSet::CompilationStage stage = oldStage;
|
Settings::CompilerSet::CompilationStage stage = oldStage;
|
||||||
switch(mCompileType) {
|
switch(mCompileType) {
|
||||||
|
@ -46,6 +48,7 @@ bool FileCompiler::prepareForCompile()
|
||||||
break;
|
break;
|
||||||
case CppCompileType::GenerateAssemblyOnly:
|
case CppCompileType::GenerateAssemblyOnly:
|
||||||
stage = Settings::CompilerSet::CompilationStage::CompilationProperOnly;
|
stage = Settings::CompilerSet::CompilationStage::CompilationProperOnly;
|
||||||
|
compilerSet()->setCompileOption(CC_CMD_OPT_DEBUG_INFO,COMPILER_OPTION_OFF);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
stage = oldStage;
|
stage = oldStage;
|
||||||
|
|
|
@ -76,6 +76,8 @@
|
||||||
#include <QFileIconProvider>
|
#include <QFileIconProvider>
|
||||||
#include <QMimeDatabase>
|
#include <QMimeDatabase>
|
||||||
#include <QMimeType>
|
#include <QMimeType>
|
||||||
|
#include <QToolTip>
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QTextDocumentFragment>
|
#include <QTextDocumentFragment>
|
||||||
|
@ -92,10 +94,6 @@
|
||||||
#include "widgets/searchinfiledialog.h"
|
#include "widgets/searchinfiledialog.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#include <QMimeDatabase>
|
|
||||||
#include <QMimeType>
|
|
||||||
#include <QProgressDialog>
|
|
||||||
#include <QToolTip>
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -127,6 +125,10 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
addActions( this->findChildren<QAction *>(QString(), Qt::FindChildrenRecursively));
|
addActions( this->findChildren<QAction *>(QString(), Qt::FindChildrenRecursively));
|
||||||
|
|
||||||
|
//custom actions
|
||||||
|
createCustomActions();
|
||||||
|
|
||||||
// status bar
|
// status bar
|
||||||
|
|
||||||
//statusBar takes the owner ships
|
//statusBar takes the owner ships
|
||||||
|
@ -421,7 +423,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
//git menu
|
//git menu
|
||||||
connect(ui->menuGit, &QMenu::aboutToShow,
|
connect(ui->menuGit, &QMenu::aboutToShow,
|
||||||
this, &MainWindow::updateVCSActions);
|
this, &MainWindow::updateVCSActions);
|
||||||
createCustomActions();
|
|
||||||
initToolButtons();
|
initToolButtons();
|
||||||
buildContextMenus();
|
buildContextMenus();
|
||||||
updateAppTitle();
|
updateAppTitle();
|
||||||
|
@ -623,8 +625,8 @@ void MainWindow::updateEditorActions(const Editor *e)
|
||||||
ui->actionLocate_in_Files_View->setEnabled(!e->isNew());
|
ui->actionLocate_in_Files_View->setEnabled(!e->isNew());
|
||||||
}
|
}
|
||||||
|
|
||||||
updateCompileActions();
|
updateCompileActions(e);
|
||||||
updateCompilerSet();
|
updateCompilerSet(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -646,7 +648,11 @@ void MainWindow::updateProjectActions()
|
||||||
updateCompileActions();
|
updateCompileActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateCompileActions()
|
void MainWindow::updateCompileActions() {
|
||||||
|
updateCompileActions(mEditorList->getEditor());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::updateCompileActions(const Editor *e)
|
||||||
{
|
{
|
||||||
if (mCompilerManager->compiling() || mCompilerManager->running() || mDebugger->executing()) {
|
if (mCompilerManager->compiling() || mCompilerManager->running() || mDebugger->executing()) {
|
||||||
ui->actionCompile->setEnabled(false);
|
ui->actionCompile->setEnabled(false);
|
||||||
|
@ -660,7 +666,6 @@ void MainWindow::updateCompileActions()
|
||||||
bool forProject=false;
|
bool forProject=false;
|
||||||
bool canRun = false;
|
bool canRun = false;
|
||||||
bool canCompile = false;
|
bool canCompile = false;
|
||||||
Editor * e = mEditorList->getEditor();
|
|
||||||
if (e) {
|
if (e) {
|
||||||
if (!e->inProject()) {
|
if (!e->inProject()) {
|
||||||
FileType fileType = getFileType(e->filename());
|
FileType fileType = getFileType(e->filename());
|
||||||
|
@ -684,7 +689,7 @@ void MainWindow::updateCompileActions()
|
||||||
ui->actionCompile_Run->setEnabled(canRun && canCompile);
|
ui->actionCompile_Run->setEnabled(canRun && canCompile);
|
||||||
ui->actionRun->setEnabled(canRun);
|
ui->actionRun->setEnabled(canRun);
|
||||||
ui->actionRebuild->setEnabled(canCompile);
|
ui->actionRebuild->setEnabled(canCompile);
|
||||||
ui->actionGenerate_Assembly->setEnabled(!forProject);
|
ui->actionGenerate_Assembly->setEnabled(canCompile && !forProject);
|
||||||
ui->actionDebug->setEnabled(canRun);
|
ui->actionDebug->setEnabled(canRun);
|
||||||
ui->btnRunAllProblemCases->setEnabled(canRun);
|
ui->btnRunAllProblemCases->setEnabled(canRun);
|
||||||
}
|
}
|
||||||
|
@ -696,7 +701,6 @@ void MainWindow::updateCompileActions()
|
||||||
//it's not a compile action, but put here for convinience
|
//it's not a compile action, but put here for convinience
|
||||||
ui->actionSaveAll->setEnabled(mProject!=nullptr
|
ui->actionSaveAll->setEnabled(mProject!=nullptr
|
||||||
|| mEditorList->pageCount()>0);
|
|| mEditorList->pageCount()>0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateEditorColorSchemes()
|
void MainWindow::updateEditorColorSchemes()
|
||||||
|
@ -1535,6 +1539,11 @@ void MainWindow::changeOptions(const QString &widgetName, const QString &groupNa
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateCompilerSet()
|
void MainWindow::updateCompilerSet()
|
||||||
|
{
|
||||||
|
updateCompilerSet(mEditorList->getEditor());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::updateCompilerSet(const Editor *e)
|
||||||
{
|
{
|
||||||
mCompilerSet->blockSignals(true);
|
mCompilerSet->blockSignals(true);
|
||||||
mCompilerSet->clear();
|
mCompilerSet->clear();
|
||||||
|
@ -1543,7 +1552,6 @@ void MainWindow::updateCompilerSet()
|
||||||
}
|
}
|
||||||
int index=pSettings->compilerSets().defaultIndex();
|
int index=pSettings->compilerSets().defaultIndex();
|
||||||
if (mProject) {
|
if (mProject) {
|
||||||
Editor *e = mEditorList->getEditor();
|
|
||||||
if ( !e || e->inProject()) {
|
if ( !e || e->inProject()) {
|
||||||
index = mProject->options().compilerSet;
|
index = mProject->options().compilerSet;
|
||||||
} else if (e->syntaxer()
|
} else if (e->syntaxer()
|
||||||
|
@ -3781,11 +3789,14 @@ void MainWindow::onLstProblemSetContextMenu(const QPoint &pos)
|
||||||
void MainWindow::onTableProblemCasesContextMenu(const QPoint &pos)
|
void MainWindow::onTableProblemCasesContextMenu(const QPoint &pos)
|
||||||
{
|
{
|
||||||
QMenu menu(this);
|
QMenu menu(this);
|
||||||
|
menu.addAction(mProblem_AddCase);
|
||||||
|
menu.addAction(mProblem_RemoveCases);
|
||||||
menu.addAction(mProblem_batchSetCases);
|
menu.addAction(mProblem_batchSetCases);
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
QModelIndex idx = ui->tblProblemCases->currentIndex();
|
QModelIndex idx = ui->tblProblemCases->currentIndex();
|
||||||
menu.addAction(mProblem_RunAllCases);
|
menu.addAction(mProblem_RunAllCases);
|
||||||
menu.addAction(mProblem_RunCurrentCase);
|
menu.addAction(mProblem_RunCurrentCase);
|
||||||
|
menu.addAction(mProblem_CaseValidationOptions);
|
||||||
mProblem_RunAllCases->setEnabled(mOJProblemModel.count()>0 && ui->actionRun->isEnabled());
|
mProblem_RunAllCases->setEnabled(mOJProblemModel.count()>0 && ui->actionRun->isEnabled());
|
||||||
mProblem_RunCurrentCase->setEnabled(idx.isValid() && ui->actionRun->isEnabled());
|
mProblem_RunCurrentCase->setEnabled(idx.isValid() && ui->actionRun->isEnabled());
|
||||||
menu.exec(ui->tblProblemCases->mapToGlobal(pos));
|
menu.exec(ui->tblProblemCases->mapToGlobal(pos));
|
||||||
|
@ -3805,7 +3816,7 @@ void MainWindow::onProblemSetIndexChanged(const QModelIndex ¤t, const QMod
|
||||||
{
|
{
|
||||||
QModelIndex idx = current;
|
QModelIndex idx = current;
|
||||||
if (!idx.isValid()) {
|
if (!idx.isValid()) {
|
||||||
ui->btnRemoveProblem->setEnabled(false);
|
mProblemSet_RemoveProblem->setEnabled(false);
|
||||||
mOJProblemModel.setProblem(nullptr);
|
mOJProblemModel.setProblem(nullptr);
|
||||||
ui->txtProblemCaseExpected->clear();
|
ui->txtProblemCaseExpected->clear();
|
||||||
ui->txtProblemCaseInput->clear();
|
ui->txtProblemCaseInput->clear();
|
||||||
|
@ -3815,7 +3826,7 @@ void MainWindow::onProblemSetIndexChanged(const QModelIndex ¤t, const QMod
|
||||||
ui->lblProblem->setToolTip("");
|
ui->lblProblem->setToolTip("");
|
||||||
ui->tabProblem->setEnabled(false);
|
ui->tabProblem->setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
ui->btnRemoveProblem->setEnabled(true);
|
mProblemSet_RemoveProblem->setEnabled(true);
|
||||||
POJProblem problem = mOJProblemSetModel.problem(idx.row());
|
POJProblem problem = mOJProblemSetModel.problem(idx.row());
|
||||||
if (problem && !problem->answerProgram.isEmpty()) {
|
if (problem && !problem->answerProgram.isEmpty()) {
|
||||||
openFile(problem->answerProgram);
|
openFile(problem->answerProgram);
|
||||||
|
@ -3845,7 +3856,7 @@ void MainWindow::onProblemCaseIndexChanged(const QModelIndex ¤t, const QMo
|
||||||
if (idx.isValid()) {
|
if (idx.isValid()) {
|
||||||
POJProblemCase problemCase = mOJProblemModel.getCase(idx.row());
|
POJProblemCase problemCase = mOJProblemModel.getCase(idx.row());
|
||||||
if (problemCase) {
|
if (problemCase) {
|
||||||
ui->btnRemoveProblemCase->setEnabled(true);
|
mProblem_RemoveCases->setEnabled(true);
|
||||||
ui->btnRunAllProblemCases->setEnabled(ui->actionRun->isEnabled());
|
ui->btnRunAllProblemCases->setEnabled(ui->actionRun->isEnabled());
|
||||||
fillProblemCaseInputAndExpected(problemCase);
|
fillProblemCaseInputAndExpected(problemCase);
|
||||||
ui->txtProblemCaseOutput->clear();
|
ui->txtProblemCaseOutput->clear();
|
||||||
|
@ -3865,7 +3876,7 @@ void MainWindow::onProblemCaseIndexChanged(const QModelIndex ¤t, const QMo
|
||||||
ui->txtProblemCaseExpectedOutputFileName->clear();
|
ui->txtProblemCaseExpectedOutputFileName->clear();
|
||||||
ui->txtProblemCaseExpectedOutputFileName->setToolTip("");
|
ui->txtProblemCaseExpectedOutputFileName->setToolTip("");
|
||||||
|
|
||||||
ui->btnRemoveProblemCase->setEnabled(false);
|
mProblem_RemoveCases->setEnabled(false);
|
||||||
ui->btnRunAllProblemCases->setEnabled(false);
|
ui->btnRunAllProblemCases->setEnabled(false);
|
||||||
ui->txtProblemCaseInputFileName->clear();
|
ui->txtProblemCaseInputFileName->clear();
|
||||||
ui->btnProblemCaseInputFileName->setEnabled(false);
|
ui->btnProblemCaseInputFileName->setEnabled(false);
|
||||||
|
@ -7926,6 +7937,11 @@ void MainWindow::onAddProblem()
|
||||||
|
|
||||||
void MainWindow::onRemoveProblem()
|
void MainWindow::onRemoveProblem()
|
||||||
{
|
{
|
||||||
|
if (ui->lstProblemSet->selectionModel()->selectedIndexes().isEmpty()) {
|
||||||
|
QModelIndex idx=ui->lstProblemSet->currentIndex();
|
||||||
|
if (idx.isValid())
|
||||||
|
mOJProblemSetModel.removeProblem(idx.row());
|
||||||
|
} else {
|
||||||
QList<int> idxList;
|
QList<int> idxList;
|
||||||
foreach (const QModelIndex idx,ui->lstProblemSet->selectionModel()->selectedIndexes()) {
|
foreach (const QModelIndex idx,ui->lstProblemSet->selectionModel()->selectedIndexes()) {
|
||||||
idxList.append(idx.row());
|
idxList.append(idx.row());
|
||||||
|
@ -7936,18 +7952,13 @@ void MainWindow::onRemoveProblem()
|
||||||
return i1>i2;
|
return i1>i2;
|
||||||
});
|
});
|
||||||
bool oldBlock = ui->lstProblemSet->selectionModel()->blockSignals(true);
|
bool oldBlock = ui->lstProblemSet->selectionModel()->blockSignals(true);
|
||||||
QProgressDialog progress(tr("Removing Problems..."),tr("Abort"),0,idxList.count(),this);
|
|
||||||
progress.setWindowModality(Qt::WindowModal);
|
|
||||||
for (int i=0;i<idxList.count();i++) {
|
for (int i=0;i<idxList.count();i++) {
|
||||||
progress.setValue(i);
|
|
||||||
if (progress.wasCanceled())
|
|
||||||
break;
|
|
||||||
mOJProblemSetModel.removeProblem(idxList[i]);
|
mOJProblemSetModel.removeProblem(idxList[i]);
|
||||||
}
|
}
|
||||||
progress.setValue(idxList.count());
|
|
||||||
ui->lstProblemSet->selectionModel()->blockSignals(oldBlock);
|
ui->lstProblemSet->selectionModel()->blockSignals(oldBlock);
|
||||||
onProblemSetIndexChanged(ui->lstProblemSet->currentIndex(),QModelIndex());
|
onProblemSetIndexChanged(ui->lstProblemSet->currentIndex(),QModelIndex());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::onSaveProblemSet()
|
void MainWindow::onSaveProblemSet()
|
||||||
|
|
|
@ -124,8 +124,10 @@ public:
|
||||||
void updateEditorActions(const Editor *e);
|
void updateEditorActions(const Editor *e);
|
||||||
void updateProjectActions();
|
void updateProjectActions();
|
||||||
void updateCompileActions();
|
void updateCompileActions();
|
||||||
|
void updateCompileActions(const Editor* e);
|
||||||
void updateEditorColorSchemes();
|
void updateEditorColorSchemes();
|
||||||
void updateCompilerSet();
|
void updateCompilerSet();
|
||||||
|
void updateCompilerSet(const Editor* e);
|
||||||
void updateDebuggerSettings();
|
void updateDebuggerSettings();
|
||||||
void updateActionIcons();
|
void updateActionIcons();
|
||||||
void checkSyntaxInBack(Editor* e);
|
void checkSyntaxInBack(Editor* e);
|
||||||
|
|
Loading…
Reference in New Issue