mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 07:45:39 +00:00
Make the launcher ignore case in bsa names
This commit is contained in:
parent
cdf7bd74d5
commit
7556ab6f90
4 changed files with 54 additions and 4 deletions
|
@ -30,6 +30,7 @@
|
|||
#include <components/navmeshtool/protocol.hpp>
|
||||
#include <components/settings/values.hpp>
|
||||
#include <components/vfs/bsaarchive.hpp>
|
||||
#include <components/vfs/qtconversion.hpp>
|
||||
|
||||
#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<QString> archives;
|
||||
std::unordered_set<VFS::Path::Normalized, VFS::Path::Hash> 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -554,6 +554,10 @@ if (USE_QT)
|
|||
application
|
||||
)
|
||||
|
||||
add_component_qt_dir (vfs
|
||||
qtconversion
|
||||
)
|
||||
|
||||
QT_WRAP_UI(ESM_UI_HDR ${ESM_UI})
|
||||
endif()
|
||||
|
||||
|
|
26
components/vfs/qtconversion.cpp
Normal file
26
components/vfs/qtconversion.cpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
|
||||
#include "qtconversion.hpp"
|
||||
|
||||
#include <components/misc/strings/conversion.hpp>
|
||||
|
||||
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 };
|
||||
}
|
19
components/vfs/qtconversion.hpp
Normal file
19
components/vfs/qtconversion.hpp
Normal file
|
@ -0,0 +1,19 @@
|
|||
#ifndef COMPONENTS_VFS_QTCONVERSION_HPP
|
||||
#define COMPONENTS_VFS_QTCONVERSION_HPP
|
||||
|
||||
#include <QString>
|
||||
|
||||
#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
|
Loading…
Reference in a new issue