diff options
author | axis <qt-info@nokia.com> | 2010-02-09 09:03:06 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2010-02-09 09:24:40 (GMT) |
commit | 8985620b40e92dae928d6597924eacdf36da020c (patch) | |
tree | 7f7b0c2e8fd1469b78fbb87a25f9a84781acc0b5 | |
parent | 0de1cf57c6ad80776dc4d57a394ea5e0982686a6 (diff) | |
download | Qt-8985620b40e92dae928d6597924eacdf36da020c.zip Qt-8985620b40e92dae928d6597924eacdf36da020c.tar.gz Qt-8985620b40e92dae928d6597924eacdf36da020c.tar.bz2 |
Implemented rss file generator for Linux.
Most code was reused from the Windows generator. Icons don't
currently work due to a problem with the mifconv tool.
In addition backslashes were changed to slashes in all common code,
since qmake seems to prefer this when doing path cleanup and the
like.
-rw-r--r-- | mkspecs/features/symbian/application_icon.prf | 20 | ||||
-rw-r--r-- | mkspecs/symbian/linux-armcc/features/symbian_building.prf | 40 | ||||
-rw-r--r-- | qmake/generators/symbian/initprojectdeploy_symbian.cpp | 57 | ||||
-rw-r--r-- | qmake/generators/symbian/symbian_makefile.h | 19 | ||||
-rw-r--r-- | qmake/generators/symbian/symbiancommon.cpp | 443 | ||||
-rw-r--r-- | qmake/generators/symbian/symbiancommon.h | 12 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake.cpp | 391 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake.h | 10 |
8 files changed, 554 insertions, 438 deletions
diff --git a/mkspecs/features/symbian/application_icon.prf b/mkspecs/features/symbian/application_icon.prf index 1edbe14..069678e 100644 --- a/mkspecs/features/symbian/application_icon.prf +++ b/mkspecs/features/symbian/application_icon.prf @@ -28,23 +28,33 @@ contains( CONFIG, no_icon ) { baseTarget = $$replace(baseTarget, " ",_) # Note: symbian-sbsv2 builds can't utilize extra compiler for mifconv, so ICON handling is done in code - symbian-abld { + !symbian-sbsv2 { #Makefile: requires paths with backslash - ICON = $$replace( ICON, /, \\) + ICON_backslashed = $$replace( ICON, /, \\) + + symbian-abld { + mifIconZDir = ${ZDIR}$$APP_RESOURCE_DIR + } else { + isEmpty(DESTDIR) { + mifIconZDir = . + } else { + mifIconZDir = $$DESTDIR + } + } # Extra compiler rules for mifconv - mifconv.output = ${ZDIR}$$APP_RESOURCE_DIR/$${baseTarget}.mif + mifconv.output = $$mifIconZDir/$${baseTarget}.mif # Based on: http://www.forum.nokia.com/document/Cpp_Developers_Library # svg-t icons should always use /c32 depth mifconv.commands = mifconv ${QMAKE_FILE_OUT} /c32 ${QMAKE_FILE_IN} - mifconv.input = ICON + mifconv.input = ICON_backslashed mifconv.CONFIG = no_link combine # target_predeps together with combine seems not to work correctly, lets define it by ourselves PRE_TARGETDEPS += $$mifconv.output QMAKE_EXTRA_COMPILERS += mifconv } # Rules to use generated MIF file from symbian resources - RSS_RULES.number_of_icons = $$size(ICON) + RSS_RULES.number_of_icons = $$size(ICON_backslashed) RSS_RULES.icon_file = $$APP_RESOURCE_DIR/$${baseTarget}.mif } } diff --git a/mkspecs/symbian/linux-armcc/features/symbian_building.prf b/mkspecs/symbian/linux-armcc/features/symbian_building.prf index 25d6e0b..1106fd9 100644 --- a/mkspecs/symbian/linux-armcc/features/symbian_building.prf +++ b/mkspecs/symbian/linux-armcc/features/symbian_building.prf @@ -133,6 +133,40 @@ symbianresources.CONFIG = no_link QMAKE_EXTRA_COMPILERS += symbianresources +contains(TEMPLATE, "app"):!contains(CONFIG, "no_icon") { + baseTarget = $$basename(TARGET) + baseTarget = $$replace(baseTarget, -,_) + baseTarget = $$replace(baseTarget, :,_) + baseTarget = $$replace(baseTarget, \.,_) + baseTarget = $$replace(baseTarget, " ",_) + + # Make our own extra compiler target in order to get dependencies for generated + # files right. This also avoids the warning about files not found. + symbianGenResource.inputFile = $${baseTarget}.rss + symbianGenResource.input = symbianGenResource.inputFile + # Reuse the command from earlier. + symbianGenResource.commands = $$symbianresources.commands + symbianGenResource.output = $$symbianresources.output + symbianGenResource.CONFIG = no_link target_predeps + + symbianGenRegResource.inputFile = $${baseTarget}_reg.rss + symbianGenRegResource.input = symbianGenRegResource.inputFile + symbianGenRegResource.commands = $$symbianresources.commands + symbianGenRegResource.output = $$symbianresources.output + symbianGenRegResource.CONFIG = no_link target_predeps + symbianGenRegResource.depends = $${symbian_resources_RCC_DIR}/$${baseTarget}.rsg + + QMAKE_EXTRA_COMPILERS += symbianGenResource symbianGenRegResource + + QMAKE_DISTCLEAN += $${TARGET}.rss + QMAKE_DISTCLEAN += $${TARGET}_reg.rss + QMAKE_DISTCLEAN += $${TARGET}.loc +} + +# Generated pkg files + +QMAKE_DISTCLEAN += $${TARGET}_template.pkg + # Pre 2.6.23 Linux kernels have a limit on the environment size that can be passed to # a forked process. We quite easily overstep this boundary when building big projects # on Symbian, and since we depend on running the system() command, this causes the build @@ -142,3 +176,9 @@ execve_sanity_test = $$system("echo testing") !contains(execve_sanity_test, "testing") { error("Running system() failed. Maybe your kernel is too old? (Linux kernels need at least version 2.6.23)") } + +# ### FIXME! TODO! Remove this after icons have been fixed. +QMAKE_EXTRA_COMPILERS -= mifconv +RSS_RULES.number_of_icons = +RSS_RULES.icon_file = +PRE_TARGETDEPS -= $$mifconv.output diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp index efeaaae..7e24df7 100644 --- a/qmake/generators/symbian/initprojectdeploy_symbian.cpp +++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp @@ -46,12 +46,18 @@ #include <qsettings.h> #include <qdebug.h> -#define SYSBIN_DIR "\\sys\\bin" +#define SYSBIN_DIR "/sys/bin" #define SUFFIX_DLL "dll" #define SUFFIX_EXE "exe" #define SUFFIX_QTPLUGIN "qtplugin" +static QString fixPathToEpocOS(const QString &src) +{ + QString ret = Option::fixPathToTargetOS(src); + return ret.replace('/', '\\'); +} + static void fixEpocRootStr(QString& path) { path.replace("\\", "/"); @@ -194,7 +200,7 @@ static void createPluginStub(const QFileInfo& info, } QFileInfo stubInfo(stubFile); deploymentList.append(CopyItem(Option::fixPathToLocalOS(stubInfo.absoluteFilePath()), - Option::fixPathToLocalOS(devicePath + "\\" + stubInfo.fileName()))); + fixPathToEpocOS(devicePath + "/" + stubInfo.fileName()))); } QString generate_uid(const QString& target) @@ -282,13 +288,13 @@ void initProjectDeploySymbian(QMakeProject* project, || devicePath.at(0) == QLatin1Char('\\') || devicePathHasDriveLetter)) { // create output path - devicePath = Option::fixPathToLocalOS(QDir::cleanPath(targetPath + QLatin1Char('\\') + devicePath)); + devicePath = Option::fixPathToLocalOS(QDir::cleanPath(targetPath + QLatin1Char('/') + devicePath)); } else { if (0 == platform.compare(QLatin1String("winscw"), Qt::CaseInsensitive)) { if (devicePathHasDriveLetter) { - devicePath = epocRoot() + "epoc32\\winscw\\" + devicePath.remove(1, 1); + devicePath = epocRoot() + "epoc32/winscw/" + devicePath.remove(1, 1); } else { - devicePath = epocRoot() + "epoc32\\winscw\\c" + devicePath; + devicePath = epocRoot() + "epoc32/winscw/c" + devicePath; } } else { // Drive letter needed if targetpath contains one and it is not already in @@ -298,7 +304,7 @@ void initProjectDeploySymbian(QMakeProject* project, } } - devicePath.replace(QLatin1String("/"), QLatin1String("\\")); + devicePath.replace(QLatin1String("\\"), QLatin1String("/")); if (!deployBinaries && 0 == devicePath.right(8).compare(QLatin1String(SYSBIN_DIR), Qt::CaseInsensitive)) { @@ -332,15 +338,21 @@ void initProjectDeploySymbian(QMakeProject* project, // Executables and libraries are deployed to \sys\bin QFileInfo targetPath; if (epocBuild) - targetPath.setFile(epocRoot() + "epoc32\\release\\" + platform + "\\" + build + "\\"); + targetPath.setFile(epocRoot() + "epoc32/release/" + platform + "/" + build + "/"); else targetPath.setFile(info.path() + QDir::separator()); if(devicePathHasDriveLetter) { - deploymentList.append(CopyItem(Option::fixPathToLocalOS(targetPath.absolutePath() + "\\" + info.fileName(), false, true), - Option::fixPathToLocalOS(devicePath.left(2) + QLatin1String(SYSBIN_DIR "\\") + info.fileName()))); + deploymentList.append(CopyItem( + Option::fixPathToLocalOS(targetPath.absolutePath() + "/" + info.fileName(), + false, true), + fixPathToEpocOS(devicePath.left(2) + QLatin1String(SYSBIN_DIR "/") + + info.fileName()))); } else { - deploymentList.append(CopyItem(Option::fixPathToLocalOS(targetPath.absolutePath() + "\\" + info.fileName(), false, true), - Option::fixPathToLocalOS(deploymentDrive + QLatin1String(SYSBIN_DIR "\\") + info.fileName()))); + deploymentList.append(CopyItem( + Option::fixPathToLocalOS(targetPath.absolutePath() + "/" + info.fileName(), + false, true), + fixPathToEpocOS(deploymentDrive + QLatin1String(SYSBIN_DIR "/") + + info.fileName()))); } } if (isPlugin(info, devicePath)) { @@ -351,7 +363,7 @@ void initProjectDeploySymbian(QMakeProject* project, // Generate deployment even if file doesn't exist, as this may be the case // when generating .pkg files. deploymentList.append(CopyItem(Option::fixPathToLocalOS(info.absoluteFilePath()), - Option::fixPathToLocalOS(devicePath + "\\" + info.fileName()))); + fixPathToEpocOS(devicePath + "/" + info.fileName()))); continue; } } @@ -373,14 +385,25 @@ void initProjectDeploySymbian(QMakeProject* project, // This deploys pre-built plugins. Other pre-built binaries will deploy normally, // as they have SYSBIN_DIR target path. if (deployBinaries) { - deploymentList.append(CopyItem(Option::fixPathToLocalOS(absoluteItemPath + "\\" + iterator.fileName()), - Option::fixPathToLocalOS(deploymentDrive + QLatin1String(SYSBIN_DIR "\\") + iterator.fileName()))); + if (devicePathHasDriveLetter) { + deploymentList.append(CopyItem( + Option::fixPathToLocalOS(absoluteItemPath + "/" + iterator.fileName()), + fixPathToEpocOS(devicePath.left(2) + QLatin1String(SYSBIN_DIR "/") + + iterator.fileName()))); + } else { + deploymentList.append(CopyItem( + Option::fixPathToLocalOS(absoluteItemPath + "/" + iterator.fileName()), + fixPathToEpocOS(deploymentDrive + QLatin1String(SYSBIN_DIR "/") + + iterator.fileName()))); + } } - createPluginStub(info, devicePath + "\\" + absoluteItemPath.right(diffSize), deploymentList, generatedDirs, generatedFiles); + createPluginStub(info, devicePath + "/" + absoluteItemPath.right(diffSize), deploymentList, generatedDirs, generatedFiles); continue; } else { - deploymentList.append(CopyItem(Option::fixPathToLocalOS(absoluteItemPath + "\\" + iterator.fileName()), - Option::fixPathToLocalOS(devicePath + "\\" + absoluteItemPath.right(diffSize) + "\\" + iterator.fileName()))); + deploymentList.append(CopyItem( + Option::fixPathToLocalOS(absoluteItemPath + "/" + iterator.fileName()), + fixPathToEpocOS(devicePath + "/" + absoluteItemPath.right(diffSize) + + "/" + iterator.fileName()))); } } } diff --git a/qmake/generators/symbian/symbian_makefile.h b/qmake/generators/symbian/symbian_makefile.h index 91b3563..532ab89 100644 --- a/qmake/generators/symbian/symbian_makefile.h +++ b/qmake/generators/symbian/symbian_makefile.h @@ -59,13 +59,26 @@ public: bool writeMakefile(QTextStream &t) { - bool ret = T::writeMakefile(t); - + QString numberOfIcons; QString iconFile; + QStringList userRssRules; + readRssRules(numberOfIcons, iconFile, userRssRules); + DeploymentList depList; generatePkgFile(iconFile, depList, false); - return ret; + // Get the application translations and convert to symbian OS lang code, i.e. decical number + QStringList symbianLangCodes = symbianLangCodesFromTsFiles(); + + if (targetType == TypeExe) { + if (!this->project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { + writeRegRssFile(userRssRules); + writeRssFile(numberOfIcons, iconFile); + writeLocFile(symbianLangCodes); + } + } + + return T::writeMakefile(t); } }; diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index a36e4be..ccbc8cb 100644 --- a/qmake/generators/symbian/symbiancommon.cpp +++ b/qmake/generators/symbian/symbiancommon.cpp @@ -40,6 +40,14 @@ ****************************************************************************/ #include "symbiancommon.h" +#include <qdebug.h> + +#define RESOURCE_DIRECTORY_RESOURCE "\\\\resource\\\\apps\\\\" + +#define RSS_RULES "RSS_RULES" +#define RSS_RULES_BASE "RSS_RULES." +#define RSS_TAG_NBROFICONS "number_of_icons" +#define RSS_TAG_ICONFILE "icon_file" SymbianCommonGenerator::SymbianCommonGenerator(MakefileGenerator *generator) : generator(generator) @@ -194,39 +202,64 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, Deployment QString installPathRegResource = "!:\\private\\10003a3f\\import\\apps"; // Find location of builds - QString epocReleasePath = QString("%1epoc32/release/$(PLATFORM)/$(TARGET)") - .arg(epocRoot()); - + QString destDirBin; + QString destDirResource; + QString destDirRegResource; + if (epocBuild) { + destDirBin = QString("%1epoc32/release/$(PLATFORM)/$(TARGET)").arg(epocRoot()); + destDirResource = QString("%1epoc32/data/z/resource/apps").arg(epocRoot()); + destDirRegResource = QString("%1epoc32/data/z/private/10003a3f/import/apps").arg(epocRoot()); + } else { + destDirBin = project->first("DESTDIR"); + if (destDirBin.isEmpty()) + destDirBin = "."; + else if (destDirBin.endsWith('/') || destDirBin.endsWith('\\')) + destDirBin.chop(1); + destDirResource = destDirBin; + destDirRegResource = destDirBin; + } if (targetType == TypeExe) { // deploy .exe file t << "; Executable and default resource files" << endl; QString exeFile = fixedTarget + ".exe"; t << QString("\"%1/%2\" - \"%3\\%4\"") - .arg(epocReleasePath) + .arg(destDirBin) .arg(exeFile) .arg(installPathBin) .arg(exeFile) << endl; // deploy rsc & reg_rsc file if (!project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { - t << QString("\"%1epoc32/data/z/resource/apps/%2\" - \"%3\\%4\"") - .arg(epocRoot()) + t << QString("\"%1/%2\" - \"%3\\%4\"") + .arg(destDirResource) .arg(fixedTarget + ".rsc") .arg(installPathResource) .arg(fixedTarget + ".rsc") << endl; - t << QString("\"%1epoc32/data/z/private/10003a3f/import/apps/%2\" - \"%3\\%4\"") - .arg(epocRoot()) + t << QString("\"%1/%2\" - \"%3\\%4\"") + .arg(destDirRegResource) .arg(fixedTarget + "_reg.rsc") .arg(installPathRegResource) .arg(fixedTarget + "_reg.rsc") << endl; if (!iconFile.isEmpty()) { - t << QString("\"%1epoc32/data/z%2\" - \"!:%3\"") - .arg(epocRoot()) - .arg(iconFile) - .arg(QDir::toNativeSeparators(iconFile)) << endl << endl; + if (epocBuild) { + t << QString("\"%1epoc32/data/z%2\" - \"!:%3\"") + .arg(epocRoot()) + .arg(iconFile) + .arg(QDir::toNativeSeparators(iconFile)) << endl << endl; + } else { + QDir mifIconDir(project->first("DESTDIR")); + QFileInfo mifIcon(mifIconDir.relativeFilePath(project->first("TARGET"))); + QString mifIconFileName = mifIcon.fileName(); + mifIconFileName.replace(QRegExp("[-: .]"), "_"); + mifIconFileName.append(".mif"); + t << QString("\"%1/%2\" - \"!:%3\"") + .arg(mifIcon.path()) + .arg(mifIconFileName) + .arg(QDir::toNativeSeparators(iconFile)) << endl << endl; + } } } } @@ -274,3 +307,389 @@ QString SymbianCommonGenerator::removePathSeparators(QString &file) return ret; } +void SymbianCommonGenerator::writeRegRssFile(QStringList &userItems) +{ + QString filename(fixedTarget); + filename.append("_reg.rss"); + QFile ft(filename); + if (ft.open(QIODevice::WriteOnly)) { + generatedFiles << ft.fileName(); + QTextStream t(&ft); + t << "// ============================================================================" << endl; + t << "// * Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: "; + t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; + t << "// * This file is generated by qmake and should not be modified by the" << endl; + t << "// * user." << endl; + t << "// ============================================================================" << endl; + t << endl; + t << "#include <" << fixedTarget << ".rsg>" << endl; + t << "#include <appinfo.rh>" << endl; + t << endl; + t << "UID2 KUidAppRegistrationResourceFile" << endl; + t << "UID3 " << uid3 << endl << endl; + t << "RESOURCE APP_REGISTRATION_INFO" << endl; + t << "\t{" << endl; + t << "\tapp_file=\"" << fixedTarget << "\";" << endl; + t << "\tlocalisable_resource_file=\"" RESOURCE_DIRECTORY_RESOURCE << fixedTarget << "\";" << endl; + t << endl; + + foreach(QString item, userItems) + t << "\t" << item << endl; + t << "\t}" << endl; + } else { + PRINT_FILE_CREATE_ERROR(filename) + } +} + +void SymbianCommonGenerator::writeRssFile(QString &numberOfIcons, QString &iconFile) +{ + QString filename(fixedTarget); + filename.append(".rss"); + QFile ft(filename); + if (ft.open(QIODevice::WriteOnly)) { + generatedFiles << ft.fileName(); + QTextStream t(&ft); + t << "// ============================================================================" << endl; + t << "// * Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: "; + t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; + t << "// * This file is generated by qmake and should not be modified by the" << endl; + t << "// * user." << endl; + t << "// ============================================================================" << endl; + t << endl; + t << "#include <appinfo.rh>" << endl; + t << "#include \"" << fixedTarget << ".loc\"" << endl; + t << endl; + t << "RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info" << endl; + t << "\t{" << endl; + t << "\tshort_caption = STRING_r_short_caption;" << endl; + t << "\tcaption_and_icon =" << endl; + t << "\tCAPTION_AND_ICON_INFO" << endl; + t << "\t\t{" << endl; + t << "\t\tcaption = STRING_r_caption;" << endl; + + QString rssIconFile = iconFile; + rssIconFile = rssIconFile.replace("/", "\\\\"); + + if (numberOfIcons.isEmpty() || rssIconFile.isEmpty()) { + // There can be maximum one item in this tag, validated when parsed + t << "\t\tnumber_of_icons = 0;" << endl; + t << "\t\ticon_file = \"\";" << endl; + } else { + // There can be maximum one item in this tag, validated when parsed + t << "\t\tnumber_of_icons = " << numberOfIcons << ";" << endl; + t << "\t\ticon_file = \"" << rssIconFile << "\";" << endl; + } + t << "\t\t};" << endl; + t << "\t}" << endl; + t << endl; + } else { + PRINT_FILE_CREATE_ERROR(filename); + } +} + +void SymbianCommonGenerator::writeLocFile(QStringList &symbianLangCodes) +{ + QString filename(fixedTarget); + filename.append(".loc"); + QFile ft(filename); + if (ft.open(QIODevice::WriteOnly)) { + generatedFiles << ft.fileName(); + QTextStream t(&ft); + t << "// ============================================================================" << endl; + t << "// * Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: "; + t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; + t << "// * This file is generated by qmake and should not be modified by the" << endl; + t << "// * user." << endl; + t << "// ============================================================================" << endl; + t << endl; + t << "#ifdef LANGUAGE_SC" << endl; + t << "#define STRING_r_short_caption \"" << fixedTarget << "\"" << endl; + t << "#define STRING_r_caption \"" << fixedTarget << "\"" << endl; + foreach(QString lang, symbianLangCodes) { + t << "#elif defined LANGUAGE_" << lang << endl; + t << "#define STRING_r_short_caption \"" << fixedTarget << "\"" << endl; + t << "#define STRING_r_caption \"" << fixedTarget << "\"" << endl; + } + t << "#else" << endl; + t << "#define STRING_r_short_caption \"" << fixedTarget << "\"" << endl; + t << "#define STRING_r_caption \"" << fixedTarget << "\"" << endl; + t << "#endif" << endl; + } else { + PRINT_FILE_CREATE_ERROR(filename); + } +} + +void SymbianCommonGenerator::readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules) +{ + QMakeProject *project = generator->project; + for (QMap<QString, QStringList>::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { + if (it.key().startsWith(RSS_RULES_BASE)) { + QString newKey = it.key().mid(sizeof(RSS_RULES_BASE) - 1); + if (newKey.isEmpty()) { + fprintf(stderr, "Warning: Empty RSS_RULES_BASE key encountered\n"); + continue; + } + QStringList newValues; + QStringList values = it.value(); + foreach(QString item, values) { + // If there is no stringlist defined for a rule, use rule name directly + // This is convenience for defining single line statements + if (project->values(item).isEmpty()) { + newValues << item; + } else { + foreach(QString itemRow, project->values(item)) { + newValues << itemRow; + } + } + } + // Verify thet there is exactly one value in RSS_TAG_NBROFICONS + if (newKey == RSS_TAG_NBROFICONS) { + if (newValues.count() == 1) { + numberOfIcons = newValues[0]; + } else { + fprintf(stderr, "Warning: There must be exactly one value in '%s%s'\n", + RSS_RULES_BASE, RSS_TAG_NBROFICONS); + continue; + } + // Verify thet there is exactly one value in RSS_TAG_ICONFILE + } else if (newKey == RSS_TAG_ICONFILE) { + if (newValues.count() == 1) { + iconFile = newValues[0]; + } else { + fprintf(stderr, "Warning: There must be exactly one value in '%s%s'\n", + RSS_RULES_BASE, RSS_TAG_ICONFILE); + continue; + } + } else { + fprintf(stderr, "Warning: Unsupported key:'%s%s'\n", + RSS_RULES_BASE, newKey.toLatin1().constData()); + continue; + } + } + } + + foreach(QString item, project->values(RSS_RULES)) { + // If there is no stringlist defined for a rule, use rule name directly + // This is convenience for defining single line mmp statements + if (project->values(item).isEmpty()) { + userRssRules << item; + } else { + userRssRules << project->values(item); + } + } + + // Validate that either both RSS_TAG_NBROFICONS and RSS_TAG_ICONFILE keys exist + // or neither of them exist + if (!((numberOfIcons.isEmpty() && iconFile.isEmpty()) || + (!numberOfIcons.isEmpty() && !iconFile.isEmpty()))) { + numberOfIcons.clear(); + iconFile.clear(); + fprintf(stderr, "Warning: Both or neither of '%s%s' and '%s%s' keys must exist.\n", + RSS_RULES_BASE, RSS_TAG_NBROFICONS, RSS_RULES_BASE, RSS_TAG_ICONFILE); + } + + // Validate that RSS_TAG_NBROFICONS contains only numbers + if (!numberOfIcons.isEmpty()) { + bool ok; + numberOfIcons = numberOfIcons.simplified(); + int tmp = numberOfIcons.toInt(&ok); + if (!ok) { + numberOfIcons.clear(); + iconFile.clear(); + fprintf(stderr, "Warning: '%s%s' must be integer in decimal format.\n", + RSS_RULES_BASE, RSS_TAG_NBROFICONS); + } + } +} + +QStringList SymbianCommonGenerator::symbianLangCodesFromTsFiles() +{ + QStringList tsfiles; + QStringList symbianLangCodes; + tsfiles << generator->project->values("TRANSLATIONS"); + + fillQt2S60LangMapTable(); + + foreach(QString file, tsfiles) { + int extIndex = file.lastIndexOf("."); + int langIndex = file.lastIndexOf("_", (extIndex - file.length())); + langIndex += 1; + QString qtlang = file.mid(langIndex, extIndex - langIndex); + QString s60lang = qt2S60LangMapTable.value(qtlang, QString("SC")); + + if (!symbianLangCodes.contains(s60lang) && s60lang != "SC") + symbianLangCodes += s60lang; + } + + return symbianLangCodes; +} + +void SymbianCommonGenerator::fillQt2S60LangMapTable() +{ + qt2S60LangMapTable.reserve(170); // 165 items at time of writing. + qt2S60LangMapTable.insert("ab", "SC"); //Abkhazian // + qt2S60LangMapTable.insert("om", "SC"); //Afan // + qt2S60LangMapTable.insert("aa", "SC"); //Afar // + qt2S60LangMapTable.insert("af", "34"); //Afrikaans //Afrikaans + qt2S60LangMapTable.insert("sq", "35"); //Albanian //Albanian + qt2S60LangMapTable.insert("am", "36"); //Amharic //Amharic + qt2S60LangMapTable.insert("ar", "37"); //Arabic //Arabic + qt2S60LangMapTable.insert("hy", "38"); //Armenian //Armenian + qt2S60LangMapTable.insert("as", "SC"); //Assamese // + qt2S60LangMapTable.insert("ay", "SC"); //Aymara // + qt2S60LangMapTable.insert("az", "SC"); //Azerbaijani // + qt2S60LangMapTable.insert("ba", "SC"); //Bashkir // + qt2S60LangMapTable.insert("eu", "SC"); //Basque // + qt2S60LangMapTable.insert("bn", "41"); //Bengali //Bengali + qt2S60LangMapTable.insert("dz", "SC"); //Bhutani // + qt2S60LangMapTable.insert("bh", "SC"); //Bihari // + qt2S60LangMapTable.insert("bi", "SC"); //Bislama // + qt2S60LangMapTable.insert("br", "SC"); //Breton // + qt2S60LangMapTable.insert("bg", "42"); //Bulgarian //Bulgarian + qt2S60LangMapTable.insert("my", "43"); //Burmese //Burmese + qt2S60LangMapTable.insert("be", "40"); //Byelorussian //Belarussian + qt2S60LangMapTable.insert("km", "SC"); //Cambodian // + qt2S60LangMapTable.insert("ca", "44"); //Catalan //Catalan + qt2S60LangMapTable.insert("zh", "SC"); //Chinese // + qt2S60LangMapTable.insert("co", "SC"); //Corsican // + qt2S60LangMapTable.insert("hr", "45"); //Croatian //Croatian + qt2S60LangMapTable.insert("cs", "25"); //Czech //Czech + qt2S60LangMapTable.insert("da", "07"); //Danish //Danish + qt2S60LangMapTable.insert("nl", "18"); //Dutch //Dutch + qt2S60LangMapTable.insert("en", "01"); //English //English(UK) + qt2S60LangMapTable.insert("eo", "SC"); //Esperanto // + qt2S60LangMapTable.insert("et", "49"); //Estonian //Estonian + qt2S60LangMapTable.insert("fo", "SC"); //Faroese // + qt2S60LangMapTable.insert("fj", "SC"); //Fiji // + qt2S60LangMapTable.insert("fi", "09"); //Finnish //Finnish + qt2S60LangMapTable.insert("fr", "02"); //French //French + qt2S60LangMapTable.insert("fy", "SC"); //Frisian // + qt2S60LangMapTable.insert("gd", "52"); //Gaelic //Gaelic + qt2S60LangMapTable.insert("gl", "SC"); //Galician // + qt2S60LangMapTable.insert("ka", "53"); //Georgian //Georgian + qt2S60LangMapTable.insert("de", "03"); //German //German + qt2S60LangMapTable.insert("el", "54"); //Greek //Greek + qt2S60LangMapTable.insert("kl", "SC"); //Greenlandic // + qt2S60LangMapTable.insert("gn", "SC"); //Guarani // + qt2S60LangMapTable.insert("gu", "56"); //Gujarati //Gujarati + qt2S60LangMapTable.insert("ha", "SC"); //Hausa // + qt2S60LangMapTable.insert("he", "57"); //Hebrew //Hebrew + qt2S60LangMapTable.insert("hi", "58"); //Hindi //Hindi + qt2S60LangMapTable.insert("hu", "17"); //Hungarian //Hungarian + qt2S60LangMapTable.insert("is", "15"); //Icelandic //Icelandic + qt2S60LangMapTable.insert("id", "59"); //Indonesian //Indonesian + qt2S60LangMapTable.insert("ia", "SC"); //Interlingua // + qt2S60LangMapTable.insert("ie", "SC"); //Interlingue // + qt2S60LangMapTable.insert("iu", "SC"); //Inuktitut // + qt2S60LangMapTable.insert("ik", "SC"); //Inupiak // + qt2S60LangMapTable.insert("ga", "60"); //Irish //Irish + qt2S60LangMapTable.insert("it", "05"); //Italian //Italian + qt2S60LangMapTable.insert("ja", "32"); //Japanese //Japanese + qt2S60LangMapTable.insert("jv", "SC"); //Javanese // + qt2S60LangMapTable.insert("kn", "62"); //Kannada //Kannada + qt2S60LangMapTable.insert("ks", "SC"); //Kashmiri // + qt2S60LangMapTable.insert("kk", "63"); //Kazakh //Kazakh + qt2S60LangMapTable.insert("rw", "SC"); //Kinyarwanda // + qt2S60LangMapTable.insert("ky", "SC"); //Kirghiz // + qt2S60LangMapTable.insert("ko", "65"); //Korean //Korean + qt2S60LangMapTable.insert("ku", "SC"); //Kurdish // + qt2S60LangMapTable.insert("rn", "SC"); //Kurundi // + qt2S60LangMapTable.insert("lo", "66"); //Laothian //Laothian + qt2S60LangMapTable.insert("la", "SC"); //Latin // + qt2S60LangMapTable.insert("lv", "67"); //Latvian //Latvian + qt2S60LangMapTable.insert("ln", "SC"); //Lingala // + qt2S60LangMapTable.insert("lt", "68"); //Lithuanian //Lithuanian + qt2S60LangMapTable.insert("mk", "69"); //Macedonian //Macedonian + qt2S60LangMapTable.insert("mg", "SC"); //Malagasy // + qt2S60LangMapTable.insert("ms", "70"); //Malay //Malay + qt2S60LangMapTable.insert("ml", "71"); //Malayalam //Malayalam + qt2S60LangMapTable.insert("mt", "SC"); //Maltese // + qt2S60LangMapTable.insert("mi", "SC"); //Maori // + qt2S60LangMapTable.insert("mr", "72"); //Marathi //Marathi + qt2S60LangMapTable.insert("mo", "73"); //Moldavian //Moldovian + qt2S60LangMapTable.insert("mn", "74"); //Mongolian //Mongolian + qt2S60LangMapTable.insert("na", "SC"); //Nauru // + qt2S60LangMapTable.insert("ne", "SC"); //Nepali // + qt2S60LangMapTable.insert("nb", "08"); //Norwegian //Norwegian + qt2S60LangMapTable.insert("oc", "SC"); //Occitan // + qt2S60LangMapTable.insert("or", "SC"); //Oriya // + qt2S60LangMapTable.insert("ps", "SC"); //Pashto // + qt2S60LangMapTable.insert("fa", "SC"); //Persian // + qt2S60LangMapTable.insert("pl", "27"); //Polish //Polish + qt2S60LangMapTable.insert("pt", "13"); //Portuguese //Portuguese + qt2S60LangMapTable.insert("pa", "77"); //Punjabi //Punjabi + qt2S60LangMapTable.insert("qu", "SC"); //Quechua // + qt2S60LangMapTable.insert("rm", "SC"); //RhaetoRomance // + qt2S60LangMapTable.insert("ro", "78"); //Romanian //Romanian + qt2S60LangMapTable.insert("ru", "16"); //Russian //Russian + qt2S60LangMapTable.insert("sm", "SC"); //Samoan // + qt2S60LangMapTable.insert("sg", "SC"); //Sangho // + qt2S60LangMapTable.insert("sa", "SC"); //Sanskrit // + qt2S60LangMapTable.insert("sr", "79"); //Serbian //Serbian + qt2S60LangMapTable.insert("sh", "SC"); //SerboCroatian // + qt2S60LangMapTable.insert("st", "SC"); //Sesotho // + qt2S60LangMapTable.insert("tn", "SC"); //Setswana // + qt2S60LangMapTable.insert("sn", "SC"); //Shona // + qt2S60LangMapTable.insert("sd", "SC"); //Sindhi // + qt2S60LangMapTable.insert("si", "80"); //Singhalese //Sinhalese + qt2S60LangMapTable.insert("ss", "SC"); //Siswati // + qt2S60LangMapTable.insert("sk", "26"); //Slovak //Slovak + qt2S60LangMapTable.insert("sl", "28"); //Slovenian //Slovenian + qt2S60LangMapTable.insert("so", "81"); //Somali //Somali + qt2S60LangMapTable.insert("es", "04"); //Spanish //Spanish + qt2S60LangMapTable.insert("su", "SC"); //Sundanese // + qt2S60LangMapTable.insert("sw", "84"); //Swahili //Swahili + qt2S60LangMapTable.insert("sv", "06"); //Swedish //Swedish + qt2S60LangMapTable.insert("tl", "39"); //Tagalog //Tagalog + qt2S60LangMapTable.insert("tg", "SC"); //Tajik // + qt2S60LangMapTable.insert("ta", "87"); //Tamil //Tamil + qt2S60LangMapTable.insert("tt", "SC"); //Tatar // + qt2S60LangMapTable.insert("te", "88"); //Telugu //Telugu + qt2S60LangMapTable.insert("th", "33"); //Thai //Thai + qt2S60LangMapTable.insert("bo", "89"); //Tibetan //Tibetan + qt2S60LangMapTable.insert("ti", "90"); //Tigrinya //Tigrinya + qt2S60LangMapTable.insert("to", "SC"); //Tonga // + qt2S60LangMapTable.insert("ts", "SC"); //Tsonga // + qt2S60LangMapTable.insert("tr", "14"); //Turkish //Turkish + qt2S60LangMapTable.insert("tk", "92"); //Turkmen //Turkmen + qt2S60LangMapTable.insert("tw", "SC"); //Twi // + qt2S60LangMapTable.insert("ug", "SC"); //Uigur // + qt2S60LangMapTable.insert("uk", "93"); //Ukrainian //Ukrainian + qt2S60LangMapTable.insert("ur", "94"); //Urdu //Urdu + qt2S60LangMapTable.insert("uz", "SC"); //Uzbek // + qt2S60LangMapTable.insert("vi", "96"); //Vietnamese //Vietnamese + qt2S60LangMapTable.insert("vo", "SC"); //Volapuk // + qt2S60LangMapTable.insert("cy", "97"); //Welsh //Welsh + qt2S60LangMapTable.insert("wo", "SC"); //Wolof // + qt2S60LangMapTable.insert("xh", "SC"); //Xhosa // + qt2S60LangMapTable.insert("yi", "SC"); //Yiddish // + qt2S60LangMapTable.insert("yo", "SC"); //Yoruba // + qt2S60LangMapTable.insert("za", "SC"); //Zhuang // + qt2S60LangMapTable.insert("zu", "98"); //Zulu //Zulu + qt2S60LangMapTable.insert("nn", "75"); //Nynorsk //NorwegianNynorsk + qt2S60LangMapTable.insert("bs", "SC"); //Bosnian // + qt2S60LangMapTable.insert("dv", "SC"); //Divehi // + qt2S60LangMapTable.insert("gv", "SC"); //Manx // + qt2S60LangMapTable.insert("kw", "SC"); //Cornish // + qt2S60LangMapTable.insert("ak", "SC"); //Akan // + qt2S60LangMapTable.insert("kok", "SC"); //Konkani // + qt2S60LangMapTable.insert("gaa", "SC"); //Ga // + qt2S60LangMapTable.insert("ig", "SC"); //Igbo // + qt2S60LangMapTable.insert("kam", "SC"); //Kamba // + qt2S60LangMapTable.insert("syr", "SC"); //Syriac // + qt2S60LangMapTable.insert("byn", "SC"); //Blin // + qt2S60LangMapTable.insert("gez", "SC"); //Geez // + qt2S60LangMapTable.insert("kfo", "SC"); //Koro // + qt2S60LangMapTable.insert("sid", "SC"); //Sidamo // + qt2S60LangMapTable.insert("cch", "SC"); //Atsam // + qt2S60LangMapTable.insert("tig", "SC"); //Tigre // + qt2S60LangMapTable.insert("kaj", "SC"); //Jju // + qt2S60LangMapTable.insert("fur", "SC"); //Friulian // + qt2S60LangMapTable.insert("ve", "SC"); //Venda // + qt2S60LangMapTable.insert("ee", "SC"); //Ewe // + qt2S60LangMapTable.insert("wa", "SC"); //Walamo // + qt2S60LangMapTable.insert("haw", "SC"); //Hawaiian // + qt2S60LangMapTable.insert("kcg", "SC"); //Tyap // + qt2S60LangMapTable.insert("ny", "SC"); //Chewa // +} + diff --git a/qmake/generators/symbian/symbiancommon.h b/qmake/generators/symbian/symbiancommon.h index abe6d51..32f9483 100644 --- a/qmake/generators/symbian/symbiancommon.h +++ b/qmake/generators/symbian/symbiancommon.h @@ -63,11 +63,21 @@ public: virtual void init(); +protected: + QString removePathSeparators(QString &file); void removeSpecialCharacters(QString& str); void generatePkgFile(const QString &iconFile, DeploymentList &depList, bool epocBuild); bool containsStartWithItem(const QChar &c, const QStringList& src); + void writeRegRssFile(QStringList &useritems); + void writeRssFile(QString &numberOfIcons, QString &iconfile); + void writeLocFile(QStringList &symbianLangCodes); + void readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules); + + QStringList symbianLangCodesFromTsFiles(); + void fillQt2S60LangMapTable(); + protected: MakefileGenerator *generator; @@ -77,6 +87,8 @@ protected: QString privateDirUid; QString uid3; TargetType targetType; + + QHash<QString, QString> qt2S60LangMapTable; }; #endif // SYMBIANCOMMON_H diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 38b6cad..9cb4c85 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -50,7 +50,6 @@ #include <qdebug.h> #define RESOURCE_DIRECTORY_MMP "/resource/apps" -#define RESOURCE_DIRECTORY_RESOURCE "\\\\resource\\\\apps\\\\" #define REGISTRATION_RESOURCE_DIRECTORY_HW "/private/10003a3f/import/apps" #define PLUGIN_COMMON_DEF_FILE_FOR_MMP "./plugin_common.def" #define PLUGIN_COMMON_DEF_FILE_ACTUAL "plugin_commonU.def" @@ -63,11 +62,6 @@ #define BLD_INF_TAG_EXTENSIONS "prj_extensions" #define BLD_INF_TAG_EXPORTS "prj_exports" -#define RSS_RULES "RSS_RULES" -#define RSS_RULES_BASE "RSS_RULES." -#define RSS_TAG_NBROFICONS "number_of_icons" -#define RSS_TAG_ICONFILE "icon_file" - #define MMP_TARGET "TARGET" #define MMP_TARGETTYPE "TARGETTYPE" #define MMP_SECUREID "SECUREID" @@ -1123,391 +1117,6 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy } } -void SymbianMakefileGenerator::writeRegRssFile(QStringList &userItems) -{ - QString filename(fixedTarget); - filename.append("_reg.rss"); - QFile ft(filename); - if (ft.open(QIODevice::WriteOnly)) { - generatedFiles << ft.fileName(); - QTextStream t(&ft); - t << "// ============================================================================" << endl; - t << "// * Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: "; - t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; - t << "// * This file is generated by qmake and should not be modified by the" << endl; - t << "// * user." << endl; - t << "// ============================================================================" << endl; - t << endl; - t << "#include <" << fixedTarget << ".rsg>" << endl; - t << "#include <appinfo.rh>" << endl; - t << endl; - t << "UID2 KUidAppRegistrationResourceFile" << endl; - t << "UID3 " << uid3 << endl << endl; - t << "RESOURCE APP_REGISTRATION_INFO" << endl; - t << "\t{" << endl; - t << "\tapp_file=\"" << fixedTarget << "\";" << endl; - t << "\tlocalisable_resource_file=\"" RESOURCE_DIRECTORY_RESOURCE << fixedTarget << "\";" << endl; - t << endl; - - foreach(QString item, userItems) - t << "\t" << item << endl; - t << "\t}" << endl; - } else { - PRINT_FILE_CREATE_ERROR(filename) - } -} - -void SymbianMakefileGenerator::writeRssFile(QString &numberOfIcons, QString &iconFile) -{ - QString filename(fixedTarget); - filename.append(".rss"); - QFile ft(filename); - if (ft.open(QIODevice::WriteOnly)) { - generatedFiles << ft.fileName(); - QTextStream t(&ft); - t << "// ============================================================================" << endl; - t << "// * Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: "; - t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; - t << "// * This file is generated by qmake and should not be modified by the" << endl; - t << "// * user." << endl; - t << "// ============================================================================" << endl; - t << endl; - t << "#include <appinfo.rh>" << endl; - t << "#include \"" << fixedTarget << ".loc\"" << endl; - t << endl; - t << "RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info" << endl; - t << "\t{" << endl; - t << "\tshort_caption = STRING_r_short_caption;" << endl; - t << "\tcaption_and_icon =" << endl; - t << "\tCAPTION_AND_ICON_INFO" << endl; - t << "\t\t{" << endl; - t << "\t\tcaption = STRING_r_caption;" << endl; - - QString rssIconFile = iconFile; - rssIconFile = rssIconFile.replace("/", "\\\\"); - - if (numberOfIcons.isEmpty() || rssIconFile.isEmpty()) { - // There can be maximum one item in this tag, validated when parsed - t << "\t\tnumber_of_icons = 0;" << endl; - t << "\t\ticon_file = \"\";" << endl; - } else { - // There can be maximum one item in this tag, validated when parsed - t << "\t\tnumber_of_icons = " << numberOfIcons << ";" << endl; - t << "\t\ticon_file = \"" << rssIconFile << "\";" << endl; - } - t << "\t\t};" << endl; - t << "\t}" << endl; - t << endl; - } else { - PRINT_FILE_CREATE_ERROR(filename); - } -} - -void SymbianMakefileGenerator::writeLocFile(QStringList &symbianLangCodes) -{ - QString filename(fixedTarget); - filename.append(".loc"); - QFile ft(filename); - if (ft.open(QIODevice::WriteOnly)) { - generatedFiles << ft.fileName(); - QTextStream t(&ft); - t << "// ============================================================================" << endl; - t << "// * Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: "; - t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; - t << "// * This file is generated by qmake and should not be modified by the" << endl; - t << "// * user." << endl; - t << "// ============================================================================" << endl; - t << endl; - t << "#ifdef LANGUAGE_SC" << endl; - t << "#define STRING_r_short_caption \"" << fixedTarget << "\"" << endl; - t << "#define STRING_r_caption \"" << fixedTarget << "\"" << endl; - foreach(QString lang, symbianLangCodes) { - t << "#elif defined LANGUAGE_" << lang << endl; - t << "#define STRING_r_short_caption \"" << fixedTarget << "\"" << endl; - t << "#define STRING_r_caption \"" << fixedTarget << "\"" << endl; - } - t << "#else" << endl; - t << "#define STRING_r_short_caption \"" << fixedTarget << "\"" << endl; - t << "#define STRING_r_caption \"" << fixedTarget << "\"" << endl; - t << "#endif" << endl; - } else { - PRINT_FILE_CREATE_ERROR(filename); - } -} - -void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules) -{ - for (QMap<QString, QStringList>::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { - if (it.key().startsWith(RSS_RULES_BASE)) { - QString newKey = it.key().mid(sizeof(RSS_RULES_BASE) - 1); - if (newKey.isEmpty()) { - fprintf(stderr, "Warning: Empty RSS_RULES_BASE key encountered\n"); - continue; - } - QStringList newValues; - QStringList values = it.value(); - foreach(QString item, values) { - // If there is no stringlist defined for a rule, use rule name directly - // This is convenience for defining single line statements - if (project->values(item).isEmpty()) { - newValues << item; - } else { - foreach(QString itemRow, project->values(item)) { - newValues << itemRow; - } - } - } - // Verify thet there is exactly one value in RSS_TAG_NBROFICONS - if (newKey == RSS_TAG_NBROFICONS) { - if (newValues.count() == 1) { - numberOfIcons = newValues[0]; - } else { - fprintf(stderr, "Warning: There must be exactly one value in '%s%s'\n", - RSS_RULES_BASE, RSS_TAG_NBROFICONS); - continue; - } - // Verify thet there is exactly one value in RSS_TAG_ICONFILE - } else if (newKey == RSS_TAG_ICONFILE) { - if (newValues.count() == 1) { - iconFile = newValues[0]; - } else { - fprintf(stderr, "Warning: There must be exactly one value in '%s%s'\n", - RSS_RULES_BASE, RSS_TAG_ICONFILE); - continue; - } - } else { - fprintf(stderr, "Warning: Unsupported key:'%s%s'\n", - RSS_RULES_BASE, newKey.toLatin1().constData()); - continue; - } - } - } - - foreach(QString item, project->values(RSS_RULES)) { - // If there is no stringlist defined for a rule, use rule name directly - // This is convenience for defining single line mmp statements - if (project->values(item).isEmpty()) { - userRssRules << item; - } else { - userRssRules << project->values(item); - } - } - - // Validate that either both RSS_TAG_NBROFICONS and RSS_TAG_ICONFILE keys exist - // or neither of them exist - if (!((numberOfIcons.isEmpty() && iconFile.isEmpty()) || - (!numberOfIcons.isEmpty() && !iconFile.isEmpty()))) { - numberOfIcons.clear(); - iconFile.clear(); - fprintf(stderr, "Warning: Both or neither of '%s%s' and '%s%s' keys must exist.\n", - RSS_RULES_BASE, RSS_TAG_NBROFICONS, RSS_RULES_BASE, RSS_TAG_ICONFILE); - } - - // Validate that RSS_TAG_NBROFICONS contains only numbers - if (!numberOfIcons.isEmpty()) { - bool ok; - numberOfIcons = numberOfIcons.simplified(); - int tmp = numberOfIcons.toInt(&ok); - if (!ok) { - numberOfIcons.clear(); - iconFile.clear(); - fprintf(stderr, "Warning: '%s%s' must be integer in decimal format.\n", - RSS_RULES_BASE, RSS_TAG_NBROFICONS); - } - } -} - -QStringList SymbianMakefileGenerator::symbianLangCodesFromTsFiles() -{ - QStringList tsfiles; - QStringList symbianLangCodes; - tsfiles << project->values("TRANSLATIONS"); - - fillQt2S60LangMapTable(); - - foreach(QString file, tsfiles) { - int extIndex = file.lastIndexOf("."); - int langIndex = file.lastIndexOf("_", (extIndex - file.length())); - langIndex += 1; - QString qtlang = file.mid(langIndex, extIndex - langIndex); - QString s60lang = qt2S60LangMapTable.value(qtlang, QString("SC")); - - if (!symbianLangCodes.contains(s60lang) && s60lang != "SC") - symbianLangCodes += s60lang; - } - - return symbianLangCodes; -} - -void SymbianMakefileGenerator::fillQt2S60LangMapTable() -{ - qt2S60LangMapTable.reserve(170); // 165 items at time of writing. - qt2S60LangMapTable.insert("ab", "SC"); //Abkhazian // - qt2S60LangMapTable.insert("om", "SC"); //Afan // - qt2S60LangMapTable.insert("aa", "SC"); //Afar // - qt2S60LangMapTable.insert("af", "34"); //Afrikaans //Afrikaans - qt2S60LangMapTable.insert("sq", "35"); //Albanian //Albanian - qt2S60LangMapTable.insert("am", "36"); //Amharic //Amharic - qt2S60LangMapTable.insert("ar", "37"); //Arabic //Arabic - qt2S60LangMapTable.insert("hy", "38"); //Armenian //Armenian - qt2S60LangMapTable.insert("as", "SC"); //Assamese // - qt2S60LangMapTable.insert("ay", "SC"); //Aymara // - qt2S60LangMapTable.insert("az", "SC"); //Azerbaijani // - qt2S60LangMapTable.insert("ba", "SC"); //Bashkir // - qt2S60LangMapTable.insert("eu", "SC"); //Basque // - qt2S60LangMapTable.insert("bn", "41"); //Bengali //Bengali - qt2S60LangMapTable.insert("dz", "SC"); //Bhutani // - qt2S60LangMapTable.insert("bh", "SC"); //Bihari // - qt2S60LangMapTable.insert("bi", "SC"); //Bislama // - qt2S60LangMapTable.insert("br", "SC"); //Breton // - qt2S60LangMapTable.insert("bg", "42"); //Bulgarian //Bulgarian - qt2S60LangMapTable.insert("my", "43"); //Burmese //Burmese - qt2S60LangMapTable.insert("be", "40"); //Byelorussian //Belarussian - qt2S60LangMapTable.insert("km", "SC"); //Cambodian // - qt2S60LangMapTable.insert("ca", "44"); //Catalan //Catalan - qt2S60LangMapTable.insert("zh", "SC"); //Chinese // - qt2S60LangMapTable.insert("co", "SC"); //Corsican // - qt2S60LangMapTable.insert("hr", "45"); //Croatian //Croatian - qt2S60LangMapTable.insert("cs", "25"); //Czech //Czech - qt2S60LangMapTable.insert("da", "07"); //Danish //Danish - qt2S60LangMapTable.insert("nl", "18"); //Dutch //Dutch - qt2S60LangMapTable.insert("en", "01"); //English //English(UK) - qt2S60LangMapTable.insert("eo", "SC"); //Esperanto // - qt2S60LangMapTable.insert("et", "49"); //Estonian //Estonian - qt2S60LangMapTable.insert("fo", "SC"); //Faroese // - qt2S60LangMapTable.insert("fj", "SC"); //Fiji // - qt2S60LangMapTable.insert("fi", "09"); //Finnish //Finnish - qt2S60LangMapTable.insert("fr", "02"); //French //French - qt2S60LangMapTable.insert("fy", "SC"); //Frisian // - qt2S60LangMapTable.insert("gd", "52"); //Gaelic //Gaelic - qt2S60LangMapTable.insert("gl", "SC"); //Galician // - qt2S60LangMapTable.insert("ka", "53"); //Georgian //Georgian - qt2S60LangMapTable.insert("de", "03"); //German //German - qt2S60LangMapTable.insert("el", "54"); //Greek //Greek - qt2S60LangMapTable.insert("kl", "SC"); //Greenlandic // - qt2S60LangMapTable.insert("gn", "SC"); //Guarani // - qt2S60LangMapTable.insert("gu", "56"); //Gujarati //Gujarati - qt2S60LangMapTable.insert("ha", "SC"); //Hausa // - qt2S60LangMapTable.insert("he", "57"); //Hebrew //Hebrew - qt2S60LangMapTable.insert("hi", "58"); //Hindi //Hindi - qt2S60LangMapTable.insert("hu", "17"); //Hungarian //Hungarian - qt2S60LangMapTable.insert("is", "15"); //Icelandic //Icelandic - qt2S60LangMapTable.insert("id", "59"); //Indonesian //Indonesian - qt2S60LangMapTable.insert("ia", "SC"); //Interlingua // - qt2S60LangMapTable.insert("ie", "SC"); //Interlingue // - qt2S60LangMapTable.insert("iu", "SC"); //Inuktitut // - qt2S60LangMapTable.insert("ik", "SC"); //Inupiak // - qt2S60LangMapTable.insert("ga", "60"); //Irish //Irish - qt2S60LangMapTable.insert("it", "05"); //Italian //Italian - qt2S60LangMapTable.insert("ja", "32"); //Japanese //Japanese - qt2S60LangMapTable.insert("jv", "SC"); //Javanese // - qt2S60LangMapTable.insert("kn", "62"); //Kannada //Kannada - qt2S60LangMapTable.insert("ks", "SC"); //Kashmiri // - qt2S60LangMapTable.insert("kk", "63"); //Kazakh //Kazakh - qt2S60LangMapTable.insert("rw", "SC"); //Kinyarwanda // - qt2S60LangMapTable.insert("ky", "SC"); //Kirghiz // - qt2S60LangMapTable.insert("ko", "65"); //Korean //Korean - qt2S60LangMapTable.insert("ku", "SC"); //Kurdish // - qt2S60LangMapTable.insert("rn", "SC"); //Kurundi // - qt2S60LangMapTable.insert("lo", "66"); //Laothian //Laothian - qt2S60LangMapTable.insert("la", "SC"); //Latin // - qt2S60LangMapTable.insert("lv", "67"); //Latvian //Latvian - qt2S60LangMapTable.insert("ln", "SC"); //Lingala // - qt2S60LangMapTable.insert("lt", "68"); //Lithuanian //Lithuanian - qt2S60LangMapTable.insert("mk", "69"); //Macedonian //Macedonian - qt2S60LangMapTable.insert("mg", "SC"); //Malagasy // - qt2S60LangMapTable.insert("ms", "70"); //Malay //Malay - qt2S60LangMapTable.insert("ml", "71"); //Malayalam //Malayalam - qt2S60LangMapTable.insert("mt", "SC"); //Maltese // - qt2S60LangMapTable.insert("mi", "SC"); //Maori // - qt2S60LangMapTable.insert("mr", "72"); //Marathi //Marathi - qt2S60LangMapTable.insert("mo", "73"); //Moldavian //Moldovian - qt2S60LangMapTable.insert("mn", "74"); //Mongolian //Mongolian - qt2S60LangMapTable.insert("na", "SC"); //Nauru // - qt2S60LangMapTable.insert("ne", "SC"); //Nepali // - qt2S60LangMapTable.insert("nb", "08"); //Norwegian //Norwegian - qt2S60LangMapTable.insert("oc", "SC"); //Occitan // - qt2S60LangMapTable.insert("or", "SC"); //Oriya // - qt2S60LangMapTable.insert("ps", "SC"); //Pashto // - qt2S60LangMapTable.insert("fa", "SC"); //Persian // - qt2S60LangMapTable.insert("pl", "27"); //Polish //Polish - qt2S60LangMapTable.insert("pt", "13"); //Portuguese //Portuguese - qt2S60LangMapTable.insert("pa", "77"); //Punjabi //Punjabi - qt2S60LangMapTable.insert("qu", "SC"); //Quechua // - qt2S60LangMapTable.insert("rm", "SC"); //RhaetoRomance // - qt2S60LangMapTable.insert("ro", "78"); //Romanian //Romanian - qt2S60LangMapTable.insert("ru", "16"); //Russian //Russian - qt2S60LangMapTable.insert("sm", "SC"); //Samoan // - qt2S60LangMapTable.insert("sg", "SC"); //Sangho // - qt2S60LangMapTable.insert("sa", "SC"); //Sanskrit // - qt2S60LangMapTable.insert("sr", "79"); //Serbian //Serbian - qt2S60LangMapTable.insert("sh", "SC"); //SerboCroatian // - qt2S60LangMapTable.insert("st", "SC"); //Sesotho // - qt2S60LangMapTable.insert("tn", "SC"); //Setswana // - qt2S60LangMapTable.insert("sn", "SC"); //Shona // - qt2S60LangMapTable.insert("sd", "SC"); //Sindhi // - qt2S60LangMapTable.insert("si", "80"); //Singhalese //Sinhalese - qt2S60LangMapTable.insert("ss", "SC"); //Siswati // - qt2S60LangMapTable.insert("sk", "26"); //Slovak //Slovak - qt2S60LangMapTable.insert("sl", "28"); //Slovenian //Slovenian - qt2S60LangMapTable.insert("so", "81"); //Somali //Somali - qt2S60LangMapTable.insert("es", "04"); //Spanish //Spanish - qt2S60LangMapTable.insert("su", "SC"); //Sundanese // - qt2S60LangMapTable.insert("sw", "84"); //Swahili //Swahili - qt2S60LangMapTable.insert("sv", "06"); //Swedish //Swedish - qt2S60LangMapTable.insert("tl", "39"); //Tagalog //Tagalog - qt2S60LangMapTable.insert("tg", "SC"); //Tajik // - qt2S60LangMapTable.insert("ta", "87"); //Tamil //Tamil - qt2S60LangMapTable.insert("tt", "SC"); //Tatar // - qt2S60LangMapTable.insert("te", "88"); //Telugu //Telugu - qt2S60LangMapTable.insert("th", "33"); //Thai //Thai - qt2S60LangMapTable.insert("bo", "89"); //Tibetan //Tibetan - qt2S60LangMapTable.insert("ti", "90"); //Tigrinya //Tigrinya - qt2S60LangMapTable.insert("to", "SC"); //Tonga // - qt2S60LangMapTable.insert("ts", "SC"); //Tsonga // - qt2S60LangMapTable.insert("tr", "14"); //Turkish //Turkish - qt2S60LangMapTable.insert("tk", "92"); //Turkmen //Turkmen - qt2S60LangMapTable.insert("tw", "SC"); //Twi // - qt2S60LangMapTable.insert("ug", "SC"); //Uigur // - qt2S60LangMapTable.insert("uk", "93"); //Ukrainian //Ukrainian - qt2S60LangMapTable.insert("ur", "94"); //Urdu //Urdu - qt2S60LangMapTable.insert("uz", "SC"); //Uzbek // - qt2S60LangMapTable.insert("vi", "96"); //Vietnamese //Vietnamese - qt2S60LangMapTable.insert("vo", "SC"); //Volapuk // - qt2S60LangMapTable.insert("cy", "97"); //Welsh //Welsh - qt2S60LangMapTable.insert("wo", "SC"); //Wolof // - qt2S60LangMapTable.insert("xh", "SC"); //Xhosa // - qt2S60LangMapTable.insert("yi", "SC"); //Yiddish // - qt2S60LangMapTable.insert("yo", "SC"); //Yoruba // - qt2S60LangMapTable.insert("za", "SC"); //Zhuang // - qt2S60LangMapTable.insert("zu", "98"); //Zulu //Zulu - qt2S60LangMapTable.insert("nn", "75"); //Nynorsk //NorwegianNynorsk - qt2S60LangMapTable.insert("bs", "SC"); //Bosnian // - qt2S60LangMapTable.insert("dv", "SC"); //Divehi // - qt2S60LangMapTable.insert("gv", "SC"); //Manx // - qt2S60LangMapTable.insert("kw", "SC"); //Cornish // - qt2S60LangMapTable.insert("ak", "SC"); //Akan // - qt2S60LangMapTable.insert("kok", "SC"); //Konkani // - qt2S60LangMapTable.insert("gaa", "SC"); //Ga // - qt2S60LangMapTable.insert("ig", "SC"); //Igbo // - qt2S60LangMapTable.insert("kam", "SC"); //Kamba // - qt2S60LangMapTable.insert("syr", "SC"); //Syriac // - qt2S60LangMapTable.insert("byn", "SC"); //Blin // - qt2S60LangMapTable.insert("gez", "SC"); //Geez // - qt2S60LangMapTable.insert("kfo", "SC"); //Koro // - qt2S60LangMapTable.insert("sid", "SC"); //Sidamo // - qt2S60LangMapTable.insert("cch", "SC"); //Atsam // - qt2S60LangMapTable.insert("tig", "SC"); //Tigre // - qt2S60LangMapTable.insert("kaj", "SC"); //Jju // - qt2S60LangMapTable.insert("fur", "SC"); //Friulian // - qt2S60LangMapTable.insert("ve", "SC"); //Venda // - qt2S60LangMapTable.insert("ee", "SC"); //Ewe // - qt2S60LangMapTable.insert("wa", "SC"); //Walamo // - qt2S60LangMapTable.insert("haw", "SC"); //Hawaiian // - qt2S60LangMapTable.insert("kcg", "SC"); //Tyap // - qt2S60LangMapTable.insert("ny", "SC"); //Chewa // -} - void SymbianMakefileGenerator::appendIfnotExist(QStringList &list, QString value) { if (!list.contains(value)) diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h index 46071b8..7ff1ce9 100644 --- a/qmake/generators/symbian/symmake.h +++ b/qmake/generators/symbian/symmake.h @@ -66,8 +66,6 @@ protected: QMap<QString, QStringList> makmakeCommands; QStringList overriddenMmpKeywords; - QHash<QString, QString> qt2S60LangMapTable; - QString fixPathForMmp(const QString& origPath, const QDir& parentDir); QString canonizePath(const QString& origPath); @@ -110,14 +108,6 @@ protected: void writeCustomDefFile(); - void writeRegRssFile(QStringList &useritems); - void writeRssFile(QString &numberOfIcons, QString &iconfile); - void writeLocFile(QStringList &symbianLangCodes); - void readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules); - - QStringList symbianLangCodesFromTsFiles(); - void fillQt2S60LangMapTable(); - void appendIfnotExist(QStringList &list, QString value); void appendIfnotExist(QStringList &list, QStringList values); |