Changeset View
Changeset View
Standalone View
Standalone View
src/kconfig_compiler/kconfig_compiler.cpp
Show First 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | 101 | if (trString == QLatin1String("kde")) { | |||
---|---|---|---|---|---|
103 | translationDomain = codegenConfig.value(QStringLiteral("TranslationDomain")).toString(); | 103 | translationDomain = codegenConfig.value(QStringLiteral("TranslationDomain")).toString(); | ||
104 | } else { | 104 | } else { | ||
105 | if (!trString.isEmpty() && trString != QLatin1String("qt")) { | 105 | if (!trString.isEmpty() && trString != QLatin1String("qt")) { | ||
106 | cerr << "Unknown translation system, falling back to Qt tr()" << endl; | 106 | cerr << "Unknown translation system, falling back to Qt tr()" << endl; | ||
107 | } | 107 | } | ||
108 | translationSystem = QtTranslation; | 108 | translationSystem = QtTranslation; | ||
109 | } | 109 | } | ||
110 | qCategoryLoggingName = codegenConfig.value(QStringLiteral("CategoryLoggingName"), QString()).toString(); | 110 | qCategoryLoggingName = codegenConfig.value(QStringLiteral("CategoryLoggingName"), QString()).toString(); | ||
111 | headerExtension = codegenConfig.value(QStringLiteral("HeaderExtension"), QStringLiteral("h")).toString(); | ||||
112 | sourceExtension = codegenConfig.value(QStringLiteral("SourceExtension"), QStringLiteral("cpp")).toString(); | ||||
111 | } | 113 | } | ||
112 | 114 | | |||
113 | public: | 115 | public: | ||
114 | enum TranslationSystem { | 116 | enum TranslationSystem { | ||
115 | QtTranslation, | 117 | QtTranslation, | ||
116 | KdeTranslation | 118 | KdeTranslation | ||
117 | }; | 119 | }; | ||
118 | 120 | | |||
119 | // These are read from the .kcfgc configuration file | 121 | // These are read from the .kcfgc configuration file | ||
120 | QString nameSpace; // The namespace for the class to be generated | 122 | QString nameSpace; // The namespace for the class to be generated | ||
121 | QString className; // The class name to be generated | 123 | QString className; // The class name to be generated | ||
122 | QString inherits; // The class the generated class inherits (if empty, from KConfigSkeleton) | 124 | QString inherits; // The class the generated class inherits (if empty, from KConfigSkeleton) | ||
123 | QString visibility; | 125 | QString visibility; | ||
124 | bool forceStringFilename; | 126 | bool forceStringFilename; | ||
125 | bool singleton; // The class will be a singleton | 127 | bool singleton; // The class will be a singleton | ||
126 | bool staticAccessors; // provide or not static accessors | 128 | bool staticAccessors; // provide or not static accessors | ||
127 | bool customAddons; | 129 | bool customAddons; | ||
128 | QString memberVariables; | 130 | QString memberVariables; | ||
129 | QStringList headerIncludes; | 131 | QStringList headerIncludes; | ||
130 | QStringList sourceIncludes; | 132 | QStringList sourceIncludes; | ||
131 | QStringList mutators; | 133 | QStringList mutators; | ||
132 | QStringList defaultGetters; | 134 | QStringList defaultGetters; | ||
133 | QString qCategoryLoggingName; | 135 | QString qCategoryLoggingName; | ||
136 | QString headerExtension; | ||||
137 | QString sourceExtension; | ||||
134 | bool allMutators; | 138 | bool allMutators; | ||
135 | bool setUserTexts; | 139 | bool setUserTexts; | ||
136 | bool allDefaultGetters; | 140 | bool allDefaultGetters; | ||
137 | bool dpointer; | 141 | bool dpointer; | ||
138 | bool globalEnums; | 142 | bool globalEnums; | ||
139 | bool useEnumTypes; | 143 | bool useEnumTypes; | ||
140 | bool itemAccessors; | 144 | bool itemAccessors; | ||
141 | TranslationSystem translationSystem; | 145 | TranslationSystem translationSystem; | ||
▲ Show 20 Lines • Show All 1595 Lines • ▼ Show 20 Line(s) | |||||
1737 | 1741 | | |||
1738 | #if 0 | 1742 | #if 0 | ||
1739 | CfgEntry *cfg; | 1743 | CfgEntry *cfg; | ||
1740 | for (cfg = entries.first(); cfg; cfg = entries.next()) { | 1744 | for (cfg = entries.first(); cfg; cfg = entries.next()) { | ||
1741 | cfg->dump(); | 1745 | cfg->dump(); | ||
1742 | } | 1746 | } | ||
1743 | #endif | 1747 | #endif | ||
1744 | 1748 | | |||
1745 | QString headerFileName = baseName + ".h"; | 1749 | QString headerFileName = baseName + '.' + cfg.headerExtension; | ||
1746 | QString implementationFileName = baseName + ".cpp"; | 1750 | QString implementationFileName = baseName + '.' + cfg.sourceExtension; | ||
1747 | QString mocFileName = baseName + ".moc"; | 1751 | QString mocFileName = baseName + ".moc"; | ||
1748 | QString cppPreamble; // code to be inserted at the beginnin of the cpp file, e.g. initialization of static values | 1752 | QString cppPreamble; // code to be inserted at the beginnin of the cpp file, e.g. initialization of static values | ||
1749 | 1753 | | |||
1750 | QFile header(baseDir + headerFileName); | 1754 | QFile header(baseDir + headerFileName); | ||
1751 | if (!header.open(QIODevice::WriteOnly)) { | 1755 | if (!header.open(QIODevice::WriteOnly)) { | ||
1752 | cerr << "Can not open '" << baseDir << headerFileName << "for writing." << endl; | 1756 | cerr << "Can not open '" << baseDir << headerFileName << "for writing." << endl; | ||
1753 | return 1; | 1757 | return 1; | ||
1754 | } | 1758 | } | ||
▲ Show 20 Lines • Show All 439 Lines • ▼ Show 20 Line(s) | 2189 | if (cfg.allDefaultGetters || cfg.defaultGetters.contains((*itEntry)->name())) { | |||
2194 | h << ")" << Const << ";" << endl; | 2198 | h << ")" << Const << ";" << endl; | ||
2195 | } | 2199 | } | ||
2196 | } | 2200 | } | ||
2197 | h << " " + cfg.className + "Private *d;" << endl; | 2201 | h << " " + cfg.className + "Private *d;" << endl; | ||
2198 | } | 2202 | } | ||
2199 | 2203 | | |||
2200 | if (cfg.customAddons) { | 2204 | if (cfg.customAddons) { | ||
2201 | h << " // Include custom additions" << endl; | 2205 | h << " // Include custom additions" << endl; | ||
2202 | h << " #include \"" << filenameOnly(baseName) << "_addons.h\"" << endl; | 2206 | h << " #include \"" << filenameOnly(baseName) << "_addons." << cfg.headerExtension << '"' << endl; | ||
2203 | } | 2207 | } | ||
2204 | 2208 | | |||
2205 | h << "};" << endl << endl; | 2209 | h << "};" << endl << endl; | ||
2206 | 2210 | | |||
2207 | endNamespaces(cfg.nameSpace, h); | 2211 | endNamespaces(cfg.nameSpace, h); | ||
2208 | 2212 | | |||
2209 | h << "#endif" << endl << endl; | 2213 | h << "#endif" << endl << endl; | ||
2210 | 2214 | | |||
▲ Show 20 Lines • Show All 481 Lines • Show Last 20 Lines |