create QString from utf-8 when expected

pull/108/head
greye 11 years ago
parent eafdefe999
commit cd990a665a

@ -41,11 +41,11 @@ Launcher::MainDialog::MainDialog(QWidget *parent)
// Check if the font is installed // Check if the font is installed
if (!fonts.contains("EB Garamond")) { if (!fonts.contains("EB Garamond")) {
QString font = QString::fromStdString(mCfgMgr.getGlobalDataPath().string()) + QString("resources/mygui/EBGaramond-Regular.ttf"); QString font = QString::fromUtf8(mCfgMgr.getGlobalDataPath().string().c_str()) + QString("resources/mygui/EBGaramond-Regular.ttf");
file.setFileName(font); file.setFileName(font);
if (!file.exists()) { if (!file.exists()) {
font = QString::fromStdString(mCfgMgr.getLocalPath().string()) + QString("resources/mygui/EBGaramond-Regular.ttf"); font = QString::fromUtf8(mCfgMgr.getLocalPath().string().c_str()) + QString("resources/mygui/EBGaramond-Regular.ttf");
} }
fontDatabase.addApplicationFont(font); fontDatabase.addApplicationFont(font);
@ -243,7 +243,7 @@ bool Launcher::MainDialog::showFirstRunDialog()
} }
// Create the file if it doesn't already exist, else the importer will fail // Create the file if it doesn't already exist, else the importer will fail
QString path = QString::fromStdString(mCfgMgr.getUserConfigPath().string()) + QString("openmw.cfg"); QString path = QString::fromUtf8(mCfgMgr.getUserConfigPath().string().c_str()) + QString("openmw.cfg");
QFile file(path); QFile file(path);
if (!file.exists()) { if (!file.exists()) {
@ -358,7 +358,7 @@ bool Launcher::MainDialog::setupLauncherSettings()
{ {
mLauncherSettings.setMultiValueEnabled(true); mLauncherSettings.setMultiValueEnabled(true);
QString userPath = QString::fromStdString(mCfgMgr.getUserConfigPath().string()); QString userPath = QString::fromUtf8(mCfgMgr.getUserConfigPath().string().c_str());
QStringList paths; QStringList paths;
paths.append(QString("launcher.cfg")); paths.append(QString("launcher.cfg"));
@ -464,8 +464,8 @@ bool Launcher::expansions(Launcher::UnshieldThread& cd)
bool Launcher::MainDialog::setupGameSettings() bool Launcher::MainDialog::setupGameSettings()
{ {
QString userPath = QString::fromStdString(mCfgMgr.getUserConfigPath().string()); QString userPath = QString::fromUtf8(mCfgMgr.getUserConfigPath().string().c_str());
QString globalPath = QString::fromStdString(mCfgMgr.getGlobalPath().string()); QString globalPath = QString::fromUtf8(mCfgMgr.getGlobalPath().string().c_str());
// Load the user config file first, separately // Load the user config file first, separately
// So we can write it properly, uncontaminated // So we can write it properly, uncontaminated
@ -594,7 +594,7 @@ bool Launcher::MainDialog::setupGameSettings()
while(expansions(cd)); while(expansions(cd));
selectedFile = QString::fromStdString(cd.GetMWEsmPath()); selectedFile = QString::fromUtf8(cd.GetMWEsmPath().c_str());
} }
#endif // WIN32 #endif // WIN32
@ -615,8 +615,8 @@ bool Launcher::MainDialog::setupGraphicsSettings()
{ {
mGraphicsSettings.setMultiValueEnabled(false); mGraphicsSettings.setMultiValueEnabled(false);
QString userPath = QString::fromStdString(mCfgMgr.getUserConfigPath().string()); QString userPath = QString::fromUtf8(mCfgMgr.getUserConfigPath().string().c_str());
QString globalPath = QString::fromStdString(mCfgMgr.getGlobalPath().string()); QString globalPath = QString::fromUtf8(mCfgMgr.getGlobalPath().string().c_str());
QFile localDefault(QString("settings-default.cfg")); QFile localDefault(QString("settings-default.cfg"));
QFile globalDefault(globalPath + QString("settings-default.cfg")); QFile globalDefault(globalPath + QString("settings-default.cfg"));
@ -702,7 +702,7 @@ bool Launcher::MainDialog::writeSettings()
mGraphicsPage->saveSettings(); mGraphicsPage->saveSettings();
mDataFilesPage->saveSettings(); mDataFilesPage->saveSettings();
QString userPath = QString::fromStdString(mCfgMgr.getUserConfigPath().string()); QString userPath = QString::fromUtf8(mCfgMgr.getUserConfigPath().string().c_str());
QDir dir(userPath); QDir dir(userPath);
if (!dir.exists()) { if (!dir.exists()) {

@ -53,7 +53,7 @@ void Launcher::GameSettings::validatePaths()
mDataDirs.clear(); mDataDirs.clear();
for (Files::PathContainer::iterator it = dataDirs.begin(); it != dataDirs.end(); ++it) { for (Files::PathContainer::iterator it = dataDirs.begin(); it != dataDirs.end(); ++it) {
QString path = QString::fromStdString(it->string()); QString path = QString::fromUtf8(it->string().c_str());
path.remove(QChar('\"')); path.remove(QChar('\"'));
QDir dir(path); QDir dir(path);
@ -73,7 +73,7 @@ void Launcher::GameSettings::validatePaths()
mCfgMgr.processPaths(dataDirs); mCfgMgr.processPaths(dataDirs);
if (!dataDirs.empty()) { if (!dataDirs.empty()) {
QString path = QString::fromStdString(dataDirs.front().string()); QString path = QString::fromUtf8(dataDirs.front().string().c_str());
path.remove(QChar('\"')); path.remove(QChar('\"'));
QDir dir(path); QDir dir(path);

Loading…
Cancel
Save