Remove redundant decoder in ContentModel

celladd
scrawl 10 years ago
parent cff0127ce7
commit 4c6b9f8266

@ -442,11 +442,6 @@ void ContentSelectorModel::ContentModel::addFiles(const QString &path)
filters << "*.esp" << "*.esm" << "*.omwgame" << "*.omwaddon"; filters << "*.esp" << "*.esm" << "*.omwgame" << "*.omwaddon";
dir.setNameFilters(filters); dir.setNameFilters(filters);
QTextCodec *codec = QTextCodec::codecForName("UTF8");
// Create a decoder for non-latin characters in esx metadata
QTextDecoder *decoder = codec->makeDecoder();
foreach (const QString &path, dir.entryList()) foreach (const QString &path, dir.entryList())
{ {
QFileInfo info(dir.absoluteFilePath(path)); QFileInfo info(dir.absoluteFilePath(path));
@ -466,11 +461,11 @@ void ContentSelectorModel::ContentModel::addFiles(const QString &path)
foreach (const ESM::Header::MasterData &item, fileReader.getGameFiles()) foreach (const ESM::Header::MasterData &item, fileReader.getGameFiles())
file->addGameFile(QString::fromStdString(item.name)); file->addGameFile(QString::fromStdString(item.name));
file->setAuthor (decoder->toUnicode(fileReader.getAuthor().c_str())); file->setAuthor (QString::fromUtf8(fileReader.getAuthor().c_str()));
file->setDate (info.lastModified()); file->setDate (info.lastModified());
file->setFormat (fileReader.getFormat()); file->setFormat (fileReader.getFormat());
file->setFilePath (info.absoluteFilePath()); file->setFilePath (info.absoluteFilePath());
file->setDescription(decoder->toUnicode(fileReader.getDesc().c_str())); file->setDescription(QString::fromUtf8(fileReader.getDesc().c_str()));
// Put the file in the table // Put the file in the table
addFile(file); addFile(file);
@ -483,8 +478,6 @@ void ContentSelectorModel::ContentModel::addFiles(const QString &path)
} }
delete decoder;
sortFiles(); sortFiles();
} }

Loading…
Cancel
Save