Skip to content
Snippets Groups Projects
Commit 88289c1e authored by SeeLook's avatar SeeLook :musical_note:
Browse files

Put grounds for shipping level files with installers

- implemented a way to have them possible to translate
parent f31600cd
No related branches found
No related tags found
No related merge requests found
This directory contains Nootka exam levels distributed with the application.
They will be automatically loaded and visible inside Nootka on the level list.
Levels in this directory must have extra translatable tags:
<nameTR>translate("Levels", "Level name here", "Keep it short, please - 29 characters max")</nameTR>
<descriptionTR>translate("Levels", "Level description here")</descriptionTR>
Of course <level> tag must have some "name" attribute.
<level name="Level name here">
and to detect them correctly, lupdate has to be invoked in such a way:
lupdate -extensions cpp,h,qml,nel -recursive ../src ../levels -ts some_file.ts
from inside lang directory
Do not forget to add those level files to install scripts (cmake) and NSIS
......@@ -35,5 +35,6 @@ else
ln -s $SRC_DIR/picts $DST_DIR
ln -s $SRC_DIR/lang $DST_DIR
ln -s $SRC_DIR/sounds $DST_DIR
ln -s $SRC_DIR/levels $DST_DIR
fi
/***************************************************************************
* Copyright (C) 2011-2020 by Tomasz Bojczuk *
* Copyright (C) 2011-2021 by Tomasz Bojczuk *
* seelook@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
......@@ -269,10 +269,6 @@ Tlevel::EerrorType Tlevel::loadFromXml(QXmlStreamReader& xml) {
if (name.isEmpty()) {
qDebug() << "[Tlevel] Level key has empty 'name' attribute";
return e_otherError;
} else if (name.size() > 29) {
name = name.left(29);
er = e_levelFixed;
qDebug() << "[Tlevel] Name of a level was reduced to 29 characters:" << name;
}
melodySet.clear();
randOrderInSet = true;
......@@ -281,6 +277,14 @@ Tlevel::EerrorType Tlevel::loadFromXml(QXmlStreamReader& xml) {
while (xml.readNextStartElement()) {
if (xml.name() == QLatin1String("description"))
desc = xml.readElementText();
else if (xml.name() == QLatin1String("nameTR"))
name = QApplication::translate("Levels", xml.readElementText()
.replace(QLatin1String("translate(\"Levels\", \""), QString())
.replace(QLatin1String("\")"), QString()).toLocal8Bit());
else if (xml.name() == QLatin1String("descriptionTR"))
desc = QApplication::translate("Levels", xml.readElementText()
.replace(QLatin1String("translate(\"Levels\", \""), QString())
.replace(QLatin1String("\")"), QString()).toLocal8Bit());
// QUESTIONS
else if (xml.name() == QLatin1String("questions")) {
while (xml.readNextStartElement()) {
......@@ -435,20 +439,25 @@ Tlevel::EerrorType Tlevel::loadFromXml(QXmlStreamReader& xml) {
} else
skipCurrentXmlKey(xml);
}
if (name.size() > 29) {
name = name.left(29);
er = e_levelFixed;
qDebug() << "[Tlevel] Name of a level was reduced to 29 characters:" << name;
}
if (canBeGuitar() && fixFretRange() == e_levelFixed) {
er = e_levelFixed;
qDebug() << "[Tlevel] Lowest fret in range was bigger than the highest one. Fixed";
qDebug() << "[Tlevel] Lowest fret in the range was bigger than the highest one. Fixed";
}
if (useKeySign && !isSingleKey && fixKeyRange() == e_levelFixed) {
er = e_levelFixed;
qDebug() << "[Tlevel] Lowest key in range was higher than the highest one. Fixed";
qDebug() << "[Tlevel] Lowest key in the range was higher than the highest one. Fixed";
}
if (loNote.note() == 0 || hiNote.note() == 0) {
qDebug() << "[Tlevel] Note range is wrong.";
return e_otherError;
} else if (fixNoteRange() == e_levelFixed) {
er = e_levelFixed;
qDebug() << "[Tlevel] Lowest note in range was higher than the highest one. Fixed";
qDebug() << "[Tlevel] Lowest note in the range was higher than the highest one. Fixed";
}
if (notesList.isEmpty()) {
if (randMelody == e_randFromList) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment