forked from qt-creator/qt-creator
Wizards: Support using #pragma once instead of include guards
Allow users to choose #pragma once instead of #ifndef include guards in generated header files. Fixes: QTCREATORBUG-12166 Change-Id: I3ba41c7570beb9c5958e174b5581fcc25855050f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Filip Bucek <fbucek@atlas.cz>
This commit is contained in:
@@ -55,6 +55,7 @@ static const char headerSuffixKeyC[] = "HeaderSuffix";
|
||||
static const char sourceSuffixKeyC[] = "SourceSuffix";
|
||||
static const char headerSearchPathsKeyC[] = "HeaderSearchPaths";
|
||||
static const char sourceSearchPathsKeyC[] = "SourceSearchPaths";
|
||||
static const char headerPragmaOnceC[] = "HeaderPragmaOnce";
|
||||
static const char licenseTemplatePathKeyC[] = "LicenseTemplate";
|
||||
|
||||
const char *licenseTemplateTemplate = QT_TRANSLATE_NOOP("CppTools::Internal::CppFileSettingsWidget",
|
||||
@@ -68,11 +69,6 @@ const char *licenseTemplateTemplate = QT_TRANSLATE_NOOP("CppTools::Internal::Cpp
|
||||
namespace CppTools {
|
||||
namespace Internal {
|
||||
|
||||
CppFileSettings::CppFileSettings() :
|
||||
lowerCaseFiles(false)
|
||||
{
|
||||
}
|
||||
|
||||
void CppFileSettings::toSettings(QSettings *s) const
|
||||
{
|
||||
s->beginGroup(QLatin1String(Constants::CPPTOOLS_SETTINGSGROUP));
|
||||
@@ -83,6 +79,7 @@ void CppFileSettings::toSettings(QSettings *s) const
|
||||
s->setValue(QLatin1String(headerSearchPathsKeyC), headerSearchPaths);
|
||||
s->setValue(QLatin1String(sourceSearchPathsKeyC), sourceSearchPaths);
|
||||
s->setValue(QLatin1String(Constants::LOWERCASE_CPPFILES_KEY), lowerCaseFiles);
|
||||
s->setValue(QLatin1String(headerPragmaOnceC), headerPragmaOnce);
|
||||
s->setValue(QLatin1String(licenseTemplatePathKeyC), licenseTemplatePath);
|
||||
s->endGroup();
|
||||
}
|
||||
@@ -106,6 +103,7 @@ void CppFileSettings::fromSettings(QSettings *s)
|
||||
.toStringList();
|
||||
const bool lowerCaseDefault = Constants::lowerCaseFilesDefault;
|
||||
lowerCaseFiles = s->value(QLatin1String(Constants::LOWERCASE_CPPFILES_KEY), QVariant(lowerCaseDefault)).toBool();
|
||||
headerPragmaOnce = s->value(headerPragmaOnceC, headerPragmaOnce).toBool();
|
||||
licenseTemplatePath = s->value(QLatin1String(licenseTemplatePathKeyC), QString()).toString();
|
||||
s->endGroup();
|
||||
}
|
||||
@@ -127,6 +125,7 @@ bool CppFileSettings::applySuffixesToMimeDB()
|
||||
bool CppFileSettings::equals(const CppFileSettings &rhs) const
|
||||
{
|
||||
return lowerCaseFiles == rhs.lowerCaseFiles
|
||||
&& headerPragmaOnce == rhs.headerPragmaOnce
|
||||
&& headerPrefixes == rhs.headerPrefixes
|
||||
&& sourcePrefixes == rhs.sourcePrefixes
|
||||
&& headerSuffix == rhs.headerSuffix
|
||||
@@ -303,6 +302,7 @@ CppFileSettings CppFileSettingsWidget::settings() const
|
||||
{
|
||||
CppFileSettings rc;
|
||||
rc.lowerCaseFiles = m_ui->lowerCaseFileNamesCheckBox->isChecked();
|
||||
rc.headerPragmaOnce = m_ui->headerPragmaOnceCheckBox->isChecked();
|
||||
rc.headerPrefixes = trimmedPaths(m_ui->headerPrefixesEdit->text());
|
||||
rc.sourcePrefixes = trimmedPaths(m_ui->sourcePrefixesEdit->text());
|
||||
rc.headerSuffix = m_ui->headerSuffixComboBox->currentText();
|
||||
@@ -323,6 +323,7 @@ void CppFileSettingsWidget::setSettings(const CppFileSettings &s)
|
||||
{
|
||||
const QChar comma = QLatin1Char(',');
|
||||
m_ui->lowerCaseFileNamesCheckBox->setChecked(s.lowerCaseFiles);
|
||||
m_ui->headerPragmaOnceCheckBox->setChecked(s.headerPragmaOnce);
|
||||
m_ui->headerPrefixesEdit->setText(s.headerPrefixes.join(comma));
|
||||
m_ui->sourcePrefixesEdit->setText(s.sourcePrefixes.join(comma));
|
||||
setComboText(m_ui->headerSuffixComboBox, s.headerSuffix);
|
||||
|
||||
Reference in New Issue
Block a user