Merge pull request #678 from Scrumplex/improvements-around-proprietary-services
This commit is contained in:
@ -1,9 +1,28 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
/*
|
||||
* PolyMC - Minecraft Launcher
|
||||
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include "ModDownloadDialog.h"
|
||||
|
||||
#include <BaseVersion.h>
|
||||
#include <icons/IconList.h>
|
||||
#include <InstanceList.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "ProgressDialog.h"
|
||||
#include "ReviewMessageBox.h"
|
||||
|
||||
@ -100,13 +119,13 @@ void ModDownloadDialog::accept()
|
||||
|
||||
QList<BasePage *> ModDownloadDialog::getPages()
|
||||
{
|
||||
modrinthPage = new ModrinthModPage(this, m_instance);
|
||||
flameModPage = new FlameModPage(this, m_instance);
|
||||
return
|
||||
{
|
||||
modrinthPage,
|
||||
flameModPage
|
||||
};
|
||||
QList<BasePage *> pages;
|
||||
|
||||
pages.append(new ModrinthModPage(this, m_instance));
|
||||
if (APPLICATION->currentCapabilities() & Application::SupportsFlame)
|
||||
pages.append(new FlameModPage(this, m_instance));
|
||||
|
||||
return pages;
|
||||
}
|
||||
|
||||
void ModDownloadDialog::addSelectedMod(const QString& name, ModDownloadTask* task)
|
||||
|
@ -1,3 +1,21 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
/*
|
||||
* PolyMC - Minecraft Launcher
|
||||
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
@ -48,9 +66,6 @@ private:
|
||||
QDialogButtonBox * m_buttons = nullptr;
|
||||
QVBoxLayout *m_verticalLayout = nullptr;
|
||||
|
||||
|
||||
ModrinthModPage *modrinthPage = nullptr;
|
||||
FlameModPage *flameModPage = nullptr;
|
||||
QHash<QString, ModDownloadTask*> modTask;
|
||||
BaseInstance *m_instance;
|
||||
};
|
||||
|
@ -150,20 +150,21 @@ void NewInstanceDialog::accept()
|
||||
|
||||
QList<BasePage *> NewInstanceDialog::getPages()
|
||||
{
|
||||
QList<BasePage *> pages;
|
||||
|
||||
importPage = new ImportPage(this);
|
||||
flamePage = new FlamePage(this);
|
||||
auto technicPage = new TechnicPage(this);
|
||||
return
|
||||
{
|
||||
new VanillaPage(this),
|
||||
importPage,
|
||||
new AtlPage(this),
|
||||
flamePage,
|
||||
new FtbPage(this),
|
||||
new LegacyFTB::Page(this),
|
||||
new ModrinthPage(this),
|
||||
technicPage
|
||||
};
|
||||
|
||||
pages.append(new VanillaPage(this));
|
||||
pages.append(importPage);
|
||||
pages.append(new AtlPage(this));
|
||||
if (APPLICATION->currentCapabilities() & Application::SupportsFlame)
|
||||
pages.append(new FlamePage(this));
|
||||
pages.append(new FtbPage(this));
|
||||
pages.append(new LegacyFTB::Page(this));
|
||||
pages.append(new ModrinthPage(this));
|
||||
pages.append(new TechnicPage(this));
|
||||
|
||||
return pages;
|
||||
}
|
||||
|
||||
QString NewInstanceDialog::dialogTitle()
|
||||
|
@ -1,16 +1,36 @@
|
||||
/* Copyright 2013-2021 MultiMC Contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
/*
|
||||
* PolyMC - Minecraft Launcher
|
||||
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@ -69,7 +89,6 @@ private:
|
||||
|
||||
QString InstIconKey;
|
||||
ImportPage *importPage = nullptr;
|
||||
FlamePage *flamePage = nullptr;
|
||||
std::unique_ptr<InstanceTask> creationTask;
|
||||
|
||||
bool importIcon = false;
|
||||
|
@ -40,8 +40,10 @@
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
#include <QRegularExpression>
|
||||
#include <QStandardPaths>
|
||||
#include <QTabBar>
|
||||
#include <QValidator>
|
||||
#include <QVariant>
|
||||
|
||||
#include "settings/SettingsObject.h"
|
||||
@ -63,6 +65,10 @@ APIPage::APIPage(QWidget *parent) :
|
||||
};
|
||||
|
||||
static QRegularExpression validUrlRegExp("https?://.+");
|
||||
static QRegularExpression validMSAClientID(QRegularExpression::anchoredPattern(
|
||||
"[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}"));
|
||||
static QRegularExpression validFlameKey(QRegularExpression::anchoredPattern(
|
||||
"\\$2[ayb]\\$.{56}"));
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
@ -75,6 +81,8 @@ APIPage::APIPage(QWidget *parent) :
|
||||
// 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->msaClientID->setValidator(new QRegularExpressionValidator(validMSAClientID, ui->msaClientID));
|
||||
ui->flameKey->setValidator(new QRegularExpressionValidator(validFlameKey, ui->flameKey));
|
||||
|
||||
ui->metaURL->setPlaceholderText(BuildConfig.META_URL);
|
||||
ui->userAgentLineEdit->setPlaceholderText(BuildConfig.USER_AGENT);
|
||||
@ -137,8 +145,8 @@ void APIPage::loadSettings()
|
||||
ui->msaClientID->setText(msaClientID);
|
||||
QString metaURL = s->get("MetaURLOverride").toString();
|
||||
ui->metaURL->setText(metaURL);
|
||||
QString curseKey = s->get("CFKeyOverride").toString();
|
||||
ui->curseKey->setText(curseKey);
|
||||
QString flameKey = s->get("FlameKeyOverride").toString();
|
||||
ui->flameKey->setText(flameKey);
|
||||
QString customUserAgent = s->get("UserAgentOverride").toString();
|
||||
ui->userAgentLineEdit->setText(customUserAgent);
|
||||
}
|
||||
@ -167,8 +175,8 @@ void APIPage::applySettings()
|
||||
}
|
||||
|
||||
s->set("MetaURLOverride", metaURL);
|
||||
QString curseKey = ui->curseKey->text();
|
||||
s->set("CFKeyOverride", curseKey);
|
||||
QString flameKey = ui->flameKey->text();
|
||||
s->set("FlameKeyOverride", flameKey);
|
||||
s->set("UserAgentOverride", ui->userAgentLineEdit->text());
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_curse">
|
||||
<widget class="QGroupBox" name="groupBox_flame">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@ -214,7 +214,7 @@
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Enter a custom API Key for CurseForge here. </string>
|
||||
<string>Enter a custom API Key for CurseForge here.</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
@ -228,7 +228,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="curseKey">
|
||||
<widget class="QLineEdit" name="flameKey">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
@ -96,7 +96,7 @@ AccountListPage::AccountListPage(QWidget *parent)
|
||||
updateButtonStates();
|
||||
|
||||
// Xbox authentication won't work without a client identifier, so disable the button if it is missing
|
||||
if (APPLICATION->getMSAClientID().isEmpty()) {
|
||||
if (~APPLICATION->currentCapabilities() & Application::SupportsMSA) {
|
||||
ui->actionAddMicrosoft->setVisible(false);
|
||||
ui->actionAddMicrosoft->setToolTip(tr("No Microsoft Authentication client ID was set."));
|
||||
}
|
||||
|
@ -40,7 +40,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>- Curseforge modpacks (ZIP)</string>
|
||||
<string>- CurseForge modpacks (ZIP)</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
|
Reference in New Issue
Block a user