|
|
@ -1,7 +1,6 @@ |
|
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
|
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
|
#include <filesystem>
|
|
|
|
|
|
#include <QFileInfo>
|
|
|
#include <QFileInfo>
|
|
|
#include <qnamespace.h>
|
|
|
#include <qnamespace.h>
|
|
|
#include "mod_select_dialog.h"
|
|
|
#include "mod_select_dialog.h"
|
|
|
@ -19,7 +18,7 @@ ModSelectDialog::ModSelectDialog(const QStringList& mods, QWidget* parent) |
|
|
qRegisterMetaType<QList<QStandardItem*>>("QList<QStandardItem*>"); |
|
|
qRegisterMetaType<QList<QStandardItem*>>("QList<QStandardItem*>"); |
|
|
|
|
|
|
|
|
for (const auto& mod : mods) { |
|
|
for (const auto& mod : mods) { |
|
|
const auto basename = QFileInfo(mod).baseName(); |
|
|
|
|
|
|
|
|
const auto basename = QFileInfo(mod).fileName(); |
|
|
|
|
|
|
|
|
auto* const first_item = new QStandardItem; |
|
|
auto* const first_item = new QStandardItem; |
|
|
first_item->setText(basename); |
|
|
first_item->setText(basename); |
|
|
@ -35,7 +34,8 @@ ModSelectDialog::ModSelectDialog(const QStringList& mods, QWidget* parent) |
|
|
ui->treeView->resizeColumnToContents(0); |
|
|
ui->treeView->resizeColumnToContents(0); |
|
|
|
|
|
|
|
|
int rows = item_model->rowCount(); |
|
|
int rows = item_model->rowCount(); |
|
|
int height = ui->treeView->contentsMargins().top() + ui->treeView->contentsMargins().bottom(); |
|
|
|
|
|
|
|
|
int height = |
|
|
|
|
|
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) { |
|
|
@ -43,7 +43,7 @@ ModSelectDialog::ModSelectDialog(const QStringList& mods, QWidget* parent) |
|
|
width = qMax(width, item_model->item(i)->sizeHint().width()); |
|
|
width = qMax(width, item_model->item(i)->sizeHint().width()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
width += ui->treeView->contentsMargins().left() + ui->treeView->contentsMargins().right(); |
|
|
|
|
|
|
|
|
width += 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(qMin(width, 700)); |
|
|
adjustSize(); |
|
|
adjustSize(); |
|
|
|