Show changelog even when there are no new updates available.
This commit is contained in:
parent
d8d6f5929b
commit
3821569363
@ -305,12 +305,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||||||
auto updater = MMC->updateChecker();
|
auto updater = MMC->updateChecker();
|
||||||
connect(updater.get(), &UpdateChecker::updateAvailable, this,
|
connect(updater.get(), &UpdateChecker::updateAvailable, this,
|
||||||
&MainWindow::updateAvailable);
|
&MainWindow::updateAvailable);
|
||||||
connect(updater.get(), &UpdateChecker::noUpdateFound, [this]()
|
connect(updater.get(), &UpdateChecker::noUpdateFound, this,
|
||||||
{
|
&MainWindow::updateNotAvailable);
|
||||||
CustomMessageBox::selectable(
|
|
||||||
this, tr("No update found."),
|
|
||||||
tr("No MultiMC update was found!\nYou are using the latest version."))->exec();
|
|
||||||
});
|
|
||||||
// if automatic update checks are allowed, start one.
|
// if automatic update checks are allowed, start one.
|
||||||
if (MMC->settings()->get("AutoUpdate").toBool())
|
if (MMC->settings()->get("AutoUpdate").toBool())
|
||||||
on_actionCheckUpdate_triggered();
|
on_actionCheckUpdate_triggered();
|
||||||
@ -621,6 +617,12 @@ void MainWindow::updateAvailable(QString repo, QString versionName, int versionI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::updateNotAvailable()
|
||||||
|
{
|
||||||
|
UpdateDialog dlg(false);
|
||||||
|
dlg.exec();
|
||||||
|
}
|
||||||
|
|
||||||
QList<int> stringToIntList(const QString &string)
|
QList<int> stringToIntList(const QString &string)
|
||||||
{
|
{
|
||||||
QStringList split = string.split(',', QString::SkipEmptyParts);
|
QStringList split = string.split(',', QString::SkipEmptyParts);
|
||||||
|
@ -154,6 +154,8 @@ slots:
|
|||||||
|
|
||||||
void updateAvailable(QString repo, QString versionName, int versionId);
|
void updateAvailable(QString repo, QString versionName, int versionId);
|
||||||
|
|
||||||
|
void updateNotAvailable();
|
||||||
|
|
||||||
void notificationsChanged();
|
void notificationsChanged();
|
||||||
|
|
||||||
void activeAccountChanged();
|
void activeAccountChanged();
|
||||||
|
@ -73,7 +73,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::Se
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MMC->updateChecker()->updateChanList();
|
MMC->updateChecker()->updateChanList(false);
|
||||||
}
|
}
|
||||||
connect(ui->proxyGroup, SIGNAL(buttonClicked(int)), SLOT(proxyChanged(int)));
|
connect(ui->proxyGroup, SIGNAL(buttonClicked(int)), SLOT(proxyChanged(int)));
|
||||||
ui->mceditLink->setOpenExternalLinks(true);
|
ui->mceditLink->setOpenExternalLinks(true);
|
||||||
|
@ -5,12 +5,21 @@
|
|||||||
#include "MultiMC.h"
|
#include "MultiMC.h"
|
||||||
#include <logic/settings/SettingsObject.h>
|
#include <logic/settings/SettingsObject.h>
|
||||||
|
|
||||||
UpdateDialog::UpdateDialog(QWidget *parent) : QDialog(parent), ui(new Ui::UpdateDialog)
|
UpdateDialog::UpdateDialog(bool hasUpdate, QWidget *parent) : QDialog(parent), ui(new Ui::UpdateDialog)
|
||||||
{
|
{
|
||||||
MultiMCPlatform::fixWM_CLASS(this);
|
MultiMCPlatform::fixWM_CLASS(this);
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
auto channel = MMC->settings()->get("UpdateChannel").toString();
|
auto channel = MMC->settings()->get("UpdateChannel").toString();
|
||||||
ui->label->setText(tr("A new %1 update is available!").arg(channel));
|
if(hasUpdate)
|
||||||
|
{
|
||||||
|
ui->label->setText(tr("A new %1 update is available!").arg(channel));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->label->setText(tr("No %1 updates found. You are running the latest version.").arg(channel));
|
||||||
|
ui->btnUpdateNow->setDisabled(true);
|
||||||
|
ui->btnUpdateOnExit->setDisabled(true);
|
||||||
|
}
|
||||||
loadChangelog();
|
loadChangelog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class UpdateDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit UpdateDialog(QWidget *parent = 0);
|
explicit UpdateDialog(bool hasUpdate = true, QWidget *parent = 0);
|
||||||
~UpdateDialog();
|
~UpdateDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -91,7 +91,7 @@ void DownloadUpdateTask::findCurrentVersionInfo()
|
|||||||
|
|
||||||
QObject::connect(checker.get(), &UpdateChecker::channelListLoaded, this,
|
QObject::connect(checker.get(), &UpdateChecker::channelListLoaded, this,
|
||||||
&DownloadUpdateTask::processChannels);
|
&DownloadUpdateTask::processChannels);
|
||||||
checker->updateChanList();
|
checker->updateChanList(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -59,7 +59,7 @@ void UpdateChecker::checkForUpdate(bool notifyNoUpdate)
|
|||||||
QLOG_DEBUG() << "Channel list isn't loaded yet. Loading channel list and deferring "
|
QLOG_DEBUG() << "Channel list isn't loaded yet. Loading channel list and deferring "
|
||||||
"update check.";
|
"update check.";
|
||||||
m_checkUpdateWaiting = true;
|
m_checkUpdateWaiting = true;
|
||||||
updateChanList();
|
updateChanList(notifyNoUpdate);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ void UpdateChecker::updateCheckFailed()
|
|||||||
QLOG_ERROR() << "Update check failed for reasons unknown.";
|
QLOG_ERROR() << "Update check failed for reasons unknown.";
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateChecker::updateChanList()
|
void UpdateChecker::updateChanList(bool notifyNoUpdate)
|
||||||
{
|
{
|
||||||
QLOG_DEBUG() << "Loading the channel list.";
|
QLOG_DEBUG() << "Loading the channel list.";
|
||||||
|
|
||||||
@ -185,13 +185,14 @@ void UpdateChecker::updateChanList()
|
|||||||
m_chanListLoading = true;
|
m_chanListLoading = true;
|
||||||
NetJob *job = new NetJob("Update System Channel List");
|
NetJob *job = new NetJob("Update System Channel List");
|
||||||
job->addNetAction(ByteArrayDownload::make(QUrl(m_channelListUrl)));
|
job->addNetAction(ByteArrayDownload::make(QUrl(m_channelListUrl)));
|
||||||
QObject::connect(job, &NetJob::succeeded, this, &UpdateChecker::chanListDownloadFinished);
|
connect(job, &NetJob::succeeded, [this, notifyNoUpdate]()
|
||||||
|
{ chanListDownloadFinished(notifyNoUpdate); });
|
||||||
QObject::connect(job, &NetJob::failed, this, &UpdateChecker::chanListDownloadFailed);
|
QObject::connect(job, &NetJob::failed, this, &UpdateChecker::chanListDownloadFailed);
|
||||||
chanListJob.reset(job);
|
chanListJob.reset(job);
|
||||||
job->start();
|
job->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateChecker::chanListDownloadFinished()
|
void UpdateChecker::chanListDownloadFinished(bool notifyNoUpdate)
|
||||||
{
|
{
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
{
|
{
|
||||||
@ -250,7 +251,7 @@ void UpdateChecker::chanListDownloadFinished()
|
|||||||
|
|
||||||
// If we're waiting to check for updates, do that now.
|
// If we're waiting to check for updates, do that now.
|
||||||
if (m_checkUpdateWaiting)
|
if (m_checkUpdateWaiting)
|
||||||
checkForUpdate(false);
|
checkForUpdate(notifyNoUpdate);
|
||||||
|
|
||||||
emit channelListLoaded();
|
emit channelListLoaded();
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ public:
|
|||||||
* Causes the update checker to download the channel list from the URL specified in config.h (generated by CMake).
|
* Causes the update checker to download the channel list from the URL specified in config.h (generated by CMake).
|
||||||
* If this isn't called before checkForUpdate(), it will automatically be called.
|
* If this isn't called before checkForUpdate(), it will automatically be called.
|
||||||
*/
|
*/
|
||||||
void updateChanList();
|
void updateChanList(bool notifyNoUpdate);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* An entry in the channel list.
|
* An entry in the channel list.
|
||||||
@ -70,7 +70,7 @@ private slots:
|
|||||||
void updateCheckFinished(bool notifyNoUpdate);
|
void updateCheckFinished(bool notifyNoUpdate);
|
||||||
void updateCheckFailed();
|
void updateCheckFailed();
|
||||||
|
|
||||||
void chanListDownloadFinished();
|
void chanListDownloadFinished(bool notifyNoUpdate);
|
||||||
void chanListDownloadFailed();
|
void chanListDownloadFailed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -116,7 +116,7 @@ slots:
|
|||||||
|
|
||||||
checker.setChannelListUrl(channelUrl);
|
checker.setChannelListUrl(channelUrl);
|
||||||
|
|
||||||
checker.updateChanList();
|
checker.updateChanList(false);
|
||||||
|
|
||||||
if (valid)
|
if (valid)
|
||||||
{
|
{
|
||||||
@ -165,7 +165,7 @@ slots:
|
|||||||
QSignalSpy channelListLoadedSpy(&checker, SIGNAL(channelListLoaded()));
|
QSignalSpy channelListLoadedSpy(&checker, SIGNAL(channelListLoaded()));
|
||||||
QVERIFY(channelListLoadedSpy.isValid());
|
QVERIFY(channelListLoadedSpy.isValid());
|
||||||
|
|
||||||
checker.updateChanList();
|
checker.updateChanList(false);
|
||||||
QVERIFY(channelListLoadedSpy.wait());
|
QVERIFY(channelListLoadedSpy.wait());
|
||||||
|
|
||||||
checker.m_channels[0].url = QUrl::fromLocalFile(QDir::current().absoluteFilePath("tests/data/")).toString();
|
checker.m_channels[0].url = QUrl::fromLocalFile(QDir::current().absoluteFilePath("tests/data/")).toString();
|
||||||
|
Loading…
Reference in New Issue
Block a user