added "beta update" settings

This commit is contained in:
fourtf 2019-09-02 10:52:01 +02:00
parent b1ed458c31
commit 42581598e1
4 changed files with 19 additions and 2 deletions

View file

@ -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();
}

View file

@ -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 = {

View file

@ -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 <QProcess>
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)

View file

@ -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());