Commit 979c0a74 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

By default in qt6 QTextStream uses UTF-8

parent 84b340b4
......@@ -2162,7 +2162,9 @@ void Bin::createClip(const QDomElement &xml)
KMessageBox::sorry(this, i18n("Unable to write to file %1", path));
} else {
QTextStream out(&f);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
#endif
out << doc.toString();
f.close();
KMessageBox::information(
......
......@@ -1013,7 +1013,9 @@ void SubtitleModel::jsontoSubtitle(const QString &data)
auto list = json.array();
if (outF.open(QIODevice::WriteOnly)) {
QTextStream out(&outF);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
#endif
if (assFormat) {
out << scriptInfoSection << '\n';
out << styleSection << '\n';
......
......@@ -1811,7 +1811,9 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
if (file.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&file);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
#endif
out << doc.toString();
}
file.close();
......
......@@ -926,7 +926,9 @@ void KdenliveDoc::saveCustomEffects(const QDomNodeList &customeffects)
QFile file(path);
if (file.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&file);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
#endif
out << doc.toString();
}
}
......
......@@ -246,7 +246,9 @@ void EffectTreeModel::editCustomAsset(const QString &newName, const QString &new
if (file.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&file);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
#endif
out << doc.toString();
}
file.close();
......
......@@ -379,7 +379,9 @@ QPair<QString, QString> EffectsRepository::fixCustomAssetFile(const QString &pat
}
if (file.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&file);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
#endif
out << doc.toString();
}
file.close();
......
......@@ -562,7 +562,9 @@ void CollapsibleEffectView::slotSaveEffect()
if (file.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&file);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
#endif
out << doc.toString();
}
file.close();
......
......@@ -531,7 +531,9 @@ void EffectStackView::slotSaveStack()
QFile file(dir.absoluteFilePath(name + QStringLiteral(".xml")));
if (file.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&file);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
#endif
out << doc.toString();
}
file.close();
......
......@@ -88,7 +88,9 @@ void ProxyTask::run()
if (playlist->open()) {
source = playlist->fileName();
QTextStream out(playlist);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
#endif
out << doc.toString();
playlist->close();
}
......
......@@ -72,7 +72,9 @@ void TranscodeTask::run()
QDomDocument doc;
binClip->getProducerXML(doc, false, true);
QTextStream out(&src);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
#endif
out << doc.toString();
src.close();
}
......
......@@ -1241,7 +1241,9 @@ void ProjectManager::saveWithUpdatedProfile(const QString &updatedProfile)
return;
}
QTextStream out(&file);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
#endif
out << doc.toString();
if (file.error() != QFile::NoError) {
KMessageBox::error(qApp->activeWindow(), i18n("Cannot write to file %1", convertedFile));
......
......@@ -155,7 +155,9 @@ void RenderPresetRepository::parseFile(const QString &exportFile, bool editable)
return;
}
QTextStream out(&file);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
#endif
out << newdoc.toString();
file.close();
// now that we fixed the file, run this function again
......@@ -368,7 +370,9 @@ const QString RenderPresetRepository::savePreset(RenderPresetModel *preset, bool
return {};
}
QTextStream out(&file);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
#endif
out << doc.toString();
if (file.error() != QFile::NoError) {
KMessageBox::error(nullptr, i18n("Cannot write to file %1", file.fileName()));
......@@ -425,7 +429,9 @@ bool RenderPresetRepository::deletePreset(const QString &name, bool dontRefresh)
return false;
}
QTextStream out(&file);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
#endif
out << doc.toString();
if (file.error() != QFile::NoError) {
KMessageBox::error(nullptr, i18n("Cannot write to file %1", exportFile));
......
Supports Markdown
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