Start of mod downloading
This commit is contained in:
@ -26,6 +26,7 @@
|
||||
#include "Application.h"
|
||||
|
||||
#include "ui/dialogs/CustomMessageBox.h"
|
||||
#include "ui/dialogs/ModDownloadDialog.h"
|
||||
#include "ui/GuiUtil.h"
|
||||
|
||||
#include "DesktopServices.h"
|
||||
@ -36,6 +37,7 @@
|
||||
#include "minecraft/PackProfile.h"
|
||||
|
||||
#include "Version.h"
|
||||
#include "ui/dialogs/ProgressDialog.h"
|
||||
|
||||
namespace {
|
||||
// FIXME: wasteful
|
||||
@ -342,6 +344,33 @@ void ModFolderPage::on_actionRemove_triggered()
|
||||
m_mods->deleteMods(selection.indexes());
|
||||
}
|
||||
|
||||
void ModFolderPage::on_actionInstall_mods_triggered()
|
||||
{
|
||||
if(!m_controlsEnabled) {
|
||||
return;
|
||||
}
|
||||
ModDownloadDialog mdownload(m_mods, this);
|
||||
mdownload.exec();
|
||||
ModDownloadTask * task = mdownload.getTask();
|
||||
if(task){
|
||||
connect(task, &Task::failed, [this](QString reason)
|
||||
{
|
||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
||||
});
|
||||
connect(task, &Task::succeeded, [this, task]()
|
||||
{
|
||||
QStringList warnings = task->warnings();
|
||||
if(warnings.count())
|
||||
{
|
||||
CustomMessageBox::selectable(this, tr("Warnings"), warnings.join('\n'), QMessageBox::Warning)->show();
|
||||
}
|
||||
});
|
||||
ProgressDialog loadDialog(this);
|
||||
loadDialog.setSkipButton(true, tr("Abort"));
|
||||
loadDialog.execWithTask(task);
|
||||
}
|
||||
}
|
||||
|
||||
void ModFolderPage::on_actionView_configs_triggered()
|
||||
{
|
||||
DesktopServices::openDirectory(m_inst->instanceConfigFolder(), true);
|
||||
|
@ -102,6 +102,7 @@ slots:
|
||||
void on_actionRemove_triggered();
|
||||
void on_actionEnable_triggered();
|
||||
void on_actionDisable_triggered();
|
||||
void on_actionInstall_mods_triggered();
|
||||
void on_actionView_Folder_triggered();
|
||||
void on_actionView_configs_triggered();
|
||||
void ShowContextMenu(const QPoint &pos);
|
||||
|
@ -88,6 +88,7 @@
|
||||
<addaction name="actionRemove"/>
|
||||
<addaction name="actionEnable"/>
|
||||
<addaction name="actionDisable"/>
|
||||
<addaction name="actionInstall_mods"/>
|
||||
<addaction name="actionView_configs"/>
|
||||
<addaction name="actionView_Folder"/>
|
||||
</widget>
|
||||
@ -136,6 +137,14 @@
|
||||
<string>View &Folder</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionInstall_mods">
|
||||
<property name="text">
|
||||
<string>Install mods</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Install mods from Modrinth or Curseforge</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
Reference in New Issue
Block a user