No known key found for this signature in database
GPG Key ID: 425ACD2D4830EBC6
11 changed files with 321 additions and 140 deletions
-
15src/frontend_common/mod_manager.cpp
-
2src/frontend_common/mod_manager.h
-
184src/qt_common/util/mod.cpp
-
7src/qt_common/util/mod.h
-
1src/yuzu/CMakeLists.txt
-
46src/yuzu/configuration/addon/mod_select_dialog.cpp
-
23src/yuzu/configuration/addon/mod_select_dialog.h
-
99src/yuzu/configuration/addon/mod_select_dialog.ui
-
79src/yuzu/configuration/configure_per_game_addons.cpp
-
3src/yuzu/configuration/configure_per_game_addons.h
-
2src/yuzu/main_window.cpp
@ -0,0 +1,46 @@ |
|||
#include <filesystem>
|
|||
#include <qnamespace.h>
|
|||
#include "mod_select_dialog.h"
|
|||
#include "ui_mod_select_dialog.h"
|
|||
|
|||
ModSelectDialog::ModSelectDialog(const QStringList& mods, QWidget* parent) |
|||
: QDialog(parent), ui(new Ui::ModSelectDialog) { |
|||
ui->setupUi(this); |
|||
|
|||
item_model = new QStandardItemModel(ui->treeView); |
|||
ui->treeView->setModel(item_model); |
|||
|
|||
// We must register all custom types with the Qt Automoc system so that we are able to use it
|
|||
// with signals/slots. In this case, QList falls under the umbrella of custom types.
|
|||
qRegisterMetaType<QList<QStandardItem*>>("QList<QStandardItem*>"); |
|||
|
|||
for (const auto& mod : mods) { |
|||
const auto basename = QString::fromStdString(std::filesystem::path(mod.toStdString()).filename()); |
|||
|
|||
auto* const first_item = new QStandardItem; |
|||
first_item->setText(basename); |
|||
first_item->setData(mod); |
|||
|
|||
first_item->setCheckable(true); |
|||
first_item->setCheckState(Qt::Checked); |
|||
|
|||
item_model->appendRow(first_item); |
|||
item_model->layoutChanged(); |
|||
} |
|||
|
|||
connect(this, &QDialog::accepted, this, [this]() { |
|||
QStringList selected_mods; |
|||
|
|||
for (qsizetype i = 0; i < item_model->rowCount(); ++i) { |
|||
auto *const item = item_model->item(i); |
|||
if (item->checkState() == Qt::Checked) |
|||
selected_mods << item->data().toString(); |
|||
} |
|||
|
|||
emit modsSelected(selected_mods); |
|||
}); |
|||
} |
|||
|
|||
ModSelectDialog::~ModSelectDialog() { |
|||
delete ui; |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
#pragma once |
|||
|
|||
#include <QDialog> |
|||
#include <QStandardItemModel> |
|||
|
|||
namespace Ui { |
|||
class ModSelectDialog; |
|||
} |
|||
|
|||
class ModSelectDialog : public QDialog { |
|||
Q_OBJECT |
|||
|
|||
public: |
|||
explicit ModSelectDialog(const QStringList &mods, QWidget* parent = nullptr); |
|||
~ModSelectDialog(); |
|||
|
|||
signals: |
|||
void modsSelected(const QStringList &mods); |
|||
private: |
|||
Ui::ModSelectDialog* ui; |
|||
|
|||
QStandardItemModel* item_model; |
|||
}; |
|||
@ -0,0 +1,99 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<ui version="4.0"> |
|||
<class>ModSelectDialog</class> |
|||
<widget class="QDialog" name="ModSelectDialog"> |
|||
<property name="geometry"> |
|||
<rect> |
|||
<x>0</x> |
|||
<y>0</y> |
|||
<width>400</width> |
|||
<height>300</height> |
|||
</rect> |
|||
</property> |
|||
<property name="windowTitle"> |
|||
<string>Dialog</string> |
|||
</property> |
|||
<layout class="QVBoxLayout" name="verticalLayout"> |
|||
<item> |
|||
<widget class="QLabel" name="label"> |
|||
<property name="text"> |
|||
<string>The specified folder or archive contain the following mods. Select which ones to install.</string> |
|||
</property> |
|||
<property name="wordWrap"> |
|||
<bool>true</bool> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item> |
|||
<widget class="QTreeView" name="treeView"> |
|||
<property name="contextMenuPolicy"> |
|||
<enum>Qt::ContextMenuPolicy::NoContextMenu</enum> |
|||
</property> |
|||
<property name="editTriggers"> |
|||
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set> |
|||
</property> |
|||
<property name="alternatingRowColors"> |
|||
<bool>true</bool> |
|||
</property> |
|||
<property name="verticalScrollMode"> |
|||
<enum>QAbstractItemView::ScrollMode::ScrollPerPixel</enum> |
|||
</property> |
|||
<property name="uniformRowHeights"> |
|||
<bool>true</bool> |
|||
</property> |
|||
<property name="sortingEnabled"> |
|||
<bool>true</bool> |
|||
</property> |
|||
<property name="headerHidden"> |
|||
<bool>true</bool> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item> |
|||
<widget class="QDialogButtonBox" name="buttonBox"> |
|||
<property name="orientation"> |
|||
<enum>Qt::Orientation::Horizontal</enum> |
|||
</property> |
|||
<property name="standardButtons"> |
|||
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
</layout> |
|||
</widget> |
|||
<resources/> |
|||
<connections> |
|||
<connection> |
|||
<sender>buttonBox</sender> |
|||
<signal>accepted()</signal> |
|||
<receiver>ModSelectDialog</receiver> |
|||
<slot>accept()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel"> |
|||
<x>248</x> |
|||
<y>254</y> |
|||
</hint> |
|||
<hint type="destinationlabel"> |
|||
<x>157</x> |
|||
<y>274</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
<connection> |
|||
<sender>buttonBox</sender> |
|||
<signal>rejected()</signal> |
|||
<receiver>ModSelectDialog</receiver> |
|||
<slot>reject()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel"> |
|||
<x>316</x> |
|||
<y>260</y> |
|||
</hint> |
|||
<hint type="destinationlabel"> |
|||
<x>286</x> |
|||
<y>274</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
</connections> |
|||
</ui> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue