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/Env.cpp \
|
||||
src/common/LinkParser.cpp \
|
||||
src/common/Modes.cpp \
|
||||
src/common/NetworkManager.cpp \
|
||||
src/common/NetworkPrivate.cpp \
|
||||
src/common/NetworkRequest.cpp \
|
||||
|
@ -235,6 +236,7 @@ HEADERS += \
|
|||
src/common/DownloadManager.hpp \
|
||||
src/common/Env.hpp \
|
||||
src/common/LinkParser.hpp \
|
||||
src/common/Modes.hpp \
|
||||
src/common/NetworkCommon.hpp \
|
||||
src/common/NetworkManager.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 <cassert>
|
||||
|
||||
#include "common/Modes.hpp"
|
||||
#include "util/CombinePath.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
@ -32,7 +33,7 @@ bool Paths::createFolder(const QString &folderPath)
|
|||
|
||||
bool Paths::isPortable()
|
||||
{
|
||||
return this->portable_.get();
|
||||
return Modes::getInstance().isPortable;
|
||||
}
|
||||
|
||||
QString Paths::cacheDirectory()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "Updates.hpp"
|
||||
|
||||
#include "Settings.hpp"
|
||||
#include "common/Modes.hpp"
|
||||
#include "common/NetworkRequest.hpp"
|
||||
#include "common/Outcome.hpp"
|
||||
#include "common/Version.hpp"
|
||||
|
@ -201,6 +202,14 @@ void Updates::installUpdates()
|
|||
|
||||
void Updates::checkForUpdates()
|
||||
{
|
||||
// Disable updates if on nightly and windows.
|
||||
#ifdef Q_OS_WIN
|
||||
if (Modes::getInstance().isNightly)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
QString url =
|
||||
"https://notitia.chatterino.com/version/chatterino/" CHATTERINO_OS "/" +
|
||||
currentBranch();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "widgets/Window.hpp"
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "common/Modes.hpp"
|
||||
#include "common/Version.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "providers/twitch/TwitchServer.hpp"
|
||||
|
@ -115,18 +116,10 @@ bool Window::event(QEvent *event)
|
|||
void Window::showEvent(QShowEvent *event)
|
||||
{
|
||||
// Startup notification
|
||||
if (getSettings()->startUpNotification.getValue() < 1)
|
||||
/*if (getSettings()->startUpNotification.getValue() < 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
|
||||
if (getSettings()->currentVersion.getValue() != "" &&
|
||||
|
@ -377,16 +370,25 @@ void Window::onAccountSelected()
|
|||
{
|
||||
auto user = getApp()->accounts->twitch.getCurrent();
|
||||
|
||||
//#ifdef CHATTERINO_NIGHTLY_VERSION_STRING
|
||||
// auto windowTitleEnd =
|
||||
// QString("Chatterino Nightly " CHATTERINO_VERSION
|
||||
// " (" UGLYMACROHACK(CHATTERINO_NIGHTLY_VERSION_STRING) ")");
|
||||
//#else
|
||||
auto windowTitleEnd = QString("Chatterino " CHATTERINO_VERSION);
|
||||
//#endif
|
||||
// update title
|
||||
QString title = "Chatterino ";
|
||||
if (Modes::getInstance().isNightly)
|
||||
{
|
||||
title += " Nightly";
|
||||
}
|
||||
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 (this->userLabel_)
|
||||
|
@ -401,6 +403,6 @@ void Window::onAccountSelected()
|
|||
this->userLabel_->getLabel().setText(user->getUserName());
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace chatterino
|
||||
|
||||
} // namespace chatterino
|
||||
|
|
Loading…
Reference in a new issue