diff --git a/apps/launcher/datafilespage.cpp b/apps/launcher/datafilespage.cpp index 356a15de81..9e812138c8 100644 --- a/apps/launcher/datafilespage.cpp +++ b/apps/launcher/datafilespage.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include "utils/profilescombobox.hpp" #include "utils/textinputdialog.hpp" @@ -393,7 +394,7 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName) int row = 0; for (const auto& archive : selectedArchives) { - const auto match = ui.archiveListWidget->findItems(archive.value, Qt::MatchExactly); + const auto match = ui.archiveListWidget->findItems(archive.value, Qt::MatchFixedString); if (match.isEmpty()) continue; const auto name = match[0]->text(); @@ -889,9 +890,9 @@ void Launcher::DataFilesPage::addArchivesFromDir(const QString& path) QStringList archiveFilter{ "*.bsa", "*.ba2" }; QDir dir(path); - std::unordered_set archives; + std::unordered_set archives; for (int i = 0; i < ui.archiveListWidget->count(); ++i) - archives.insert(ui.archiveListWidget->item(i)->text()); + archives.insert(VFS::Path::normalizedFromQString(ui.archiveListWidget->item(i)->text())); for (const auto& fileinfo : dir.entryInfoList(archiveFilter)) { @@ -901,7 +902,7 @@ void Launcher::DataFilesPage::addArchivesFromDir(const QString& path) const auto fileName = fileinfo.fileName(); - if (archives.insert(fileName).second) + if (archives.insert(VFS::Path::normalizedFromQString(fileName)).second) addArchive(fileName, Qt::Unchecked); } } diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index a326836050..3a0acdae22 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -554,6 +554,10 @@ if (USE_QT) application ) + add_component_qt_dir (vfs + qtconversion + ) + QT_WRAP_UI(ESM_UI_HDR ${ESM_UI}) endif() diff --git a/components/vfs/qtconversion.cpp b/components/vfs/qtconversion.cpp new file mode 100644 index 0000000000..472e3dd0b4 --- /dev/null +++ b/components/vfs/qtconversion.cpp @@ -0,0 +1,26 @@ + +#include "qtconversion.hpp" + +#include + +QString VFS::Path::normalizedToQString(NormalizedView path) +{ + return QString::fromUtf8(path.value().data(), path.value().size()); +} + +QString VFS::Path::normalizedToQString(Normalized&& path) +{ + return QString::fromUtf8(path.value().data(), path.value().size()); +} + +VFS::Path::Normalized VFS::Path::normalizedFromQString(QStringView path) +{ + const auto tmp = path.toUtf8(); + return Normalized{ tmp }; +} + +VFS::Path::Normalized VFS::Path::normalizedFromQString(QString&& path) +{ + const auto tmp = path.toUtf8(); + return Normalized{ tmp }; +} diff --git a/components/vfs/qtconversion.hpp b/components/vfs/qtconversion.hpp new file mode 100644 index 0000000000..b4ec7ab1a4 --- /dev/null +++ b/components/vfs/qtconversion.hpp @@ -0,0 +1,19 @@ +#ifndef COMPONENTS_VFS_QTCONVERSION_HPP +#define COMPONENTS_VFS_QTCONVERSION_HPP + +#include + +#include "pathutil.hpp" + +namespace VFS::Path +{ + QString normalizedToQString(NormalizedView path); + + QString normalizedToQString(Normalized&& path); + + Normalized normalizedFromQString(QStringView path); + + Normalized normalizedFromQString(QString&& path); +} + +#endif // COMPONENTS_VFS_QTCONVERSION_HPP