diff options
| author | Tannin <devnull@localhost> | 2014-01-05 18:50:56 +0100 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2014-01-05 18:50:56 +0100 |
| commit | db09b806b9e765b5cb49a9a80f74a4440fff3027 (patch) | |
| tree | 47d8bc442416698d2e5b34c49d7ddd3b6efd04ce /src/modinfodialog.cpp | |
| parent | 859c0aed984240467e9e59f72aa4c9714df9fb0b (diff) | |
- Mod Organizer can now display most image types (including dds) and txt files from the data
tree, presenting a comparison of variants in case of overwritten files
Diffstat (limited to 'src/modinfodialog.cpp')
| -rw-r--r-- | src/modinfodialog.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/modinfodialog.cpp b/src/modinfodialog.cpp index 1da050ed..674e7165 100644 --- a/src/modinfodialog.cpp +++ b/src/modinfodialog.cpp @@ -398,19 +398,10 @@ void ModInfoDialog::on_textFileList_currentItemChanged(QListWidgetItem *current, void ModInfoDialog::openTextFile(const QString &fileName) { - QFile textFile(fileName); - textFile.open(QIODevice::ReadOnly); - QByteArray buffer = textFile.readAll(); - QTextCodec *codec = QTextCodec::codecForUtfText(buffer, m_UTF8Codec); - QString text = codec->toUnicode(buffer); - if (codec->fromUnicode(text) != buffer) { - qDebug("conversion failed assuming local encoding"); - codec = QTextCodec::codecForLocale(); - text = codec->toUnicode(buffer); - } - ui->textFileView->setText(text); + QString encoding; + ui->textFileView->setText(MOBase::readFileText(fileName, &encoding)); ui->textFileView->setProperty("currentFile", fileName); - ui->textFileView->setProperty("encoding", codec->name()); + ui->textFileView->setProperty("encoding", encoding); ui->saveTXTButton->setEnabled(false); } |
