fix: replace defines with constexpr/const and use more absolute paths for includes (#5527)

bye bye nuuls
This commit is contained in:
nerix
2024-08-03 12:00:58 +02:00
committed by GitHub
parent 5ee5abf5b2
commit aed55ac1ba
83 changed files with 386 additions and 380 deletions
+3 -3
View File
@@ -24,11 +24,11 @@
#include <utility>
#define UPLOAD_DELAY 2000
// Delay between uploads in milliseconds
namespace {
// Delay between uploads in milliseconds
constexpr int UPLOAD_DELAY = 2000;
std::optional<QByteArray> convertToPng(const QImage &image)
{
QByteArray imageData;
-1
View File
@@ -1,4 +1,3 @@
#include "singletons/Theme.hpp"
#include "Application.hpp"
+5 -7
View File
@@ -1,4 +1,4 @@
#include "Toasts.hpp"
#include "singletons/Toasts.hpp"
#include "Application.hpp"
#include "common/Common.hpp"
@@ -83,19 +83,17 @@ bool Toasts::isEnabled()
QString Toasts::findStringFromReaction(const ToastReaction &reaction)
{
// The constants are macros right now, but we want to avoid ASCII casts,
// so we're concatenating them with a QString literal - effectively making them part of it.
switch (reaction)
{
case ToastReaction::OpenInBrowser:
return OPEN_IN_BROWSER u""_s;
return OPEN_IN_BROWSER;
case ToastReaction::OpenInPlayer:
return OPEN_PLAYER_IN_BROWSER u""_s;
return OPEN_PLAYER_IN_BROWSER;
case ToastReaction::OpenInStreamlink:
return OPEN_IN_STREAMLINK u""_s;
return OPEN_IN_STREAMLINK;
case ToastReaction::DontOpen:
default:
return DONT_OPEN u""_s;
return DONT_OPEN;
}
}
+28 -10
View File
@@ -1,12 +1,13 @@
#include "Updates.hpp"
#include "singletons/Updates.hpp"
#include "common/Literals.hpp"
#include "common/Modes.hpp"
#include "common/network/NetworkRequest.hpp"
#include "common/network/NetworkResult.hpp"
#include "common/QLogging.hpp"
#include "common/Version.hpp"
#include "Settings.hpp"
#include "singletons/Paths.hpp"
#include "singletons/Settings.hpp"
#include "util/CombinePath.hpp"
#include "util/PostToThread.hpp"
@@ -15,16 +16,34 @@
#include <QMessageBox>
#include <QProcess>
#include <QRegularExpression>
#include <QStringBuilder>
#include <semver/semver.hpp>
namespace chatterino {
namespace {
QString currentBranch()
{
return getSettings()->betaUpdates ? "beta" : "stable";
}
using namespace chatterino;
using namespace literals;
QString currentBranch()
{
return getSettings()->betaUpdates ? "beta" : "stable";
}
#if defined(Q_OS_WIN)
const QString CHATTERINO_OS = u"win"_s;
#elif defined(Q_OS_MACOS)
const QString CHATTERINO_OS = u"macos"_s;
#elif defined(Q_OS_LINUX)
const QString CHATTERINO_OS = u"linux"_s;
#elif defined(Q_OS_FREEBSD)
const QString CHATTERINO_OS = u"freebsd"_s;
#else
const QString CHATTERINO_OS = u"unknown"_s;
#endif
;
} // namespace
namespace chatterino {
Updates::Updates(const Paths &paths_)
: paths(paths_)
@@ -262,9 +281,8 @@ void Updates::checkForUpdates()
return;
}
QString url =
"https://notitia.chatterino.com/version/chatterino/" CHATTERINO_OS "/" +
currentBranch();
QString url = "https://notitia.chatterino.com/version/chatterino/" %
CHATTERINO_OS % "/" % currentBranch();
NetworkRequest(url)
.timeout(60000)