chore: remove old Qt 5.12 code, update docs and FreeBSD runner (#5396)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
nerix
2024-06-23 14:26:59 +02:00
committed by GitHub
parent 4421b6c90a
commit 189be8c68f
30 changed files with 35 additions and 138 deletions
-4
View File
@@ -85,11 +85,7 @@ void DebugCount::decrease(const QString &name, const int64_t &amount)
QString DebugCount::getDebugText()
{
#if QT_VERSION > QT_VERSION_CHECK(5, 13, 0)
static const QLocale locale(QLocale::English);
#else
static QLocale locale(QLocale::English);
#endif
auto counts = COUNTS.access();
+4 -8
View File
@@ -11,7 +11,7 @@ namespace chatterino {
namespace _helpers_internal {
SizeType skipSpace(StringView view, SizeType startPos)
SizeType skipSpace(QStringView view, SizeType startPos)
{
while (startPos < view.length() && view.at(startPos).isSpace())
{
@@ -20,7 +20,7 @@ namespace _helpers_internal {
return startPos - 1;
}
bool matchesIgnorePlural(StringView word, const QString &expected)
bool matchesIgnorePlural(QStringView word, const QString &expected)
{
if (!word.startsWith(expected))
{
@@ -34,7 +34,7 @@ namespace _helpers_internal {
word.at(word.length() - 1).toLatin1() == 's';
}
std::pair<uint64_t, bool> findUnitMultiplierToSec(StringView view,
std::pair<uint64_t, bool> findUnitMultiplierToSec(QStringView view,
SizeType &pos)
{
// Step 1. find end of unit
@@ -207,11 +207,7 @@ int64_t parseDurationToSeconds(const QString &inputString,
return -1;
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 2)
StringView input(inputString);
#else
StringView input(&inputString);
#endif
QStringView input(inputString);
input = input.trimmed();
uint64_t currentValue = 0;
+4 -13
View File
@@ -4,10 +4,6 @@
#include <QLocale>
#include <QString>
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 2)
# include <QStringRef>
#endif
#include <cmath>
#include <optional>
#include <vector>
@@ -17,12 +13,7 @@ namespace chatterino {
// only qualified for tests
namespace _helpers_internal {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 2)
using StringView = QStringView;
#else
using StringView = QStringRef;
#endif
using SizeType = StringView::size_type;
using SizeType = QStringView::size_type;
/**
* Skips all spaces.
@@ -32,7 +23,7 @@ namespace _helpers_internal {
* @param startPos The starting position (there must be a space in the view).
* @return The position of the last space.
*/
SizeType skipSpace(StringView view, SizeType startPos);
SizeType skipSpace(QStringView view, SizeType startPos);
/**
* Checks if `word` equals `expected` (singular) or `expected` + 's' (plural).
@@ -41,7 +32,7 @@ namespace _helpers_internal {
* @param expected Singular of the expected word.
* @return true if `word` is singular or plural of `expected`.
*/
bool matchesIgnorePlural(StringView word, const QString &expected);
bool matchesIgnorePlural(QStringView word, const QString &expected);
/**
* Tries to find the unit starting at `pos` and returns its multiplier so
@@ -58,7 +49,7 @@ namespace _helpers_internal {
* if it's a valid unit, undefined otherwise.
* @return (multiplier, ok)
*/
std::pair<uint64_t, bool> findUnitMultiplierToSec(StringView view,
std::pair<uint64_t, bool> findUnitMultiplierToSec(QStringView view,
SizeType &pos);
} // namespace _helpers_internal
-16
View File
@@ -4,8 +4,6 @@
#include <QHash>
#include <QString>
#include <functional>
namespace boost {
template <>
@@ -17,17 +15,3 @@ struct hash<QString> {
};
} // namespace boost
namespace std {
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
template <>
struct hash<QString> {
std::size_t operator()(const QString &s) const
{
return qHash(s);
}
};
#endif
} // namespace std
-9
View File
@@ -1,9 +0,0 @@
#pragma once
#include <QtGlobal>
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
namespace Qt {
const QString::SplitBehavior SkipEmptyParts = QString::SkipEmptyParts;
}
#endif
-1
View File
@@ -1,7 +1,6 @@
#include "util/XDGDirectory.hpp"
#include "util/CombinePath.hpp"
#include "util/Qt.hpp"
#include <unordered_map>
-1
View File
@@ -3,7 +3,6 @@
#include "common/Literals.hpp"
#include "common/QLogging.hpp"
#include "util/CombinePath.hpp"
#include "util/Qt.hpp"
#include "util/XDGDesktopFile.hpp"
#include "util/XDGDirectory.hpp"