- fix: When start parsing and exit app, app may crash
- enhancement: add "Allow parallel build" option in project option dialog's custom compile options page - fix: crash when rename project file - fix: When remove project file, symbols in it not correctly removed from code parser - fix: infos in class browser (structure panel) not correctly updated when add/create/remove/rename project files
This commit is contained in:
parent
d642ff3b74
commit
93751d1b23
17
NEWS.md
17
NEWS.md
|
@ -1,3 +1,12 @@
|
|||
Red Panda C++ Version 2.3
|
||||
|
||||
- fix: When start parsing and exit app, app may crash
|
||||
- enhancement: add "Allow parallel build" option in project option dialog's custom compile options page
|
||||
- fix: crash when rename project file
|
||||
- fix: When remove project file, symbols in it not correctly removed from code parser
|
||||
- fix: infos in class browser (structure panel) not correctly updated when add/create/remove/rename project files
|
||||
|
||||
|
||||
Red Panda C++ Version 2.2
|
||||
|
||||
- enhancement: basic code completion support for C++ lambdas
|
||||
|
@ -10,9 +19,11 @@ Red Panda C++ Version 2.2
|
|||
- fix: Edting / show context menu when code analysis is turned on may crash app.
|
||||
- fix: Show context menu when edting non c/c++ file may crash app.
|
||||
- fix: Project Options Dialog's Files panel will crash app.
|
||||
- fix: Memory usage of undo system is not correctly calculated
|
||||
- fix: Set max undo memory usage to 0 don't really remove limit of undo
|
||||
- fix: Set max undo times to 0 don't really remove limit of undo
|
||||
- fix: Memory usage of undo system is not correctly calculated, which may cause undo items lost
|
||||
- fix: Set max undo memory usage to 0 don't really remove the limit for undo
|
||||
- fix: Set max undo times to 0 don't really remove the limit for undo
|
||||
- fix: Keep the newest undo info regardless of undo memory usage
|
||||
|
||||
|
||||
Red Panda C++ Version 2.1
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ isEmpty(APP_NAME) {
|
|||
}
|
||||
|
||||
isEmpty(APP_VERSION) {
|
||||
APP_VERSION = 2.2
|
||||
APP_VERSION = 2.3
|
||||
}
|
||||
|
||||
macos: {
|
||||
|
|
|
@ -210,6 +210,7 @@ void ProjectCompiler::writeMakeDefines(QFile &file)
|
|||
cCompileArguments += " -D__DEBUG__";
|
||||
cppCompileArguments+= " -D__DEBUG__";
|
||||
}
|
||||
|
||||
writeln(file,"CPP = " + extractFileName(compilerSet()->cppCompiler()));
|
||||
writeln(file,"CC = " + extractFileName(compilerSet()->CCompiler()));
|
||||
#ifdef Q_OS_WIN
|
||||
|
@ -407,9 +408,10 @@ void ProjectCompiler::writeMakeObjFilesRules(QFile &file)
|
|||
}
|
||||
} else if (unit->encoding()==ENCODING_SYSTEM_DEFAULT) {
|
||||
sourceEncoding = defaultSystemEncoding;
|
||||
} else if (unit->encoding()!=ENCODING_ASCII && !unit->encoding().isEmpty()
|
||||
&& unit->encoding()!=targetEncoding) {
|
||||
} else if (unit->encoding()!=ENCODING_ASCII && !unit->encoding().isEmpty()) {
|
||||
sourceEncoding = unit->encoding();
|
||||
} else {
|
||||
sourceEncoding = targetEncoding;
|
||||
}
|
||||
|
||||
if (sourceEncoding!=targetEncoding) {
|
||||
|
@ -421,14 +423,14 @@ void ProjectCompiler::writeMakeObjFilesRules(QFile &file)
|
|||
|
||||
if (mOnlyCheckSyntax) {
|
||||
if (unit->compileCpp())
|
||||
writeln(file, "\t$(CPP) -c " + genMakePath1(unit->fileName()) + " $(CXXFLAGS) " + encodingStr);
|
||||
writeln(file, "\t$(CPP) -c " + genMakePath1(shortFileName) + " $(CXXFLAGS) " + encodingStr);
|
||||
else
|
||||
writeln(file, "\t(CC) -c " + genMakePath1(unit->fileName()) + " $(CFLAGS) " + encodingStr);
|
||||
writeln(file, "\t(CC) -c " + genMakePath1(shortFileName) + " $(CFLAGS) " + encodingStr);
|
||||
} else {
|
||||
if (unit->compileCpp())
|
||||
writeln(file, "\t$(CPP) -c " + genMakePath1(unit->fileName()) + " -o " + ObjFileName2 + " $(CXXFLAGS) " + encodingStr);
|
||||
writeln(file, "\t$(CPP) -c " + genMakePath1(shortFileName) + " -o " + ObjFileName2 + " $(CXXFLAGS) " + encodingStr);
|
||||
else
|
||||
writeln(file, "\t$(CC) -c " + genMakePath1(unit->fileName()) + " -o " + ObjFileName2 + " $(CFLAGS) " + encodingStr);
|
||||
writeln(file, "\t$(CC) -c " + genMakePath1(shortFileName) + " -o " + ObjFileName2 + " $(CFLAGS) " + encodingStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -526,16 +528,29 @@ bool ProjectCompiler::prepareForCompile()
|
|||
buildMakeFile();
|
||||
|
||||
mCompiler = compilerSet()->make();
|
||||
|
||||
QString parallelParam;
|
||||
if (mProject->options().allowParallelBuilding) {
|
||||
if (mProject->options().parellelBuildingJobs==0) {
|
||||
parallelParam = " --jobs";
|
||||
} else {
|
||||
parallelParam = QString(" -j%1").arg(mProject->options().parellelBuildingJobs);
|
||||
}
|
||||
}
|
||||
|
||||
if (mOnlyClean) {
|
||||
mArguments = QString("-f \"%1\" clean").arg(extractRelativePath(
|
||||
mArguments = QString(" %1 -f \"%2\" clean").arg(parallelParam,
|
||||
extractRelativePath(
|
||||
mProject->directory(),
|
||||
mProject->makeFileName()));
|
||||
} else if (mRebuild) {
|
||||
mArguments = QString("-f \"%1\" clean all").arg(extractRelativePath(
|
||||
mArguments = QString(" %1 -f \"%2\" clean all").arg(parallelParam,
|
||||
extractRelativePath(
|
||||
mProject->directory(),
|
||||
mProject->makeFileName()));
|
||||
} else {
|
||||
mArguments = QString("-f \"%1\" all").arg(extractRelativePath(
|
||||
mArguments = QString(" %1 -f \"%2\" all").arg(parallelParam,
|
||||
extractRelativePath(
|
||||
mProject->directory(),
|
||||
mProject->makeFileName()));
|
||||
}
|
||||
|
|
|
@ -422,6 +422,8 @@ Editor* EditorList::getOpenedEditorByFilename(QString filename)
|
|||
|
||||
bool EditorList::getContentFromOpenedEditor(const QString &filename, QStringList &buffer)
|
||||
{
|
||||
if (pMainWindow->isQuitting())
|
||||
return false;
|
||||
Editor * e= getOpenedEditorByFilename(filename);
|
||||
if (!e)
|
||||
return false;
|
||||
|
|
|
@ -6354,7 +6354,7 @@ void MainWindow::on_actionAdd_to_project_triggered()
|
|||
PProjectModelNode folderNode = mProject->pointerToNode(node);
|
||||
foreach (const QString& filename, dialog.selectedFiles()) {
|
||||
PProjectUnit newUnit = mProject->addUnit(filename,folderNode);
|
||||
mProject->cppParser()->addFileToScan(filename);
|
||||
mProject->cppParser()->addFileToScan(filename,true);
|
||||
QString branch;
|
||||
if (pSettings->vcs().gitOk() && mProject->model()->iconProvider()->VCSRepository()->hasRepository(branch)) {
|
||||
QString output;
|
||||
|
@ -6372,6 +6372,7 @@ void MainWindow::on_actionAdd_to_project_triggered()
|
|||
}
|
||||
}
|
||||
}
|
||||
mClassBrowserModel.setCurrentFiles(mProject->unitFiles());
|
||||
mProject->saveAll();
|
||||
updateProjectView();
|
||||
parseFileList(mProject->cppParser());
|
||||
|
@ -6399,8 +6400,15 @@ void MainWindow::on_actionRemove_from_project_triggered()
|
|||
if (!folderNode)
|
||||
continue;
|
||||
PProjectUnit unit = folderNode->pUnit.lock();
|
||||
if (mProject->cppParser()) {
|
||||
mProject->cppParser()->invalidateFile(unit->fileName());
|
||||
mProject->cppParser()->removeProjectFile(unit->fileName());
|
||||
}
|
||||
mProject->removeUnit(unit, true, removeFile);
|
||||
};
|
||||
mClassBrowserModel.beginUpdate();
|
||||
mClassBrowserModel.setCurrentFiles(mProject->unitFiles());
|
||||
mClassBrowserModel.endUpdate();
|
||||
ui->projectView->selectionModel()->clearSelection();
|
||||
mProject->saveAll();
|
||||
updateProjectView();
|
||||
|
@ -6708,6 +6716,9 @@ void MainWindow::newProjectUnitFile()
|
|||
setProjectViewCurrentUnit(newUnit);
|
||||
|
||||
mProject->saveAll();
|
||||
if (mProject->cppParser())
|
||||
mProject->cppParser()->addFileToScan(newFileName,true);
|
||||
mClassBrowserModel.setCurrentFiles(mProject->unitFiles());
|
||||
Editor * editor = mProject->openUnit(newUnit, false);
|
||||
if (editor)
|
||||
editor->activate();
|
||||
|
@ -6837,6 +6848,7 @@ QString MainWindow::switchHeaderSourceTarget(Editor *editor)
|
|||
|
||||
void MainWindow::onProjectViewNodeRenamed()
|
||||
{
|
||||
mClassBrowserModel.setCurrentFiles(mProject->unitFiles());
|
||||
updateProjectView();
|
||||
}
|
||||
|
||||
|
@ -7950,8 +7962,11 @@ void MainWindow::on_actionNew_Header_triggered()
|
|||
stringsToFile(header, headerFilename);
|
||||
|
||||
PProjectUnit newUnit=mProject->addUnit(headerFilename,mProject->rootNode());
|
||||
mProject->cppParser()->addFileToScan(headerFilename);
|
||||
mProject->saveAll();
|
||||
|
||||
mProject->cppParser()->addFileToScan(headerFilename,true);
|
||||
mClassBrowserModel.setCurrentFiles(mProject->unitFiles());
|
||||
|
||||
parseFileList(mProject->cppParser());
|
||||
setProjectViewCurrentUnit(newUnit);
|
||||
updateProjectView();
|
||||
|
@ -8024,12 +8039,16 @@ void MainWindow::on_actionNew_Class_triggered()
|
|||
stringsToFile(source, sourceFilename);
|
||||
|
||||
PProjectUnit newUnit=mProject->addUnit(headerFilename,mProject->rootNode());
|
||||
mProject->cppParser()->addFileToScan(headerFilename);
|
||||
|
||||
setProjectViewCurrentUnit(newUnit);
|
||||
newUnit=mProject->addUnit(sourceFilename,mProject->rootNode());
|
||||
mProject->cppParser()->addFileToScan(sourceFilename);
|
||||
setProjectViewCurrentUnit(newUnit);
|
||||
mProject->saveAll();
|
||||
|
||||
mProject->cppParser()->addFileToScan(sourceFilename,true);
|
||||
mProject->cppParser()->addFileToScan(headerFilename,true);
|
||||
mClassBrowserModel.setCurrentFiles(mProject->unitFiles());
|
||||
|
||||
parseFileList(mProject->cppParser());
|
||||
updateProjectView();
|
||||
|
||||
|
|
|
@ -97,6 +97,14 @@ void CppParser::addIncludePath(const QString &value)
|
|||
mPreprocessor.addIncludePath(includeTrailingPathDelimiter(value));
|
||||
}
|
||||
|
||||
void CppParser::removeProjectFile(const QString &value)
|
||||
{
|
||||
QMutexLocker locker(&mMutex);
|
||||
|
||||
mProjectFiles.remove(value);
|
||||
mFilesToScan.remove(value);
|
||||
}
|
||||
|
||||
void CppParser::addProjectIncludePath(const QString &value)
|
||||
{
|
||||
QMutexLocker locker(&mMutex);
|
||||
|
@ -1126,7 +1134,6 @@ void CppParser::addFileToScan(const QString& value, bool inProject)
|
|||
if (!mPreprocessor.scannedFiles().contains(value)) {
|
||||
mFilesToScan.insert(value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PStatement CppParser::addInheritedStatement(const PStatement& derived, const PStatement& inherit, StatementClassScope access)
|
||||
|
@ -4719,8 +4726,8 @@ QSet<QString> CppParser::calculateFilesToBeReparsed(const QString &fileName)
|
|||
QSet<QString> result;
|
||||
result.insert(fileName);
|
||||
foreach (const QString& file, mProjectFiles) {
|
||||
PFileIncludes fileIncludes = mPreprocessor.includesList()[file];
|
||||
if (fileIncludes->includeFiles.contains(fileName)) {
|
||||
PFileIncludes fileIncludes = mPreprocessor.includesList().value(file,PFileIncludes());
|
||||
if (fileIncludes && fileIncludes->includeFiles.contains(fileName)) {
|
||||
result.insert(file);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ public:
|
|||
void addHardDefineByLine(const QString& line);
|
||||
void addFileToScan(const QString& value, bool inProject = false);
|
||||
void addIncludePath(const QString& value);
|
||||
void removeProjectFile(const QString& value);
|
||||
void addProjectIncludePath(const QString& value);
|
||||
void clearIncludePaths();
|
||||
void clearProjectIncludePaths();
|
||||
|
|
|
@ -699,13 +699,20 @@ void Project::renameUnit(PProjectUnit& unit, const QString &sFileName)
|
|||
return;
|
||||
if (sFileName.compare(unit->fileName(),PATH_SENSITIVITY)==0)
|
||||
return;
|
||||
|
||||
if (mParser) {
|
||||
mParser->removeProjectFile(unit->fileName());
|
||||
mParser->addFileToScan(sFileName,true);
|
||||
}
|
||||
Editor * editor=unitEditor(unit);
|
||||
if (editor) {
|
||||
//prevent recurse
|
||||
editor->saveAs(sFileName,true);
|
||||
} else {
|
||||
if (mParser)
|
||||
mParser->invalidateFile(unit->fileName());
|
||||
copyFile(unit->fileName(),sFileName,true);
|
||||
if (mParser)
|
||||
mParser->parseFile(sFileName,true);
|
||||
}
|
||||
removeUnit(unit,false,true);
|
||||
PProjectModelNode parentNode = unit->node()->parent.lock();
|
||||
|
@ -1135,6 +1142,10 @@ void Project::saveOptions()
|
|||
ini.SetValue("Project","Encoding",toByteArray(mOptions.encoding));
|
||||
ini.SetLongValue("Project","ModelType", (int)mOptions.modelType);
|
||||
ini.SetLongValue("Project","ClassBrowserType", (int)mOptions.classBrowserType);
|
||||
ini.SetBoolValue("Project","AllowParallelBuilding",mOptions.allowParallelBuilding);
|
||||
ini.SetLongValue("Project","ParellelBuildingJobs",mOptions.parellelBuildingJobs);
|
||||
|
||||
|
||||
//for Red Panda Dev C++ 6 compatibility
|
||||
ini.SetLongValue("Project","UseUTF8",mOptions.encoding == ENCODING_UTF8);
|
||||
|
||||
|
@ -2056,6 +2067,10 @@ void Project::loadOptions(SimpleIni& ini)
|
|||
mOptions.encoding = fromByteArray(ini.GetValue("Project","Encoding", ENCODING_AUTO_DETECT));
|
||||
}
|
||||
|
||||
mOptions.allowParallelBuilding = ini.GetBoolValue("Project","AllowParallelBuilding");
|
||||
mOptions.parellelBuildingJobs = ini.GetLongValue("Project","ParellelBuildingJobs");
|
||||
|
||||
|
||||
mOptions.versionInfo.major = ini.GetLongValue("VersionInfo", "Major", 0);
|
||||
mOptions.versionInfo.minor = ini.GetLongValue("VersionInfo", "Minor", 1);
|
||||
mOptions.versionInfo.release = ini.GetLongValue("VersionInfo", "Release", 1);
|
||||
|
|
|
@ -56,4 +56,6 @@ ProjectOptions::ProjectOptions()
|
|||
modelType = ProjectModelType::FileSystem;
|
||||
classBrowserType = ProjectClassBrowserType::CurrentFile;
|
||||
execEncoding = ENCODING_SYSTEM_DEFAULT;
|
||||
allowParallelBuilding=false;
|
||||
parellelBuildingJobs=0;
|
||||
}
|
||||
|
|
|
@ -99,5 +99,7 @@ struct ProjectOptions{
|
|||
QString encoding;
|
||||
ProjectModelType modelType;
|
||||
ProjectClassBrowserType classBrowserType;
|
||||
bool allowParallelBuilding;
|
||||
int parellelBuildingJobs;
|
||||
};
|
||||
#endif // PROJECTOPTIONS_H
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
#include "../project.h"
|
||||
#include "../iconsmanager.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <sysinfoapi.h>
|
||||
#endif
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
ProjectCompileParamatersWidget::ProjectCompileParamatersWidget(const QString &name, const QString &group, QWidget *parent) :
|
||||
|
@ -27,6 +31,11 @@ ProjectCompileParamatersWidget::ProjectCompileParamatersWidget(const QString &na
|
|||
ui(new Ui::ProjectCompileParamatersWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
#ifdef Q_OS_WIN
|
||||
SYSTEM_INFO info;
|
||||
GetSystemInfo(&info);
|
||||
ui->spinParallelJobs->setMaximum(info.dwNumberOfProcessors);
|
||||
#endif
|
||||
}
|
||||
|
||||
ProjectCompileParamatersWidget::~ProjectCompileParamatersWidget()
|
||||
|
@ -39,6 +48,8 @@ void ProjectCompileParamatersWidget::doLoad()
|
|||
ui->txtCCompiler->setPlainText(pMainWindow->project()->options().compilerCmd);
|
||||
ui->txtCPPCompiler->setPlainText(pMainWindow->project()->options().cppCompilerCmd);
|
||||
ui->txtLinker->setPlainText(pMainWindow->project()->options().linkerCmd);
|
||||
ui->grpAllowParallelBuilding->setChecked(pMainWindow->project()->options().allowParallelBuilding);
|
||||
ui->spinParallelJobs->setValue(pMainWindow->project()->options().parellelBuildingJobs);
|
||||
}
|
||||
|
||||
void ProjectCompileParamatersWidget::doSave()
|
||||
|
@ -46,6 +57,8 @@ void ProjectCompileParamatersWidget::doSave()
|
|||
pMainWindow->project()->options().compilerCmd = ui->txtCCompiler->toPlainText();
|
||||
pMainWindow->project()->options().cppCompilerCmd = ui->txtCPPCompiler->toPlainText();
|
||||
pMainWindow->project()->options().linkerCmd = ui->txtLinker->toPlainText();
|
||||
pMainWindow->project()->options().allowParallelBuilding = ui->grpAllowParallelBuilding->isChecked();
|
||||
pMainWindow->project()->options().parellelBuildingJobs = ui->spinParallelJobs->value();
|
||||
pMainWindow->project()->saveOptions();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,10 +15,38 @@
|
|||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Additional build options:</string>
|
||||
<widget class="QGroupBox" name="grpAllowParallelBuilding">
|
||||
<property name="title">
|
||||
<string>Parallel Build</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Parallel Jobs(0 means infinite):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinParallelJobs"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -5103,7 +5103,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Additional build options:</source>
|
||||
<translation>Opções de montagem adicionais:</translation>
|
||||
<translation type="vanished">Opções de montagem adicionais:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>C Compiler</source>
|
||||
|
@ -5125,6 +5125,14 @@
|
|||
<source>Library Files</source>
|
||||
<translation>Arquivos de bibliotecas</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Parallel Build</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Parallel Jobs(0 means infinite):</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ProjectCompiler</name>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4914,10 +4914,6 @@
|
|||
<source>Form</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Additional build options:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>C Compiler</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -4938,6 +4934,14 @@
|
|||
<source>Library Files</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Parallel Build</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Parallel Jobs(0 means infinite):</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ProjectCompiler</name>
|
||||
|
|
Loading…
Reference in New Issue