- enhancement: Disable "run" and "debug" actions when current project is static or dynamic library

This commit is contained in:
Roy Qu 2022-11-30 21:05:08 +08:00
parent bb2532a2ef
commit 164d766c75
2 changed files with 35 additions and 20 deletions

19
NEWS.md
View File

@ -1,19 +1,20 @@
Red Panda C++ Version 2.5
- enhancement: new color scheme Monokai (contributed by 小龙Dev(XiaoLoong@github))
- enhancemnet: add "Reserve word for Types" item in color scheme
- enhancement: auto save / load problem set
- enhancement: project's custom compile include/lib/bin directory is under folder of the app, save them using the path relative to the app
- enhancement: slightly reduce memory usage
- enhancement: New color scheme Monokai (contributed by 小龙Dev(XiaoLoong@github))
- enhancemnet: Add "Reserve word for Types" item in color scheme
- enhancement: Auto save / load problem set
- enhancement: Project's custom compile include/lib/bin directory is under folder of the app, save them using the path relative to the app
- enhancement: Slightly reduce memory usage
- enhancement: Options -> editor -> custom C/C++ type keywords page
- change: Default value of option "Editors share one code analyzer" is ON
- change: Default value of option "Auto clear symbols in hidden editors" is OFF
- enhancement: show completion suggest for "namespace" after "using"
- enhancement: Show completion suggest for "namespace" after "using"
- fix: MinGW-w64 gcc displayed as "MinGW GCC"
- enhancement: Deduce type info for "auto" in some simple cases for stl containers.
- fix: crash when no semicolon or left brace after the keyword "namespace"
- fix: can't correctly show completion suggest for type with template parameters
- enhancement: show compltion suggest for std::pair::first and std::pair second
- fix: Crash when no semicolon or left brace after the keyword "namespace"
- fix: Can't correctly show completion suggest for type with template parameters
- enhancement: Show compltion suggest for std::pair::first and std::pair second
- enhancement: Disable "run" and "debug" actions when current project is static or dynamic library
Red Panda C++ Version 2.4

View File

@ -645,17 +645,31 @@ void MainWindow::updateProjectActions()
void MainWindow::updateCompileActions()
{
bool hasProject = (mProject!=nullptr);
bool editorCanCompile = false;
bool forProject=false;
bool canCompile = false;
bool canRun = false;
Editor * e = mEditorList->getEditor();
if (e) {
if (!e->inProject()) {
FileType fileType = getFileType(e->filename());
if (fileType == FileType::CSource
|| fileType == FileType::CppSource || e->isNew())
editorCanCompile = true;
|| fileType == FileType::CppSource || e->isNew()) {
canCompile = true;
canRun = true;
}
} else {
forProject = (mProject!=nullptr);
}
} else {
forProject = (mProject!=nullptr);
}
if (forProject) {
canCompile = true;
canRun = (mProject->options().type !=ProjectType::DynamicLib)
&& (mProject->options().type !=ProjectType::StaticLib);
}
if (mCompilerManager->compiling() || mCompilerManager->running() || mDebugger->executing()
|| (!hasProject && !editorCanCompile) ) {
|| (!canCompile)) {
ui->actionCompile->setEnabled(false);
ui->actionCompile_Run->setEnabled(false);
ui->actionRun->setEnabled(false);
@ -664,11 +678,11 @@ void MainWindow::updateCompileActions()
ui->btnRunAllProblemCases->setEnabled(false);
} else {
ui->actionCompile->setEnabled(true);
ui->actionCompile_Run->setEnabled(true);
ui->actionRun->setEnabled(true);
ui->actionCompile_Run->setEnabled(canRun);
ui->actionRun->setEnabled(canRun);
ui->actionRebuild->setEnabled(true);
ui->actionDebug->setEnabled(true);
ui->btnRunAllProblemCases->setEnabled(true);
ui->actionDebug->setEnabled(canRun);
ui->btnRunAllProblemCases->setEnabled(canRun);
}
if (!mDebugger->executing()) {
disableDebugActions();