mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-06-06 01:13:45 -04:00
[desktop] Fix 2 mod manager bugs (#3884)
- Multi-import would show duplicates of a mod if it had both exefs and romfs - Import from folder would crash on some single mods Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3884 Reviewed-by: Lizzie <lizzie@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
This commit is contained in:
parent
048d02e5b4
commit
91058d7383
4 changed files with 13 additions and 8 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#include <iostream>
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#include "common/fs/fs.h"
|
#include "common/fs/fs.h"
|
||||||
#include "common/fs/fs_types.h"
|
#include "common/fs/fs_types.h"
|
||||||
|
|
@ -25,7 +26,10 @@ std::vector<std::filesystem::path> GetModFolder(const std::string& root) {
|
||||||
"romfslite"};
|
"romfslite"};
|
||||||
|
|
||||||
if (std::ranges::find(valid_names, name) != valid_names.end()) {
|
if (std::ranges::find(valid_names, name) != valid_names.end()) {
|
||||||
paths.emplace_back(entry.path().parent_path());
|
const auto parent = entry.path().parent_path();
|
||||||
|
if (std::ranges::find(paths, parent) == paths.end()) {
|
||||||
|
paths.emplace_back(parent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -101,8 +101,10 @@ QStringList GetModFolders(const QString& root, const QString& fallbackName) {
|
||||||
} else {
|
} else {
|
||||||
// Rename the existing mod folder.
|
// Rename the existing mod folder.
|
||||||
const auto new_path = std_path.parent_path() / name.toStdString();
|
const auto new_path = std_path.parent_path() / name.toStdString();
|
||||||
fs::remove_all(new_path);
|
if (new_path != std_path) {
|
||||||
fs::rename(std_path, new_path);
|
fs::remove_all(new_path);
|
||||||
|
fs::rename(std_path, new_path);
|
||||||
|
}
|
||||||
std_path = new_path;
|
std_path = new_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,10 @@ ModSelectDialog::ModSelectDialog(const QStringList& mods, QWidget* parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->treeView->expandAll();
|
ui->treeView->expandAll();
|
||||||
ui->treeView->resizeColumnToContents(0);
|
|
||||||
|
|
||||||
int rows = item_model->rowCount();
|
int rows = item_model->rowCount();
|
||||||
int height =
|
int height =
|
||||||
ui->treeView->contentsMargins().top() * 4 + ui->treeView->contentsMargins().bottom() * 4;
|
4 + ui->treeView->contentsMargins().top() * 4 + ui->treeView->contentsMargins().bottom() * 4;
|
||||||
int width = 0;
|
int width = 0;
|
||||||
|
|
||||||
for (int i = 0; i < rows; ++i) {
|
for (int i = 0; i < rows; ++i) {
|
||||||
|
|
@ -46,7 +45,7 @@ ModSelectDialog::ModSelectDialog(const QStringList& mods, QWidget* parent)
|
||||||
width +=
|
width +=
|
||||||
ui->treeView->contentsMargins().left() * 4 + ui->treeView->contentsMargins().right() * 4;
|
ui->treeView->contentsMargins().left() * 4 + ui->treeView->contentsMargins().right() * 4;
|
||||||
ui->treeView->setMinimumHeight(qMin(height, 600));
|
ui->treeView->setMinimumHeight(qMin(height, 600));
|
||||||
ui->treeView->setMinimumWidth(qMin(width, 700));
|
ui->treeView->setMinimumWidth(qMax(width, 540));
|
||||||
adjustSize();
|
adjustSize();
|
||||||
|
|
||||||
connect(this, &QDialog::accepted, this, [this]() {
|
connect(this, &QDialog::accepted, this, [this]() {
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,12 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>580</width>
|
||||||
<height>430</height>
|
<height>430</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Import Mods</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue