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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 35 additions and 138 deletions

View file

@ -1,9 +1,9 @@
freebsd_instance:
image: freebsd-13-1-release-amd64
image_family: freebsd-14-0
task:
install_script:
- pkg install -y boost-libs git qt5-buildtools qt5-concurrent qt5-core qt5-multimedia qt5-svg qtkeychain-qt5 qt5-qmake cmake qt5-linguist
- pkg install -y boost-libs git qt6-base qt6-svg qt6-5compat qt6-imageformats qtkeychain-qt6 cmake
script: |
git submodule init
git submodule update
@ -20,6 +20,7 @@ task:
-DUSE_SYSTEM_QTKEYCHAIN="ON" \
-DCMAKE_BUILD_TYPE="release" \
-DCMAKE_EXPORT_COMPILE_COMMANDS="ON" \
-DBUILD_WITH_QT6="ON" \
..
cat compile_commands.json
make -j $(getconf _NPROCESSORS_ONLN)

View file

@ -1,15 +1,15 @@
# FreeBSD
Note on Qt version compatibility: If you are installing Qt from a package manager, please ensure the version you are installing is at least **Qt 5.12 or newer**.
For all dependencies below we use Qt 6. Our minimum supported version is Qt 5.15.2, but you are on your own.
## FreeBSD 12.1-RELEASE
## FreeBSD 14.0-RELEASE
Note: This is known to work on FreeBSD 12.1-RELEASE amd64. Chances are
Note: This is known to work on FreeBSD 14.0-RELEASE amd64. Chances are
high that this also works on older FreeBSD releases, architectures and
FreeBSD 13.0-CURRENT.
FreeBSD 15.0-SNAP.
1. Install build dependencies from package sources (or build from the
ports tree): `# pkg install qt5-core qt5-multimedia qt5-svg qt5-buildtools gstreamer-plugins-good boost-libs rapidjson cmake`
ports tree): `# pkg install boost-libs git qt6-base qt6-svg qt6-5compat qt6-imageformats qtkeychain-qt6 cmake`
1. In the project directory, create a build directory and enter it
```sh
mkdir build
@ -17,7 +17,7 @@ FreeBSD 13.0-CURRENT.
```
1. Generate build files. To enable Lua plugins in your build add `-DCHATTERINO_PLUGINS=ON` to this command.
```sh
cmake ..
cmake -DBUILD_WITH_QT6=ON ..
```
1. Build the project
```sh

View file

@ -1,6 +1,6 @@
# Linux
For all dependencies below we use Qt6. Our minimum supported version is Qt5.15, but you are on your own.
For all dependencies below we use Qt 6. Our minimum supported version is Qt 5.15.2, but you are on your own.
## Install dependencies
@ -8,11 +8,11 @@ For all dependencies below we use Qt6. Our minimum supported version is Qt5.15,
Building on Ubuntu requires Docker.
Use https://github.com/Chatterino/docker/pkgs/container/chatterino2-build-ubuntu-20.04 as your base if you're on Ubuntu 20.04.
Use <https://github.com/Chatterino/docker/pkgs/container/chatterino2-build-ubuntu-20.04> as your base if you're on Ubuntu 20.04.
Use https://github.com/Chatterino/docker/pkgs/container/chatterino2-build-ubuntu-22.04 if you're on Ubuntu 22.04.
Use <https://github.com/Chatterino/docker/pkgs/container/chatterino2-build-ubuntu-22.04> if you're on Ubuntu 22.04.
The built binary should be exportable from the final image & able to run on your system assuming you perform a static build. See our [build.yml github workflow file](.github/workflows/build.yml) for the cmake line used for Ubuntu builds.
The built binary should be exportable from the final image & able to run on your system assuming you perform a static build. See our [build.yml GitHub workflow file](.github/workflows/build.yml) for the CMake line used for Ubuntu builds.
### Debian 12 (bookworm) or later

View file

@ -1,6 +1,6 @@
# Building on macOS
Chatterino2 is built in CI on Intel on macOS 12.
Chatterino2 is built in CI on Intel on macOS 13.
Local dev machines for testing are available on Apple Silicon on macOS 13.
## Installing dependencies

View file

@ -24,7 +24,7 @@ Notes:
Notes:
- Installing the latest **stable** Qt version is advised for new installations, but if you want to use your existing installation please ensure you are running **Qt 5.12 or later**.
- Installing the latest **stable** Qt version is advised for new installations, but if you want to use your existing installation please ensure you are running **Qt 5.15.2 or later**.
#### Components
@ -33,7 +33,7 @@ When prompted which components to install, do the following:
1. Unfold the tree element that says "Qt"
2. Unfold the top most tree element (latest stable Qt version, e.g. `Qt 6.5.3`)
3. Under this version, select the following entries:
- `MSVC 2019 64-bit` (or alternative version if you are using that)
- `MSVC 2019 64-bit` (or `MSVC 2022 64-bit` from Qt 6.8 onwards)
- `Qt 5 Compatibility Module`
- `Additional Libraries` > `Qt Image Formats`
4. Under the "Tools" tree element (at the bottom), ensure that `Qt Creator X.X.X` and `Debugging Tools for Windows` are selected. (they should be checked by default)
@ -66,9 +66,9 @@ These dependencies are only required if you are not using a package manager
- Visit the downloads list on [SourceForge](https://sourceforge.net/projects/boost/files/boost-binaries/).
- Select the latest version from the list.
- Download the `.exe` file appropriate to your Visual Studio installation version and system bitness (choose `-64` for 64-bit systems).
Visual Studio versions map as follows: `14.3` in the filename corresponds to MSVC 2022,`14.2` to 2019, `14.1` to 2017, `14.0` to 2015. _Anything prior to Visual Studio 2015 is unsupported. Please upgrade should you have an older installation._
Visual Studio versions map as follows: `14.3` in the filename corresponds to MSVC 2022. _Anything prior to Visual Studio 2022 is unsupported. Please upgrade should you have an older installation._
**Convenience link for Visual Studio 2022: [boost_1_79_0-msvc-14.3-64.exe](https://sourceforge.net/projects/boost/files/boost-binaries/1.79.0/boost_1_79_0-msvc-14.3-64.exe/download)**
**Convenience link for Visual Studio 2022: [boost_1_84_0-msvc-14.3-64.exe](https://sourceforge.net/projects/boost/files/boost-binaries/1.84.0/boost_1_84_0-msvc-14.3-64.exe/download)**
2. When prompted where to install Boost, set the location to `C:\local\boost`.
3. After the installation finishes, rename the `C:\local\boost\lib64-msvc-14.3` (or similar) directory to simply `lib` (`C:\local\boost\lib`).
@ -237,7 +237,7 @@ Select the `CMake Applications > chatterino` configuration and add a new _Run Ex
Now you can run the `chatterino | Debug` configuration.
If you want to run the portable version of Chatterino, create a file called `modes` inside of `build/bin` and
If you want to run the portable version of Chatterino, create a file called `modes` inside `build/bin` and
write `portable` into it.
#### Debugging

View file

@ -1,6 +1,6 @@
# Building on Windows with vcpkg
This will require more than 30GB of free space on your hard drive.
This will require more than 30 GB of free space on your hard drive.
## Prerequisites
@ -29,7 +29,7 @@ This will require more than 30GB of free space on your hard drive.
See [VCPKG_ROOT documentation](https://learn.microsoft.com/en-gb/vcpkg/users/config-environment#vcpkg_root)
- Append the vcpkg path to your path
e.g. `setx PATH "%PATH%;<path to vcpkg>"`
- For more configurations, see https://learn.microsoft.com/en-gb/vcpkg/users/config-environment
- For more configurations, see <https://learn.microsoft.com/en-gb/vcpkg/users/config-environment>
1. You may need to restart your computer to ensure all your environment variables and what-not are loaded everywhere.
## Building

View file

@ -41,6 +41,7 @@
- Dev: The MSVC CRT is now bundled with Chatterino as it depends on having a recent version installed. (#5447)
- Dev: Refactor/unsingletonize `UserDataController`. (#5459)
- Dev: Cleanup `BrowserExtension`. (#5465)
- Dev: Deprecate Qt 5.12. (#5396)
## 2.5.1

View file

@ -124,15 +124,6 @@ LinkParser::LinkParser(const QString &unparsedString)
QStringView remaining(unparsedString);
QStringView protocol(remaining);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringView wholeString(unparsedString);
const auto refFromView = [&](QStringView view) {
return QStringRef(&unparsedString,
static_cast<int>(view.begin() - wholeString.begin()),
static_cast<int>(view.size()));
};
#endif
// Check protocol for https?://
if (remaining.startsWith(QStringLiteral("http"), Qt::CaseInsensitive) &&
remaining.length() >= 4 + 3 + 1) // 'http' + '://' + [any]
@ -149,12 +140,7 @@ LinkParser::LinkParser(const QString &unparsedString)
{
// there's really a protocol => consume it
remaining = withProto.mid(3);
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
result.protocol = {protocol.begin(), remaining.begin()};
#else
result.protocol =
refFromView({protocol.begin(), remaining.begin()});
#endif
}
}
@ -219,13 +205,8 @@ LinkParser::LinkParser(const QString &unparsedString)
if ((nDots == 3 && isValidIpv4(host)) ||
isValidTld(host.mid(lastDotPos + 1)))
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
result.host = host;
result.rest = rest;
#else
result.host = refFromView(host);
result.rest = refFromView(rest);
#endif
result.source = unparsedString;
this->result_ = std::move(result);
}

View file

@ -7,28 +7,23 @@
namespace chatterino {
struct ParsedLink {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
using StringView = QStringView;
#else
using StringView = QStringRef;
#endif
/// The parsed protocol of the link. Can be empty.
///
/// https://www.forsen.tv/commands
/// ^------^
StringView protocol;
QStringView protocol;
/// The parsed host of the link. Can not be empty.
///
/// https://www.forsen.tv/commands
/// ^-----------^
StringView host;
QStringView host;
/// The remainder of the link. Can be empty.
///
/// https://www.forsen.tv/commands
/// ^-------^
StringView rest;
QStringView rest;
/// The original unparsed link.
///

View file

@ -40,7 +40,6 @@
#include "singletons/Paths.hpp"
#include "util/CombinePath.hpp"
#include "util/QStringHash.hpp"
#include "util/Qt.hpp"
#include <QString>

View file

@ -15,7 +15,6 @@
#include "singletons/Resources.hpp"
#include "singletons/Theme.hpp"
#include "util/FormatTime.hpp"
#include "util/Qt.hpp"
#include <QDateTime>

View file

@ -14,7 +14,6 @@
#include "singletons/StreamerMode.hpp"
#include "singletons/WindowManager.hpp"
#include "util/Helpers.hpp"
#include "util/Qt.hpp"
#include <QFileInfo>

View file

@ -1,7 +1,6 @@
#include "messages/search/AuthorPredicate.hpp"
#include "messages/Message.hpp"
#include "util/Qt.hpp"
namespace chatterino {

View file

@ -2,7 +2,6 @@
#include "messages/Message.hpp"
#include "providers/twitch/TwitchBadge.hpp"
#include "util/Qt.hpp"
namespace chatterino {

View file

@ -1,7 +1,6 @@
#include "messages/search/ChannelPredicate.hpp"
#include "messages/Message.hpp"
#include "util/Qt.hpp"
namespace chatterino {

View file

@ -2,7 +2,6 @@
#include "common/LinkParser.hpp"
#include "messages/Message.hpp"
#include "util/Qt.hpp"
namespace chatterino {

View file

@ -1,7 +1,5 @@
#include "messages/search/MessageFlagsPredicate.hpp"
#include "util/Qt.hpp"
namespace chatterino {
MessageFlagsPredicate::MessageFlagsPredicate(const QString &flags, bool negate)

View file

@ -2,7 +2,6 @@
#include "messages/Message.hpp"
#include "providers/twitch/TwitchBadge.hpp"
#include "util/Qt.hpp"
namespace chatterino {

View file

@ -37,7 +37,6 @@
#include "util/Helpers.hpp"
#include "util/IrcHelpers.hpp"
#include "util/QStringHash.hpp"
#include "util/Qt.hpp"
#include "widgets/Window.hpp"
#include <boost/variant.hpp>
@ -382,13 +381,7 @@ namespace {
dst.reserve(newLength);
for (const QStringView &chunk : std::as_const(chunks))
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 2)
static_assert(sizeof(QChar) == sizeof(decltype(*chunk.utf16())));
dst.append(reinterpret_cast<const QChar *>(chunk.utf16()),
chunk.length());
#else
dst += chunk;
#endif
}
return dst;
}
@ -1178,13 +1171,8 @@ void TwitchMessageBuilder::processIgnorePhrases(
shiftIndicesAfter(static_cast<int>(from + length),
static_cast<int>(replacement.length() - length));
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
auto midExtendedRef =
QStringView{originalMessage}.mid(wordStart, wordEnd - wordStart);
#else
auto midExtendedRef =
originalMessage.midRef(wordStart, wordEnd - wordStart);
#endif
for (auto &emote : removedEmotes)
{

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

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;

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

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

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

View file

@ -1,7 +1,6 @@
#include "util/XDGDirectory.hpp"
#include "util/CombinePath.hpp"
#include "util/Qt.hpp"
#include <unordered_map>

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"

View file

@ -77,11 +77,7 @@ QString ResizingTextEdit::textUnderCursor(bool *hadSpace) const
auto textUpToCursor = currentText.left(tc.selectionStart());
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
auto words = QStringView{textUpToCursor}.split(' ');
#else
auto words = textUpToCursor.splitRef(' ');
#endif
if (words.size() == 0)
{
return QString();

View file

@ -7,7 +7,6 @@
#include "singletons/Settings.hpp"
#include "util/CombinePath.hpp"
#include "util/LayoutCreator.hpp"
#include "util/Qt.hpp"
#include "util/StandardItemHelper.hpp"
#include "widgets/helper/EditableModelView.hpp"

View file

@ -226,20 +226,16 @@ void SplitInput::themeChangedEvent()
QPalette placeholderPalette;
palette.setColor(QPalette::WindowText, this->theme->splits.input.text);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
placeholderPalette.setColor(
QPalette::PlaceholderText,
this->theme->messages.textColors.chatPlaceholder);
#endif
this->updateEmoteButton();
this->updateCancelReplyButton();
this->ui_.textEditLength->setPalette(palette);
this->ui_.textEdit->setStyleSheet(this->theme->splits.input.styleSheet);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
this->ui_.textEdit->setPalette(placeholderPalette);
#endif
auto marginPx = static_cast<int>(2.F * this->scale());
this->ui_.vbox->setContentsMargins(marginPx, marginPx, marginPx, marginPx);

View file

@ -252,12 +252,6 @@ TEST(Helpers, BatchDifferentInputType)
EXPECT_EQ(result, expectation);
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 2)
# define makeView(x) x
#else
# define makeView(str) (&(str))
#endif
TEST(Helpers, skipSpace)
{
struct TestCase {
@ -272,7 +266,7 @@ TEST(Helpers, skipSpace)
for (const auto &c : tests)
{
const auto actual = skipSpace(makeView(c.input), c.startIdx);
const auto actual = skipSpace(c.input, c.startIdx);
EXPECT_EQ(actual, c.expected)
<< actual << " (" << c.input << ") did not match expected value "
@ -414,7 +408,7 @@ TEST(Helpers, findUnitMultiplierToSec)
for (const auto &c : tests)
{
SizeType pos = c.startPos;
const auto actual = findUnitMultiplierToSec(makeView(c.input), pos);
const auto actual = findUnitMultiplierToSec(c.input, pos);
if (c.expectedMultiplier == bad)
{