Merge pull request #3931 from jamierocks/july-wrk2

NOISSUE Debranding, fix annoying warning, updated Patreon logo
This commit is contained in:
Petr Mrázek 2021-07-22 17:40:36 +02:00 committed by GitHub
commit 4fc37f5a35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 48 additions and 12 deletions

View File

@ -75,6 +75,9 @@ set(MultiMC_META_URL "https://meta.multimc.org/v1/" CACHE STRING "URL to fetch M
# paste.ee API key # paste.ee API key
set(MultiMC_PASTE_EE_API_KEY "utLvciUouSURFzfjPxLBf5W4ISsUX4pwBDF7N1AfZ" CACHE STRING "API key you can get from paste.ee when you register an account") set(MultiMC_PASTE_EE_API_KEY "utLvciUouSURFzfjPxLBf5W4ISsUX4pwBDF7N1AfZ" CACHE STRING "API key you can get from paste.ee when you register an account")
# Imgur API Client ID
set(MultiMC_IMGUR_CLIENT_ID "5b97b0713fba4a3" CACHE STRING "Client ID you can get from Imgur when you register an application")
# Google analytics ID # Google analytics ID
set(MultiMC_ANALYTICS_ID "UA-87731965-2" CACHE STRING "ID you can get from Google analytics") set(MultiMC_ANALYTICS_ID "UA-87731965-2" CACHE STRING "ID you can get from Google analytics")

View File

@ -37,6 +37,7 @@ BaseInstance::BaseInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr s
m_settings->registerSetting("notes", ""); m_settings->registerSetting("notes", "");
m_settings->registerSetting("lastLaunchTime", 0); m_settings->registerSetting("lastLaunchTime", 0);
m_settings->registerSetting("totalTimePlayed", 0); m_settings->registerSetting("totalTimePlayed", 0);
m_settings->registerSetting("lastTimePlayed", 0);
// Custom Commands // Custom Commands
auto commandSetting = m_settings->registerSetting({"OverrideCommands","OverrideLaunchCmd"}, false); auto commandSetting = m_settings->registerSetting({"OverrideCommands","OverrideLaunchCmd"}, false);
@ -146,9 +147,12 @@ void BaseInstance::setRunning(bool running)
} }
else else
{ {
qint64 current = settings()->get("totalTimePlayed").toLongLong();
QDateTime timeEnded = QDateTime::currentDateTime(); QDateTime timeEnded = QDateTime::currentDateTime();
qint64 current = settings()->get("totalTimePlayed").toLongLong();
settings()->set("totalTimePlayed", current + m_timeStarted.secsTo(timeEnded)); settings()->set("totalTimePlayed", current + m_timeStarted.secsTo(timeEnded));
settings()->set("lastTimePlayed", m_timeStarted.secsTo(timeEnded));
emit propertiesChanged(this); emit propertiesChanged(this);
} }
@ -166,9 +170,20 @@ int64_t BaseInstance::totalTimePlayed() const
return current; return current;
} }
int64_t BaseInstance::lastTimePlayed() const
{
if(m_isRunning)
{
QDateTime timeNow = QDateTime::currentDateTime();
return m_timeStarted.secsTo(timeNow);
}
return settings()->get("lastTimePlayed").toLongLong();
}
void BaseInstance::resetTimePlayed() void BaseInstance::resetTimePlayed()
{ {
settings()->reset("totalTimePlayed"); settings()->reset("totalTimePlayed");
settings()->reset("lastTimePlayed");
} }
QString BaseInstance::instanceType() const QString BaseInstance::instanceType() const

View File

@ -87,6 +87,7 @@ public:
void setRunning(bool running); void setRunning(bool running);
bool isRunning() const; bool isRunning() const;
int64_t totalTimePlayed() const; int64_t totalTimePlayed() const;
int64_t lastTimePlayed() const;
void resetTimePlayed(); void resetTimePlayed();
/// get the type of this instance /// get the type of this instance

View File

@ -798,9 +798,15 @@ QString MinecraftInstance::getStatusbarDescription()
QString description; QString description;
description.append(tr("Minecraft %1 (%2)").arg(m_components->getComponentVersion("net.minecraft")).arg(typeName())); description.append(tr("Minecraft %1 (%2)").arg(m_components->getComponentVersion("net.minecraft")).arg(typeName()));
if(m_settings->get("ShowGameTime").toBool() && totalTimePlayed() > 0) if(m_settings->get("ShowGameTime").toBool())
{ {
description.append(tr(", played for %1").arg(prettifyTimeDuration(totalTimePlayed()))); if (lastTimePlayed() > 0) {
description.append(tr(", last played for %1").arg(prettifyTimeDuration(lastTimePlayed())));
}
if (totalTimePlayed() > 0) {
description.append(tr(", total played for %1").arg(prettifyTimeDuration(totalTimePlayed())));
}
} }
if(hasCrashed()) if(hasCrashed())
{ {

View File

@ -15,6 +15,7 @@
#include "Download.h" #include "Download.h"
#include "BuildConfig.h"
#include <QFileInfo> #include <QFileInfo>
#include <QDateTime> #include <QDateTime>
#include <QDebug> #include <QDebug>
@ -94,7 +95,7 @@ void Download::start()
return; return;
} }
request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0"); request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT);
QNetworkReply *rep = ENV.qnam().get(request); QNetworkReply *rep = ENV.qnam().get(request);

View File

@ -5,6 +5,7 @@
#include <QJsonArray> #include <QJsonArray>
#include <QJsonDocument> #include <QJsonDocument>
#include <QFile> #include <QFile>
#include <BuildConfig.h>
PasteUpload::PasteUpload(QWidget *window, QString text, QString key) : m_window(window) PasteUpload::PasteUpload(QWidget *window, QString text, QString key) : m_window(window)
{ {
@ -34,7 +35,7 @@ bool PasteUpload::validateText()
void PasteUpload::executeTask() void PasteUpload::executeTask()
{ {
QNetworkRequest request(QUrl("https://api.paste.ee/v1/pastes")); QNetworkRequest request(QUrl("https://api.paste.ee/v1/pastes"));
request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)"); request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT_UNCACHED);
request.setRawHeader("Content-Type", "application/json"); request.setRawHeader("Content-Type", "application/json");
request.setRawHeader("Content-Length", QByteArray::number(m_jsonContent.size())); request.setRawHeader("Content-Length", QByteArray::number(m_jsonContent.size()));

View File

@ -20,9 +20,9 @@ void ImgurAlbumCreation::start()
{ {
m_status = Job_InProgress; m_status = Job_InProgress;
QNetworkRequest request(m_url); QNetworkRequest request(m_url);
request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)"); request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT_UNCACHED);
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
request.setRawHeader("Authorization", "Client-ID 5b97b0713fba4a3"); request.setRawHeader("Authorization", QString("Client-ID %1").arg(BuildConfig.IMGUR_CLIENT_ID).toStdString().c_str());
request.setRawHeader("Accept", "application/json"); request.setRawHeader("Accept", "application/json");
QStringList hashes; QStringList hashes;

View File

@ -23,8 +23,8 @@ void ImgurUpload::start()
finished = false; finished = false;
m_status = Job_InProgress; m_status = Job_InProgress;
QNetworkRequest request(m_url); QNetworkRequest request(m_url);
request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)"); request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT_UNCACHED);
request.setRawHeader("Authorization", "Client-ID 5b97b0713fba4a3"); request.setRawHeader("Authorization", QString("Client-ID %1").arg(BuildConfig.IMGUR_CLIENT_ID).toStdString().c_str());
request.setRawHeader("Accept", "application/json"); request.setRawHeader("Accept", "application/json");
QFile f(m_shot->m_file.absoluteFilePath()); QFile f(m_shot->m_file.absoluteFilePath());

View File

@ -95,9 +95,7 @@ void Technic::ListModel::performSearch()
NetJob *netJob = new NetJob("Technic::Search"); NetJob *netJob = new NetJob("Technic::Search");
QString searchUrl = ""; QString searchUrl = "";
if (currentSearchTerm.isEmpty()) { if (currentSearchTerm.isEmpty()) {
searchUrl = QString( searchUrl = "https://api.technicpack.net/trending?build=multimc";
"https://api.technicpack.net/trending?build=multimc"
).arg(currentSearchTerm);
} }
else else
{ {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 682 B

After

Width:  |  Height:  |  Size: 840 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 976 B

After

Width:  |  Height:  |  Size: 939 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 977 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -33,6 +33,7 @@ Config::Config()
VERSION_STR = "@MultiMC_VERSION_STRING@"; VERSION_STR = "@MultiMC_VERSION_STRING@";
NEWS_RSS_URL = "@MultiMC_NEWS_RSS_URL@"; NEWS_RSS_URL = "@MultiMC_NEWS_RSS_URL@";
PASTE_EE_KEY = "@MultiMC_PASTE_EE_API_KEY@"; PASTE_EE_KEY = "@MultiMC_PASTE_EE_API_KEY@";
IMGUR_CLIENT_ID = "@MultiMC_IMGUR_CLIENT_ID@";
META_URL = "@MultiMC_META_URL@"; META_URL = "@MultiMC_META_URL@";
BUG_TRACKER_URL = "@MultiMC_BUG_TRACKER_URL@"; BUG_TRACKER_URL = "@MultiMC_BUG_TRACKER_URL@";

View File

@ -31,6 +31,11 @@ public:
/// URL for the updater's channel /// URL for the updater's channel
QString CHANLIST_URL; QString CHANLIST_URL;
/// User-Agent to use.
QString USER_AGENT = "MultiMC/5.0";
/// User-Agent to use for uncached requests.
QString USER_AGENT_UNCACHED = "MultiMC/5.0 (Uncached)";
/// Google analytics ID /// Google analytics ID
QString ANALYTICS_ID; QString ANALYTICS_ID;
@ -60,6 +65,11 @@ public:
*/ */
QString PASTE_EE_KEY; QString PASTE_EE_KEY;
/**
* Client ID you can get from Imgur when you register an application
*/
QString IMGUR_CLIENT_ID;
/** /**
* MultiMC Metadata repository URL prefix * MultiMC Metadata repository URL prefix
*/ */