diff --git a/src/Application.cpp b/src/Application.cpp index 0a374fbc7..42b9bd0bf 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -24,6 +24,7 @@ #include "singletons/Settings.hpp" #include "singletons/Theme.hpp" #include "singletons/Toasts.hpp" +#include "singletons/Updates.hpp" #include "singletons/WindowManager.hpp" #include "util/IsBigEndian.hpp" #include "util/PostToThread.hpp" @@ -99,6 +100,9 @@ int Application::run(QApplication &qtApp) this->windows->getMainWindow().show(); + getSettings()->betaUpdates.connect( + [] { Updates::getInstance().checkForUpdates(); }, false); + return qtApp.exec(); } diff --git a/src/singletons/Settings.hpp b/src/singletons/Settings.hpp index 295ad7e58..2ab20d06d 100644 --- a/src/singletons/Settings.hpp +++ b/src/singletons/Settings.hpp @@ -198,6 +198,7 @@ public: QStringSetting streamlinkOpts = {"/external/streamlink/options", ""}; /// Misc + BoolSetting betaUpdates = {"/misc/beta", false}; IntSetting startUpNotification = {"/misc/startUpNotification", 0}; QStringSetting currentVersion = {"/misc/currentVersion", ""}; BoolSetting loadTwitchMessageHistoryOnConnect = { diff --git a/src/singletons/Updates.cpp b/src/singletons/Updates.cpp index 5930c59c1..8a5c813d7 100644 --- a/src/singletons/Updates.cpp +++ b/src/singletons/Updates.cpp @@ -1,5 +1,6 @@ #include "Updates.hpp" +#include "Settings.hpp" #include "common/NetworkRequest.hpp" #include "common/Outcome.hpp" #include "common/Version.hpp" @@ -13,6 +14,12 @@ #include namespace chatterino { +namespace { + QString currentBranch() + { + return getSettings()->betaUpdates ? "beta" : "stable"; + } +} // namespace Updates::Updates() : currentVersion_(CHATTERINO_VERSION) @@ -195,8 +202,8 @@ void Updates::installUpdates() void Updates::checkForUpdates() { QString url = - "https://notitia.chatterino.com/version/chatterino/" CHATTERINO_OS - "/stable"; + "https://notitia.chatterino.com/version/chatterino/" CHATTERINO_OS "/" + + currentBranch(); NetworkRequest(url) .timeout(60000) diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp index 6ee10777a..41312b47d 100644 --- a/src/widgets/settingspages/GeneralPage.cpp +++ b/src/widgets/settingspages/GeneralPage.cpp @@ -290,6 +290,11 @@ void GeneralPage::initLayout(SettingsLayout &layout) layout.addCheckbox("Category", s.headerGame); layout.addCheckbox("Title", s.headerStreamTitle); + layout.addTitle("Beta"); + layout.addDescription("You can receive updates earlier by ticking the box " + "below. Updates are checked on startup."); + layout.addCheckbox("Receive beta updates", s.betaUpdates); + layout.addTitle("Miscellaneous"); //layout.addWidget(makeOpenSettingDirButton());