mirror of
https://github.com/UltimMC/Launcher.git
synced 2025-10-03 16:51:30 +00:00
NOISSUE Remove concept of switching update channels
It is all develop from now on, we no longer make stable releases. This means no maintenance of version numbers and removal of all the overhead associated with making stable releases. MultiMC 6 might have a better system, but with how infrequent and stable MultiMC releases are getting, there's no need to have a distinction between `stable` and `develop` anymore.
This commit is contained in:
@@ -849,14 +849,13 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow
|
||||
// if automatic update checks are allowed, start one.
|
||||
if (APPLICATION->settings()->get("AutoUpdate").toBool() && updatesAllowed)
|
||||
{
|
||||
updater->checkForUpdate(APPLICATION->settings()->get("UpdateChannel").toString(), false);
|
||||
updater->checkForUpdate(false);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
auto checker = new NotificationChecker();
|
||||
checker->setNotificationsUrl(QUrl(BuildConfig.NOTIFICATION_URL));
|
||||
checker->setApplicationChannel(BuildConfig.VERSION_CHANNEL);
|
||||
checker->setApplicationPlatform(BuildConfig.BUILD_PLATFORM);
|
||||
checker->setApplicationFullVersion(BuildConfig.FULL_VERSION_STR);
|
||||
m_notificationChecker.reset(checker);
|
||||
@@ -1639,7 +1638,7 @@ void MainWindow::checkForUpdates()
|
||||
if(BuildConfig.UPDATER_ENABLED)
|
||||
{
|
||||
auto updater = APPLICATION->updateChecker();
|
||||
updater->checkForUpdate(APPLICATION->settings()->get("UpdateChannel").toString(), true);
|
||||
updater->checkForUpdate(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -11,14 +11,13 @@
|
||||
UpdateDialog::UpdateDialog(bool hasUpdate, QWidget *parent) : QDialog(parent), ui(new Ui::UpdateDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
auto channel = APPLICATION->settings()->get("UpdateChannel").toString();
|
||||
if(hasUpdate)
|
||||
{
|
||||
ui->label->setText(tr("A new %1 update is available!").arg(channel));
|
||||
ui->label->setText(tr("A new update is available!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->label->setText(tr("No %1 updates found. You are running the latest version.").arg(channel));
|
||||
ui->label->setText(tr("No updates found. You are running the latest version."));
|
||||
ui->btnUpdateNow->setHidden(true);
|
||||
ui->btnUpdateLater->setText(tr("Close"));
|
||||
}
|
||||
@@ -33,19 +32,10 @@ UpdateDialog::~UpdateDialog()
|
||||
|
||||
void UpdateDialog::loadChangelog()
|
||||
{
|
||||
auto channel = APPLICATION->settings()->get("UpdateChannel").toString();
|
||||
dljob = new NetJob("Changelog", APPLICATION->network());
|
||||
QString url;
|
||||
if(channel == "stable")
|
||||
{
|
||||
url = QString("https://raw.githubusercontent.com/MultiMC/Launcher/%1/changelog.md").arg(channel);
|
||||
m_changelogType = CHANGELOG_MARKDOWN;
|
||||
}
|
||||
else
|
||||
{
|
||||
url = QString("https://api.github.com/repos/MultiMC/Launcher/compare/%1...%2").arg(BuildConfig.GIT_COMMIT, channel);
|
||||
m_changelogType = CHANGELOG_COMMITS;
|
||||
}
|
||||
url = QString("https://api.github.com/repos/MultiMC/Launcher/compare/%1...develop").arg(BuildConfig.GIT_COMMIT);
|
||||
m_changelogType = CHANGELOG_COMMITS;
|
||||
dljob->addNetAction(Net::Download::makeByteArray(QUrl(url), &changelogData));
|
||||
connect(dljob.get(), &NetJob::succeeded, this, &UpdateDialog::changelogLoaded);
|
||||
connect(dljob.get(), &NetJob::failed, this, &UpdateDialog::changelogFailed);
|
||||
@@ -65,7 +55,6 @@ QString reprocessMarkdown(QByteArray markdown)
|
||||
|
||||
QString reprocessCommits(QByteArray json)
|
||||
{
|
||||
auto channel = APPLICATION->settings()->get("UpdateChannel").toString();
|
||||
try
|
||||
{
|
||||
QString result;
|
||||
@@ -119,7 +108,7 @@ QString reprocessCommits(QByteArray json)
|
||||
|
||||
if(status == "identical")
|
||||
{
|
||||
return QObject::tr("<p>There are no code changes between your current version and latest %1.</p>").arg(channel);
|
||||
return QObject::tr("<p>There are no code changes between your current version and the latest.</p>");
|
||||
}
|
||||
else if(status == "ahead")
|
||||
{
|
||||
|
@@ -56,23 +56,12 @@ LauncherPage::LauncherPage(QWidget *parent) : QWidget(parent), ui(new Ui::Launch
|
||||
m_languageModel = APPLICATION->translations();
|
||||
loadSettings();
|
||||
|
||||
if(BuildConfig.UPDATER_ENABLED)
|
||||
{
|
||||
QObject::connect(APPLICATION->updateChecker().get(), &UpdateChecker::channelListLoaded, this, &LauncherPage::refreshUpdateChannelList);
|
||||
|
||||
if (APPLICATION->updateChecker()->hasChannels())
|
||||
{
|
||||
refreshUpdateChannelList();
|
||||
}
|
||||
else
|
||||
{
|
||||
APPLICATION->updateChecker()->updateChanList(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
// Updater
|
||||
if(!BuildConfig.UPDATER_ENABLED)
|
||||
{
|
||||
ui->updateSettingsBox->setHidden(true);
|
||||
}
|
||||
|
||||
// Analytics
|
||||
if(BuildConfig.ANALYTICS_ID.isEmpty())
|
||||
{
|
||||
@@ -163,78 +152,6 @@ void LauncherPage::on_migrateDataFolderMacBtn_clicked()
|
||||
qApp->quit();
|
||||
}
|
||||
|
||||
void LauncherPage::refreshUpdateChannelList()
|
||||
{
|
||||
// Stop listening for selection changes. It's going to change a lot while we update it and
|
||||
// we don't need to update the
|
||||
// description label constantly.
|
||||
QObject::disconnect(ui->updateChannelComboBox, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(updateChannelSelectionChanged(int)));
|
||||
|
||||
QList<UpdateChecker::ChannelListEntry> channelList = APPLICATION->updateChecker()->getChannelList();
|
||||
ui->updateChannelComboBox->clear();
|
||||
int selection = -1;
|
||||
for (int i = 0; i < channelList.count(); i++)
|
||||
{
|
||||
UpdateChecker::ChannelListEntry entry = channelList.at(i);
|
||||
|
||||
// When it comes to selection, we'll rely on the indexes of a channel entry being the
|
||||
// same in the
|
||||
// combo box as it is in the update checker's channel list.
|
||||
// This probably isn't very safe, but the channel list doesn't change often enough (or
|
||||
// at all) for
|
||||
// this to be a big deal. Hope it doesn't break...
|
||||
ui->updateChannelComboBox->addItem(entry.name);
|
||||
|
||||
// If the update channel we just added was the selected one, set the current index in
|
||||
// the combo box to it.
|
||||
if (entry.id == m_currentUpdateChannel)
|
||||
{
|
||||
qDebug() << "Selected index" << i << "channel id" << m_currentUpdateChannel;
|
||||
selection = i;
|
||||
}
|
||||
}
|
||||
|
||||
ui->updateChannelComboBox->setCurrentIndex(selection);
|
||||
|
||||
// Start listening for selection changes again and update the description label.
|
||||
QObject::connect(ui->updateChannelComboBox, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(updateChannelSelectionChanged(int)));
|
||||
refreshUpdateChannelDesc();
|
||||
|
||||
// Now that we've updated the channel list, we can enable the combo box.
|
||||
// It starts off disabled so that if the channel list hasn't been loaded, it will be
|
||||
// disabled.
|
||||
ui->updateChannelComboBox->setEnabled(true);
|
||||
}
|
||||
|
||||
void LauncherPage::updateChannelSelectionChanged(int index)
|
||||
{
|
||||
refreshUpdateChannelDesc();
|
||||
}
|
||||
|
||||
void LauncherPage::refreshUpdateChannelDesc()
|
||||
{
|
||||
// Get the channel list.
|
||||
QList<UpdateChecker::ChannelListEntry> channelList = APPLICATION->updateChecker()->getChannelList();
|
||||
int selectedIndex = ui->updateChannelComboBox->currentIndex();
|
||||
if (selectedIndex < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (selectedIndex < channelList.count())
|
||||
{
|
||||
// Find the channel list entry with the given index.
|
||||
UpdateChecker::ChannelListEntry selected = channelList.at(selectedIndex);
|
||||
|
||||
// Set the description text.
|
||||
ui->updateChannelDescLabel->setText(selected.description);
|
||||
|
||||
// Set the currently selected channel ID.
|
||||
m_currentUpdateChannel = selected.id;
|
||||
}
|
||||
}
|
||||
|
||||
void LauncherPage::applySettings()
|
||||
{
|
||||
auto s = APPLICATION->settings();
|
||||
@@ -246,7 +163,6 @@ void LauncherPage::applySettings()
|
||||
|
||||
// Updates
|
||||
s->set("AutoUpdate", ui->autoUpdateCheckBox->isChecked());
|
||||
s->set("UpdateChannel", m_currentUpdateChannel);
|
||||
auto original = s->get("IconTheme").toString();
|
||||
//FIXME: make generic
|
||||
switch (ui->themeComboBox->currentIndex())
|
||||
@@ -333,7 +249,6 @@ void LauncherPage::loadSettings()
|
||||
auto s = APPLICATION->settings();
|
||||
// Updates
|
||||
ui->autoUpdateCheckBox->setChecked(s->get("AutoUpdate").toBool());
|
||||
m_currentUpdateChannel = s->get("UpdateChannel").toString();
|
||||
//FIXME: make generic
|
||||
auto theme = s->get("IconTheme").toString();
|
||||
if (theme == "pe_dark")
|
||||
|
@@ -69,31 +69,14 @@ slots:
|
||||
void on_iconsDirBrowseBtn_clicked();
|
||||
void on_migrateDataFolderMacBtn_clicked();
|
||||
|
||||
/*!
|
||||
* Updates the list of update channels in the combo box.
|
||||
*/
|
||||
void refreshUpdateChannelList();
|
||||
|
||||
/*!
|
||||
* Updates the channel description label.
|
||||
*/
|
||||
void refreshUpdateChannelDesc();
|
||||
|
||||
/*!
|
||||
* Updates the font preview
|
||||
*/
|
||||
void refreshFontPreview();
|
||||
|
||||
void updateChannelSelectionChanged(int index);
|
||||
|
||||
private:
|
||||
Ui::LauncherPage *ui;
|
||||
|
||||
/*!
|
||||
* Stores the currently selected update channel.
|
||||
*/
|
||||
QString m_currentUpdateChannel;
|
||||
|
||||
// default format for the font preview...
|
||||
QTextCharFormat *defaultFormat;
|
||||
|
||||
|
@@ -58,33 +58,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="updateChannelLabel">
|
||||
<property name="text">
|
||||
<string>Up&date Channel:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>updateChannelComboBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="updateChannelComboBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="updateChannelDescLabel">
|
||||
<property name="text">
|
||||
<string>No channel selected.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -555,7 +528,6 @@
|
||||
<tabstops>
|
||||
<tabstop>tabWidget</tabstop>
|
||||
<tabstop>autoUpdateCheckBox</tabstop>
|
||||
<tabstop>updateChannelComboBox</tabstop>
|
||||
<tabstop>instDirTextBox</tabstop>
|
||||
<tabstop>instDirBrowseBtn</tabstop>
|
||||
<tabstop>modsDirTextBox</tabstop>
|
||||
|
Reference in New Issue
Block a user