Commit a1c13cb4 authored by Simon Eugster's avatar Simon Eugster

Review remaining LC_NUMERIC occurrences

Related: #713
parent 2f64cc05
Pipeline #24582 passed with stage
in 26 minutes and 2 seconds
......@@ -61,10 +61,12 @@ AssetParameterModel::AssetParameterModel(std::unique_ptr<Mlt::Properties> asset,
if (EffectsRepository::get()->exists(assetId)) {
qDebug() << "Asset " << assetId << " found in the repository. Description: " << EffectsRepository::get()->getDescription(assetId);
#if false
QString str;
QTextStream stream(&str);
EffectsRepository::get()->getXml(assetId).save(stream, 4);
qDebug() << "Asset XML: " << str;
#endif
} else {
qDebug() << "Asset not found in repo: " << assetId;
}
......
......@@ -76,11 +76,11 @@ QPair<bool, QString> DocumentValidator::validate(const double currentVersion)
QLocale documentLocale = QLocale::c(); // Document locale for conversion. Previous MLT / Kdenlive versions used C locale by default
if (mlt.hasAttribute(QStringLiteral("LC_NUMERIC"))) {
// Check document numeric separator (added in Kdenlive 16.12.1
if (mlt.hasAttribute(QStringLiteral("LC_NUMERIC"))) { // Backwards compatibility
// Check document numeric separator (added in Kdenlive 16.12.1 and removed in Kdenlive 20.08)
QDomElement main_playlist = mlt.firstChildElement(QStringLiteral("playlist"));
QString sep = Xml::getXmlProperty(main_playlist, "kdenlive:docproperties.decimalPoint", QString("."));
QString mltLocale = mlt.attribute(QStringLiteral("LC_NUMERIC"), "C");
QString mltLocale = mlt.attribute(QStringLiteral("LC_NUMERIC"), "C"); // Backwards compatibility
qDebug() << "LOCALE: Document uses " << sep << " as decimal point and " << mltLocale << " as locale";
auto localeMatch = LocaleHandling::getQLocaleForDecimalPoint(mltLocale, sep);
......@@ -1821,7 +1821,7 @@ auto DocumentValidator::upgradeTo100(const QLocale &documentLocale) -> QString {
QString newValue = QString(value).replace(decimalPoint, ".");
if (value != newValue) {
Xml::setXmlProperty(filter, property, newValue);
qDebug() << "Decimal point: Property" << mltService << "converted from " << value << "to" << newValue;
qDebug() << "Decimal point: Converted service property" << mltService << "from " << value << "to" << newValue;
}
}
}
......
......@@ -314,10 +314,6 @@ const QByteArray KdenliveDoc::getAndClearProjectXml()
return result;
}
QString KdenliveDoc::getLcNumeric() {
return m_document.documentElement().attribute("LC_NUMERIC");
}
QDomDocument KdenliveDoc::createEmptyDocument(int videotracks, int audiotracks)
{
QList<TrackInfo> tracks;
......
......@@ -63,7 +63,6 @@ public:
friend class LoadJob;
/** @brief Get current document's producer. */
const QByteArray getAndClearProjectXml();
QString getLcNumeric();
double fps() const;
int width() const;
int height() const;
......
......@@ -865,29 +865,6 @@ bool ProjectManager::updateTimeline(int pos, int scrollPos)
pCore->window()->getMainTimeline()->loading = true;
pCore->window()->slotSwitchTimelineZone(m_project->getDocumentProperty(QStringLiteral("enableTimelineZone")).toInt() == 1);
auto lcNumericCategory = m_project->getLcNumeric();
if (lcNumericCategory.isEmpty() || lcNumericCategory == "C") {
// Default locale is C. All fine, no number format issues to expect.
} else if (false) {
qDebug() << "Document uses the locale " << lcNumericCategory << ", switching locale for loading the document";
QString newLocale = LocaleHandling::setLocale(lcNumericCategory);
if (newLocale.isEmpty()) {
qDebug() << "Could not switch locale. Is it installed?";
auto res =
KMessageBox::warningYesNo(qApp->activeWindow(), i18n("This project file uses the locale %1 but it is not installed on the system. Load anyway? "
"Warning: Loaded project may be corrupted or cause a crash.",
lcNumericCategory));
if (res == KMessageBox::No) {
newFile(false);
return false;
} else {
qDebug() << "WARNING: Loading project with locale " << lcNumericCategory << " which is not found on the system.";
}
} else {
qDebug() << "Locale successfully switched to " << newLocale;
}
}
QScopedPointer<Mlt::Producer> xmlProd(new Mlt::Producer(pCore->getCurrentProfile()->profile(), "xml-string",
m_project->getAndClearProjectXml().constData()));
......
......@@ -132,13 +132,9 @@ QDomDocument TitleDocument::xml(QGraphicsRectItem *startv, QGraphicsRectItem *en
QDomElement main = doc.createElement(QStringLiteral("kdenlivetitle"));
main.setAttribute(QStringLiteral("width"), m_width);
main.setAttribute(QStringLiteral("height"), m_height);
// Save locale
#ifndef Q_OS_MAC
const char *locale = setlocale(LC_NUMERIC, nullptr);
#else
const char *locale = setlocale(LC_NUMERIC_MASK, nullptr);
#endif
main.setAttribute(QStringLiteral("LC_NUMERIC"), locale);
// Save locale. Since 20.08, we always use the C locale for serialising.
main.setAttribute(QStringLiteral("LC_NUMERIC"), "C");
doc.appendChild(main);
QTextCursor cur;
QTextBlockFormat format;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment