Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 11 commits into from
Jun 23, 2024
5 changes: 3 additions & 2 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
freebsd_instance:
image: freebsd-13-1-release-amd64
image_family: freebsd-14-0
pajlada marked this conversation as resolved.
Show resolved Hide resolved

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
Expand All @@ -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)
12 changes: 6 additions & 6 deletions BUILDING_ON_FREEBSD.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# 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
cd build
```
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
Expand Down
8 changes: 4 additions & 4 deletions BUILDING_ON_LINUX.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# 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

### Ubuntu

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

Expand Down
2 changes: 1 addition & 1 deletion BUILDING_ON_MAC.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 5 additions & 5 deletions BUILDING_ON_WINDOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down Expand Up @@ -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._
pajlada marked this conversation as resolved.
Show resolved Hide resolved

**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`).
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions BUILDING_ON_WINDOWS_WITH_VCPKG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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>
pajlada marked this conversation as resolved.
Show resolved Hide resolved
1. You may need to restart your computer to ensure all your environment variables and what-not are loaded everywhere.

## Building
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
19 changes: 0 additions & 19 deletions src/common/LinkParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
}
}

Expand Down Expand Up @@ -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);
}
Expand Down
11 changes: 3 additions & 8 deletions src/common/LinkParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
1 change: 0 additions & 1 deletion src/controllers/commands/CommandController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include "singletons/Paths.hpp"
#include "util/CombinePath.hpp"
#include "util/QStringHash.hpp"
#include "util/Qt.hpp"

#include <QString>

Expand Down
1 change: 0 additions & 1 deletion src/messages/MessageBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "singletons/Resources.hpp"
#include "singletons/Theme.hpp"
#include "util/FormatTime.hpp"
#include "util/Qt.hpp"

#include <QDateTime>

Expand Down
1 change: 0 additions & 1 deletion src/messages/SharedMessageBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "singletons/StreamerMode.hpp"
#include "singletons/WindowManager.hpp"
#include "util/Helpers.hpp"
#include "util/Qt.hpp"

#include <QFileInfo>

Expand Down
1 change: 0 additions & 1 deletion src/messages/search/AuthorPredicate.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "messages/search/AuthorPredicate.hpp"

#include "messages/Message.hpp"
#include "util/Qt.hpp"

namespace chatterino {

Expand Down
1 change: 0 additions & 1 deletion src/messages/search/BadgePredicate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "messages/Message.hpp"
#include "providers/twitch/TwitchBadge.hpp"
#include "util/Qt.hpp"

namespace chatterino {

Expand Down
1 change: 0 additions & 1 deletion src/messages/search/ChannelPredicate.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "messages/search/ChannelPredicate.hpp"

#include "messages/Message.hpp"
#include "util/Qt.hpp"

namespace chatterino {

Expand Down
1 change: 0 additions & 1 deletion src/messages/search/LinkPredicate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "common/LinkParser.hpp"
#include "messages/Message.hpp"
#include "util/Qt.hpp"

namespace chatterino {

Expand Down
2 changes: 0 additions & 2 deletions src/messages/search/MessageFlagsPredicate.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "messages/search/MessageFlagsPredicate.hpp"

#include "util/Qt.hpp"

namespace chatterino {

MessageFlagsPredicate::MessageFlagsPredicate(const QString &flags, bool negate)
Expand Down
1 change: 0 additions & 1 deletion src/messages/search/SubtierPredicate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "messages/Message.hpp"
#include "providers/twitch/TwitchBadge.hpp"
#include "util/Qt.hpp"

namespace chatterino {

Expand Down
12 changes: 0 additions & 12 deletions src/providers/twitch/TwitchMessageBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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)
{
Expand Down
4 changes: 0 additions & 4 deletions src/util/DebugCount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
12 changes: 4 additions & 8 deletions src/util/Helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand All @@ -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))
{
Expand All @@ -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
Expand Down Expand Up @@ -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;
Expand Down
Loading
Loading