Merge branch 'develop' into global-jvm-args
This commit is contained in:
@ -1,3 +1,38 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
/*
|
||||
* PolyMC - Minecraft Launcher
|
||||
* Copyright (C) 2022 Lenny McLennington <lenny@sneed.church>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This file incorporates work covered by the following copyright and
|
||||
* permission notice:
|
||||
*
|
||||
* Copyright 2013-2021 MultiMC Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "GuiUtil.h"
|
||||
|
||||
#include <QClipboard>
|
||||
@ -16,8 +51,9 @@
|
||||
QString GuiUtil::uploadPaste(const QString &text, QWidget *parentWidget)
|
||||
{
|
||||
ProgressDialog dialog(parentWidget);
|
||||
auto pasteUrlSetting = APPLICATION->settings()->get("PastebinURL").toString();
|
||||
std::unique_ptr<PasteUpload> paste(new PasteUpload(parentWidget, text, pasteUrlSetting));
|
||||
auto pasteTypeSetting = static_cast<PasteUpload::PasteType>(APPLICATION->settings()->get("PastebinType").toInt());
|
||||
auto pasteCustomAPIBaseSetting = APPLICATION->settings()->get("PastebinCustomAPIBase").toString();
|
||||
std::unique_ptr<PasteUpload> paste(new PasteUpload(parentWidget, text, pasteCustomAPIBaseSetting, pasteTypeSetting));
|
||||
|
||||
dialog.execWithTask(paste.get());
|
||||
if (!paste->wasSuccessful())
|
||||
|
@ -1868,6 +1868,9 @@ void MainWindow::globalSettingsClosed()
|
||||
updateMainToolBar();
|
||||
updateToolsMenu();
|
||||
updateStatusCenter();
|
||||
// This needs to be done to prevent UI elements disappearing in the event the config is changed
|
||||
// but PolyMC exits abnormally, causing the window state to never be saved:
|
||||
APPLICATION->settings()->set("MainWindowState", saveState().toBase64());
|
||||
update();
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
* PolyMC - Minecraft Launcher
|
||||
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
||||
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
* Copyright (c) 2022 Lenny McLennington <lenny@sneed.church>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -46,16 +47,43 @@
|
||||
#include "settings/SettingsObject.h"
|
||||
#include "tools/BaseProfiler.h"
|
||||
#include "Application.h"
|
||||
#include "net/PasteUpload.h"
|
||||
#include "BuildConfig.h"
|
||||
|
||||
APIPage::APIPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::APIPage)
|
||||
{
|
||||
// This is here so you can reorder the entries in the combobox without messing stuff up
|
||||
int comboBoxEntries[] = {
|
||||
PasteUpload::PasteType::Mclogs,
|
||||
PasteUpload::PasteType::NullPointer,
|
||||
PasteUpload::PasteType::PasteGG,
|
||||
PasteUpload::PasteType::Hastebin
|
||||
};
|
||||
|
||||
static QRegularExpression validUrlRegExp("https?://.+");
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->urlChoices->setValidator(new QRegularExpressionValidator(validUrlRegExp, ui->urlChoices));
|
||||
ui->tabWidget->tabBar()->hide();\
|
||||
|
||||
for (auto pasteType : comboBoxEntries) {
|
||||
ui->pasteTypeComboBox->addItem(PasteUpload::PasteTypes.at(pasteType).name, pasteType);
|
||||
}
|
||||
|
||||
void (QComboBox::*currentIndexChangedSignal)(int) (&QComboBox::currentIndexChanged);
|
||||
connect(ui->pasteTypeComboBox, currentIndexChangedSignal, this, &APIPage::updateBaseURLPlaceholder);
|
||||
// This function needs to be called even when the ComboBox's index is still in its default state.
|
||||
updateBaseURLPlaceholder(ui->pasteTypeComboBox->currentIndex());
|
||||
ui->baseURLEntry->setValidator(new QRegularExpressionValidator(validUrlRegExp, ui->baseURLEntry));
|
||||
ui->tabWidget->tabBar()->hide();
|
||||
|
||||
ui->metaURL->setPlaceholderText(BuildConfig.META_URL);
|
||||
|
||||
loadSettings();
|
||||
|
||||
resetBaseURLNote();
|
||||
connect(ui->pasteTypeComboBox, currentIndexChangedSignal, this, &APIPage::updateBaseURLNote);
|
||||
connect(ui->baseURLEntry, &QLineEdit::textEdited, this, &APIPage::resetBaseURLNote);
|
||||
}
|
||||
|
||||
APIPage::~APIPage()
|
||||
@ -63,13 +91,52 @@ APIPage::~APIPage()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void APIPage::resetBaseURLNote()
|
||||
{
|
||||
ui->baseURLNote->hide();
|
||||
baseURLPasteType = ui->pasteTypeComboBox->currentIndex();
|
||||
}
|
||||
|
||||
void APIPage::updateBaseURLNote(int index)
|
||||
{
|
||||
if (baseURLPasteType == index)
|
||||
{
|
||||
ui->baseURLNote->hide();
|
||||
}
|
||||
else if (!ui->baseURLEntry->text().isEmpty())
|
||||
{
|
||||
ui->baseURLNote->show();
|
||||
}
|
||||
}
|
||||
|
||||
void APIPage::updateBaseURLPlaceholder(int index)
|
||||
{
|
||||
int pasteType = ui->pasteTypeComboBox->itemData(index).toInt();
|
||||
QString pasteDefaultURL = PasteUpload::PasteTypes.at(pasteType).defaultBase;
|
||||
ui->baseURLEntry->setPlaceholderText(pasteDefaultURL);
|
||||
}
|
||||
|
||||
void APIPage::loadSettings()
|
||||
{
|
||||
auto s = APPLICATION->settings();
|
||||
QString pastebinURL = s->get("PastebinURL").toString();
|
||||
ui->urlChoices->setCurrentText(pastebinURL);
|
||||
|
||||
int pasteType = s->get("PastebinType").toInt();
|
||||
QString pastebinURL = s->get("PastebinCustomAPIBase").toString();
|
||||
|
||||
ui->baseURLEntry->setText(pastebinURL);
|
||||
int pasteTypeIndex = ui->pasteTypeComboBox->findData(pasteType);
|
||||
if (pasteTypeIndex == -1)
|
||||
{
|
||||
pasteTypeIndex = ui->pasteTypeComboBox->findData(PasteUpload::PasteType::Mclogs);
|
||||
ui->baseURLEntry->clear();
|
||||
}
|
||||
|
||||
ui->pasteTypeComboBox->setCurrentIndex(pasteTypeIndex);
|
||||
|
||||
QString msaClientID = s->get("MSAClientIDOverride").toString();
|
||||
ui->msaClientID->setText(msaClientID);
|
||||
QString metaURL = s->get("MetaURLOverride").toString();
|
||||
ui->metaURL->setText(metaURL);
|
||||
QString curseKey = s->get("CFKeyOverride").toString();
|
||||
ui->curseKey->setText(curseKey);
|
||||
}
|
||||
@ -77,10 +144,27 @@ void APIPage::loadSettings()
|
||||
void APIPage::applySettings()
|
||||
{
|
||||
auto s = APPLICATION->settings();
|
||||
QString pastebinURL = ui->urlChoices->currentText();
|
||||
s->set("PastebinURL", pastebinURL);
|
||||
|
||||
s->set("PastebinType", ui->pasteTypeComboBox->currentData().toInt());
|
||||
s->set("PastebinCustomAPIBase", ui->baseURLEntry->text());
|
||||
|
||||
QString msaClientID = ui->msaClientID->text();
|
||||
s->set("MSAClientIDOverride", msaClientID);
|
||||
QUrl metaURL = ui->metaURL->text();
|
||||
// Add required trailing slash
|
||||
if (!metaURL.isEmpty() && !metaURL.path().endsWith('/'))
|
||||
{
|
||||
QString path = metaURL.path();
|
||||
path.append('/');
|
||||
metaURL.setPath(path);
|
||||
}
|
||||
// Don't allow HTTP, since meta is basically RCE with all the jar files.
|
||||
if(!metaURL.isEmpty() && metaURL.scheme() == "http")
|
||||
{
|
||||
metaURL.setScheme("https");
|
||||
}
|
||||
|
||||
s->set("MetaURLOverride", metaURL);
|
||||
QString curseKey = ui->curseKey->text();
|
||||
s->set("CFKeyOverride", curseKey);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
* PolyMC - Minecraft Launcher
|
||||
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
||||
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
* Copyright (c) 2022 Lenny McLennington <lenny@sneed.church>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -73,6 +74,10 @@ public:
|
||||
void retranslate() override;
|
||||
|
||||
private:
|
||||
int baseURLPasteType;
|
||||
void resetBaseURLNote();
|
||||
void updateBaseURLNote(int index);
|
||||
void updateBaseURLPlaceholder(int index);
|
||||
void loadSettings();
|
||||
void applySettings();
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>603</width>
|
||||
<height>530</height>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
@ -36,60 +36,44 @@
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_paste">
|
||||
<property name="title">
|
||||
<string>&Pastebin URL</string>
|
||||
<string>Pastebin Service</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<widget class="QLabel" name="pasteServiceTypeLabel">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Note: only input that starts with <span style=" font-weight:600;">http://</span> or <span style=" font-weight:600;">https://</span> will be accepted.</p></body></html></string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
<string>Paste Service Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="urlChoices">
|
||||
<property name="editable">
|
||||
<widget class="QComboBox" name="pasteTypeComboBox"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="baseURLLabel">
|
||||
<property name="text">
|
||||
<string>Base URL</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="baseURLEntry">
|
||||
<property name="placeholderText">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="insertPolicy">
|
||||
<enum>QComboBox::NoInsert</enum>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">https://0x0.st</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QLabel" name="baseURLNote">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Here you can choose from a predefined list of paste services, or input the URL of a different paste service of your choice, provided it supports the same protocol as 0x0.st, that is POST a file parameter to the URL and return a link in the response body.</p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
<string>Note: you probably want to change or clear the Base URL after changing the paste service type.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -101,13 +85,6 @@
|
||||
<string>&Microsoft Authentication</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
@ -147,6 +124,51 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_meta">
|
||||
<property name="title">
|
||||
<string>Meta&data Server</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>You can set this to a third-party metadata server to use patched libraries or other hacks.</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="metaURL">
|
||||
<property name="placeholderText">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Enter a custom URL for meta here.</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_curse">
|
||||
<property name="enabled">
|
||||
@ -155,16 +177,9 @@
|
||||
<property name="title">
|
||||
<string>&CurseForge Core API</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Note: you probably don't need to set this if CurseForge already works.</string>
|
||||
</property>
|
||||
@ -181,7 +196,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Enter a custom API Key for CurseForge here. </string>
|
||||
</property>
|
||||
@ -199,6 +214,19 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -391,7 +391,7 @@ void ModFolderPage::on_actionInstall_mods_triggered()
|
||||
return; //this is a null instance or a legacy instance
|
||||
}
|
||||
auto profile = ((MinecraftInstance *)m_inst)->getPackProfile();
|
||||
if (profile->getModLoader() == ModAPI::Unspecified) {
|
||||
if (profile->getModLoaders() == ModAPI::Unspecified) {
|
||||
QMessageBox::critical(this,tr("Error"),tr("Please install a mod loader first!"));
|
||||
return;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ void ListModel::requestModVersions(ModPlatform::IndexedPack const& current)
|
||||
{
|
||||
auto profile = (dynamic_cast<MinecraftInstance*>((dynamic_cast<ModPage*>(parent()))->m_instance))->getPackProfile();
|
||||
|
||||
m_parent->apiProvider()->getVersions(this, { current.addonId.toString(), getMineVersions(), profile->getModLoader() });
|
||||
m_parent->apiProvider()->getVersions(this, { current.addonId.toString(), getMineVersions(), profile->getModLoaders() });
|
||||
}
|
||||
|
||||
void ListModel::performPaginatedSearch()
|
||||
@ -76,7 +76,7 @@ void ListModel::performPaginatedSearch()
|
||||
auto profile = (dynamic_cast<MinecraftInstance*>((dynamic_cast<ModPage*>(parent()))->m_instance))->getPackProfile();
|
||||
|
||||
m_parent->apiProvider()->searchMods(
|
||||
this, { nextSearchOffset, currentSearchTerm, getSorts()[currentSort], profile->getModLoader(), getMineVersions() });
|
||||
this, { nextSearchOffset, currentSearchTerm, getSorts()[currentSort], profile->getModLoaders(), getMineVersions() });
|
||||
}
|
||||
|
||||
void ListModel::refresh()
|
||||
|
@ -175,7 +175,7 @@ void ModPage::updateModVersions(int prev_count)
|
||||
bool valid = false;
|
||||
for(auto& mcVer : m_filter->versions){
|
||||
//NOTE: Flame doesn't care about loader, so passing it changes nothing.
|
||||
if (validateVersion(version, mcVer.toString(), packProfile->getModLoader())) {
|
||||
if (validateVersion(version, mcVer.toString(), packProfile->getModLoaders())) {
|
||||
valid = true;
|
||||
break;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class ModPage : public QWidget, public BasePage {
|
||||
void retranslate() override;
|
||||
|
||||
auto shouldDisplay() const -> bool override = 0;
|
||||
virtual auto validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, ModAPI::ModLoaderType loader = ModAPI::Unspecified) const -> bool = 0;
|
||||
virtual auto validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, ModAPI::ModLoaderTypes loaders = ModAPI::Unspecified) const -> bool = 0;
|
||||
|
||||
auto apiProvider() const -> const ModAPI* { return api.get(); };
|
||||
auto getFilter() const -> const std::shared_ptr<ModFilterWidget::Filter> { return m_filter; }
|
||||
|
@ -43,8 +43,11 @@
|
||||
#include "modplatform/atlauncher/ATLShareCode.h"
|
||||
#include "Application.h"
|
||||
|
||||
AtlOptionalModListModel::AtlOptionalModListModel(QWidget *parent, QVector<ATLauncher::VersionMod> mods)
|
||||
: QAbstractListModel(parent), m_mods(mods) {
|
||||
AtlOptionalModListModel::AtlOptionalModListModel(QWidget* parent, ATLauncher::PackVersion version, QVector<ATLauncher::VersionMod> mods)
|
||||
: QAbstractListModel(parent)
|
||||
, m_version(version)
|
||||
, m_mods(mods)
|
||||
{
|
||||
// fill mod index
|
||||
for (int i = 0; i < m_mods.size(); i++) {
|
||||
auto mod = m_mods.at(i);
|
||||
@ -97,6 +100,11 @@ QVariant AtlOptionalModListModel::data(const QModelIndex &index, int role) const
|
||||
return mod.description;
|
||||
}
|
||||
}
|
||||
else if (role == Qt::ForegroundRole) {
|
||||
if (!mod.colour.isEmpty() && m_version.colours.contains(mod.colour)) {
|
||||
return QColor(QString("#%1").arg(m_version.colours[mod.colour]));
|
||||
}
|
||||
}
|
||||
else if (role == Qt::CheckStateRole) {
|
||||
if (index.column() == EnabledColumn) {
|
||||
return m_selection[mod.name] ? Qt::Checked : Qt::Unchecked;
|
||||
@ -223,7 +231,21 @@ void AtlOptionalModListModel::clearAll() {
|
||||
}
|
||||
|
||||
void AtlOptionalModListModel::toggleMod(ATLauncher::VersionMod mod, int index) {
|
||||
setMod(mod, index, !m_selection[mod.name]);
|
||||
auto enable = !m_selection[mod.name];
|
||||
|
||||
// If there is a warning for the mod, display that first (if we would be enabling the mod)
|
||||
if (enable && !mod.warning.isEmpty() && m_version.warnings.contains(mod.warning)) {
|
||||
auto message = QString("%1<br><br>%2")
|
||||
.arg(m_version.warnings[mod.warning], tr("Are you sure that you want to enable this mod?"));
|
||||
|
||||
// fixme: avoid casting here
|
||||
auto result = QMessageBox::warning((QWidget*) this->parent(), tr("Warning"), message, QMessageBox::Yes | QMessageBox::No);
|
||||
if (result != QMessageBox::Yes) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
setMod(mod, index, enable);
|
||||
}
|
||||
|
||||
void AtlOptionalModListModel::setMod(ATLauncher::VersionMod mod, int index, bool enable, bool shouldEmit) {
|
||||
@ -287,12 +309,13 @@ void AtlOptionalModListModel::setMod(ATLauncher::VersionMod mod, int index, bool
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AtlOptionalModDialog::AtlOptionalModDialog(QWidget *parent, QVector<ATLauncher::VersionMod> mods)
|
||||
: QDialog(parent), ui(new Ui::AtlOptionalModDialog) {
|
||||
AtlOptionalModDialog::AtlOptionalModDialog(QWidget* parent, ATLauncher::PackVersion version, QVector<ATLauncher::VersionMod> mods)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::AtlOptionalModDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
listModel = new AtlOptionalModListModel(this, mods);
|
||||
listModel = new AtlOptionalModListModel(this, version, mods);
|
||||
ui->treeView->setModel(listModel);
|
||||
|
||||
ui->treeView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
DescriptionColumn,
|
||||
};
|
||||
|
||||
AtlOptionalModListModel(QWidget *parent, QVector<ATLauncher::VersionMod> mods);
|
||||
AtlOptionalModListModel(QWidget *parent, ATLauncher::PackVersion version, QVector<ATLauncher::VersionMod> mods);
|
||||
|
||||
QVector<QString> getResult();
|
||||
|
||||
@ -86,7 +86,9 @@ private:
|
||||
NetJob::Ptr m_jobPtr;
|
||||
QByteArray m_response;
|
||||
|
||||
ATLauncher::PackVersion m_version;
|
||||
QVector<ATLauncher::VersionMod> m_mods;
|
||||
|
||||
QMap<QString, bool> m_selection;
|
||||
QMap<QString, int> m_index;
|
||||
QMap<QString, QVector<QString>> m_dependants;
|
||||
@ -96,7 +98,7 @@ class AtlOptionalModDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AtlOptionalModDialog(QWidget *parent, QVector<ATLauncher::VersionMod> mods);
|
||||
AtlOptionalModDialog(QWidget *parent, ATLauncher::PackVersion version, QVector<ATLauncher::VersionMod> mods);
|
||||
~AtlOptionalModDialog() override;
|
||||
|
||||
QVector<QString> getResult() {
|
||||
|
@ -45,8 +45,12 @@
|
||||
|
||||
#include <BuildConfig.h>
|
||||
|
||||
AtlPage::AtlPage(NewInstanceDialog* dialog, QWidget *parent)
|
||||
: QWidget(parent), ui(new Ui::AtlPage), dialog(dialog)
|
||||
#include <QMessageBox>
|
||||
|
||||
AtlPage::AtlPage(NewInstanceDialog* dialog, QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::AtlPage)
|
||||
, dialog(dialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@ -169,8 +173,9 @@ void AtlPage::onVersionSelectionChanged(QString data)
|
||||
suggestCurrent();
|
||||
}
|
||||
|
||||
QVector<QString> AtlPage::chooseOptionalMods(QVector<ATLauncher::VersionMod> mods) {
|
||||
AtlOptionalModDialog optionalModDialog(this, mods);
|
||||
QVector<QString> AtlPage::chooseOptionalMods(ATLauncher::PackVersion version, QVector<ATLauncher::VersionMod> mods)
|
||||
{
|
||||
AtlOptionalModDialog optionalModDialog(this, version, mods);
|
||||
optionalModDialog.exec();
|
||||
return optionalModDialog.getResult();
|
||||
}
|
||||
@ -210,3 +215,8 @@ QString AtlPage::chooseVersion(Meta::VersionListPtr vlist, QString minecraftVers
|
||||
vselect.exec();
|
||||
return vselect.selectedVersion()->descriptor();
|
||||
}
|
||||
|
||||
void AtlPage::displayMessage(QString message)
|
||||
{
|
||||
QMessageBox::information(this, tr("Installing"), message);
|
||||
}
|
||||
|
@ -84,7 +84,8 @@ private:
|
||||
void suggestCurrent();
|
||||
|
||||
QString chooseVersion(Meta::VersionListPtr vlist, QString minecraftVersion) override;
|
||||
QVector<QString> chooseOptionalMods(QVector<ATLauncher::VersionMod> mods) override;
|
||||
QVector<QString> chooseOptionalMods(ATLauncher::PackVersion version, QVector<ATLauncher::VersionMod> mods) override;
|
||||
void displayMessage(QString message) override;
|
||||
|
||||
private slots:
|
||||
void triggerSearch();
|
||||
|
@ -61,9 +61,9 @@ FlameModPage::FlameModPage(ModDownloadDialog* dialog, BaseInstance* instance)
|
||||
connect(ui->modSelectionButton, &QPushButton::clicked, this, &FlameModPage::onModSelected);
|
||||
}
|
||||
|
||||
auto FlameModPage::validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, ModAPI::ModLoaderType loader) const -> bool
|
||||
auto FlameModPage::validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, ModAPI::ModLoaderTypes loaders) const -> bool
|
||||
{
|
||||
Q_UNUSED(loader);
|
||||
Q_UNUSED(loaders);
|
||||
return ver.mcVersion.contains(mineVer);
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ class FlameModPage : public ModPage {
|
||||
inline auto debugName() const -> QString override { return "Flame"; }
|
||||
inline auto metaEntryBase() const -> QString override { return "FlameMods"; };
|
||||
|
||||
auto validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, ModAPI::ModLoaderType loader = ModAPI::Unspecified) const -> bool override;
|
||||
auto validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, ModAPI::ModLoaderTypes loaders = ModAPI::Unspecified) const -> bool override;
|
||||
|
||||
auto shouldDisplay() const -> bool override;
|
||||
};
|
||||
|
@ -61,9 +61,9 @@ ModrinthModPage::ModrinthModPage(ModDownloadDialog* dialog, BaseInstance* instan
|
||||
connect(ui->modSelectionButton, &QPushButton::clicked, this, &ModrinthModPage::onModSelected);
|
||||
}
|
||||
|
||||
auto ModrinthModPage::validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, ModAPI::ModLoaderType loader) const -> bool
|
||||
auto ModrinthModPage::validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, ModAPI::ModLoaderTypes loaders) const -> bool
|
||||
{
|
||||
auto loaderStrings = ModrinthAPI::getModLoaderStrings(loader);
|
||||
auto loaderStrings = ModrinthAPI::getModLoaderStrings(loaders);
|
||||
|
||||
auto loaderCompatible = false;
|
||||
for (auto remoteLoader : ver.loaders)
|
||||
|
@ -55,7 +55,7 @@ class ModrinthModPage : public ModPage {
|
||||
inline auto debugName() const -> QString override { return "Modrinth"; }
|
||||
inline auto metaEntryBase() const -> QString override { return "ModrinthPacks"; };
|
||||
|
||||
auto validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, ModAPI::ModLoaderType loader = ModAPI::Unspecified) const -> bool override;
|
||||
auto validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, ModAPI::ModLoaderTypes loaders = ModAPI::Unspecified) const -> bool override;
|
||||
|
||||
auto shouldDisplay() const -> bool override;
|
||||
};
|
||||
|
42
launcher/ui/setupwizard/PasteWizardPage.cpp
Normal file
42
launcher/ui/setupwizard/PasteWizardPage.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
#include "PasteWizardPage.h"
|
||||
#include "ui_PasteWizardPage.h"
|
||||
|
||||
#include "Application.h"
|
||||
#include "net/PasteUpload.h"
|
||||
|
||||
PasteWizardPage::PasteWizardPage(QWidget *parent) :
|
||||
BaseWizardPage(parent),
|
||||
ui(new Ui::PasteWizardPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
PasteWizardPage::~PasteWizardPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void PasteWizardPage::initializePage()
|
||||
{
|
||||
}
|
||||
|
||||
bool PasteWizardPage::validatePage()
|
||||
{
|
||||
auto s = APPLICATION->settings();
|
||||
QString prevPasteURL = s->get("PastebinURL").toString();
|
||||
s->reset("PastebinURL");
|
||||
if (ui->previousSettingsRadioButton->isChecked())
|
||||
{
|
||||
bool usingDefaultBase = prevPasteURL == PasteUpload::PasteTypes.at(PasteUpload::PasteType::NullPointer).defaultBase;
|
||||
s->set("PastebinType", PasteUpload::PasteType::NullPointer);
|
||||
if (!usingDefaultBase)
|
||||
s->set("PastebinCustomAPIBase", prevPasteURL);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void PasteWizardPage::retranslate()
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
27
launcher/ui/setupwizard/PasteWizardPage.h
Normal file
27
launcher/ui/setupwizard/PasteWizardPage.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef PASTEDEFAULTSCONFIRMATIONWIZARD_H
|
||||
#define PASTEDEFAULTSCONFIRMATIONWIZARD_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "BaseWizardPage.h"
|
||||
|
||||
namespace Ui {
|
||||
class PasteWizardPage;
|
||||
}
|
||||
|
||||
class PasteWizardPage : public BaseWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PasteWizardPage(QWidget *parent = nullptr);
|
||||
~PasteWizardPage();
|
||||
|
||||
void initializePage() override;
|
||||
bool validatePage() override;
|
||||
void retranslate() override;
|
||||
|
||||
private:
|
||||
Ui::PasteWizardPage *ui;
|
||||
};
|
||||
|
||||
#endif // PASTEDEFAULTSCONFIRMATIONWIZARD_H
|
80
launcher/ui/setupwizard/PasteWizardPage.ui
Normal file
80
launcher/ui/setupwizard/PasteWizardPage.ui
Normal file
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PasteWizardPage</class>
|
||||
<widget class="QWidget" name="PasteWizardPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>The default paste service has changed to mclo.gs, please choose what you want to do with your settings.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="defaultSettingsRadioButton">
|
||||
<property name="text">
|
||||
<string>Use new default service</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="previousSettingsRadioButton">
|
||||
<property name="text">
|
||||
<string>Keep previous settings</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>156</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="buttonGroup"/>
|
||||
</buttongroups>
|
||||
</ui>
|
Reference in New Issue
Block a user