mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
Merge branch 'ensure_utf8_encoding' into 'master'
Move ensureUtf8Encoding to named namespace See merge request OpenMW/openmw!2632
This commit is contained in:
commit
f0e58d1c59
@ -308,7 +308,7 @@ bool Launcher::MainDialog::setupLauncherSettings()
|
||||
return false;
|
||||
}
|
||||
QTextStream stream(&file);
|
||||
ensureUtf8Encoding(stream);
|
||||
Misc::ensureUtf8Encoding(stream);
|
||||
|
||||
mLauncherSettings.readFile(stream);
|
||||
}
|
||||
@ -344,7 +344,7 @@ bool Launcher::MainDialog::setupGameSettings()
|
||||
return {};
|
||||
}
|
||||
QTextStream stream(&file);
|
||||
ensureUtf8Encoding(stream);
|
||||
Misc::ensureUtf8Encoding(stream);
|
||||
|
||||
(mGameSettings.*reader)(stream, ignoreContent);
|
||||
file.close();
|
||||
@ -544,7 +544,7 @@ bool Launcher::MainDialog::writeSettings()
|
||||
|
||||
QTextStream stream(&file);
|
||||
stream.setDevice(&file);
|
||||
ensureUtf8Encoding(stream);
|
||||
Misc::ensureUtf8Encoding(stream);
|
||||
|
||||
mLauncherSettings.writeFile(stream);
|
||||
file.close();
|
||||
|
@ -165,7 +165,7 @@ void Wizard::MainWizard::setupGameSettings()
|
||||
return;
|
||||
}
|
||||
QTextStream stream(&file);
|
||||
ensureUtf8Encoding(stream);
|
||||
Misc::ensureUtf8Encoding(stream);
|
||||
|
||||
mGameSettings.readUserFile(stream);
|
||||
}
|
||||
@ -197,7 +197,7 @@ void Wizard::MainWizard::setupGameSettings()
|
||||
return;
|
||||
}
|
||||
QTextStream stream(&file);
|
||||
ensureUtf8Encoding(stream);
|
||||
Misc::ensureUtf8Encoding(stream);
|
||||
|
||||
mGameSettings.readFile(stream);
|
||||
}
|
||||
@ -233,7 +233,7 @@ void Wizard::MainWizard::setupLauncherSettings()
|
||||
return;
|
||||
}
|
||||
QTextStream stream(&file);
|
||||
ensureUtf8Encoding(stream);
|
||||
Misc::ensureUtf8Encoding(stream);
|
||||
|
||||
mLauncherSettings.readFile(stream);
|
||||
}
|
||||
@ -460,7 +460,7 @@ void Wizard::MainWizard::writeSettings()
|
||||
}
|
||||
|
||||
QTextStream stream(&file);
|
||||
ensureUtf8Encoding(stream);
|
||||
Misc::ensureUtf8Encoding(stream);
|
||||
|
||||
mGameSettings.writeFile(stream);
|
||||
file.close();
|
||||
@ -486,7 +486,7 @@ void Wizard::MainWizard::writeSettings()
|
||||
}
|
||||
|
||||
stream.setDevice(&file);
|
||||
ensureUtf8Encoding(stream);
|
||||
Misc::ensureUtf8Encoding(stream);
|
||||
|
||||
mLauncherSettings.writeFile(stream);
|
||||
file.close();
|
||||
|
@ -230,7 +230,7 @@ bool Config::GameSettings::isOrderedLine(const QString& line)
|
||||
bool Config::GameSettings::writeFileWithComments(QFile& file)
|
||||
{
|
||||
QTextStream stream(&file);
|
||||
ensureUtf8Encoding(stream);
|
||||
Misc::ensureUtf8Encoding(stream);
|
||||
|
||||
// slurp
|
||||
std::vector<QString> fileCopy;
|
||||
|
@ -1,14 +1,16 @@
|
||||
#ifndef MISC_UTF8QTEXTSTREAM_HPP
|
||||
#define MISC_UTF8QTEXTSTREAM_HPP
|
||||
#ifndef OPENMW_COMPONENTS_MISC_UTF8QTEXTSTREAM_HPP
|
||||
#define OPENMW_COMPONENTS_MISC_UTF8QTEXTSTREAM_HPP
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#include <QTextCodec>
|
||||
#endif
|
||||
#include <QTextStream>
|
||||
|
||||
namespace
|
||||
namespace Misc
|
||||
{
|
||||
void ensureUtf8Encoding(QTextStream& stream)
|
||||
inline void ensureUtf8Encoding(QTextStream& stream)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
stream.setCodec(QTextCodec::codecForName("UTF-8"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user