Designer: Remove indention setting from FormClassWizardGenerationParameters

There is no UI for that anymore.

Change-Id: Ib8c5c4735870af7e5196416bf1a99fe846c6c410
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Tobias Hunger
2014-07-24 10:59:11 +02:00
parent 5df28e57b9
commit 43953fe05c
2 changed files with 7 additions and 14 deletions

View File

@@ -47,11 +47,10 @@ static const char formClassWizardPageGroupC[] = "FormClassWizardPage";
static const char translationKeyC[] = "RetranslationSupport"; static const char translationKeyC[] = "RetranslationSupport";
static const char embeddingModeKeyC[] = "Embedding"; static const char embeddingModeKeyC[] = "Embedding";
// TODO: These 3 are general coding convention settings and // TODO: These 2 are general coding convention settings and
// should go to CppTools... // should go to CppTools...
static const char includeQtModuleKeyC[] = "IncludeQtModule"; static const char includeQtModuleKeyC[] = "IncludeQtModule";
static const char addQtVersionCheckKeyC[] = "AddQtVersionCheck"; static const char addQtVersionCheckKeyC[] = "AddQtVersionCheck";
static const char indentNamespaceKeyC[] = "IndentNamespace";
static const bool retranslationSupportDefault = false; static const bool retranslationSupportDefault = false;
@@ -62,8 +61,7 @@ FormClassWizardGenerationParameters::FormClassWizardGenerationParameters() :
embedding(PointerAggregatedUiClass), embedding(PointerAggregatedUiClass),
retranslationSupport(retranslationSupportDefault), retranslationSupport(retranslationSupportDefault),
includeQtModule(false), includeQtModule(false),
addQtVersionCheck(false), addQtVersionCheck(false)
indentNamespace(false)
{ {
} }
@@ -75,7 +73,6 @@ void FormClassWizardGenerationParameters::fromSettings(const QSettings *settings
embedding = static_cast<UiClassEmbedding>(settings->value(group + QLatin1String(embeddingModeKeyC), int(PointerAggregatedUiClass)).toInt()); embedding = static_cast<UiClassEmbedding>(settings->value(group + QLatin1String(embeddingModeKeyC), int(PointerAggregatedUiClass)).toInt());
includeQtModule = settings->value(group + QLatin1String(includeQtModuleKeyC), false).toBool(); includeQtModule = settings->value(group + QLatin1String(includeQtModuleKeyC), false).toBool();
addQtVersionCheck = settings->value(group + QLatin1String(addQtVersionCheckKeyC), false).toBool(); addQtVersionCheck = settings->value(group + QLatin1String(addQtVersionCheckKeyC), false).toBool();
indentNamespace = settings->value(group + QLatin1String(indentNamespaceKeyC), false).toBool();
} }
void FormClassWizardGenerationParameters::toSettings(QSettings *settings) const void FormClassWizardGenerationParameters::toSettings(QSettings *settings) const
@@ -85,7 +82,6 @@ void FormClassWizardGenerationParameters::toSettings(QSettings *settings) const
settings->setValue(QLatin1String(embeddingModeKeyC), embedding); settings->setValue(QLatin1String(embeddingModeKeyC), embedding);
settings->setValue(QLatin1String(includeQtModuleKeyC), includeQtModule); settings->setValue(QLatin1String(includeQtModuleKeyC), includeQtModule);
settings->setValue(QLatin1String(addQtVersionCheckKeyC), addQtVersionCheck); settings->setValue(QLatin1String(addQtVersionCheckKeyC), addQtVersionCheck);
settings->setValue(QLatin1String(indentNamespaceKeyC), indentNamespace);
settings->endGroup(); settings->endGroup();
} }
@@ -94,8 +90,7 @@ bool FormClassWizardGenerationParameters::equals(const FormClassWizardGeneration
return embedding == rhs.embedding return embedding == rhs.embedding
&& retranslationSupport == rhs.retranslationSupport && retranslationSupport == rhs.retranslationSupport
&& includeQtModule == rhs.includeQtModule && includeQtModule == rhs.includeQtModule
&& addQtVersionCheck == rhs.addQtVersionCheck && addQtVersionCheck == rhs.addQtVersionCheck;
&& indentNamespace == rhs.indentNamespace;
} }
// Generation code // Generation code
@@ -185,8 +180,7 @@ bool QtDesignerFormClassCodeGenerator::generateCpp(const FormClassWizardParamete
} }
} }
const QString namespaceIndent = Utils::writeOpeningNameSpaces(namespaceList, const QString namespaceIndent = Utils::writeOpeningNameSpaces(namespaceList, QString(),
generationParameters.indentNamespace ? indent : QString(),
headerStr); headerStr);
// Forward-declare the UI class // Forward-declare the UI class
@@ -220,7 +214,7 @@ bool QtDesignerFormClassCodeGenerator::generateCpp(const FormClassWizardParamete
headerStr << uiMemberC << ";\n"; headerStr << uiMemberC << ";\n";
} }
headerStr << namespaceIndent << "};\n\n"; headerStr << namespaceIndent << "};\n\n";
Utils::writeClosingNameSpaces(namespaceList, generationParameters.indentNamespace ? indent : QString(), headerStr); Utils::writeClosingNameSpaces(namespaceList, QString(), headerStr);
headerStr << "#endif // "<< guard << '\n'; headerStr << "#endif // "<< guard << '\n';
// 2) Source file // 2) Source file
@@ -230,7 +224,7 @@ bool QtDesignerFormClassCodeGenerator::generateCpp(const FormClassWizardParamete
if (generationParameters.embedding == Internal::PointerAggregatedUiClass) if (generationParameters.embedding == Internal::PointerAggregatedUiClass)
Utils::writeIncludeFileDirective(uiInclude, false, sourceStr); Utils::writeIncludeFileDirective(uiInclude, false, sourceStr);
// NameSpaces( // NameSpaces(
Utils::writeOpeningNameSpaces(namespaceList, generationParameters.indentNamespace ? indent : QString(), sourceStr); Utils::writeOpeningNameSpaces(namespaceList, QString(), sourceStr);
// Constructor with setupUi // Constructor with setupUi
sourceStr << '\n' << namespaceIndent << unqualifiedClassName << "::" << unqualifiedClassName << "(QWidget *parent) :\n" sourceStr << '\n' << namespaceIndent << unqualifiedClassName << "::" << unqualifiedClassName << "(QWidget *parent) :\n"
<< namespaceIndent << indent << formBaseClass << "(parent)"; << namespaceIndent << indent << formBaseClass << "(parent)";
@@ -261,7 +255,7 @@ bool QtDesignerFormClassCodeGenerator::generateCpp(const FormClassWizardParamete
<< namespaceIndent << indent << "}\n" << namespaceIndent << indent << "}\n"
<< namespaceIndent << "}\n"; << namespaceIndent << "}\n";
} }
Utils::writeClosingNameSpaces(namespaceList, generationParameters.indentNamespace ? indent : QString(), sourceStr); Utils::writeClosingNameSpaces(namespaceList, QString(), sourceStr);
return true; return true;
} }

View File

@@ -63,7 +63,6 @@ struct FormClassWizardGenerationParameters
bool retranslationSupport; // Add handling for language change events bool retranslationSupport; // Add handling for language change events
bool includeQtModule; // Include "<QtGui/[Class]>" or just "<[Class]>" bool includeQtModule; // Include "<QtGui/[Class]>" or just "<[Class]>"
bool addQtVersionCheck; // Include #ifdef when using "#include <QtGui/..." bool addQtVersionCheck; // Include #ifdef when using "#include <QtGui/..."
bool indentNamespace;
}; };
inline bool operator==(const FormClassWizardGenerationParameters &p1, const FormClassWizardGenerationParameters &p2) { return p1.equals(p2); } inline bool operator==(const FormClassWizardGenerationParameters &p1, const FormClassWizardGenerationParameters &p2) { return p1.equals(p2); }