C++: introduce the unique ProjectPart::id()

And change the code-model inspector dialog to use them in the
ProjectParts tab to sync the master/details view, and in the
CppPreProcessorDialog to save/reload the selected part.

Change-Id: I7cc8ac1c21d31122f8650985d0b85177ebabdfb8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
Erik Verbruggen
2014-08-21 15:22:08 +02:00
committed by Nikolai Kosjar
parent eedd47657f
commit 8b2cff4b8b
4 changed files with 17 additions and 9 deletions

View File

@@ -57,7 +57,7 @@ CppPreProcessorDialog::CppPreProcessorDialog(QWidget *parent, const QString &fil
CppSnippetProvider().decorateEditor(m_ui->editWidget);
const QString &currentProjectFile = ProjectExplorer::SessionManager::value(
const QString &projectPartIdToUse = ProjectExplorer::SessionManager::value(
QLatin1String(Constants::CPP_PREPROCESSOR_PROJECT_PREFIX) + m_filePath).toString();
int currentIndex = 0;
@@ -70,7 +70,7 @@ CppPreProcessorDialog::CppPreProcessorDialog(QWidget *parent, const QString &fil
addition.projectPart = projectPart;
addition.additionalDirectives = ProjectExplorer::SessionManager::value(
projectPart->projectFile + QLatin1Char(',') + m_filePath).toString();
if (projectPart->projectFile == currentProjectFile)
if (projectPart->id() == projectPartIdToUse)
currentIndex = m_ui->projectComboBox->count() - 1;
m_partAdditions << addition;
}
@@ -95,7 +95,7 @@ int CppPreProcessorDialog::exec()
ProjectExplorer::SessionManager::setValue(
QLatin1String(Constants::CPP_PREPROCESSOR_PROJECT_PREFIX) + m_filePath,
m_partAdditions[m_ui->projectComboBox->currentIndex()].projectPart->projectFile);
m_partAdditions[m_ui->projectComboBox->currentIndex()].projectPart->id());
foreach (ProjectPartAddition partAddition, m_partAdditions) {
const QString &previousDirectives = ProjectExplorer::SessionManager::value(