- enhancement: "Run" / "Generate Assembly" for project source files
This commit is contained in:
parent
bcb6069fe3
commit
dd92cfa6da
1
NEWS.md
1
NEWS.md
|
@ -3,6 +3,7 @@ Red Panda C++ Version 2.8
|
|||
- fix: Crash when editing makefile
|
||||
- enhancement: Add "Resources" in project option's dialog's custom compiler parameter page
|
||||
- fix: Crash while input using input method in makefile
|
||||
- enhancement: "Run" / "Generate Assembly" for project source files
|
||||
|
||||
Red Panda C++ Version 2.7
|
||||
|
||||
|
|
|
@ -669,11 +669,13 @@ void MainWindow::updateCompileActions(const Editor *e)
|
|||
bool forProject=false;
|
||||
bool canRun = false;
|
||||
bool canCompile = false;
|
||||
bool canGenerateAssembly=false;
|
||||
if (e) {
|
||||
if (!e->inProject()) {
|
||||
FileType fileType = getFileType(e->filename());
|
||||
if (fileType == FileType::CSource
|
||||
|| fileType == FileType::CppSource || e->isNew()) {
|
||||
canGenerateAssembly = true;
|
||||
canCompile = true;
|
||||
canRun = true;
|
||||
}
|
||||
|
@ -687,12 +689,19 @@ void MainWindow::updateCompileActions(const Editor *e)
|
|||
canCompile = true;
|
||||
canRun = (mProject->options().type !=ProjectType::DynamicLib)
|
||||
&& (mProject->options().type !=ProjectType::StaticLib);
|
||||
if (e) {
|
||||
FileType fileType = getFileType(e->filename());
|
||||
if (fileType == FileType::CSource
|
||||
|| fileType == FileType::CppSource) {
|
||||
canGenerateAssembly = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
ui->actionCompile->setEnabled(canCompile);
|
||||
ui->actionCompile_Run->setEnabled(canRun && canCompile);
|
||||
ui->actionRun->setEnabled(canRun);
|
||||
ui->actionRebuild->setEnabled(canCompile);
|
||||
ui->actionGenerate_Assembly->setEnabled(canCompile && !forProject);
|
||||
ui->actionGenerate_Assembly->setEnabled(canGenerateAssembly);
|
||||
ui->actionDebug->setEnabled(canRun);
|
||||
ui->btnRunAllProblemCases->setEnabled(canRun);
|
||||
}
|
||||
|
@ -1843,7 +1852,7 @@ bool MainWindow::compile(bool rebuild, CppCompileType compileType)
|
|||
{
|
||||
mCompilerManager->stopPausing();
|
||||
CompileTarget target =getCompileTarget();
|
||||
if (target == CompileTarget::Project) {
|
||||
if (target == CompileTarget::Project && compileType == CppCompileType::Normal) {
|
||||
if (mProject->modified()) {
|
||||
mProject->saveAll();
|
||||
}
|
||||
|
@ -1874,6 +1883,8 @@ bool MainWindow::compile(bool rebuild, CppCompileType compileType)
|
|||
}
|
||||
if (mCompileSuccessionTask) {
|
||||
Settings::PCompilerSet compilerSet=pSettings->compilerSets().defaultSet();
|
||||
if (editor->inProject())
|
||||
compilerSet = pSettings->compilerSets().getSet(mProject->options().compilerSet);
|
||||
if (compilerSet) {
|
||||
Settings::CompilerSet::CompilationStage stage;
|
||||
switch(compileType) {
|
||||
|
@ -7586,13 +7597,13 @@ void MainWindow::doCompileRun(RunType runType)
|
|||
void MainWindow::doGenerateAssembly()
|
||||
{
|
||||
CompileTarget target =getCompileTarget();
|
||||
QStringList binDirs;
|
||||
QString execName;
|
||||
if (target == CompileTarget::File) {
|
||||
binDirs = getDefaultCompilerSetBinDirs();
|
||||
if (target!= CompileTarget::File
|
||||
&& target != CompileTarget::Project) {
|
||||
return;
|
||||
}
|
||||
mCompileSuccessionTask = std::make_shared<CompileSuccessionTask>();
|
||||
mCompileSuccessionTask->binDirs=binDirs;
|
||||
//mCompileSuccessionTask->binDirs="";
|
||||
mCompileSuccessionTask->type = CompileSuccessionTaskType::RunNormal;
|
||||
compile(false,CppCompileType::GenerateAssemblyOnly);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue