mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-06-12 05:07:46 +02:00
Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into change_version
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
@ -37,6 +37,7 @@
|
||||
*/
|
||||
|
||||
#include "ModFolderPage.h"
|
||||
#include "ui/dialogs/ExportToModListDialog.h"
|
||||
#include "ui_ExternalResourcesPage.h"
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
@ -128,6 +129,9 @@ ModFolderPage::ModFolderPage(BaseInstance* inst, std::shared_ptr<ModFolderModel>
|
||||
ui->actionsToolbar->insertActionAfter(ui->actionUpdateItem, changeVersion);
|
||||
connect(changeVersion, &QAction::triggered, this, &ModFolderPage::changeModVersion);
|
||||
|
||||
ui->actionsToolbar->insertActionAfter(ui->actionVisitItemPage, ui->actionExportMetadata);
|
||||
connect(ui->actionExportMetadata, &QAction::triggered, this, &ModFolderPage::exportModMetadata);
|
||||
|
||||
auto check_allow_update = [this] { return ui->treeView->selectionModel()->hasSelection() || !m_model->empty(); };
|
||||
|
||||
connect(ui->treeView->selectionModel(), &QItemSelectionModel::selectionChanged, this,
|
||||
@ -431,3 +435,15 @@ void ModFolderPage::changeModVersion()
|
||||
m_model->update();
|
||||
}
|
||||
}
|
||||
|
||||
void ModFolderPage::exportModMetadata()
|
||||
{
|
||||
auto selection = m_filterModel->mapSelectionToSource(ui->treeView->selectionModel()->selection()).indexes();
|
||||
auto selectedMods = m_model->selectedMods(selection);
|
||||
if (selectedMods.length() == 0)
|
||||
selectedMods = m_model->allMods();
|
||||
|
||||
std::sort(selectedMods.begin(), selectedMods.end(), [](const Mod* a, const Mod* b) { return a->name() < b->name(); });
|
||||
ExportToModListDialog dlg(m_instance->name(), selectedMods, this);
|
||||
dlg.exec();
|
||||
}
|
||||
|
Reference in New Issue
Block a user