fix: cppparser : #included files not correctly handled
refactor project options -> file page
This commit is contained in:
parent
29ed064b91
commit
762c27b860
|
@ -810,22 +810,28 @@ void CppPreprocessor::openInclude(QString fileName)
|
||||||
fileName.squeeze();
|
fileName.squeeze();
|
||||||
}
|
}
|
||||||
if (mIncludes.size()>0) {
|
if (mIncludes.size()>0) {
|
||||||
PParsedFile topFile = mIncludes.front();
|
// PParsedFile topFile = mIncludes.front();
|
||||||
if (topFile->fileIncludes->includeFiles.contains(fileName)) {
|
// if (topFile->fileIncludes->includeFiles.contains(fileName)) {
|
||||||
PParsedFile innerMostFile = mIncludes.back();
|
// PParsedFile innerMostFile = mIncludes.back();
|
||||||
innerMostFile->fileIncludes->includeFiles.insert(fileName, false);
|
// innerMostFile->fileIncludes->includeFiles.insert(fileName, false);
|
||||||
return; //already included
|
// return; //already included
|
||||||
}
|
// }
|
||||||
|
bool alreadyIncluded = false;
|
||||||
for (PParsedFile& parsedFile:mIncludes) {
|
for (PParsedFile& parsedFile:mIncludes) {
|
||||||
|
if (parsedFile->fileIncludes->includeFiles.contains(fileName)) {
|
||||||
|
alreadyIncluded = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
parsedFile->fileIncludes->includeFiles.insert(fileName,false);
|
parsedFile->fileIncludes->includeFiles.insert(fileName,false);
|
||||||
}
|
}
|
||||||
// Backup old position if we're entering a new file
|
|
||||||
PParsedFile innerMostFile = mIncludes.back();
|
PParsedFile innerMostFile = mIncludes.back();
|
||||||
innerMostFile->index = mIndex;
|
|
||||||
innerMostFile->branches = mBranchResults.count();
|
|
||||||
|
|
||||||
innerMostFile->fileIncludes->includeFiles.insert(fileName,true);
|
innerMostFile->fileIncludes->includeFiles.insert(fileName,true);
|
||||||
innerMostFile->fileIncludes->directIncludes.append(fileName);
|
innerMostFile->fileIncludes->directIncludes.append(fileName);
|
||||||
|
if (alreadyIncluded)
|
||||||
|
return;
|
||||||
|
// Backup old position if we're entering a new file
|
||||||
|
innerMostFile->index = mIndex;
|
||||||
|
innerMostFile->branches = mBranchResults.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
// // Add the new file to the includes of the current file
|
// // Add the new file to the includes of the current file
|
||||||
|
|
|
@ -34,6 +34,13 @@ ProjectFilesWidget::~ProjectFilesWidget()
|
||||||
|
|
||||||
void ProjectFilesWidget::doLoad()
|
void ProjectFilesWidget::doLoad()
|
||||||
{
|
{
|
||||||
|
if (ui->cbEncoding->count()>0) {
|
||||||
|
if (pMainWindow->project()->options().encoding==ENCODING_SYSTEM_DEFAULT) {
|
||||||
|
ui->cbEncoding->setItemText(0,tr("Project(%1)").arg(tr("ANSI")));
|
||||||
|
} else {
|
||||||
|
ui->cbEncoding->setItemText(0,tr("Project(%1)").arg(QString(pMainWindow->project()->options().encoding)));
|
||||||
|
}
|
||||||
|
}
|
||||||
ui->treeProject->expandAll();
|
ui->treeProject->expandAll();
|
||||||
ui->grpFileOptions->setEnabled(false);
|
ui->grpFileOptions->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
@ -274,19 +281,6 @@ void ProjectFilesWidget::init()
|
||||||
SettingsWidget::init();
|
SettingsWidget::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFilesWidget::showEvent(QShowEvent *event)
|
|
||||||
{
|
|
||||||
if (ui->cbEncoding->count()>0) {
|
|
||||||
if (pMainWindow->project()->options().encoding==ENCODING_SYSTEM_DEFAULT) {
|
|
||||||
ui->cbEncoding->setItemText(0,tr("Project(%1)").arg(tr("ANSI")));
|
|
||||||
} else {
|
|
||||||
ui->cbEncoding->setItemText(0,tr("Project(%1)").arg(QString(pMainWindow->project()->options().encoding)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SettingsWidget::showEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ProjectFilesWidget::on_cbEncodingDetail_currentTextChanged(const QString &)
|
void ProjectFilesWidget::on_cbEncodingDetail_currentTextChanged(const QString &)
|
||||||
{
|
{
|
||||||
PProjectUnit unit = currentUnit();
|
PProjectUnit unit = currentUnit();
|
||||||
|
|
|
@ -65,9 +65,6 @@ private slots:
|
||||||
public:
|
public:
|
||||||
void init() override;
|
void init() override;
|
||||||
|
|
||||||
// QWidget interface
|
|
||||||
protected:
|
|
||||||
void showEvent(QShowEvent *event) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PROJECTFILESWIDGET_H
|
#endif // PROJECTFILESWIDGET_H
|
||||||
|
|
Loading…
Reference in New Issue