Merge branch 'PolyMC:develop' into feature/download_mods

This commit is contained in:
timoreo22
2022-01-28 18:12:35 +01:00
committed by GitHub
43 changed files with 344 additions and 760 deletions

View File

@ -246,32 +246,31 @@ void LauncherPage::applySettings()
//FIXME: make generic
switch (ui->themeComboBox->currentIndex())
{
case 1:
case 0:
s->set("IconTheme", "pe_dark");
break;
case 2:
case 1:
s->set("IconTheme", "pe_light");
break;
case 3:
case 2:
s->set("IconTheme", "pe_blue");
break;
case 4:
case 3:
s->set("IconTheme", "pe_colored");
break;
case 5:
case 4:
s->set("IconTheme", "OSX");
break;
case 6:
case 5:
s->set("IconTheme", "iOS");
break;
case 7:
case 6:
s->set("IconTheme", "flat");
break;
case 8:
case 7:
s->set("IconTheme", "custom");
break;
case 0:
default:
case 8:
s->set("IconTheme", "multimc");
break;
}
@ -327,29 +326,33 @@ void LauncherPage::loadSettings()
auto theme = s->get("IconTheme").toString();
if (theme == "pe_dark")
{
ui->themeComboBox->setCurrentIndex(1);
ui->themeComboBox->setCurrentIndex(0);
}
else if (theme == "pe_light")
{
ui->themeComboBox->setCurrentIndex(2);
ui->themeComboBox->setCurrentIndex(1);
}
else if (theme == "pe_blue")
{
ui->themeComboBox->setCurrentIndex(3);
ui->themeComboBox->setCurrentIndex(2);
}
else if (theme == "pe_colored")
{
ui->themeComboBox->setCurrentIndex(4);
ui->themeComboBox->setCurrentIndex(3);
}
else if (theme == "OSX")
{
ui->themeComboBox->setCurrentIndex(5);
ui->themeComboBox->setCurrentIndex(4);
}
else if (theme == "iOS")
{
ui->themeComboBox->setCurrentIndex(6);
ui->themeComboBox->setCurrentIndex(5);
}
else if (theme == "flat")
{
ui->themeComboBox->setCurrentIndex(6);
}
else if (theme == "multimc")
{
ui->themeComboBox->setCurrentIndex(7);
}
@ -357,10 +360,6 @@ void LauncherPage::loadSettings()
{
ui->themeComboBox->setCurrentIndex(8);
}
else
{
ui->themeComboBox->setCurrentIndex(0);
}
{
auto currentTheme = s->get("ApplicationTheme").toString();

View File

@ -262,11 +262,6 @@
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<item>
<property name="text">
<string>Default</string>
</property>
</item>
<item>
<property name="text">
<string>Simple (Dark Icons)</string>
@ -307,6 +302,11 @@
<string>Custom</string>
</property>
</item>
<item>
<property name="text">
<string>MultiMC</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1">

View File

@ -1,4 +1,4 @@
/* Copyright 2013-2021 MultiMC Contributors
/* Copyright 2013-2021 MultiMC & PolyMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -13,69 +13,51 @@
* limitations under the License.
*/
#include "PasteEEPage.h"
#include "ui_PasteEEPage.h"
#include "PastePage.h"
#include "ui_PastePage.h"
#include <QMessageBox>
#include <QFileDialog>
#include <QStandardPaths>
#include <QTabBar>
#include <QVariant>
#include "settings/SettingsObject.h"
#include "tools/BaseProfiler.h"
#include "Application.h"
PasteEEPage::PasteEEPage(QWidget *parent) :
PastePage::PastePage(QWidget *parent) :
QWidget(parent),
ui(new Ui::PasteEEPage)
ui(new Ui::PastePage)
{
static QRegularExpression validUrlRegExp("https?://.+");
ui->setupUi(this);
ui->urlChoices->setValidator(new QRegularExpressionValidator(validUrlRegExp, ui->urlChoices));
ui->tabWidget->tabBar()->hide();\
connect(ui->customAPIkeyEdit, &QLineEdit::textEdited, this, &PasteEEPage::textEdited);
loadSettings();
}
PasteEEPage::~PasteEEPage()
PastePage::~PastePage()
{
delete ui;
}
void PasteEEPage::loadSettings()
void PastePage::loadSettings()
{
auto s = APPLICATION->settings();
QString keyToUse = s->get("PasteEEAPIKey").toString();
if(keyToUse == "multimc")
{
ui->multimcButton->setChecked(true);
}
else
{
ui->customButton->setChecked(true);
ui->customAPIkeyEdit->setText(keyToUse);
}
QString pastebinURL = s->get("PastebinURL").toString();
ui->urlChoices->setCurrentText(pastebinURL);
}
void PasteEEPage::applySettings()
void PastePage::applySettings()
{
auto s = APPLICATION->settings();
QString pasteKeyToUse;
if (ui->customButton->isChecked())
pasteKeyToUse = ui->customAPIkeyEdit->text();
else
{
pasteKeyToUse = "multimc";
}
s->set("PasteEEAPIKey", pasteKeyToUse);
QString pastebinURL = ui->urlChoices->currentText();
s->set("PastebinURL", pastebinURL);
}
bool PasteEEPage::apply()
bool PastePage::apply()
{
applySettings();
return true;
}
void PasteEEPage::textEdited(const QString& text)
{
ui->customButton->setChecked(true);
}

View File

@ -21,16 +21,16 @@
#include <Application.h>
namespace Ui {
class PasteEEPage;
class PastePage;
}
class PasteEEPage : public QWidget, public BasePage
class PastePage : public QWidget, public BasePage
{
Q_OBJECT
public:
explicit PasteEEPage(QWidget *parent = 0);
~PasteEEPage();
explicit PastePage(QWidget *parent = 0);
~PastePage();
QString displayName() const override
{
@ -54,9 +54,7 @@ private:
void loadSettings();
void applySettings();
private slots:
void textEdited(const QString &text);
private:
Ui::PasteEEPage *ui;
Ui::PastePage *ui;
};

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PasteEEPage</class>
<widget class="QWidget" name="PasteEEPage">
<class>PastePage</class>
<widget class="QWidget" name="PastePage">
<property name="geometry">
<rect>
<x>0</x>
@ -36,39 +36,9 @@
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>paste.ee API key</string>
<string>Pastebin URL</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<widget class="QRadioButton" name="multimcButton">
<property name="text">
<string>MultiMC key - 12MB &amp;upload limit</string>
</property>
<attribute name="buttonGroup">
<string notr="true">pasteButtonGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="customButton">
<property name="text">
<string>&amp;Your own key - 12MB upload limit:</string>
</property>
<attribute name="buttonGroup">
<string notr="true">pasteButtonGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="QLineEdit" name="customAPIkeyEdit">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
<property name="placeholderText">
<string>Paste your API key here!</string>
</property>
</widget>
</item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="Line" name="line">
<property name="orientation">
@ -76,10 +46,45 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Note: only input that starts with &lt;span style=&quot; font-weight:600;&quot;&gt;http://&lt;/span&gt; or &lt;span style=&quot; font-weight:600;&quot;&gt;https://&lt;/span&gt; will be accepted.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="urlChoices">
<property name="editable">
<bool>true</bool>
</property>
<property name="insertPolicy">
<enum>QComboBox::NoInsert</enum>
</property>
<item>
<property name="text">
<string>https://0x0.st</string>
</property>
</item>
<item>
<property name="text">
<string>https://paste.polymc.org</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://paste.ee&quot;&gt;paste.ee&lt;/a&gt; is used by MultiMC for log uploads. If you have a &lt;a href=&quot;https://paste.ee&quot;&gt;paste.ee&lt;/a&gt; account, you can add your API key here and have your uploaded logs paired with your account.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
@ -116,13 +121,7 @@
</widget>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>multimcButton</tabstop>
<tabstop>customButton</tabstop>
<tabstop>customAPIkeyEdit</tabstop>
</tabstops>
<resources/>
<connections/>
<buttongroups>
<buttongroup name="pasteButtonGroup"/>
</buttongroups>
</ui>

View File

@ -100,7 +100,7 @@
<item>
<widget class="QPushButton" name="btnPaste">
<property name="toolTip">
<string>Upload the log to paste.ee - it will stay online for a month</string>
<string>Upload the log to the paste service configured in preferences</string>
</property>
<property name="text">
<string>Upload</string>

View File

@ -84,7 +84,7 @@
<item row="3" column="2">
<widget class="QPushButton" name="btnPaste">
<property name="toolTip">
<string>Upload the log to paste.ee - it will stay online for a month</string>
<string>Upload the log to the paste service configured in preferences.</string>
</property>
<property name="text">
<string>Upload</string>