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
commit 8b790a6dd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 344 additions and 760 deletions

View File

@ -47,16 +47,25 @@ If everything works correctly, the .deb will be next to the build script, in `Po
### Building a .rpm ### Building a .rpm
You don't need to install the build dependencies, as the script will use `dnf` to install them for you. Build dependencies are automatically installed using `dnf`, but you do need the `rpmdevtools` package (on Fedora)
in order to fetch sources and setup your tree.
``` ```
cd ~
# setup your ~/rpmbuild directory, required for rpmbuild to work.
rpmdev-setuptree
# note: submodules are not needed here, as the spec file will download the tarball instead
git clone https://github.com/PolyMC/PolyMC.git git clone https://github.com/PolyMC/PolyMC.git
cd packages/rpm cd PolyMC/packages/rpm
sudo dnf builddep ./polymec.spec # install build dependencies
rpmbuild -bb ./polymec.spec sudo dnf builddep polymc.spec
# download build sources
spectool -g -R polymc.spec
# now build!
rpmbuild -bb polymc.spec
``` ```
The path to the rpm packages will be printed at the end of building The path to the rpm packages will be printed when the build is complete.
### Building from command line ### Building from command line
You need a source folder, a build folder and an install folder. You need a source folder, a build folder and an install folder.

View File

@ -45,9 +45,6 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_NO_DEPRECATED_WARNINGS=Y")
##################################### Set Application options ##################################### ##################################### Set Application options #####################################
######## Set URLs ########
set(Launcher_NEWS_RSS_URL "https://multimc.org/rss.xml" CACHE STRING "URL to fetch Launcher's news RSS feed from.")
######## Set version numbers ######## ######## Set version numbers ########
set(Launcher_VERSION_MAJOR 1) set(Launcher_VERSION_MAJOR 1)
set(Launcher_VERSION_MINOR 0) set(Launcher_VERSION_MINOR 0)
@ -66,10 +63,7 @@ set(Launcher_UPDATER_BASE "" CACHE STRING "Base URL for the updater.")
set(Launcher_NOTIFICATION_URL "" CACHE STRING "URL for checking for notifications.") set(Launcher_NOTIFICATION_URL "" CACHE STRING "URL for checking for notifications.")
# The metadata server # The metadata server
set(Launcher_META_URL "https://meta.multimc.org/v1/" CACHE STRING "URL to fetch Launcher's meta files from.") set(Launcher_META_URL "https://meta.polymc.org/v1/" CACHE STRING "URL to fetch Launcher's meta files from.")
# paste.ee API key
set(Launcher_PASTE_EE_API_KEY "utLvciUouSURFzfjPxLBf5W4ISsUX4pwBDF7N1AfZ" CACHE STRING "API key you can get from paste.ee when you register an account")
# Imgur API Client ID # Imgur API Client ID
set(Launcher_IMGUR_CLIENT_ID "5b97b0713fba4a3" CACHE STRING "Client ID you can get from Imgur when you register an application") set(Launcher_IMGUR_CLIENT_ID "5b97b0713fba4a3" CACHE STRING "Client ID you can get from Imgur when you register an application")

View File

@ -1,7 +1,7 @@
# PolyMC # PolyMC
Copyright (C) 2012-2021 MultiMC Contributors Copyright (C) 2012-2021 MultiMC Contributors
Copyright (C) 2021 PolyMC Contributors Copyright (C) 2021-2022 PolyMC Contributors
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public 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/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
# Launcher (https://github.com/MultiMC/Launcher) # Launcher (https://github.com/MultiMC/Launcher)
Copyright 2012-2021 MultiMC Contributors Copyright 2012-2021 MultiMC Contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,8 +1,9 @@
<p align="center"> <p align="center">
<img src="/program_info/polymc-light.png#gh-light-mode-only" alt="PolyMC logo"/> <img src="./program_info/polymc-header-black.svg#gh-light-mode-only" alt="PolyMC logo"/>
<img src="/program_info/polymc-dark.png#gh-dark-mode-only" alt="PolyMC logo"/> <img src="./program_info/polymc-header.svg#gh-dark-mode-only" alt="PolyMC logo"/>
</p> </p>
<br> <br>
PolyMC is a custom launcher for Minecraft that focuses on predictability, long term stability and simplicity. PolyMC is a custom launcher for Minecraft that focuses on predictability, long term stability and simplicity.
This is a **fork** of the MultiMC Launcher and not endorsed by MultiMC. The PolyMC community felt that the maintainer was not acting in the spirit of Free Software so this fork was made. Read "[Why was this fork made?](https://github.com/PolyMC/PolyMC/wiki/FAQ)" on the wiki for more details. This is a **fork** of the MultiMC Launcher and not endorsed by MultiMC. The PolyMC community felt that the maintainer was not acting in the spirit of Free Software so this fork was made. Read "[Why was this fork made?](https://github.com/PolyMC/PolyMC/wiki/FAQ)" on the wiki for more details.
@ -23,6 +24,7 @@ Several source build packages are available, along with experimental pre-built g
- [Windows (32-bit)](https://packages.polymc.org/latest/win32/win32.zip) ([SHA256](https://packages.polymc.org/latest/win32/win32.zip.sha256)) - this is a portable package, you can extract it anywhere and run it. This package needs testing. - [Windows (32-bit)](https://packages.polymc.org/latest/win32/win32.zip) ([SHA256](https://packages.polymc.org/latest/win32/win32.zip.sha256)) - this is a portable package, you can extract it anywhere and run it. This package needs testing.
- [Debian (AMD64)](https://packages.polymc.org/latest/deb/polymc-amd64.deb) ([SHA256](https://packages.polymc.org/latest/deb/polymc-amd64.deb.sha256)) - this is intended to be installed with `dpkg -i`. Alternatively, you may build the `.deb` yourself, by going to `packages/debian` and running `./makedeb.sh`. - [Debian (AMD64)](https://packages.polymc.org/latest/deb/polymc-amd64.deb) ([SHA256](https://packages.polymc.org/latest/deb/polymc-amd64.deb.sha256)) - this is intended to be installed with `dpkg -i`. Alternatively, you may build the `.deb` yourself, by going to `packages/debian` and running `./makedeb.sh`.
- [AppImage (AMD64)](https://packages.polymc.org/latest/appimage/PolyMC-latest-x86_64.AppImage) ([SHA256](https://packages.polymc.org/latest/appimage/PolyMC-latest-x86_64.AppImage.sha256)) - `chmod +x` must be run on this file before usage. This should work on any distribution. - [AppImage (AMD64)](https://packages.polymc.org/latest/appimage/PolyMC-latest-x86_64.AppImage) ([SHA256](https://packages.polymc.org/latest/appimage/PolyMC-latest-x86_64.AppImage.sha256)) - `chmod +x` must be run on this file before usage. This should work on any distribution.
- [Arch Linux (AMD64)](https://packages.polymc.org/latest/arch/polymc-bin-latest-1-x86_64.pkg.tar.zst) ([SHA256](https://packages.polymc.org/latest/arch/polymc-bin-latest-1-x86_64.pkg.tar.zst.sha256)) - this is intended to be installed with `pacman -U`. This is an alternative if building the AUR package is not desired.
- MacOS currently does not have any packages. We are still working on setting up MacOS packaging. - MacOS currently does not have any packages. We are still working on setting up MacOS packaging.
## Development ## Development

View File

@ -42,7 +42,6 @@ Config::Config()
VERSION_STR = "@Launcher_VERSION_STRING@"; VERSION_STR = "@Launcher_VERSION_STRING@";
NEWS_RSS_URL = "@Launcher_NEWS_RSS_URL@"; NEWS_RSS_URL = "@Launcher_NEWS_RSS_URL@";
PASTE_EE_KEY = "@Launcher_PASTE_EE_API_KEY@";
IMGUR_CLIENT_ID = "@Launcher_IMGUR_CLIENT_ID@"; IMGUR_CLIENT_ID = "@Launcher_IMGUR_CLIENT_ID@";
MSA_CLIENT_ID = "@Launcher_MSA_CLIENT_ID@"; MSA_CLIENT_ID = "@Launcher_MSA_CLIENT_ID@";
META_URL = "@Launcher_META_URL@"; META_URL = "@Launcher_META_URL@";

View File

@ -67,11 +67,6 @@ public:
*/ */
QString NEWS_RSS_URL; QString NEWS_RSS_URL;
/**
* API key you can get from paste.ee when you register an account
*/
QString PASTE_EE_KEY;
/** /**
* Client ID you can get from Imgur when you register an application * Client ID you can get from Imgur when you register an application
*/ */

View File

@ -14,7 +14,7 @@
#include "ui/pages/global/ProxyPage.h" #include "ui/pages/global/ProxyPage.h"
#include "ui/pages/global/ExternalToolsPage.h" #include "ui/pages/global/ExternalToolsPage.h"
#include "ui/pages/global/AccountListPage.h" #include "ui/pages/global/AccountListPage.h"
#include "ui/pages/global/PasteEEPage.h" #include "ui/pages/global/PastePage.h"
#include "ui/pages/global/CustomCommandsPage.h" #include "ui/pages/global/CustomCommandsPage.h"
#include "ui/themes/ITheme.h" #include "ui/themes/ITheme.h"
@ -595,7 +595,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
m_settings->registerSetting("AutoUpdate", true); m_settings->registerSetting("AutoUpdate", true);
// Theming // Theming
m_settings->registerSetting("IconTheme", QString("multimc")); m_settings->registerSetting("IconTheme", QString("pe_colored"));
m_settings->registerSetting("ApplicationTheme", QString("system")); m_settings->registerSetting("ApplicationTheme", QString("system"));
// Notifications // Notifications
@ -662,7 +662,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
// Memory // Memory
m_settings->registerSetting({"MinMemAlloc", "MinMemoryAlloc"}, 512); m_settings->registerSetting({"MinMemAlloc", "MinMemoryAlloc"}, 512);
m_settings->registerSetting({"MaxMemAlloc", "MaxMemoryAlloc"}, 1024); m_settings->registerSetting({"MaxMemAlloc", "MaxMemoryAlloc"}, 4096);
m_settings->registerSetting("PermGen", 128); m_settings->registerSetting("PermGen", 128);
// Java Settings // Java Settings
@ -714,8 +714,8 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
m_settings->registerSetting("UpdateDialogGeometry", ""); m_settings->registerSetting("UpdateDialogGeometry", "");
// paste.ee API key // pastebin URL
m_settings->registerSetting("PasteEEAPIKey", "multimc"); m_settings->registerSetting("PastebinURL", "https://0x0.st");
// Init page provider // Init page provider
{ {
@ -728,7 +728,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
m_globalSettingsProvider->addPage<ProxyPage>(); m_globalSettingsProvider->addPage<ProxyPage>();
m_globalSettingsProvider->addPage<ExternalToolsPage>(); m_globalSettingsProvider->addPage<ExternalToolsPage>();
m_globalSettingsProvider->addPage<AccountListPage>(); m_globalSettingsProvider->addPage<AccountListPage>();
m_globalSettingsProvider->addPage<PasteEEPage>(); m_globalSettingsProvider->addPage<PastePage>();
} }
qDebug() << "<> Settings loaded."; qDebug() << "<> Settings loaded.";
} }

View File

@ -181,15 +181,6 @@ set(NOTIFICATIONS_SOURCES
notifications/NotificationChecker.cpp notifications/NotificationChecker.cpp
) )
# Backend for the news bar... there's usually no news.
set(NEWS_SOURCES
# News System
news/NewsChecker.h
news/NewsChecker.cpp
news/NewsEntry.h
news/NewsEntry.cpp
)
# Icon interface # Icon interface
set(ICONS_SOURCES set(ICONS_SOURCES
# Icons System and related code # Icons System and related code
@ -719,8 +710,8 @@ SET(LAUNCHER_SOURCES
ui/pages/global/LauncherPage.h ui/pages/global/LauncherPage.h
ui/pages/global/ProxyPage.cpp ui/pages/global/ProxyPage.cpp
ui/pages/global/ProxyPage.h ui/pages/global/ProxyPage.h
ui/pages/global/PasteEEPage.cpp ui/pages/global/PastePage.cpp
ui/pages/global/PasteEEPage.h ui/pages/global/PastePage.h
# GUI - platform pages # GUI - platform pages
ui/pages/modplatform/VanillaPage.cpp ui/pages/modplatform/VanillaPage.cpp
@ -865,7 +856,7 @@ qt5_wrap_ui(LAUNCHER_UI
ui/pages/global/AccountListPage.ui ui/pages/global/AccountListPage.ui
ui/pages/global/JavaPage.ui ui/pages/global/JavaPage.ui
ui/pages/global/LauncherPage.ui ui/pages/global/LauncherPage.ui
ui/pages/global/PasteEEPage.ui ui/pages/global/PastePage.ui
ui/pages/global/ProxyPage.ui ui/pages/global/ProxyPage.ui
ui/pages/global/MinecraftPage.ui ui/pages/global/MinecraftPage.ui
ui/pages/global/ExternalToolsPage.ui ui/pages/global/ExternalToolsPage.ui

View File

@ -14,7 +14,7 @@ if [[ $EUID -eq 0 ]]; then
fi fi
LAUNCHER_NAME=@Launcher_Name@ LAUNCHER_NAME=@Launcher_APP_BINARY_NAME@
LAUNCHER_DIR="$(dirname "$(readlink -f "$0")")" LAUNCHER_DIR="$(dirname "$(readlink -f "$0")")"
echo "Launcher Dir: ${LAUNCHER_DIR}" echo "Launcher Dir: ${LAUNCHER_DIR}"

View File

@ -103,11 +103,15 @@ void JavaChecker::finished(int exitcode, QProcess::ExitStatus status)
for(QString line : lines) for(QString line : lines)
{ {
line = line.trimmed(); line = line.trimmed();
// NOTE: workaround for GH-4125, where garbage is getting printed into stdout on bedrock linux
if (line.contains("/bedrock/strata")) {
continue;
}
auto parts = line.split('=', QString::SkipEmptyParts); auto parts = line.split('=', QString::SkipEmptyParts);
if(parts.size() != 2 || parts[0].isEmpty() || parts[1].isEmpty()) if(parts.size() != 2 || parts[0].isEmpty() || parts[1].isEmpty())
{ {
success = false; continue;
} }
else else
{ {

View File

@ -44,7 +44,7 @@ void AuthRequest::onRequestFinished() {
if (reply_ != qobject_cast<QNetworkReply *>(sender())) { if (reply_ != qobject_cast<QNetworkReply *>(sender())) {
return; return;
} }
httpStatus_ = 200; httpStatus_ = reply_->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
finish(); finish();
} }

View File

@ -94,7 +94,7 @@ bool parseXTokenResponse(QByteArray & data, Katabasis::Token &output, QString na
return false; return false;
} }
if(!getString(obj.value("Token"), output.token)) { if(!getString(obj.value("Token"), output.token)) {
qWarning() << "User Token is not a timestamp"; qWarning() << "User Token is not a string";
return false; return false;
} }
auto arrayVal = obj.value("DisplayClaims").toObject().value("xui"); auto arrayVal = obj.value("DisplayClaims").toObject().value("xui");

View File

@ -56,6 +56,14 @@ void MinecraftProfileStep::onRequestDone(
return; return;
} }
if (error != QNetworkReply::NoError) { if (error != QNetworkReply::NoError) {
qWarning() << "Error getting profile:";
qWarning() << " HTTP Status: " << requestor->httpStatus_;
qWarning() << " Internal error no.: " << error;
qWarning() << " Error string: " << requestor->errorString_;
qWarning() << " Response:";
qWarning() << QString::fromUtf8(data);
emit finished( emit finished(
AccountTaskState::STATE_FAILED_SOFT, AccountTaskState::STATE_FAILED_SOFT,
tr("Minecraft Java profile acquisition failed.") tr("Minecraft Java profile acquisition failed.")

View File

@ -8,44 +8,34 @@
#include <QJsonDocument> #include <QJsonDocument>
#include <QFile> #include <QFile>
PasteUpload::PasteUpload(QWidget *window, QString text, QString key) : m_window(window) PasteUpload::PasteUpload(QWidget *window, QString text, QString url) : m_window(window), m_uploadUrl(url), m_text(text.toUtf8())
{ {
m_key = key;
QByteArray temp;
QJsonObject topLevelObj;
QJsonObject sectionObject;
sectionObject.insert("contents", text);
QJsonArray sectionArray;
sectionArray.append(sectionObject);
topLevelObj.insert("description", "Log Upload");
topLevelObj.insert("sections", sectionArray);
QJsonDocument docOut;
docOut.setObject(topLevelObj);
m_jsonContent = docOut.toJson();
} }
PasteUpload::~PasteUpload() PasteUpload::~PasteUpload()
{ {
} }
bool PasteUpload::validateText()
{
return m_jsonContent.size() <= maxSize();
}
void PasteUpload::executeTask() void PasteUpload::executeTask()
{ {
QNetworkRequest request(QUrl("https://api.paste.ee/v1/pastes")); QNetworkRequest request{QUrl(m_uploadUrl)};
request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT_UNCACHED); request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT_UNCACHED);
request.setRawHeader("Content-Type", "application/json"); QHttpMultiPart *multiPart = new QHttpMultiPart{QHttpMultiPart::FormDataType};
request.setRawHeader("Content-Length", QByteArray::number(m_jsonContent.size()));
request.setRawHeader("X-Auth-Token", m_key.toStdString().c_str());
QNetworkReply *rep = APPLICATION->network()->post(request, m_jsonContent); QHttpPart filePart;
filePart.setBody(m_text);
filePart.setHeader(QNetworkRequest::ContentTypeHeader, "text/plain");
filePart.setHeader(QNetworkRequest::ContentDispositionHeader, "form-data; name=\"file\"; filename=\"log.txt\"");
multiPart->append(filePart);
QNetworkReply *rep = APPLICATION->network()->post(request, multiPart);
multiPart->setParent(rep);
m_reply = std::shared_ptr<QNetworkReply>(rep); m_reply = std::shared_ptr<QNetworkReply>(rep);
setStatus(tr("Uploading to paste.ee")); setStatus(tr("Uploading to %1").arg(m_uploadUrl));
connect(rep, &QNetworkReply::uploadProgress, this, &Task::setProgress); connect(rep, &QNetworkReply::uploadProgress, this, &Task::setProgress);
connect(rep, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(downloadError(QNetworkReply::NetworkError))); connect(rep, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(downloadError(QNetworkReply::NetworkError)));
connect(rep, SIGNAL(finished()), this, SLOT(downloadFinished())); connect(rep, SIGNAL(finished()), this, SLOT(downloadFinished()));
@ -61,45 +51,23 @@ void PasteUpload::downloadError(QNetworkReply::NetworkError error)
void PasteUpload::downloadFinished() void PasteUpload::downloadFinished()
{ {
QByteArray data = m_reply->readAll(); QByteArray data = m_reply->readAll();
// if the download succeeded int statusCode = m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
if (m_reply->error() == QNetworkReply::NetworkError::NoError)
if (m_reply->error() != QNetworkReply::NetworkError::NoError)
{ {
m_reply.reset(); emitFailed(tr("Network error: %1").arg(m_reply->errorString()));
QJsonParseError jsonError;
QJsonDocument doc = QJsonDocument::fromJson(data, &jsonError);
if (jsonError.error != QJsonParseError::NoError)
{
emitFailed(jsonError.errorString());
return;
}
if (!parseResult(doc))
{
emitFailed(tr("paste.ee returned an error. Please consult the logs for more information"));
return;
}
}
// else the download failed
else
{
emitFailed(QString("Network error: %1").arg(m_reply->errorString()));
m_reply.reset(); m_reply.reset();
return; return;
} }
else if (statusCode != 200 && statusCode != 201)
{
QString reasonPhrase = m_reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString();
emitFailed(tr("Error: %1 returned unexpected status code %2 %3").arg(m_uploadUrl).arg(statusCode).arg(reasonPhrase));
qCritical() << m_uploadUrl << " returned unexpected status code " << statusCode << " with body: " << data;
m_reply.reset();
return;
}
m_pasteLink = QString::fromUtf8(data).trimmed();
emitSucceeded(); emitSucceeded();
} }
bool PasteUpload::parseResult(QJsonDocument doc)
{
auto object = doc.object();
auto status = object.value("success").toBool();
if (!status)
{
qCritical() << "paste.ee reported error:" << QString(object.value("error").toString());
return false;
}
m_pasteLink = object.value("link").toString();
m_pasteID = object.value("id").toString();
qDebug() << m_pasteLink;
return true;
}

View File

@ -8,37 +8,21 @@ class PasteUpload : public Task
{ {
Q_OBJECT Q_OBJECT
public: public:
PasteUpload(QWidget *window, QString text, QString key = "public"); PasteUpload(QWidget *window, QString text, QString url);
virtual ~PasteUpload(); virtual ~PasteUpload();
QString pasteLink() QString pasteLink()
{ {
return m_pasteLink; return m_pasteLink;
} }
QString pasteID()
{
return m_pasteID;
}
int maxSize()
{
// 2MB for paste.ee - public
if(m_key == "public")
return 1024*1024*2;
// 12MB for paste.ee - with actual key
return 1024*1024*12;
}
bool validateText();
protected: protected:
virtual void executeTask(); virtual void executeTask();
private: private:
bool parseResult(QJsonDocument doc);
QString m_error;
QWidget *m_window; QWidget *m_window;
QString m_pasteID;
QString m_pasteLink; QString m_pasteLink;
QString m_key; QString m_uploadUrl;
QByteArray m_jsonContent; QByteArray m_text;
std::shared_ptr<QNetworkReply> m_reply; std::shared_ptr<QNetworkReply> m_reply;
public public
slots: slots:

View File

@ -1,132 +0,0 @@
/* 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 "NewsChecker.h"
#include <QByteArray>
#include <QDomDocument>
#include <QDebug>
NewsChecker::NewsChecker(shared_qobject_ptr<QNetworkAccessManager> network, const QString& feedUrl)
{
m_network = network;
m_feedUrl = feedUrl;
}
void NewsChecker::reloadNews()
{
// Start a netjob to download the RSS feed and call rssDownloadFinished() when it's done.
if (isLoadingNews())
{
qDebug() << "Ignored request to reload news. Currently reloading already.";
return;
}
qDebug() << "Reloading news.";
NetJob* job = new NetJob("News RSS Feed", m_network);
job->addNetAction(Net::Download::makeByteArray(m_feedUrl, &newsData));
QObject::connect(job, &NetJob::succeeded, this, &NewsChecker::rssDownloadFinished);
QObject::connect(job, &NetJob::failed, this, &NewsChecker::rssDownloadFailed);
m_newsNetJob.reset(job);
job->start();
}
void NewsChecker::rssDownloadFinished()
{
// Parse the XML file and process the RSS feed entries.
qDebug() << "Finished loading RSS feed.";
m_newsNetJob.reset();
QDomDocument doc;
{
// Stuff to store error info in.
QString errorMsg = "Unknown error.";
int errorLine = -1;
int errorCol = -1;
// Parse the XML.
if (!doc.setContent(newsData, false, &errorMsg, &errorLine, &errorCol))
{
QString fullErrorMsg = QString("Error parsing RSS feed XML. %s at %d:%d.").arg(errorMsg, errorLine, errorCol);
fail(fullErrorMsg);
newsData.clear();
return;
}
newsData.clear();
}
// If the parsing succeeded, read it.
QDomNodeList items = doc.elementsByTagName("item");
m_newsEntries.clear();
for (int i = 0; i < items.length(); i++)
{
QDomElement element = items.at(i).toElement();
NewsEntryPtr entry;
entry.reset(new NewsEntry());
QString errorMsg = "An unknown error occurred.";
if (NewsEntry::fromXmlElement(element, entry.get(), &errorMsg))
{
qDebug() << "Loaded news entry" << entry->title;
m_newsEntries.append(entry);
}
else
{
qWarning() << "Failed to load news entry at index" << i << ":" << errorMsg;
}
}
succeed();
}
void NewsChecker::rssDownloadFailed(QString reason)
{
// Set an error message and fail.
fail(tr("Failed to load news RSS feed:\n%1").arg(reason));
}
QList<NewsEntryPtr> NewsChecker::getNewsEntries() const
{
return m_newsEntries;
}
bool NewsChecker::isLoadingNews() const
{
return m_newsNetJob.get() != nullptr;
}
QString NewsChecker::getLastLoadErrorMsg() const
{
return m_lastLoadError;
}
void NewsChecker::succeed()
{
m_lastLoadError = "";
qDebug() << "News loading succeeded.";
m_newsNetJob.reset();
emit newsLoaded();
}
void NewsChecker::fail(const QString& errorMsg)
{
m_lastLoadError = errorMsg;
qDebug() << "Failed to load news:" << errorMsg;
m_newsNetJob.reset();
emit newsLoadingFailed(errorMsg);
}

View File

@ -1,105 +0,0 @@
/* 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
#include <QObject>
#include <QString>
#include <QList>
#include <net/NetJob.h>
#include "NewsEntry.h"
class NewsChecker : public QObject
{
Q_OBJECT
public:
/*!
* Constructs a news reader to read from the given RSS feed URL.
*/
NewsChecker(shared_qobject_ptr<QNetworkAccessManager> network, const QString& feedUrl);
/*!
* Returns the error message for the last time the news was loaded.
* Empty string if the last load was successful.
*/
QString getLastLoadErrorMsg() const;
/*!
* Returns true if the news has been loaded successfully.
*/
bool isNewsLoaded() const;
//! True if the news is currently loading. If true, reloadNews() will do nothing.
bool isLoadingNews() const;
/*!
* Returns a list of news entries.
*/
QList<NewsEntryPtr> getNewsEntries() const;
/*!
* Reloads the news from the website's RSS feed.
* If the news is already loading, this does nothing.
*/
void Q_SLOT reloadNews();
signals:
/*!
* Signal fired after the news has finished loading.
*/
void newsLoaded();
/*!
* Signal fired after the news fails to load.
*/
void newsLoadingFailed(QString errorMsg);
protected slots:
void rssDownloadFinished();
void rssDownloadFailed(QString reason);
protected: /* data */
//! The URL for the RSS feed to fetch.
QString m_feedUrl;
//! List of news entries.
QList<NewsEntryPtr> m_newsEntries;
//! The network job to use to load the news.
NetJob::Ptr m_newsNetJob;
//! True if news has been loaded.
bool m_loadedNews;
QByteArray newsData;
/*!
* Gets the error message that was given last time the news was loaded.
* If the last news load succeeded, this will be an empty string.
*/
QString m_lastLoadError;
shared_qobject_ptr<QNetworkAccessManager> m_network;
protected slots:
/// Emits newsLoaded() and sets m_lastLoadError to empty string.
void succeed();
/// Emits newsLoadingFailed() and sets m_lastLoadError to the given message.
void fail(const QString& errorMsg);
};

View File

@ -1,77 +0,0 @@
/* 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 "NewsEntry.h"
#include <QDomNodeList>
#include <QVariant>
NewsEntry::NewsEntry(QObject* parent) :
QObject(parent)
{
this->title = tr("Untitled");
this->content = tr("No content.");
this->link = "";
this->author = tr("Unknown Author");
this->pubDate = QDateTime::currentDateTime();
}
NewsEntry::NewsEntry(const QString& title, const QString& content, const QString& link, const QString& author, const QDateTime& pubDate, QObject* parent) :
QObject(parent)
{
this->title = title;
this->content = content;
this->link = link;
this->author = author;
this->pubDate = pubDate;
}
/*!
* Gets the text content of the given child element as a QVariant.
*/
inline QString childValue(const QDomElement& element, const QString& childName, QString defaultVal="")
{
QDomNodeList nodes = element.elementsByTagName(childName);
if (nodes.count() > 0)
{
QDomElement element = nodes.at(0).toElement();
return element.text();
}
else
{
return defaultVal;
}
}
bool NewsEntry::fromXmlElement(const QDomElement& element, NewsEntry* entry, QString* errorMsg)
{
QString title = childValue(element, "title", tr("Untitled"));
QString content = childValue(element, "description", tr("No content."));
QString link = childValue(element, "link");
QString author = childValue(element, "dc:creator", tr("Unknown Author"));
QString pubDateStr = childValue(element, "pubDate");
// FIXME: For now, we're just ignoring timezones. We assume that all time zones in the RSS feed are the same.
QString dateFormat("ddd, dd MMM yyyy hh:mm:ss");
QDateTime pubDate = QDateTime::fromString(pubDateStr, dateFormat);
entry->title = title;
entry->content = content;
entry->link = link;
entry->author = author;
entry->pubDate = pubDate;
return true;
}

View File

@ -1,65 +0,0 @@
/* 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
#include <QObject>
#include <QString>
#include <QDomElement>
#include <QDateTime>
#include <memory>
class NewsEntry : public QObject
{
Q_OBJECT
public:
/*!
* Constructs an empty news entry.
*/
explicit NewsEntry(QObject* parent=0);
/*!
* Constructs a new news entry.
* Note that content may contain HTML.
*/
NewsEntry(const QString& title, const QString& content, const QString& link, const QString& author, const QDateTime& pubDate, QObject* parent=0);
/*!
* Attempts to load information from the given XML element into the given news entry pointer.
* If this fails, the function will return false and store an error message in the errorMsg pointer.
*/
static bool fromXmlElement(const QDomElement& element, NewsEntry* entry, QString* errorMsg=0);
//! The post title.
QString title;
//! The post's content. May contain HTML.
QString content;
//! URL to the post.
QString link;
//! The post's author.
QString author;
//! The date and time that this post was published.
QDateTime pubDate;
};
typedef std::shared_ptr<NewsEntry> NewsEntryPtr;

View File

@ -143,6 +143,11 @@ struct TranslationsModel::Private
std::unique_ptr<POTranslator> m_po_translator; std::unique_ptr<POTranslator> m_po_translator;
QFileSystemWatcher *watcher; QFileSystemWatcher *watcher;
const QString m_system_locale = QLocale::system().name();
const QString m_system_language = m_system_locale.split('_').front();
bool no_language_set = false;
}; };
TranslationsModel::TranslationsModel(QString path, QObject* parent): QAbstractListModel(parent) TranslationsModel::TranslationsModel(QString path, QObject* parent): QAbstractListModel(parent)
@ -164,7 +169,10 @@ TranslationsModel::~TranslationsModel()
void TranslationsModel::translationDirChanged(const QString& path) void TranslationsModel::translationDirChanged(const QString& path)
{ {
qDebug() << "Dir changed:" << path; qDebug() << "Dir changed:" << path;
reloadLocalFiles(); if (!d->no_language_set)
{
reloadLocalFiles();
}
selectLanguage(selectedLanguage()); selectLanguage(selectedLanguage());
} }
@ -172,7 +180,26 @@ void TranslationsModel::indexReceived()
{ {
qDebug() << "Got translations index!"; qDebug() << "Got translations index!";
d->m_index_job.reset(); d->m_index_job.reset();
if(d->m_selectedLanguage != defaultLangCode)
if (d->no_language_set)
{
reloadLocalFiles();
auto language = d->m_system_locale;
if (!findLanguage(language))
{
language = d->m_system_language;
}
selectLanguage(language);
if (selectedLanguage() != defaultLangCode)
{
updateLanguage(selectedLanguage());
}
APPLICATION->settings()->set("Language", selectedLanguage());
d->no_language_set = false;
}
else if(d->m_selectedLanguage != defaultLangCode)
{ {
downloadTranslation(d->m_selectedLanguage); downloadTranslation(d->m_selectedLanguage);
} }
@ -319,8 +346,19 @@ void TranslationsModel::reloadLocalFiles()
{ {
d->m_languages.append(language); d->m_languages.append(language);
} }
std::sort(d->m_languages.begin(), d->m_languages.end(), [](const Language& a, const Language& b) { std::sort(d->m_languages.begin(), d->m_languages.end(), [this](const Language& a, const Language& b) {
return a.key.compare(b.key) < 0; if (a.key != b.key)
{
if (a.key == d->m_system_locale || a.key == d->m_system_language)
{
return true;
}
if (b.key == d->m_system_locale || b.key == d->m_system_language)
{
return false;
}
}
return a.key < b.key;
}); });
endInsertRows(); endInsertRows();
} }
@ -439,6 +477,12 @@ bool TranslationsModel::selectLanguage(QString key)
{ {
QString &langCode = key; QString &langCode = key;
auto langPtr = findLanguage(key); auto langPtr = findLanguage(key);
if (langCode.isEmpty())
{
d->no_language_set = true;
}
if(!langPtr) if(!langPtr)
{ {
qWarning() << "Selected invalid language" << key << ", defaulting to" << defaultLangCode; qWarning() << "Selected invalid language" << key << ", defaulting to" << defaultLangCode;

View File

@ -16,21 +16,8 @@
QString GuiUtil::uploadPaste(const QString &text, QWidget *parentWidget) QString GuiUtil::uploadPaste(const QString &text, QWidget *parentWidget)
{ {
ProgressDialog dialog(parentWidget); ProgressDialog dialog(parentWidget);
auto APIKeySetting = APPLICATION->settings()->get("PasteEEAPIKey").toString(); auto pasteUrlSetting = APPLICATION->settings()->get("PastebinURL").toString();
if(APIKeySetting == "multimc") std::unique_ptr<PasteUpload> paste(new PasteUpload(parentWidget, text, pasteUrlSetting));
{
APIKeySetting = BuildConfig.PASTE_EE_KEY;
}
std::unique_ptr<PasteUpload> paste(new PasteUpload(parentWidget, text, APIKeySetting));
if (!paste->validateText())
{
CustomMessageBox::selectable(
parentWidget, QObject::tr("Upload failed"),
QObject::tr("The log file is too big. You'll have to upload it manually."),
QMessageBox::Warning)->exec();
return QString();
}
dialog.execWithTask(paste.get()); dialog.execWithTask(paste.get());
if (!paste->wasSuccessful()) if (!paste->wasSuccessful())

View File

@ -58,7 +58,6 @@
#include <BuildConfig.h> #include <BuildConfig.h>
#include <net/NetJob.h> #include <net/NetJob.h>
#include <net/Download.h> #include <net/Download.h>
#include <news/NewsChecker.h>
#include <notifications/NotificationChecker.h> #include <notifications/NotificationChecker.h>
#include <tools/BaseProfiler.h> #include <tools/BaseProfiler.h>
#include <updater/DownloadTask.h> #include <updater/DownloadTask.h>
@ -201,7 +200,6 @@ public:
//TranslatedAction actionRefresh; //TranslatedAction actionRefresh;
TranslatedAction actionCheckUpdate; TranslatedAction actionCheckUpdate;
TranslatedAction actionSettings; TranslatedAction actionSettings;
TranslatedAction actionMoreNews;
TranslatedAction actionManageAccounts; TranslatedAction actionManageAccounts;
TranslatedAction actionLaunchInstance; TranslatedAction actionLaunchInstance;
TranslatedAction actionRenameInstance; TranslatedAction actionRenameInstance;
@ -246,7 +244,6 @@ public:
TranslatedToolbar mainToolBar; TranslatedToolbar mainToolBar;
TranslatedToolbar instanceToolBar; TranslatedToolbar instanceToolBar;
TranslatedToolbar newsToolBar;
QVector<TranslatedToolbar *> all_toolbars; QVector<TranslatedToolbar *> all_toolbars;
bool m_kill = false; bool m_kill = false;
@ -429,29 +426,6 @@ public:
MainWindow->setStatusBar(statusBar); MainWindow->setStatusBar(statusBar);
} }
void createNewsToolbar(QMainWindow *MainWindow)
{
newsToolBar = TranslatedToolbar(MainWindow);
newsToolBar->setObjectName(QStringLiteral("newsToolBar"));
newsToolBar->setMovable(false);
newsToolBar->setAllowedAreas(Qt::BottomToolBarArea);
newsToolBar->setIconSize(QSize(16, 16));
newsToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
newsToolBar->setFloatable(false);
newsToolBar->setWindowTitle(QT_TRANSLATE_NOOP("MainWindow", "News Toolbar"));
actionMoreNews = TranslatedAction(MainWindow);
actionMoreNews->setObjectName(QStringLiteral("actionMoreNews"));
actionMoreNews->setIcon(APPLICATION->getThemedIcon("news"));
actionMoreNews.setTextId(QT_TRANSLATE_NOOP("MainWindow", "More news..."));
actionMoreNews.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Open the development blog to read more news about %1."));
all_actions.append(&actionMoreNews);
newsToolBar->addAction(actionMoreNews);
all_toolbars.append(&newsToolBar);
MainWindow->addToolBar(Qt::BottomToolBarArea, newsToolBar);
}
void createInstanceToolbar(QMainWindow *MainWindow) void createInstanceToolbar(QMainWindow *MainWindow)
{ {
instanceToolBar = TranslatedToolbar(MainWindow); instanceToolBar = TranslatedToolbar(MainWindow);
@ -636,7 +610,6 @@ public:
MainWindow->setCentralWidget(centralWidget); MainWindow->setCentralWidget(centralWidget);
createStatusBar(MainWindow); createStatusBar(MainWindow);
createNewsToolbar(MainWindow);
createInstanceToolbar(MainWindow); createInstanceToolbar(MainWindow);
retranslateUi(MainWindow); retranslateUi(MainWindow);
@ -691,20 +664,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow
connect(secretEventFilter, &KonamiCode::triggered, this, &MainWindow::konamiTriggered); connect(secretEventFilter, &KonamiCode::triggered, this, &MainWindow::konamiTriggered);
} }
// Add the news label to the news toolbar.
{
m_newsChecker.reset(new NewsChecker(APPLICATION->network(), BuildConfig.NEWS_RSS_URL));
newsLabel = new QToolButton();
newsLabel->setIcon(APPLICATION->getThemedIcon("news"));
newsLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
newsLabel->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
newsLabel->setFocusPolicy(Qt::NoFocus);
ui->newsToolBar->insertWidget(ui->actionMoreNews, newsLabel);
QObject::connect(newsLabel, &QAbstractButton::clicked, this, &MainWindow::newsButtonClicked);
QObject::connect(m_newsChecker.get(), &NewsChecker::newsLoaded, this, &MainWindow::updateNewsLabel);
updateNewsLabel();
}
// Create the instance list widget // Create the instance list widget
{ {
view = new InstanceView(ui->centralWidget); view = new InstanceView(ui->centralWidget);
@ -809,13 +768,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow
// TODO: refresh accounts here? // TODO: refresh accounts here?
// auto accounts = APPLICATION->accounts(); // auto accounts = APPLICATION->accounts();
// load the news
{
m_newsChecker->reloadNews();
updateNewsLabel();
}
if(BuildConfig.UPDATER_ENABLED) if(BuildConfig.UPDATER_ENABLED)
{ {
bool updatesAllowed = APPLICATION->updatesAreAllowed(); bool updatesAllowed = APPLICATION->updatesAreAllowed();
@ -1189,29 +1141,6 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *ev)
return QMainWindow::eventFilter(obj, ev); return QMainWindow::eventFilter(obj, ev);
} }
void MainWindow::updateNewsLabel()
{
if (m_newsChecker->isLoadingNews())
{
newsLabel->setText(tr("Loading news..."));
newsLabel->setEnabled(false);
}
else
{
QList<NewsEntryPtr> entries = m_newsChecker->getNewsEntries();
if (entries.length() > 0)
{
newsLabel->setText(entries[0]->title);
newsLabel->setEnabled(true);
}
else
{
newsLabel->setText(tr("No news available."));
newsLabel->setEnabled(false);
}
}
}
void MainWindow::updateAvailable(GoUpdate::Status status) void MainWindow::updateAvailable(GoUpdate::Status status)
{ {
if(!APPLICATION->updatesAreAllowed()) if(!APPLICATION->updatesAreAllowed())
@ -1685,24 +1614,6 @@ void MainWindow::on_actionReportBug_triggered()
DesktopServices::openUrl(QUrl(BuildConfig.BUG_TRACKER_URL)); DesktopServices::openUrl(QUrl(BuildConfig.BUG_TRACKER_URL));
} }
void MainWindow::on_actionMoreNews_triggered()
{
DesktopServices::openUrl(QUrl("https://multimc.org/posts.html"));
}
void MainWindow::newsButtonClicked()
{
QList<NewsEntryPtr> entries = m_newsChecker->getNewsEntries();
if (entries.count() > 0)
{
DesktopServices::openUrl(QUrl(entries[0]->link));
}
else
{
DesktopServices::openUrl(QUrl("https://multimc.org/posts.html"));
}
}
void MainWindow::on_actionAbout_triggered() void MainWindow::on_actionAbout_triggered()
{ {
AboutDialog dialog(this); AboutDialog dialog(this);

View File

@ -27,7 +27,6 @@
#include "updater/GoUpdate.h" #include "updater/GoUpdate.h"
class LaunchController; class LaunchController;
class NewsChecker;
class NotificationChecker; class NotificationChecker;
class QToolButton; class QToolButton;
class InstanceProxyModel; class InstanceProxyModel;
@ -109,10 +108,6 @@ private slots:
void on_actionReportBug_triggered(); void on_actionReportBug_triggered();
void on_actionMoreNews_triggered();
void newsButtonClicked();
void on_actionLaunchInstance_triggered(); void on_actionLaunchInstance_triggered();
void on_actionLaunchInstanceOffline_triggered(); void on_actionLaunchInstanceOffline_triggered();
@ -174,8 +169,6 @@ private slots:
void repopulateAccountsMenu(); void repopulateAccountsMenu();
void updateNewsLabel();
/*! /*!
* Runs the DownloadTask and installs updates. * Runs the DownloadTask and installs updates.
*/ */
@ -205,14 +198,12 @@ private:
// these are managed by Qt's memory management model! // these are managed by Qt's memory management model!
InstanceView *view = nullptr; InstanceView *view = nullptr;
InstanceProxyModel *proxymodel = nullptr; InstanceProxyModel *proxymodel = nullptr;
QToolButton *newsLabel = nullptr;
QLabel *m_statusLeft = nullptr; QLabel *m_statusLeft = nullptr;
QLabel *m_statusCenter = nullptr; QLabel *m_statusCenter = nullptr;
QMenu *accountMenu = nullptr; QMenu *accountMenu = nullptr;
QToolButton *accountMenuButton = nullptr; QToolButton *accountMenuButton = nullptr;
KonamiCode * secretEventFilter = nullptr; KonamiCode * secretEventFilter = nullptr;
unique_qobject_ptr<NewsChecker> m_newsChecker;
unique_qobject_ptr<NotificationChecker> m_notificationChecker; unique_qobject_ptr<NotificationChecker> m_notificationChecker;
InstancePtr m_selectedInstance; InstancePtr m_selectedInstance;

View File

@ -99,7 +99,7 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDia
QString urlText("<html><head/><body><p><a href=\"%1\">%1</a></p></body></html>"); QString urlText("<html><head/><body><p><a href=\"%1\">%1</a></p></body></html>");
ui->urlLabel->setText(urlText.arg(BuildConfig.LAUNCHER_GIT)); ui->urlLabel->setText(urlText.arg(BuildConfig.LAUNCHER_GIT));
QString copyText("© 2012-2021 %1"); QString copyText("© 2021-2022 %1");
ui->copyLabel->setText(copyText.arg(BuildConfig.LAUNCHER_COPYRIGHT)); ui->copyLabel->setText(copyText.arg(BuildConfig.LAUNCHER_COPYRIGHT));
connect(ui->closeButton, SIGNAL(clicked()), SLOT(close())); connect(ui->closeButton, SIGNAL(clicked()), SLOT(close()));

View File

@ -16,15 +16,19 @@
#include "MSALoginDialog.h" #include "MSALoginDialog.h"
#include "ui_MSALoginDialog.h" #include "ui_MSALoginDialog.h"
#include "DesktopServices.h"
#include "minecraft/auth/AccountTask.h" #include "minecraft/auth/AccountTask.h"
#include <QtWidgets/QPushButton> #include <QtWidgets/QPushButton>
#include <QUrl> #include <QUrl>
#include <QApplication>
#include <QClipboard>
MSALoginDialog::MSALoginDialog(QWidget *parent) : QDialog(parent), ui(new Ui::MSALoginDialog) MSALoginDialog::MSALoginDialog(QWidget *parent) : QDialog(parent), ui(new Ui::MSALoginDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->progressBar->setVisible(false); ui->progressBar->setVisible(false);
ui->actionButton->setVisible(false);
// ui->buttonBox->button(QDialogButtonBox::Cancel)->setEnabled(false); // ui->buttonBox->button(QDialogButtonBox::Cancel)->setEnabled(false);
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
@ -81,10 +85,17 @@ void MSALoginDialog::showVerificationUriAndCode(const QUrl& uri, const QString&
QString urlString = uri.toString(); QString urlString = uri.toString();
QString linkString = QString("<a href=\"%1\">%2</a>").arg(urlString, urlString); QString linkString = QString("<a href=\"%1\">%2</a>").arg(urlString, urlString);
ui->label->setText(tr("<p>Please open up %1 in a browser and put in the code <b>%2</b> to proceed with login.</p>").arg(linkString, code)); ui->label->setText(tr("<p>Please open up %1 in a browser and put in the code <b>%2</b> to proceed with login.</p>").arg(linkString, code));
ui->actionButton->setVisible(true);
connect(ui->actionButton, &QPushButton::clicked, [=]() {
DesktopServices::openUrl(uri);
QClipboard* cb = QApplication::clipboard();
cb->setText(code);
});
} }
void MSALoginDialog::hideVerificationUriAndCode() { void MSALoginDialog::hideVerificationUriAndCode() {
m_externalLoginTimer.stop(); m_externalLoginTimer.stop();
ui->actionButton->setVisible(false);
} }
void MSALoginDialog::setUserInputsEnabled(bool enable) void MSALoginDialog::setUserInputsEnabled(bool enable)
@ -110,6 +121,7 @@ void MSALoginDialog::onTaskFailed(const QString &reason)
// Re-enable user-interaction // Re-enable user-interaction
setUserInputsEnabled(true); setUserInputsEnabled(true);
ui->progressBar->setVisible(false); ui->progressBar->setVisible(false);
ui->actionButton->setVisible(false);
} }
void MSALoginDialog::onTaskSucceeded() void MSALoginDialog::onTaskSucceeded()

View File

@ -49,14 +49,25 @@ aaaaa</string>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QDialogButtonBox" name="buttonBox"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="orientation"> <item>
<enum>Qt::Horizontal</enum> <widget class="QPushButton" name="actionButton">
</property> <property name="text">
<property name="standardButtons"> <string>Open page and copy code</string>
<set>QDialogButtonBox::Cancel</set> </property>
</property> </widget>
</widget> </item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel</set>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>

View File

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

View File

@ -262,11 +262,6 @@
<property name="focusPolicy"> <property name="focusPolicy">
<enum>Qt::StrongFocus</enum> <enum>Qt::StrongFocus</enum>
</property> </property>
<item>
<property name="text">
<string>Default</string>
</property>
</item>
<item> <item>
<property name="text"> <property name="text">
<string>Simple (Dark Icons)</string> <string>Simple (Dark Icons)</string>
@ -307,6 +302,11 @@
<string>Custom</string> <string>Custom</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>MultiMC</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,69 +13,51 @@
* limitations under the License. * limitations under the License.
*/ */
#include "PasteEEPage.h" #include "PastePage.h"
#include "ui_PasteEEPage.h" #include "ui_PastePage.h"
#include <QMessageBox> #include <QMessageBox>
#include <QFileDialog> #include <QFileDialog>
#include <QStandardPaths> #include <QStandardPaths>
#include <QTabBar> #include <QTabBar>
#include <QVariant>
#include "settings/SettingsObject.h" #include "settings/SettingsObject.h"
#include "tools/BaseProfiler.h" #include "tools/BaseProfiler.h"
#include "Application.h" #include "Application.h"
PasteEEPage::PasteEEPage(QWidget *parent) : PastePage::PastePage(QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::PasteEEPage) ui(new Ui::PastePage)
{ {
static QRegularExpression validUrlRegExp("https?://.+");
ui->setupUi(this); ui->setupUi(this);
ui->urlChoices->setValidator(new QRegularExpressionValidator(validUrlRegExp, ui->urlChoices));
ui->tabWidget->tabBar()->hide();\ ui->tabWidget->tabBar()->hide();\
connect(ui->customAPIkeyEdit, &QLineEdit::textEdited, this, &PasteEEPage::textEdited);
loadSettings(); loadSettings();
} }
PasteEEPage::~PasteEEPage() PastePage::~PastePage()
{ {
delete ui; delete ui;
} }
void PasteEEPage::loadSettings() void PastePage::loadSettings()
{ {
auto s = APPLICATION->settings(); auto s = APPLICATION->settings();
QString keyToUse = s->get("PasteEEAPIKey").toString(); QString pastebinURL = s->get("PastebinURL").toString();
if(keyToUse == "multimc") ui->urlChoices->setCurrentText(pastebinURL);
{
ui->multimcButton->setChecked(true);
}
else
{
ui->customButton->setChecked(true);
ui->customAPIkeyEdit->setText(keyToUse);
}
} }
void PasteEEPage::applySettings() void PastePage::applySettings()
{ {
auto s = APPLICATION->settings(); auto s = APPLICATION->settings();
QString pastebinURL = ui->urlChoices->currentText();
QString pasteKeyToUse; s->set("PastebinURL", pastebinURL);
if (ui->customButton->isChecked())
pasteKeyToUse = ui->customAPIkeyEdit->text();
else
{
pasteKeyToUse = "multimc";
}
s->set("PasteEEAPIKey", pasteKeyToUse);
} }
bool PasteEEPage::apply() bool PastePage::apply()
{ {
applySettings(); applySettings();
return true; return true;
} }
void PasteEEPage::textEdited(const QString& text)
{
ui->customButton->setChecked(true);
}

View File

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

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>PasteEEPage</class> <class>PastePage</class>
<widget class="QWidget" name="PasteEEPage"> <widget class="QWidget" name="PastePage">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -36,39 +36,9 @@
<item> <item>
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="groupBox_2">
<property name="title"> <property name="title">
<string>paste.ee API key</string> <string>Pastebin URL</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_10"> <layout class="QVBoxLayout" name="verticalLayout_3">
<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>
<item> <item>
<widget class="Line" name="line"> <widget class="Line" name="line">
<property name="orientation"> <property name="orientation">
@ -76,10 +46,45 @@
</property> </property>
</widget> </widget>
</item> </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> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <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>
<property name="textFormat"> <property name="textFormat">
<enum>Qt::RichText</enum> <enum>Qt::RichText</enum>
@ -116,13 +121,7 @@
</widget> </widget>
<tabstops> <tabstops>
<tabstop>tabWidget</tabstop> <tabstop>tabWidget</tabstop>
<tabstop>multimcButton</tabstop>
<tabstop>customButton</tabstop>
<tabstop>customAPIkeyEdit</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections/> <connections/>
<buttongroups>
<buttongroup name="pasteButtonGroup"/>
</buttongroups>
</ui> </ui>

View File

@ -100,7 +100,7 @@
<item> <item>
<widget class="QPushButton" name="btnPaste"> <widget class="QPushButton" name="btnPaste">
<property name="toolTip"> <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>
<property name="text"> <property name="text">
<string>Upload</string> <string>Upload</string>

View File

@ -84,7 +84,7 @@
<item row="3" column="2"> <item row="3" column="2">
<widget class="QPushButton" name="btnPaste"> <widget class="QPushButton" name="btnPaste">
<property name="toolTip"> <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>
<property name="text"> <property name="text">
<string>Upload</string> <string>Upload</string>

View File

@ -6,6 +6,7 @@
#include <QLabel> #include <QLabel>
#include "Application.h" #include "Application.h"
#include "translations/TranslationsModel.h" #include "translations/TranslationsModel.h"
#include "settings/Setting.h"
LanguageSelectionWidget::LanguageSelectionWidget(QWidget *parent) : LanguageSelectionWidget::LanguageSelectionWidget(QWidget *parent) :
QWidget(parent) QWidget(parent)
@ -37,6 +38,9 @@ LanguageSelectionWidget::LanguageSelectionWidget(QWidget *parent) :
languageView->header()->setSectionResizeMode(0, QHeaderView::Stretch); languageView->header()->setSectionResizeMode(0, QHeaderView::Stretch);
connect(languageView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &LanguageSelectionWidget::languageRowChanged); connect(languageView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &LanguageSelectionWidget::languageRowChanged);
verticalLayout->setContentsMargins(0,0,0,0); verticalLayout->setContentsMargins(0,0,0,0);
auto language_setting = APPLICATION->settings()->getSetting("Language");
connect(language_setting.get(), &Setting::SettingChanged, this, &LanguageSelectionWidget::languageSettingChanged);
} }
QString LanguageSelectionWidget::getSelectedLanguageKey() const QString LanguageSelectionWidget::getSelectedLanguageKey() const
@ -64,3 +68,10 @@ void LanguageSelectionWidget::languageRowChanged(const QModelIndex& current, con
translations->selectLanguage(key); translations->selectLanguage(key);
translations->updateLanguage(key); translations->updateLanguage(key);
} }
void LanguageSelectionWidget::languageSettingChanged(const Setting &, const QVariant)
{
auto translations = APPLICATION->translations();
auto index = translations->selectedIndex();
languageView->setCurrentIndex(index);
}

View File

@ -20,6 +20,7 @@
class QVBoxLayout; class QVBoxLayout;
class QTreeView; class QTreeView;
class QLabel; class QLabel;
class Setting;
class LanguageSelectionWidget: public QWidget class LanguageSelectionWidget: public QWidget
{ {
@ -33,6 +34,7 @@ public:
protected slots: protected slots:
void languageRowChanged(const QModelIndex &current, const QModelIndex &previous); void languageRowChanged(const QModelIndex &current, const QModelIndex &previous);
void languageSettingChanged(const Setting &, const QVariant);
private: private:
QVBoxLayout *verticalLayout = nullptr; QVBoxLayout *verticalLayout = nullptr;

View File

@ -88,7 +88,7 @@ mkDerivation rec {
postInstall = '' postInstall = ''
install -Dm644 ../launcher/resources/multimc/scalable/launcher.svg $out/share/pixmaps/polymc.svg install -Dm644 ../launcher/resources/multimc/scalable/launcher.svg $out/share/pixmaps/polymc.svg
install -Dm644 ${desktopItem}/share/applications/polymc.desktop $out/share/applications/org.polymc.PolyMC.desktop install -Dm644 ${desktopItem}/share/applications/polymc.desktop $out/share/applications/org.polymc.polymc.desktop
# xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128 # xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
wrapProgram $out/bin/polymc \ wrapProgram $out/bin/polymc \

View File

@ -6,7 +6,7 @@
Name: polymc Name: polymc
Version: 1.0.5 Version: 1.0.5
Release: 1%{?dist} Release: 2%{?dist}
Summary: Minecraft launcher with ability to manage multiple instances Summary: Minecraft launcher with ability to manage multiple instances
# #
@ -61,23 +61,18 @@ Source0: https://github.com/PolyMC/PolyMC/archive/%{version}/%{name}-%{ve
Source1: https://github.com/MultiMC/libnbtplusplus/archive/%{libnbtplusplus_commit}/libnbtplusplus-%{libnbtplusplus_shortcommit}.tar.gz Source1: https://github.com/MultiMC/libnbtplusplus/archive/%{libnbtplusplus_commit}/libnbtplusplus-%{libnbtplusplus_shortcommit}.tar.gz
Source2: https://github.com/PolyMC/quazip/archive/%{quazip_commit}/quazip-%{quazip_shortcommit}.tar.gz Source2: https://github.com/PolyMC/quazip/archive/%{quazip_commit}/quazip-%{quazip_shortcommit}.tar.gz
BuildRequires: cmake3 BuildRequires: cmake
BuildRequires: desktop-file-utils BuildRequires: desktop-file-utils
BuildRequires: gcc-c++ BuildRequires: gcc-c++
# Fix warning: Could not complete Guile gdb module initialization from:
# /usr/share/gdb/guile/gdb/boot.scm
BuildRequires: gdb-headless
BuildRequires: java-devel BuildRequires: java-devel
BuildRequires: pkgconfig(gl) BuildRequires: %{?suse_version:lib}qt5-qtbase-devel
BuildRequires: pkgconfig(Qt5) BuildRequires: zlib-devel
BuildRequires: pkgconfig(zlib)
Requires: java-headless # Minecraft < 1.17
Requires: pkgconfig(gl) Recommends: java-1.8.0-openjdk-headless
Requires: pkgconfig(Qt5) # Minecraft >= 1.17
Requires: pkgconfig(zlib) Recommends: java-17-openjdk-headless
%description %description
PolyMC is a free, open source launcher for Minecraft. It allows you to have PolyMC is a free, open source launcher for Minecraft. It allows you to have
@ -105,7 +100,6 @@ mv -f libraries/libnbtplusplus-%{libnbtplusplus_commit} libraries/libnbtplusplus
%cmake_build %cmake_build
%install %install
%cmake_install %cmake_install
@ -115,8 +109,11 @@ echo "%{_libdir}/%{name}" > "%{buildroot}%{_sysconfdir}/ld.so.conf.d/%{name}-%{_
%check %check
# skip tests on systems that aren't officially supported
%if ! 0%{?suse_version}
%ctest %ctest
desktop-file-validate %{buildroot}%{_datadir}/applications/org.polymc.PolyMC.desktop desktop-file-validate %{buildroot}%{_datadir}/applications/org.polymc.polymc.desktop
%endif
%files %files
@ -127,11 +124,14 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/org.polymc.PolyMC.des
%{_datadir}/%{name}/* %{_datadir}/%{name}/*
%{_datadir}/metainfo/org.polymc.PolyMC.metainfo.xml %{_datadir}/metainfo/org.polymc.PolyMC.metainfo.xml
%{_datadir}/icons/hicolor/scalable/apps/org.polymc.PolyMC.svg %{_datadir}/icons/hicolor/scalable/apps/org.polymc.PolyMC.svg
%{_datadir}/applications/org.polymc.PolyMC.desktop %{_datadir}/applications/org.polymc.polymc.desktop
%config %{_sysconfdir}/ld.so.conf.d/* %config %{_sysconfdir}/ld.so.conf.d/*
%changelog %changelog
* Mon Jan 24 2022 Jan Drögehoff <sentrycraft123@gmail.com> - 1.0.5-2
- remove explicit dependencies, correct dependencies to work on OpenSuse
* Sun Jan 09 2022 Jan Drögehoff <sentrycraft123@gmail.com> - 1.0.5-1 * Sun Jan 09 2022 Jan Drögehoff <sentrycraft123@gmail.com> - 1.0.5-1
- Update to 1.0.5 - Update to 1.0.5

View File

@ -1,19 +1,19 @@
set(Launcher_CommonName "PolyMC") set(Launcher_CommonName "PolyMC")
set(Launcher_Copyright "PolyMC Contributors" PARENT_SCOPE) set(Launcher_Copyright "PolyMC Contributors" PARENT_SCOPE)
set(Launcher_Domain "github.com/PolyMC" PARENT_SCOPE) set(Launcher_Domain "polymc.org" PARENT_SCOPE)
set(Launcher_Name "${Launcher_CommonName}" PARENT_SCOPE) set(Launcher_Name "${Launcher_CommonName}" PARENT_SCOPE)
set(Launcher_DisplayName "${Launcher_CommonName} 5" PARENT_SCOPE) set(Launcher_DisplayName "${Launcher_CommonName}" PARENT_SCOPE)
set(Launcher_UserAgent "${Launcher_CommonName}/5.0" PARENT_SCOPE) set(Launcher_UserAgent "${Launcher_CommonName}/${Launcher_RELEASE_VERSION_NAME}" PARENT_SCOPE)
set(Launcher_ConfigFile "polymc.cfg" PARENT_SCOPE) set(Launcher_ConfigFile "polymc.cfg" PARENT_SCOPE)
set(Launcher_Git "https://github.com/PolyMC/PolyMC" PARENT_SCOPE) set(Launcher_Git "https://github.com/PolyMC/PolyMC" PARENT_SCOPE)
set(Launcher_Desktop "program_info/org.polymc.PolyMC.desktop" PARENT_SCOPE) set(Launcher_Desktop "program_info/org.polymc.polymc.desktop" PARENT_SCOPE)
set(Launcher_MetaInfo "program_info/org.polymc.PolyMC.metainfo.xml" PARENT_SCOPE) set(Launcher_MetaInfo "program_info/org.polymc.PolyMC.metainfo.xml" PARENT_SCOPE)
set(Launcher_SVG "program_info/org.polymc.PolyMC.svg" PARENT_SCOPE) set(Launcher_SVG "program_info/org.polymc.PolyMC.svg" PARENT_SCOPE)
set(Launcher_Branding_ICNS "program_info/polymc.icns" PARENT_SCOPE) set(Launcher_Branding_ICNS "program_info/polymc.icns" PARENT_SCOPE)
set(Launcher_Branding_WindowsRC "program_info/polymc.rc" PARENT_SCOPE) set(Launcher_Branding_WindowsRC "program_info/polymc.rc" PARENT_SCOPE)
set(Launcher_Branding_LogoQRC "program_info/polymc.qrc" PARENT_SCOPE) set(Launcher_Branding_LogoQRC "program_info/polymc.qrc" PARENT_SCOPE)
configure_file(org.polymc.PolyMC.desktop.in org.polymc.PolyMC.desktop) configure_file(org.polymc.polymc.desktop.in org.polymc.polymc.desktop)
configure_file(org.polymc.PolyMC.metainfo.xml.in org.polymc.PolyMC.metainfo.xml) configure_file(org.polymc.PolyMC.metainfo.xml.in org.polymc.PolyMC.metainfo.xml)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg width="1424" height="512" version="1.1" viewBox="0 0 376.77 135.47" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="linearGradient84726" x1="4.4979" x2="12.435" y1="3.8011" y2="9.5681" gradientUnits="userSpaceOnUse">
<stop stop-color="#88b858" offset="0"/>
<stop stop-color="#72b147" offset=".5"/>
<stop stop-color="#5a9a30" offset="1"/>
</linearGradient>
</defs>
<g transform="matrix(6.95 0 0 6.9572 3.7759 1.0225)">
<g>
<path d="m3.561 16.016s0-3.5642 4.9056-3.5642c4.9069 0 4.9056 3.5642 4.9056 3.5642z" fill="#765338"/>
<path d="m8.4667 12.452-4.9056 3.5642-3.0319-9.3311z" fill="#b7835a"/>
<path d="m8.4667 12.452 7.9375-5.7669-3.0319 9.3311z" fill="#5b422d"/>
<path d="m8.8308 12.716-0.36417 0.26458-0.36417-0.26458c0-0.26458 0.36417-0.26458 0.36417-0.26458s0.36417 0 0.36417 0.26458z" fill="#72b147"/>
<path d="m8.4667 12.452s-2e-7 -5.7669 7.9375-5.7669l-0.22507 0.69269-0.91853 1.1965-0.91853 0.13819-0.91853 1.1965-0.91853 0.13819-0.91853 1.1965-0.91853 0.13819-0.91853 1.1965-0.91853 0.13819z" fill="#5a9a30"/>
<path d="m8.1025 12.716-0.91853-0.13819-0.91853-1.1965-0.91853-0.13819-0.91853-1.1965-0.91853-0.13819-0.91853-1.1965-0.91853-0.13819-0.91853-1.1965-0.22507-0.69269c7.9375 1e-7 7.9375 5.7669 7.9375 5.7669z" fill="#88b858"/>
<path d="m0.52917 6.6846 7.9375 5.7669 7.9375-5.7669-7.9375-5.7669z" fill="url(#linearGradient84726)"/>
</g>
<path d="m0.75424 7.3773-0.22507-0.69269 7.9375 5.7669 7.9375-5.7669-0.22507 0.69269-7.7124 5.6034z" fill-opacity="0"/>
</g>
<g id="polymc-header-text" fill="black" transform="matrix(6.9306 0 0 6.9306 -702.9 -659.02)" stroke-width=".26458" aria-label="PolyMC">
<path d="m120.51 108.48v2.7957h-1.3074v-7.5241h2.8784q1.2609 0 1.9999 0.65629 0.74414 0.65629 0.74414 1.7363 0 1.1059-0.72864 1.7208-0.72346 0.61495-2.0309 0.61495zm0-1.049h1.571q0.69763 0 1.0645-0.32556 0.3669-0.33073 0.3669-0.95084 0-0.60978-0.37207-0.97152-0.37207-0.3669-1.0232-0.37723h-1.6071z"/>
<path d="m125.55 108.43q0-0.82165 0.32556-1.4779 0.32556-0.66145 0.91467-1.0128 0.58911-0.35657 1.3539-0.35657 1.1317 0 1.8345 0.72864 0.70797 0.72863 0.76481 1.9327l5e-3 0.29455q0 0.82682-0.32039 1.478-0.31523 0.65112-0.9095 1.0077-0.58911 0.35657-1.3643 0.35657-1.1834 0-1.8965-0.78548-0.70796-0.79065-0.70796-2.1032zm1.2557 0.10852q0 0.863 0.35657 1.3539 0.35656 0.48576 0.99218 0.48576t0.98702-0.49609q0.35657-0.49609 0.35657-1.4521 0-0.84749-0.36691-1.3436-0.36173-0.49609-0.98701-0.49609-0.61495 0-0.97668 0.49092-0.36174 0.48576-0.36174 1.4573z"/>
<path d="m133.14 111.27h-1.2557v-7.9375h1.2557z"/>
<path d="m136.46 109.47 1.1369-3.793h1.3384l-2.2221 6.4389q-0.5116 1.4108-1.7363 1.4108-0.27388 0-0.60461-0.093v-0.97151l0.23771 0.0155q0.47542 0 0.71314-0.1757 0.24287-0.17053 0.3824-0.57877l0.18087-0.48059-1.9637-5.5655h1.3539z"/>
<path d="m141.48 103.75 2.1704 5.7671 2.1652-5.7671h1.6898v7.5241h-1.3022v-2.4805l0.12919-3.3176-2.2221 5.7981h-0.93534l-2.2169-5.7929 0.12919 3.3124v2.4805h-1.3022v-7.5241z"/>
<path d="m154.79 108.82q-0.11369 1.2041-0.88883 1.881-0.77515 0.67179-2.0619 0.67179-0.89916 0-1.5865-0.42375-0.68212-0.42891-1.0542-1.2144t-0.38758-1.8242v-0.7028q0-1.0645 0.37724-1.8758 0.37724-0.81131 1.08-1.2506 0.70797-0.43925 1.633-0.43925 1.2454 0 2.005 0.67696 0.75965 0.67696 0.88367 1.912h-1.3022q-0.093-0.81132-0.47543-1.1679-0.37723-0.36174-1.111-0.36174-0.85265 0-1.3126 0.62529-0.45475 0.62011-0.46509 1.8242v0.66662q0 1.2196 0.43408 1.8604 0.43925 0.64078 1.2816 0.64078 0.76998 0 1.1576-0.34623t0.49093-1.1524z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg width="1424" height="512" version="1.1" viewBox="0 0 376.77 135.47" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="linearGradient84726" x1="4.4979" x2="12.435" y1="3.8011" y2="9.5681" gradientUnits="userSpaceOnUse">
<stop stop-color="#88b858" offset="0"/>
<stop stop-color="#72b147" offset=".5"/>
<stop stop-color="#5a9a30" offset="1"/>
</linearGradient>
</defs>
<g transform="matrix(6.95 0 0 6.9572 3.7759 1.0225)">
<g>
<path d="m3.561 16.016s0-3.5642 4.9056-3.5642c4.9069 0 4.9056 3.5642 4.9056 3.5642z" fill="#765338"/>
<path d="m8.4667 12.452-4.9056 3.5642-3.0319-9.3311z" fill="#b7835a"/>
<path d="m8.4667 12.452 7.9375-5.7669-3.0319 9.3311z" fill="#5b422d"/>
<path d="m8.8308 12.716-0.36417 0.26458-0.36417-0.26458c0-0.26458 0.36417-0.26458 0.36417-0.26458s0.36417 0 0.36417 0.26458z" fill="#72b147"/>
<path d="m8.4667 12.452s-2e-7 -5.7669 7.9375-5.7669l-0.22507 0.69269-0.91853 1.1965-0.91853 0.13819-0.91853 1.1965-0.91853 0.13819-0.91853 1.1965-0.91853 0.13819-0.91853 1.1965-0.91853 0.13819z" fill="#5a9a30"/>
<path d="m8.1025 12.716-0.91853-0.13819-0.91853-1.1965-0.91853-0.13819-0.91853-1.1965-0.91853-0.13819-0.91853-1.1965-0.91853-0.13819-0.91853-1.1965-0.22507-0.69269c7.9375 1e-7 7.9375 5.7669 7.9375 5.7669z" fill="#88b858"/>
<path d="m0.52917 6.6846 7.9375 5.7669 7.9375-5.7669-7.9375-5.7669z" fill="url(#linearGradient84726)"/>
</g>
<path d="m0.75424 7.3773-0.22507-0.69269 7.9375 5.7669 7.9375-5.7669-0.22507 0.69269-7.7124 5.6034z" fill-opacity="0"/>
</g>
<g id="polymc-header-text" fill="white" transform="matrix(6.9306 0 0 6.9306 -702.9 -659.02)" stroke-width=".26458" aria-label="PolyMC">
<path d="m120.51 108.48v2.7957h-1.3074v-7.5241h2.8784q1.2609 0 1.9999 0.65629 0.74414 0.65629 0.74414 1.7363 0 1.1059-0.72864 1.7208-0.72346 0.61495-2.0309 0.61495zm0-1.049h1.571q0.69763 0 1.0645-0.32556 0.3669-0.33073 0.3669-0.95084 0-0.60978-0.37207-0.97152-0.37207-0.3669-1.0232-0.37723h-1.6071z"/>
<path d="m125.55 108.43q0-0.82165 0.32556-1.4779 0.32556-0.66145 0.91467-1.0128 0.58911-0.35657 1.3539-0.35657 1.1317 0 1.8345 0.72864 0.70797 0.72863 0.76481 1.9327l5e-3 0.29455q0 0.82682-0.32039 1.478-0.31523 0.65112-0.9095 1.0077-0.58911 0.35657-1.3643 0.35657-1.1834 0-1.8965-0.78548-0.70796-0.79065-0.70796-2.1032zm1.2557 0.10852q0 0.863 0.35657 1.3539 0.35656 0.48576 0.99218 0.48576t0.98702-0.49609q0.35657-0.49609 0.35657-1.4521 0-0.84749-0.36691-1.3436-0.36173-0.49609-0.98701-0.49609-0.61495 0-0.97668 0.49092-0.36174 0.48576-0.36174 1.4573z"/>
<path d="m133.14 111.27h-1.2557v-7.9375h1.2557z"/>
<path d="m136.46 109.47 1.1369-3.793h1.3384l-2.2221 6.4389q-0.5116 1.4108-1.7363 1.4108-0.27388 0-0.60461-0.093v-0.97151l0.23771 0.0155q0.47542 0 0.71314-0.1757 0.24287-0.17053 0.3824-0.57877l0.18087-0.48059-1.9637-5.5655h1.3539z"/>
<path d="m141.48 103.75 2.1704 5.7671 2.1652-5.7671h1.6898v7.5241h-1.3022v-2.4805l0.12919-3.3176-2.2221 5.7981h-0.93534l-2.2169-5.7929 0.12919 3.3124v2.4805h-1.3022v-7.5241z"/>
<path d="m154.79 108.82q-0.11369 1.2041-0.88883 1.881-0.77515 0.67179-2.0619 0.67179-0.89916 0-1.5865-0.42375-0.68212-0.42891-1.0542-1.2144t-0.38758-1.8242v-0.7028q0-1.0645 0.37724-1.8758 0.37724-0.81131 1.08-1.2506 0.70797-0.43925 1.633-0.43925 1.2454 0 2.005 0.67696 0.75965 0.67696 0.88367 1.912h-1.3022q-0.093-0.81132-0.47543-1.1679-0.37723-0.36174-1.111-0.36174-0.85265 0-1.3126 0.62529-0.45475 0.62011-0.46509 1.8242v0.66662q0 1.2196 0.43408 1.8604 0.43925 0.64078 1.2816 0.64078 0.76998 0 1.1576-0.34623t0.49093-1.1524z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB