Revert "fix: remove updater if it is not used"

This reverts commit 2ff0aa09e3.

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2022-07-06 18:12:16 +02:00
parent f1902a4471
commit e210a4b244
No known key found for this signature in database
GPG Key ID: C10411294912A422
17 changed files with 19 additions and 65 deletions

View File

@ -154,7 +154,6 @@ void appDebugOutput(QtMsgType type, const QMessageLogContext &context, const QSt
fflush(stderr);
}
#ifdef LAUNCHER_WITH_UPDATER
QString getIdealPlatform(QString currentPlatform) {
auto info = Sys::getKernelInfo();
switch(info.kernelType) {
@ -193,7 +192,6 @@ QString getIdealPlatform(QString currentPlatform) {
}
return currentPlatform;
}
#endif
}
@ -758,7 +756,6 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
qDebug() << "<> Translations loaded.";
}
#ifdef LAUNCHER_WITH_UPDATER
// initialize the updater
if(BuildConfig.UPDATER_ENABLED)
{
@ -768,7 +765,6 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
m_updateChecker.reset(new UpdateChecker(m_network, channelUrl, BuildConfig.VERSION_CHANNEL, BuildConfig.VERSION_BUILD));
qDebug() << "<> Updater started.";
}
#endif
// Instance icons
{
@ -1414,9 +1410,7 @@ MainWindow* Application::showMainWindow(bool minimized)
}
m_mainWindow->checkInstancePathForProblems();
#ifdef LAUNCHER_WITH_UPDATER
connect(this, &Application::updateAllowedChanged, m_mainWindow, &MainWindow::updatesAllowedChanged);
#endif
connect(m_mainWindow, &MainWindow::isClosing, this, &Application::on_windowClose);
m_openWindows++;
}

View File

@ -42,10 +42,7 @@
#include <QIcon>
#include <QDateTime>
#include <QUrl>
#ifdef LAUNCHER_WITH_UPDATER
#include <updater/GoUpdate.h>
#endif
#include <BaseInstance.h>

View File

@ -149,23 +149,20 @@ set(LAUNCH_SOURCES
launch/LogModel.h
)
if (Launcher_UPDATER_BASE)
set(Launcher_APP_BINARY_DEFS "-DLAUNCHER_WITH_UPDATER ${Launcher_APP_BINARY_DEFS}")
# Old update system
set(UPDATE_SOURCES
# Old update system
set(UPDATE_SOURCES
updater/GoUpdate.h
updater/GoUpdate.cpp
updater/UpdateChecker.h
updater/UpdateChecker.cpp
updater/DownloadTask.h
updater/DownloadTask.cpp
)
)
ecm_add_test(updater/UpdateChecker_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
ecm_add_test(updater/UpdateChecker_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
TEST_NAME UpdateChecker)
ecm_add_test(updater/DownloadTask_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
ecm_add_test(updater/DownloadTask_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
TEST_NAME DownloadTask)
endif()
# Backend for the news bar... there's usually no news.
set(NEWS_SOURCES

View File

@ -36,7 +36,6 @@
#include "LauncherPartLaunch.h"
#include <QStandardPaths>
#include <QRegularExpression>
#include "launch/LaunchTask.h"
#include "minecraft/MinecraftInstance.h"

View File

@ -44,8 +44,6 @@
#include <QJsonArray>
#include <QJsonDocument>
#include <QFile>
#include <QHttpPart>
#include <QUrlQuery>
std::array<PasteUpload::PasteTypeInfo, 4> PasteUpload::PasteTypes = {
{{"0x0.st", "https://0x0.st", ""},

View File

@ -39,7 +39,6 @@
#include <QClipboard>
#include <QApplication>
#include <QFileDialog>
#include <QStandardPaths>
#include "ui/dialogs/ProgressDialog.h"
#include "ui/dialogs/CustomMessageBox.h"

View File

@ -1024,7 +1024,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow
}
#ifdef LAUNCHER_WITH_UPDATER
if(BuildConfig.UPDATER_ENABLED)
{
bool updatesAllowed = APPLICATION->updatesAreAllowed();
@ -1043,7 +1042,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow
updater->checkForUpdate(APPLICATION->settings()->get("UpdateChannel").toString(), false);
}
}
#endif
setSelectedInstanceById(APPLICATION->settings()->get("SelectedInstance").toString());
@ -1355,7 +1353,6 @@ void MainWindow::repopulateAccountsMenu()
ui->profileMenu->addAction(ui->actionManageAccounts);
}
#ifdef LAUNCHER_WITH_UPDATER
void MainWindow::updatesAllowedChanged(bool allowed)
{
if(!BuildConfig.UPDATER_ENABLED)
@ -1364,7 +1361,6 @@ void MainWindow::updatesAllowedChanged(bool allowed)
}
ui->actionCheckUpdate->setEnabled(allowed);
}
#endif
/*
* Assumes the sender is a QAction
@ -1470,7 +1466,6 @@ void MainWindow::updateNewsLabel()
}
}
#ifdef LAUNCHER_WITH_UPDATER
void MainWindow::updateAvailable(GoUpdate::Status status)
{
if(!APPLICATION->updatesAreAllowed())
@ -1496,7 +1491,6 @@ void MainWindow::updateNotAvailable()
UpdateDialog dlg(false, this);
dlg.exec();
}
#endif
QList<int> stringToIntList(const QString &string)
{
@ -1518,7 +1512,6 @@ QString intListToString(const QList<int> &list)
return slist.join(',');
}
#ifdef LAUNCHER_WITH_UPDATER
void MainWindow::downloadUpdates(GoUpdate::Status status)
{
if(!APPLICATION->updatesAreAllowed())
@ -1552,7 +1545,6 @@ void MainWindow::downloadUpdates(GoUpdate::Status status)
CustomMessageBox::selectable(this, tr("Error"), updateTask.failReason(), QMessageBox::Warning)->show();
}
}
#endif
void MainWindow::onCatToggled(bool state)
{
@ -1865,7 +1857,6 @@ void MainWindow::on_actionConfig_Folder_triggered()
}
}
#ifdef LAUNCHER_WITH_UPDATER
void MainWindow::checkForUpdates()
{
if(BuildConfig.UPDATER_ENABLED)
@ -1878,7 +1869,6 @@ void MainWindow::checkForUpdates()
qWarning() << "Updater not set up. Cannot check for updates.";
}
}
#endif
void MainWindow::on_actionSettings_triggered()
{

View File

@ -78,9 +78,7 @@ public:
void checkInstancePathForProblems();
#ifdef LAUNCHER_WITH_UPDATER
void updatesAllowedChanged(bool allowed);
#endif
void droppedURLs(QList<QUrl> urls);
signals:
@ -126,9 +124,7 @@ private slots:
void on_actionViewCentralModsFolder_triggered();
#ifdef LAUNCHER_WITH_UPDATER
void checkForUpdates();
#endif
void on_actionSettings_triggered();
@ -197,11 +193,9 @@ private slots:
void startTask(Task *task);
#ifdef LAUNCHER_WITH_UPDATER
void updateAvailable(GoUpdate::Status status);
void updateNotAvailable();
#endif
void defaultAccountChanged();
@ -211,12 +205,10 @@ private slots:
void updateNewsLabel();
#ifdef LAUNCHER_WITH_UPDATER
/*!
* Runs the DownloadTask and installs updates.
*/
void downloadUpdates(GoUpdate::Status status);
#endif
void konamiTriggered();

View File

@ -78,7 +78,6 @@ LauncherPage::LauncherPage(QWidget *parent) : QWidget(parent), ui(new Ui::Launch
m_languageModel = APPLICATION->translations();
loadSettings();
#ifdef LAUNCHER_WITH_UPDATER
if(BuildConfig.UPDATER_ENABLED)
{
QObject::connect(APPLICATION->updateChecker().get(), &UpdateChecker::channelListLoaded, this, &LauncherPage::refreshUpdateChannelList);
@ -91,9 +90,11 @@ LauncherPage::LauncherPage(QWidget *parent) : QWidget(parent), ui(new Ui::Launch
{
APPLICATION->updateChecker()->updateChanList(false);
}
ui->updateSettingsBox->setHidden(false);
}
#endif
else
{
ui->updateSettingsBox->setHidden(true);
}
connect(ui->fontSizeBox, SIGNAL(valueChanged(int)), SLOT(refreshFontPreview()));
connect(ui->consoleFont, SIGNAL(currentFontChanged(QFont)), SLOT(refreshFontPreview()));
}
@ -188,7 +189,6 @@ void LauncherPage::on_metadataDisableBtn_clicked()
ui->metadataWarningLabel->setHidden(!ui->metadataDisableBtn->isChecked());
}
#ifdef LAUNCHER_WITH_UPDATER
void LauncherPage::refreshUpdateChannelList()
{
// Stop listening for selection changes. It's going to change a lot while we update it and
@ -260,7 +260,6 @@ void LauncherPage::refreshUpdateChannelDesc()
m_currentUpdateChannel = selected.id;
}
}
#endif
void LauncherPage::applySettings()
{

View File

@ -90,7 +90,6 @@ slots:
void on_iconsDirBrowseBtn_clicked();
void on_metadataDisableBtn_clicked();
#ifdef LAUNCHER_WITH_UPDATER
/*!
* Updates the list of update channels in the combo box.
*/
@ -101,13 +100,13 @@ slots:
*/
void refreshUpdateChannelDesc();
void updateChannelSelectionChanged(int index);
#endif
/*!
* Updates the font preview
*/
void refreshFontPreview();
void updateChannelSelectionChanged(int index);
private:
Ui::LauncherPage *ui;

View File

@ -50,9 +50,6 @@
<property name="title">
<string>Update Settings</string>
</property>
<property name="visible">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QCheckBox" name="autoUpdateCheckBox">

View File

@ -40,7 +40,6 @@
#include "Application.h"
#include <QIcon>
#include <QIdentityProxyModel>
#include <QScrollBar>
#include <QShortcut>

View File

@ -35,7 +35,6 @@
#pragma once
#include <QItemSelection>
#include <QMainWindow>
#include "ui/pages/BasePage.h"

View File

@ -48,7 +48,6 @@
#include <QFileSystemWatcher>
#include <QMenu>
#include <QTimer>
static const int COLUMN_COUNT = 2; // 3 , TBD: latency and other nice things.

View File

@ -47,7 +47,6 @@
#include <QInputDialog>
#include <QProcess>
#include <Qt>
#include <QSortFilterProxyModel>
#include "tools/MCEditTool.h"
#include "FileSystem.h"

View File

@ -46,8 +46,6 @@
#include <BuildConfig.h>
#include <net/NetJob.h>
namespace LegacyFTB {
FilterModel::FilterModel(QObject *parent) : QSortFilterProxyModel(parent)

View File

@ -39,7 +39,6 @@
#include "modplatform/modrinth/ModrinthPackManifest.h"
#include "ui/pages/modplatform/modrinth/ModrinthPage.h"
#include "net/NetJob.h"
class ModPage;
class Version;