GH-4699 Clean some things up

Add a menu to select between MMC/Modrinth format packs instead of the custom dialog
Treat 404s on requests to the Modrinth API as success, as the API returns a 404 if a hash was not found, and we don't want to retry the download in this case
Improve logging
This commit is contained in:
arthomnix
2023-02-05 10:13:13 +00:00
parent 16cf56b7a4
commit 74addfb78b
8 changed files with 46 additions and 182 deletions

View File

@@ -1,37 +0,0 @@
/*
* Copyright 2023 arthomnix
*
* This source is subject to the Microsoft Public License (MS-PL).
* Please see the COPYING.md file for more information.
*/
#include "SelectInstanceExportFormatDialog.h"
#include "ui_SelectInstanceExportFormatDialog.h"
#include "BuildConfig.h"
#include "ModrinthExportDialog.h"
SelectInstanceExportFormatDialog::SelectInstanceExportFormatDialog(InstancePtr instance, QWidget *parent) :
QDialog(parent), ui(new Ui::SelectInstanceExportFormatDialog), m_instance(instance)
{
ui->setupUi(this);
ui->mmcFormat->setText(BuildConfig.LAUNCHER_NAME);
}
void SelectInstanceExportFormatDialog::accept()
{
if (ui->mmcFormat->isChecked()) {
ExportInstanceDialog dlg(m_instance, parentWidget());
QDialog::accept();
dlg.exec();
} else if (ui->modrinthFormat->isChecked()) {
ModrinthExportDialog dlg(m_instance, parentWidget());
QDialog::accept();
dlg.exec();
}
}
SelectInstanceExportFormatDialog::~SelectInstanceExportFormatDialog()
{
delete ui;
}

View File

@@ -1,36 +0,0 @@
/*
* Copyright 2023 arthomnix
*
* This source is subject to the Microsoft Public License (MS-PL).
* Please see the COPYING.md file for more information.
*/
#pragma once
#include <QDialog>
#include "ExportInstanceDialog.h"
QT_BEGIN_NAMESPACE
namespace Ui
{
class SelectInstanceExportFormatDialog;
}
QT_END_NAMESPACE
class SelectInstanceExportFormatDialog : public QDialog
{
Q_OBJECT
public:
explicit SelectInstanceExportFormatDialog(InstancePtr instance, QWidget *parent = nullptr);
~SelectInstanceExportFormatDialog() override;
private slots:
void accept() override;
private:
Ui::SelectInstanceExportFormatDialog *ui;
InstancePtr m_instance;
};

View File

@@ -1,95 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SelectInstanceExportFormatDialog</class>
<widget class="QDialog" name="SelectInstanceExportFormatDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>446</width>
<height>181</height>
</rect>
</property>
<property name="windowTitle">
<string>Select Instance Export Format</string>
</property>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>421</width>
<height>161</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Select export format</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="mmcFormat">
<property name="text">
<string>Launcher</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="modrinthFormat">
<property name="text">
<string>Modrinth (WIP)</string>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>SelectInstanceExportFormatDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>220</x>
<y>152</y>
</hint>
<hint type="destinationlabel">
<x>222</x>
<y>90</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>SelectInstanceExportFormatDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>220</x>
<y>152</y>
</hint>
<hint type="destinationlabel">
<x>222</x>
<y>90</y>
</hint>
</hints>
</connection>
</connections>
</ui>