Get rid of long rebuilds because of minor cmake config changes
This commit is contained in:
parent
ad9d082f57
commit
42e305bb9d
@ -179,7 +179,7 @@ ELSE()
|
||||
ENDIF()
|
||||
|
||||
######## Configure header ########
|
||||
configure_file("${PROJECT_SOURCE_DIR}/config.h.in" "${PROJECT_BINARY_DIR}/include/config.h")
|
||||
configure_file("${PROJECT_SOURCE_DIR}/Config.cpp.in" "${PROJECT_BINARY_DIR}/Config.cpp")
|
||||
|
||||
|
||||
######## Other Stuff ########
|
||||
@ -257,8 +257,9 @@ SET(MULTIMC_SOURCES
|
||||
# Application base
|
||||
MultiMC.h
|
||||
MultiMC.cpp
|
||||
MultiMCVersion.h
|
||||
MMCError.h
|
||||
Config.h
|
||||
${PROJECT_BINARY_DIR}/Config.cpp
|
||||
|
||||
# Logging
|
||||
logger/QsDebugOutput.cpp
|
||||
|
65
Config.cpp.in
Normal file
65
Config.cpp.in
Normal file
@ -0,0 +1,65 @@
|
||||
#include "Config.h"
|
||||
|
||||
Config BuildConfig;
|
||||
|
||||
Config::Config()
|
||||
{
|
||||
static bool ON = true;
|
||||
static bool OFF = false;
|
||||
// Version information
|
||||
VERSION_MAJOR = @MultiMC_VERSION_MAJOR@;
|
||||
VERSION_MINOR = @MultiMC_VERSION_MINOR@;
|
||||
VERSION_HOTFIX = @MultiMC_VERSION_HOTFIX@;
|
||||
VERSION_BUILD = @MultiMC_VERSION_BUILD@;
|
||||
VERSION_TYPE = "@MultiMC_VERSION_TYPE@";
|
||||
|
||||
if(VERSION_TYPE == "Release")
|
||||
versionTypeEnum = Release;
|
||||
else if(VERSION_TYPE == "ReleaseCandidate")
|
||||
versionTypeEnum = ReleaseCandidate;
|
||||
else if(VERSION_TYPE == "Development")
|
||||
versionTypeEnum = Development;
|
||||
else
|
||||
versionTypeEnum = Custom;
|
||||
VERSION_CHANNEL = "@MultiMC_VERSION_CHANNEL@";
|
||||
BUILD_PLATFORM = "@MultiMC_BUILD_PLATFORM@";
|
||||
CHANLIST_URL = "@MultiMC_CHANLIST_URL@";
|
||||
NOTIFICATION_URL = "@MultiMC_NOTIFICATION_URL@";
|
||||
FULL_VERSION_STR = "@MultiMC_VERSION_MAJOR@.@MultiMC_VERSION_MINOR@.@MultiMC_VERSION_BUILD@";
|
||||
|
||||
UPDATER_DRY_RUN = @MultiMC_UPDATER_DRY_RUN@;
|
||||
UPDATER_FORCE_LOCAL = @MultiMC_UPDATER_FORCE_LOCAL@;
|
||||
|
||||
GIT_COMMIT = "@MultiMC_GIT_COMMIT@";
|
||||
VERSION_STR = "@MultiMC_VERSION_STRING@";
|
||||
NEWS_RSS_URL = "@MultiMC_NEWS_RSS_URL@";
|
||||
}
|
||||
|
||||
QString Config::versionTypeName() const
|
||||
{
|
||||
switch (versionTypeEnum)
|
||||
{
|
||||
case Release:
|
||||
return "Stable Release";
|
||||
case ReleaseCandidate:
|
||||
return "Release Candidate";
|
||||
case Development:
|
||||
return "Development";
|
||||
case Custom:
|
||||
default:
|
||||
return "Custom";
|
||||
}
|
||||
}
|
||||
|
||||
QString Config::printableVersionString() const
|
||||
{
|
||||
QString vstr = QString("%1.%2").arg(QString::number(VERSION_MAJOR), QString::number(VERSION_MINOR));
|
||||
|
||||
if (VERSION_HOTFIX > 0) vstr += "." + QString::number(VERSION_HOTFIX);
|
||||
|
||||
// If the build is a development build or release candidate, add that info to the end.
|
||||
if (versionTypeEnum == Development) vstr += "-dev" + QString::number(VERSION_BUILD);
|
||||
else if (versionTypeEnum == ReleaseCandidate) vstr += "-rc" + QString::number(VERSION_BUILD);
|
||||
|
||||
return vstr;
|
||||
}
|
86
Config.h
Normal file
86
Config.h
Normal file
@ -0,0 +1,86 @@
|
||||
#pragma once
|
||||
#include <QString>
|
||||
|
||||
/**
|
||||
* \brief The Config class holds all the build-time information passed from the build system.
|
||||
*/
|
||||
class Config
|
||||
{
|
||||
public:
|
||||
Config();
|
||||
/// The major version number.
|
||||
int VERSION_MAJOR;
|
||||
/// The minor version number.
|
||||
int VERSION_MINOR;
|
||||
/// The hotfix number.
|
||||
int VERSION_HOTFIX;
|
||||
/// The build number.
|
||||
int VERSION_BUILD;
|
||||
/// The build type, as specified at build time.
|
||||
QString VERSION_TYPE;
|
||||
|
||||
/// The build type, transformed.
|
||||
enum Type
|
||||
{
|
||||
/// Version type for stable release builds.
|
||||
Release,
|
||||
|
||||
/// Version type for release candidates.
|
||||
ReleaseCandidate,
|
||||
|
||||
/// Version type for development builds.
|
||||
Development,
|
||||
|
||||
/// Version type for custom builds. This is the default when no version type is specified.
|
||||
Custom
|
||||
} versionTypeEnum;
|
||||
|
||||
/**
|
||||
* The version channel
|
||||
* This is used by the updater to determine what channel the current version came from.
|
||||
*/
|
||||
QString VERSION_CHANNEL;
|
||||
|
||||
/// A short string identifying this build's platform. For example, "lin64" or "win32".
|
||||
QString BUILD_PLATFORM;
|
||||
|
||||
/// URL for the updater's channel
|
||||
QString CHANLIST_URL;
|
||||
|
||||
/// URL for notifications
|
||||
QString NOTIFICATION_URL;
|
||||
|
||||
/// Used for matching notifications
|
||||
QString FULL_VERSION_STR;
|
||||
|
||||
/// enabled for updater dry run
|
||||
bool UPDATER_DRY_RUN;
|
||||
|
||||
/// enabled for updater dry run
|
||||
bool UPDATER_FORCE_LOCAL;
|
||||
|
||||
/// The commit hash of this build
|
||||
QString GIT_COMMIT;
|
||||
|
||||
/// This is printed on start to standard output
|
||||
QString VERSION_STR;
|
||||
|
||||
/**
|
||||
* This is used to fetch the news RSS feed.
|
||||
* It defaults in CMakeLists.txt to "http://multimc.org/rss.xml"
|
||||
*/
|
||||
QString NEWS_RSS_URL;
|
||||
|
||||
/**
|
||||
* \brief Converts the Version to a string.
|
||||
* \return The version number in string format (major.minor.revision.build).
|
||||
*/
|
||||
QString printableVersionString() const;
|
||||
|
||||
/**
|
||||
* returns a string representation of the version channel type, suitable for printing.
|
||||
*/
|
||||
QString versionTypeName() const;
|
||||
};
|
||||
|
||||
extern Config BuildConfig;
|
18
MultiMC.cpp
18
MultiMC.cpp
@ -1,4 +1,6 @@
|
||||
#include "MultiMC.h"
|
||||
#include "Config.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
@ -50,9 +52,7 @@ static const int APPDATA_BUFFER_SIZE = 1024;
|
||||
using namespace Util::Commandline;
|
||||
|
||||
MultiMC::MultiMC(int &argc, char **argv, bool root_override)
|
||||
: QApplication(argc, argv),
|
||||
m_version{VERSION_MAJOR, VERSION_MINOR, VERSION_HOTFIX, VERSION_BUILD,
|
||||
MultiMCVersion::VERSION_TYPE, VERSION_CHANNEL, BUILD_PLATFORM}
|
||||
: QApplication(argc, argv)
|
||||
{
|
||||
setOrganizationName("MultiMC");
|
||||
setApplicationName("MultiMC5");
|
||||
@ -111,8 +111,8 @@ MultiMC::MultiMC(int &argc, char **argv, bool root_override)
|
||||
// display version and exit
|
||||
if (args["version"].toBool())
|
||||
{
|
||||
std::cout << "Version " << VERSION_STR << std::endl;
|
||||
std::cout << "Git " << GIT_COMMIT << std::endl;
|
||||
std::cout << "Version " << BuildConfig.VERSION_STR.toStdString() << std::endl;
|
||||
std::cout << "Git " << BuildConfig.GIT_COMMIT.toStdString() << std::endl;
|
||||
m_status = MultiMC::Succeeded;
|
||||
return;
|
||||
}
|
||||
@ -165,8 +165,8 @@ MultiMC::MultiMC(int &argc, char **argv, bool root_override)
|
||||
initLogger();
|
||||
|
||||
QLOG_INFO() << "MultiMC 5, (c) 2013 MultiMC Contributors";
|
||||
QLOG_INFO() << "Version : " << VERSION_STR;
|
||||
QLOG_INFO() << "Git commit : " << GIT_COMMIT;
|
||||
QLOG_INFO() << "Version : " << BuildConfig.VERSION_STR;
|
||||
QLOG_INFO() << "Git commit : " << BuildConfig.GIT_COMMIT;
|
||||
if (adjustedBy.size())
|
||||
{
|
||||
QLOG_INFO() << "Work dir before adjustment : " << origcwdPath;
|
||||
@ -193,7 +193,7 @@ MultiMC::MultiMC(int &argc, char **argv, bool root_override)
|
||||
m_notificationChecker.reset(new NotificationChecker());
|
||||
|
||||
// initialize the news checker
|
||||
m_newsChecker.reset(new NewsChecker(NEWS_RSS_URL));
|
||||
m_newsChecker.reset(new NewsChecker(BuildConfig.NEWS_RSS_URL));
|
||||
|
||||
// initialize the status checker
|
||||
m_statusChecker.reset(new StatusChecker());
|
||||
@ -333,7 +333,7 @@ void MultiMC::initGlobalSettings()
|
||||
{
|
||||
m_settings.reset(new INISettingsObject("multimc.cfg", this));
|
||||
// Updates
|
||||
m_settings->registerSetting("UpdateChannel", version().channel);
|
||||
m_settings->registerSetting("UpdateChannel", BuildConfig.VERSION_CHANNEL);
|
||||
m_settings->registerSetting("AutoUpdate", true);
|
||||
|
||||
// Notifications
|
||||
|
@ -1,8 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "config.h"
|
||||
#include <QApplication>
|
||||
#include "MultiMCVersion.h"
|
||||
#include <memory>
|
||||
#include "logger/QsLog.h"
|
||||
#include "logger/QsLogDest.h"
|
||||
@ -87,11 +85,6 @@ public:
|
||||
return m_status;
|
||||
}
|
||||
|
||||
MultiMCVersion version()
|
||||
{
|
||||
return m_version;
|
||||
}
|
||||
|
||||
std::shared_ptr<QNetworkAccessManager> qnam()
|
||||
{
|
||||
return m_qnam;
|
||||
@ -227,5 +220,4 @@ private:
|
||||
QString origcwdPath;
|
||||
|
||||
Status m_status = MultiMC::Failed;
|
||||
MultiMCVersion m_version;
|
||||
};
|
||||
|
@ -1,96 +0,0 @@
|
||||
/* Copyright 2013 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 <QString>
|
||||
|
||||
/*!
|
||||
* \brief The Version class represents a MultiMC version.
|
||||
*/
|
||||
struct MultiMCVersion
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
//! Version type for stable release builds.
|
||||
Release,
|
||||
|
||||
//! Version type for release candidates.
|
||||
ReleaseCandidate,
|
||||
|
||||
//! Version type for development builds.
|
||||
Development,
|
||||
|
||||
//! Version type for custom builds. This is the default when no version type is specified.
|
||||
Custom
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Converts the Version to a string.
|
||||
* \return The version number in string format (major.minor.revision.build).
|
||||
*/
|
||||
QString toString() const
|
||||
{
|
||||
QString vstr = QString("%1.%2").arg(
|
||||
QString::number(major),
|
||||
QString::number(minor));
|
||||
|
||||
if (hotfix > 0) vstr += "." + QString::number(hotfix);
|
||||
|
||||
// If the build is a development build or release candidate, add that info to the end.
|
||||
if (type == Development) vstr += "-dev" + QString::number(build);
|
||||
else if (type == ReleaseCandidate) vstr += "-rc" + QString::number(build);
|
||||
|
||||
return vstr;
|
||||
}
|
||||
|
||||
QString typeName() const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case Release:
|
||||
return "Stable Release";
|
||||
case ReleaseCandidate:
|
||||
return "Release Candidate";
|
||||
case Development:
|
||||
return "Development";
|
||||
case Custom:
|
||||
default:
|
||||
return "Custom";
|
||||
}
|
||||
}
|
||||
|
||||
//! The major version number.
|
||||
int major;
|
||||
|
||||
//! The minor version number.
|
||||
int minor;
|
||||
|
||||
//! The hotfix number.
|
||||
int hotfix;
|
||||
|
||||
//! The build number.
|
||||
int build;
|
||||
|
||||
//! The build type.
|
||||
Type type;
|
||||
|
||||
//! The build channel.
|
||||
QString channel;
|
||||
|
||||
//! A short string identifying the platform that this version is for. For example, lin64 or win32.
|
||||
QString platform;
|
||||
};
|
||||
|
40
config.h.in
40
config.h.in
@ -1,40 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// Version information
|
||||
#define VERSION_MAJOR @MultiMC_VERSION_MAJOR@
|
||||
#define VERSION_MINOR @MultiMC_VERSION_MINOR@
|
||||
#define VERSION_HOTFIX @MultiMC_VERSION_HOTFIX@
|
||||
#define VERSION_BUILD @MultiMC_VERSION_BUILD@
|
||||
#define VERSION_TYPE @MultiMC_VERSION_TYPE@
|
||||
|
||||
// The version channel. This is used by the updater to determine what channel the current version came from.
|
||||
#define VERSION_CHANNEL "@MultiMC_VERSION_CHANNEL@"
|
||||
|
||||
// A short string identifying this build's platform. For example, "lin64" or "win32".
|
||||
#define BUILD_PLATFORM "@MultiMC_BUILD_PLATFORM@"
|
||||
|
||||
// URL for the updater's channel
|
||||
#define CHANLIST_URL "@MultiMC_CHANLIST_URL@"
|
||||
|
||||
// URL for notifications
|
||||
#define NOTIFICATION_URL "@MultiMC_NOTIFICATION_URL@"
|
||||
|
||||
// Used for matching notifications
|
||||
#define FULL_VERSION_STR "@MultiMC_VERSION_MAJOR@.@MultiMC_VERSION_MINOR@.@MultiMC_VERSION_BUILD@"
|
||||
|
||||
// enabled for updater dry run
|
||||
#cmakedefine MultiMC_UPDATER_DRY_RUN
|
||||
|
||||
// enabled for updater dry run
|
||||
#cmakedefine MultiMC_UPDATER_FORCE_LOCAL
|
||||
|
||||
// The commit hash of this build
|
||||
#define GIT_COMMIT "@MultiMC_GIT_COMMIT@"
|
||||
|
||||
// This is printed on start to standard output
|
||||
#define VERSION_STR "@MultiMC_VERSION_STRING@"
|
||||
|
||||
// This is used to fetch the news RSS feed.
|
||||
// It defaults in CMakeLists.txt to "http://multimc.org/rss.xml"
|
||||
#define NEWS_RSS_URL "@MultiMC_NEWS_RSS_URL@"
|
||||
|
@ -17,6 +17,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "MultiMC.h"
|
||||
#include "Config.h"
|
||||
|
||||
#include "MainWindow.h"
|
||||
#include "ui_MainWindow.h"
|
||||
@ -107,9 +108,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
||||
MultiMCPlatform::fixWM_CLASS(this);
|
||||
ui->setupUi(this);
|
||||
|
||||
QString winTitle = QString("MultiMC 5 - Version %1").arg(MMC->version().toString());
|
||||
if (!MMC->version().platform.isEmpty())
|
||||
winTitle += " on " + MMC->version().platform;
|
||||
QString winTitle = QString("MultiMC 5 - Version %1").arg(BuildConfig.printableVersionString());
|
||||
if (!BuildConfig.BUILD_PLATFORM.isEmpty())
|
||||
winTitle += " on " + BuildConfig.BUILD_PLATFORM;
|
||||
setWindowTitle(winTitle);
|
||||
|
||||
// OSX magic.
|
||||
@ -709,9 +710,8 @@ void MainWindow::downloadUpdates(QString repo, int versionId, bool installOnExit
|
||||
if (updateDlg.exec(&updateTask))
|
||||
{
|
||||
UpdateFlags baseFlags = None;
|
||||
#ifdef MultiMC_UPDATER_DRY_RUN
|
||||
baseFlags |= DryRun;
|
||||
#endif
|
||||
if(BuildConfig.UPDATER_DRY_RUN)
|
||||
baseFlags |= DryRun;
|
||||
if (installOnExit)
|
||||
MMC->installUpdates(updateTask.updateFilesDir(), baseFlags | OnExit);
|
||||
else
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <QIcon>
|
||||
#include "MultiMC.h"
|
||||
#include "gui/Platform.h"
|
||||
#include "Config.h"
|
||||
|
||||
AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDialog)
|
||||
{
|
||||
@ -27,19 +28,19 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDia
|
||||
ui->urlLabel->setOpenExternalLinks(true);
|
||||
|
||||
ui->icon->setPixmap(QIcon(":/icons/multimc/scalable/apps/multimc.svg").pixmap(64));
|
||||
ui->title->setText("MultiMC 5 " + MMC->version().toString());
|
||||
ui->title->setText("MultiMC 5 " + BuildConfig.printableVersionString());
|
||||
|
||||
ui->versionLabel->setText(tr("Version") +": " + MMC->version().toString());
|
||||
ui->vtypeLabel->setText(tr("Version Type") +": " + MMC->version().typeName());
|
||||
ui->platformLabel->setText(tr("Platform") +": " + MMC->version().platform);
|
||||
ui->versionLabel->setText(tr("Version") +": " + BuildConfig.printableVersionString());
|
||||
ui->vtypeLabel->setText(tr("Version Type") +": " + BuildConfig.versionTypeName());
|
||||
ui->platformLabel->setText(tr("Platform") +": " + BuildConfig.BUILD_PLATFORM);
|
||||
|
||||
if (MMC->version().build >= 0)
|
||||
ui->buildNumLabel->setText(tr("Build Number") +": " + QString::number(MMC->version().build));
|
||||
if (BuildConfig.VERSION_BUILD >= 0)
|
||||
ui->buildNumLabel->setText(tr("Build Number") +": " + QString::number(BuildConfig.VERSION_BUILD));
|
||||
else
|
||||
ui->buildNumLabel->setVisible(false);
|
||||
|
||||
if (!MMC->version().channel.isEmpty())
|
||||
ui->channelLabel->setText(tr("Channel") +": " + MMC->version().channel);
|
||||
if (!BuildConfig.VERSION_CHANNEL.isEmpty())
|
||||
ui->channelLabel->setText(tr("Channel") +": " + BuildConfig.VERSION_CHANNEL);
|
||||
else
|
||||
ui->channelLabel->setVisible(false);
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "MultiMC.h"
|
||||
#include "Config.h"
|
||||
|
||||
#include "MinecraftProcess.h"
|
||||
|
||||
@ -432,7 +433,7 @@ QStringList MinecraftProcess::javaArguments() const
|
||||
|
||||
void MinecraftProcess::arm()
|
||||
{
|
||||
emit log("MultiMC version: " + MMC->version().toString() + "\n\n");
|
||||
emit log("MultiMC version: " + BuildConfig.printableVersionString() + "\n\n");
|
||||
emit log("Minecraft folder is:\n" + workingDirectory() + "\n\n");
|
||||
|
||||
if (!preLaunch())
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include "DownloadUpdateTask.h"
|
||||
|
||||
#include "MultiMC.h"
|
||||
#include "Config.h"
|
||||
|
||||
#include "logic/updater/UpdateChecker.h"
|
||||
#include "logic/net/NetJob.h"
|
||||
#include "pathutils.h"
|
||||
@ -29,7 +31,7 @@
|
||||
DownloadUpdateTask::DownloadUpdateTask(QString repoUrl, int versionId, QObject *parent)
|
||||
: Task(parent)
|
||||
{
|
||||
m_cVersionId = MMC->version().build;
|
||||
m_cVersionId = BuildConfig.VERSION_BUILD;
|
||||
|
||||
m_nRepoUrl = repoUrl;
|
||||
m_nVersionId = versionId;
|
||||
@ -58,7 +60,7 @@ void DownloadUpdateTask::processChannels()
|
||||
}
|
||||
|
||||
QList<UpdateChecker::ChannelListEntry> channels = checker->getChannelList();
|
||||
QString channelId = MMC->version().channel;
|
||||
QString channelId = BuildConfig.VERSION_CHANNEL;
|
||||
|
||||
m_cRepoUrl.clear();
|
||||
// Search through the channel list for a channel with the correct ID.
|
||||
@ -405,17 +407,18 @@ DownloadUpdateTask::processFileLists(NetJob *job,
|
||||
|
||||
if (isUpdater)
|
||||
{
|
||||
#ifdef MultiMC_UPDATER_FORCE_LOCAL
|
||||
QLOG_DEBUG() << "Skipping updater download and using local version.";
|
||||
#else
|
||||
auto cache_entry = MMC->metacache()->resolveEntry("root", entry.path);
|
||||
QLOG_DEBUG() << "Updater will be in " << cache_entry->getFullPath();
|
||||
// force check.
|
||||
cache_entry->stale = true;
|
||||
if(BuildConfig.UPDATER_FORCE_LOCAL)
|
||||
QLOG_DEBUG() << "Skipping updater download and using local version.";
|
||||
else
|
||||
{
|
||||
auto cache_entry = MMC->metacache()->resolveEntry("root", entry.path);
|
||||
QLOG_DEBUG() << "Updater will be in " << cache_entry->getFullPath();
|
||||
// force check.
|
||||
cache_entry->stale = true;
|
||||
|
||||
auto download = CacheDownload::make(QUrl(source.url), cache_entry);
|
||||
job->addNetAction(download);
|
||||
#endif
|
||||
auto download = CacheDownload::make(QUrl(source.url), cache_entry);
|
||||
job->addNetAction(download);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5,11 +5,11 @@
|
||||
#include <QJsonArray>
|
||||
|
||||
#include "MultiMC.h"
|
||||
#include "MultiMCVersion.h"
|
||||
#include "Config.h"
|
||||
#include "logic/net/CacheDownload.h"
|
||||
|
||||
NotificationChecker::NotificationChecker(QObject *parent)
|
||||
: QObject(parent), m_notificationsUrl(QUrl(NOTIFICATION_URL))
|
||||
: QObject(parent), m_notificationsUrl(QUrl(BuildConfig.NOTIFICATION_URL))
|
||||
{
|
||||
// this will call checkForNotifications once the event loop is running
|
||||
QMetaObject::invokeMethod(this, "checkForNotifications", Qt::QueuedConnection);
|
||||
@ -93,13 +93,12 @@ void NotificationChecker::downloadSucceeded(int)
|
||||
|
||||
bool NotificationChecker::NotificationEntry::applies() const
|
||||
{
|
||||
MultiMCVersion version = MMC->version();
|
||||
bool channelApplies = channel.isEmpty() || channel == version.channel;
|
||||
bool platformApplies = platform.isEmpty() || platform == version.platform;
|
||||
bool channelApplies = channel.isEmpty() || channel == BuildConfig.VERSION_CHANNEL;
|
||||
bool platformApplies = platform.isEmpty() || platform == BuildConfig.BUILD_PLATFORM;
|
||||
bool fromApplies =
|
||||
from.isEmpty() || from == FULL_VERSION_STR || !versionLessThan(FULL_VERSION_STR, from);
|
||||
from.isEmpty() || from == BuildConfig.FULL_VERSION_STR || !versionLessThan(BuildConfig.FULL_VERSION_STR, from);
|
||||
bool toApplies =
|
||||
to.isEmpty() || to == FULL_VERSION_STR || !versionLessThan(to, FULL_VERSION_STR);
|
||||
to.isEmpty() || to == BuildConfig.FULL_VERSION_STR || !versionLessThan(to, BuildConfig.FULL_VERSION_STR);
|
||||
return channelApplies && platformApplies && fromApplies && toApplies;
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "UpdateChecker.h"
|
||||
|
||||
#include "MultiMC.h"
|
||||
#include "Config.h"
|
||||
|
||||
#include "logger/QsLog.h"
|
||||
|
||||
@ -30,7 +31,7 @@
|
||||
|
||||
UpdateChecker::UpdateChecker()
|
||||
{
|
||||
m_channelListUrl = CHANLIST_URL;
|
||||
m_channelListUrl = BuildConfig.CHANLIST_URL;
|
||||
m_updateChecking = false;
|
||||
m_chanListLoading = false;
|
||||
m_checkUpdateWaiting = false;
|
||||
@ -148,7 +149,7 @@ void UpdateChecker::updateCheckFinished(bool notifyNoUpdate)
|
||||
// We've got the version with the greatest ID number. Now compare it to our current build
|
||||
// number and update if they're different.
|
||||
int newBuildNumber = newestVersion.value("Id").toVariant().toInt();
|
||||
if (newBuildNumber != MMC->version().build)
|
||||
if (newBuildNumber != BuildConfig.VERSION_BUILD)
|
||||
{
|
||||
QLOG_DEBUG() << "Found newer version with ID" << newBuildNumber;
|
||||
// Update!
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "depends/settings/settingsobject.h"
|
||||
#include "depends/settings/setting.h"
|
||||
|
||||
#include "Config.h"
|
||||
#include "TestUtil.h"
|
||||
#include "logic/updater/UpdateChecker.h"
|
||||
|
||||
@ -154,7 +155,7 @@ slots:
|
||||
QFETCH(QList<QVariant>, result);
|
||||
|
||||
MMC->settings()->set("UpdateChannel", channel);
|
||||
MMC->m_version.build = currentBuild;
|
||||
BuildConfig.VERSION_BUILD = currentBuild;
|
||||
|
||||
UpdateChecker checker;
|
||||
checker.setChannelListUrl(channelUrl);
|
||||
|
Loading…
Reference in New Issue
Block a user