Merge pull request #3931 from jamierocks/july-wrk2
NOISSUE Debranding, fix annoying warning, updated Patreon logo
@ -75,6 +75,9 @@ set(MultiMC_META_URL "https://meta.multimc.org/v1/" CACHE STRING "URL to fetch M
|
||||
# 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")
|
||||
|
||||
# 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
|
||||
set(MultiMC_ANALYTICS_ID "UA-87731965-2" CACHE STRING "ID you can get from Google analytics")
|
||||
|
||||
|
@ -37,6 +37,7 @@ BaseInstance::BaseInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr s
|
||||
m_settings->registerSetting("notes", "");
|
||||
m_settings->registerSetting("lastLaunchTime", 0);
|
||||
m_settings->registerSetting("totalTimePlayed", 0);
|
||||
m_settings->registerSetting("lastTimePlayed", 0);
|
||||
|
||||
// Custom Commands
|
||||
auto commandSetting = m_settings->registerSetting({"OverrideCommands","OverrideLaunchCmd"}, false);
|
||||
@ -146,9 +147,12 @@ void BaseInstance::setRunning(bool running)
|
||||
}
|
||||
else
|
||||
{
|
||||
qint64 current = settings()->get("totalTimePlayed").toLongLong();
|
||||
QDateTime timeEnded = QDateTime::currentDateTime();
|
||||
|
||||
qint64 current = settings()->get("totalTimePlayed").toLongLong();
|
||||
settings()->set("totalTimePlayed", current + m_timeStarted.secsTo(timeEnded));
|
||||
settings()->set("lastTimePlayed", m_timeStarted.secsTo(timeEnded));
|
||||
|
||||
emit propertiesChanged(this);
|
||||
}
|
||||
|
||||
@ -166,9 +170,20 @@ int64_t BaseInstance::totalTimePlayed() const
|
||||
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()
|
||||
{
|
||||
settings()->reset("totalTimePlayed");
|
||||
settings()->reset("lastTimePlayed");
|
||||
}
|
||||
|
||||
QString BaseInstance::instanceType() const
|
||||
|
@ -87,6 +87,7 @@ public:
|
||||
void setRunning(bool running);
|
||||
bool isRunning() const;
|
||||
int64_t totalTimePlayed() const;
|
||||
int64_t lastTimePlayed() const;
|
||||
void resetTimePlayed();
|
||||
|
||||
/// get the type of this instance
|
||||
|
@ -798,9 +798,15 @@ QString MinecraftInstance::getStatusbarDescription()
|
||||
|
||||
QString description;
|
||||
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())
|
||||
{
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "Download.h"
|
||||
|
||||
#include "BuildConfig.h"
|
||||
#include <QFileInfo>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
@ -94,7 +95,7 @@ void Download::start()
|
||||
return;
|
||||
}
|
||||
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0");
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT);
|
||||
|
||||
QNetworkReply *rep = ENV.qnam().get(request);
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QFile>
|
||||
#include <BuildConfig.h>
|
||||
|
||||
PasteUpload::PasteUpload(QWidget *window, QString text, QString key) : m_window(window)
|
||||
{
|
||||
@ -34,7 +35,7 @@ bool PasteUpload::validateText()
|
||||
void PasteUpload::executeTask()
|
||||
{
|
||||
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-Length", QByteArray::number(m_jsonContent.size()));
|
||||
|
@ -20,9 +20,9 @@ void ImgurAlbumCreation::start()
|
||||
{
|
||||
m_status = Job_InProgress;
|
||||
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.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");
|
||||
|
||||
QStringList hashes;
|
||||
|
@ -23,8 +23,8 @@ void ImgurUpload::start()
|
||||
finished = false;
|
||||
m_status = Job_InProgress;
|
||||
QNetworkRequest request(m_url);
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)");
|
||||
request.setRawHeader("Authorization", "Client-ID 5b97b0713fba4a3");
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT_UNCACHED);
|
||||
request.setRawHeader("Authorization", QString("Client-ID %1").arg(BuildConfig.IMGUR_CLIENT_ID).toStdString().c_str());
|
||||
request.setRawHeader("Accept", "application/json");
|
||||
|
||||
QFile f(m_shot->m_file.absoluteFilePath());
|
||||
|
@ -95,9 +95,7 @@ void Technic::ListModel::performSearch()
|
||||
NetJob *netJob = new NetJob("Technic::Search");
|
||||
QString searchUrl = "";
|
||||
if (currentSearchTerm.isEmpty()) {
|
||||
searchUrl = QString(
|
||||
"https://api.technicpack.net/trending?build=multimc"
|
||||
).arg(currentSearchTerm);
|
||||
searchUrl = "https://api.technicpack.net/trending?build=multimc";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Before Width: | Height: | Size: 682 B After Width: | Height: | Size: 840 B |
Before Width: | Height: | Size: 976 B After Width: | Height: | Size: 939 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 977 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 1.6 KiB |
@ -33,6 +33,7 @@ Config::Config()
|
||||
VERSION_STR = "@MultiMC_VERSION_STRING@";
|
||||
NEWS_RSS_URL = "@MultiMC_NEWS_RSS_URL@";
|
||||
PASTE_EE_KEY = "@MultiMC_PASTE_EE_API_KEY@";
|
||||
IMGUR_CLIENT_ID = "@MultiMC_IMGUR_CLIENT_ID@";
|
||||
META_URL = "@MultiMC_META_URL@";
|
||||
|
||||
BUG_TRACKER_URL = "@MultiMC_BUG_TRACKER_URL@";
|
||||
|
@ -31,6 +31,11 @@ public:
|
||||
/// URL for the updater's channel
|
||||
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
|
||||
QString ANALYTICS_ID;
|
||||
|
||||
@ -60,6 +65,11 @@ public:
|
||||
*/
|
||||
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
|
||||
*/
|
||||
|