diff --git a/CHANGELOG.md b/CHANGELOG.md index d4ac1067dac..6ad5477b721 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,6 +70,7 @@ Bug #7450: Evading obstacles does not work for actors missing certain animations Bug #7459: Icons get stacked on the cursor when picking up multiple items simultaneously Bug #7472: Crash when enchanting last projectiles + Bug #7502: Data directories dialog (0.48.0) forces adding subdirectory instead of intended directory Bug #7505: Distant terrain does not support sample size greater than cell size Bug #7553: Faction reaction loading is incorrect Bug #7557: Terrain::ChunkManager::createChunk is called twice for the same position, lod on initial loading diff --git a/apps/launcher/datafilespage.cpp b/apps/launcher/datafilespage.cpp index 756aaba1313..b6192d3c02e 100644 --- a/apps/launcher/datafilespage.cpp +++ b/apps/launcher/datafilespage.cpp @@ -40,8 +40,35 @@ namespace { void contentSubdirs(const QString& path, QStringList& dirs) { - QStringList fileFilter{ "*.esm", "*.esp", "*.omwaddon", "*.bsa", "*.ba2", "*.omwscripts" }; - QStringList dirFilter{ "bookart", "icons", "meshes", "music", "sound", "textures" }; + static const QStringList fileFilter{ + "*.esm", + "*.esp", + "*.bsa", + "*.ba2", + "*.omwgame", + "*.omwaddon", + "*.omwscripts", + }; + + static const QStringList dirFilter{ + "animations", + "bookart", + "fonts", + "icons", + "interface", + "l10n", + "meshes", + "music", + "mygui", + "scripts", + "shaders", + "sound", + "splash", + "strings", + "textures", + "trees", + "video", + }; QDir currentDir(path); if (!currentDir.entryInfoList(fileFilter, QDir::Files).empty() @@ -587,18 +614,6 @@ void Launcher::DataFilesPage::updateCloneProfileOkButton(const QString& text) mCloneProfileDialog->setOkButtonEnabled(!text.isEmpty() && ui.profilesComboBox->findText(text) == -1); } -QString Launcher::DataFilesPage::selectDirectory() -{ - QFileDialog fileDialog(this); - fileDialog.setFileMode(QFileDialog::Directory); - fileDialog.setOptions(QFileDialog::Option::ShowDirsOnly | QFileDialog::Option::ReadOnly); - - if (fileDialog.exec() == QDialog::Rejected) - return {}; - - return QDir(fileDialog.selectedFiles()[0]).canonicalPath(); -} - void Launcher::DataFilesPage::addSubdirectories(bool append) { int selectedRow = append ? ui.directoryListWidget->count() : ui.directoryListWidget->currentRow(); @@ -606,22 +621,30 @@ void Launcher::DataFilesPage::addSubdirectories(bool append) if (selectedRow == -1) return; - const auto rootDir = selectDirectory(); - if (rootDir.isEmpty()) + QString rootPath = QFileDialog::getExistingDirectory( + this, tr("Select Directory"), QDir::homePath(), QFileDialog::ShowDirsOnly | QFileDialog::Option::ReadOnly); + + if (rootPath.isEmpty()) return; + const QDir rootDir(rootPath); + rootPath = rootDir.canonicalPath(); + QStringList subdirs; - contentSubdirs(rootDir, subdirs); + contentSubdirs(rootPath, subdirs); - if (subdirs.empty()) + // Always offer to append the root directory just in case + if (subdirs.isEmpty() || subdirs[0] != rootPath) + subdirs.prepend(rootPath); + else if (subdirs.size() == 1) { - // we didn't find anything that looks like a content directory, add directory selected by user - if (ui.directoryListWidget->findItems(rootDir, Qt::MatchFixedString).isEmpty()) - { - ui.directoryListWidget->addItem(rootDir); - mNewDataDirs.push_back(rootDir); - refreshDataFilesView(); - } + // We didn't find anything else that looks like a content directory + // Automatically add the directory selected by user + if (!ui.directoryListWidget->findItems(rootPath, Qt::MatchFixedString).isEmpty()) + return; + ui.directoryListWidget->addItem(rootPath); + mNewDataDirs.push_back(rootPath); + refreshDataFilesView(); return; } diff --git a/apps/launcher/datafilespage.hpp b/apps/launcher/datafilespage.hpp index 033c91f9c7e..dc3aeaef6f3 100644 --- a/apps/launcher/datafilespage.hpp +++ b/apps/launcher/datafilespage.hpp @@ -131,7 +131,6 @@ namespace Launcher void reloadCells(QStringList selectedFiles); void refreshDataFilesView(); void updateNavMeshProgress(int minDataSize); - QString selectDirectory(); /** * Returns the file paths of all selected content files