mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
disable updates on windows nightlies
This commit is contained in:
parent
d451b31cee
commit
7cbbd72e7f
6 changed files with 86 additions and 20 deletions
|
@ -82,6 +82,7 @@ SOURCES += \
|
||||||
src/common/DownloadManager.cpp \
|
src/common/DownloadManager.cpp \
|
||||||
src/common/Env.cpp \
|
src/common/Env.cpp \
|
||||||
src/common/LinkParser.cpp \
|
src/common/LinkParser.cpp \
|
||||||
|
src/common/Modes.cpp \
|
||||||
src/common/NetworkManager.cpp \
|
src/common/NetworkManager.cpp \
|
||||||
src/common/NetworkPrivate.cpp \
|
src/common/NetworkPrivate.cpp \
|
||||||
src/common/NetworkRequest.cpp \
|
src/common/NetworkRequest.cpp \
|
||||||
|
@ -235,6 +236,7 @@ HEADERS += \
|
||||||
src/common/DownloadManager.hpp \
|
src/common/DownloadManager.hpp \
|
||||||
src/common/Env.hpp \
|
src/common/Env.hpp \
|
||||||
src/common/LinkParser.hpp \
|
src/common/LinkParser.hpp \
|
||||||
|
src/common/Modes.hpp \
|
||||||
src/common/NetworkCommon.hpp \
|
src/common/NetworkCommon.hpp \
|
||||||
src/common/NetworkManager.hpp \
|
src/common/NetworkManager.hpp \
|
||||||
src/common/NetworkPrivate.hpp \
|
src/common/NetworkPrivate.hpp \
|
||||||
|
|
36
src/common/Modes.cpp
Normal file
36
src/common/Modes.cpp
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
#include "Modes.hpp"
|
||||||
|
|
||||||
|
#include "util/CombinePath.hpp"
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
|
Modes::Modes()
|
||||||
|
{
|
||||||
|
QFile file(combinePath(QCoreApplication::applicationDirPath(), "modes"));
|
||||||
|
file.open(QIODevice::ReadOnly);
|
||||||
|
|
||||||
|
while (!file.atEnd())
|
||||||
|
{
|
||||||
|
auto line = QString(file.readLine());
|
||||||
|
|
||||||
|
// we need to know if it is a nightly build to disable updates on windows
|
||||||
|
if (line == "nightly")
|
||||||
|
{
|
||||||
|
this->isNightly = true;
|
||||||
|
}
|
||||||
|
else if (line == "portable")
|
||||||
|
{
|
||||||
|
this->isPortable = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const Modes &Modes::getInstance()
|
||||||
|
{
|
||||||
|
static Modes instance;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace chatterino
|
16
src/common/Modes.hpp
Normal file
16
src/common/Modes.hpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
|
class Modes
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Modes();
|
||||||
|
|
||||||
|
static const Modes &getInstance();
|
||||||
|
|
||||||
|
bool isNightly{};
|
||||||
|
bool isPortable{};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace chatterino
|
|
@ -8,6 +8,7 @@
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "common/Modes.hpp"
|
||||||
#include "util/CombinePath.hpp"
|
#include "util/CombinePath.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
@ -32,7 +33,7 @@ bool Paths::createFolder(const QString &folderPath)
|
||||||
|
|
||||||
bool Paths::isPortable()
|
bool Paths::isPortable()
|
||||||
{
|
{
|
||||||
return this->portable_.get();
|
return Modes::getInstance().isPortable;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Paths::cacheDirectory()
|
QString Paths::cacheDirectory()
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "Updates.hpp"
|
#include "Updates.hpp"
|
||||||
|
|
||||||
#include "Settings.hpp"
|
#include "Settings.hpp"
|
||||||
|
#include "common/Modes.hpp"
|
||||||
#include "common/NetworkRequest.hpp"
|
#include "common/NetworkRequest.hpp"
|
||||||
#include "common/Outcome.hpp"
|
#include "common/Outcome.hpp"
|
||||||
#include "common/Version.hpp"
|
#include "common/Version.hpp"
|
||||||
|
@ -201,6 +202,14 @@ void Updates::installUpdates()
|
||||||
|
|
||||||
void Updates::checkForUpdates()
|
void Updates::checkForUpdates()
|
||||||
{
|
{
|
||||||
|
// Disable updates if on nightly and windows.
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
if (Modes::getInstance().isNightly)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QString url =
|
QString url =
|
||||||
"https://notitia.chatterino.com/version/chatterino/" CHATTERINO_OS "/" +
|
"https://notitia.chatterino.com/version/chatterino/" CHATTERINO_OS "/" +
|
||||||
currentBranch();
|
currentBranch();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "widgets/Window.hpp"
|
#include "widgets/Window.hpp"
|
||||||
|
|
||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
|
#include "common/Modes.hpp"
|
||||||
#include "common/Version.hpp"
|
#include "common/Version.hpp"
|
||||||
#include "controllers/accounts/AccountController.hpp"
|
#include "controllers/accounts/AccountController.hpp"
|
||||||
#include "providers/twitch/TwitchServer.hpp"
|
#include "providers/twitch/TwitchServer.hpp"
|
||||||
|
@ -115,18 +116,10 @@ bool Window::event(QEvent *event)
|
||||||
void Window::showEvent(QShowEvent *event)
|
void Window::showEvent(QShowEvent *event)
|
||||||
{
|
{
|
||||||
// Startup notification
|
// Startup notification
|
||||||
if (getSettings()->startUpNotification.getValue() < 1)
|
/*if (getSettings()->startUpNotification.getValue() < 1)
|
||||||
{
|
{
|
||||||
getSettings()->startUpNotification = 1;
|
getSettings()->startUpNotification = 1;
|
||||||
|
}*/
|
||||||
// auto box = new QMessageBox(
|
|
||||||
// QMessageBox::Information, "Chatterino 2 Beta",
|
|
||||||
// "Please note that this software is not stable yet. Things are "
|
|
||||||
// "rough "
|
|
||||||
// "around the edges and everything is subject to change.");
|
|
||||||
// box->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
// box->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show changelog
|
// Show changelog
|
||||||
if (getSettings()->currentVersion.getValue() != "" &&
|
if (getSettings()->currentVersion.getValue() != "" &&
|
||||||
|
@ -377,16 +370,25 @@ void Window::onAccountSelected()
|
||||||
{
|
{
|
||||||
auto user = getApp()->accounts->twitch.getCurrent();
|
auto user = getApp()->accounts->twitch.getCurrent();
|
||||||
|
|
||||||
//#ifdef CHATTERINO_NIGHTLY_VERSION_STRING
|
// update title
|
||||||
// auto windowTitleEnd =
|
QString title = "Chatterino ";
|
||||||
// QString("Chatterino Nightly " CHATTERINO_VERSION
|
if (Modes::getInstance().isNightly)
|
||||||
// " (" UGLYMACROHACK(CHATTERINO_NIGHTLY_VERSION_STRING) ")");
|
{
|
||||||
//#else
|
title += " Nightly";
|
||||||
auto windowTitleEnd = QString("Chatterino " CHATTERINO_VERSION);
|
}
|
||||||
//#endif
|
title += CHATTERINO_VERSION;
|
||||||
|
|
||||||
this->setWindowTitle(windowTitleEnd);
|
if (Modes::getInstance().isNightly)
|
||||||
|
{
|
||||||
|
#ifdef CHATTERINO_NIGHTLY_VERSION_STRING
|
||||||
|
title +=
|
||||||
|
QString(" (" UGLYMACROHACK(CHATTERINO_NIGHTLY_VERSION_STRING) ")");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
this->setWindowTitle(title);
|
||||||
|
|
||||||
|
// update user
|
||||||
if (user->isAnon())
|
if (user->isAnon())
|
||||||
{
|
{
|
||||||
if (this->userLabel_)
|
if (this->userLabel_)
|
||||||
|
@ -401,6 +403,6 @@ void Window::onAccountSelected()
|
||||||
this->userLabel_->getLabel().setText(user->getUserName());
|
this->userLabel_->getLabel().setText(user->getUserName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // namespace chatterino
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
Loading…
Reference in a new issue