mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
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:
parent
4421b6c90a
commit
189be8c68f
|
@ -1,9 +1,9 @@
|
||||||
freebsd_instance:
|
freebsd_instance:
|
||||||
image: freebsd-13-1-release-amd64
|
image_family: freebsd-14-0
|
||||||
|
|
||||||
task:
|
task:
|
||||||
install_script:
|
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: |
|
script: |
|
||||||
git submodule init
|
git submodule init
|
||||||
git submodule update
|
git submodule update
|
||||||
|
@ -20,6 +20,7 @@ task:
|
||||||
-DUSE_SYSTEM_QTKEYCHAIN="ON" \
|
-DUSE_SYSTEM_QTKEYCHAIN="ON" \
|
||||||
-DCMAKE_BUILD_TYPE="release" \
|
-DCMAKE_BUILD_TYPE="release" \
|
||||||
-DCMAKE_EXPORT_COMPILE_COMMANDS="ON" \
|
-DCMAKE_EXPORT_COMPILE_COMMANDS="ON" \
|
||||||
|
-DBUILD_WITH_QT6="ON" \
|
||||||
..
|
..
|
||||||
cat compile_commands.json
|
cat compile_commands.json
|
||||||
make -j $(getconf _NPROCESSORS_ONLN)
|
make -j $(getconf _NPROCESSORS_ONLN)
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
# FreeBSD
|
# 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
|
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
|
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
|
1. In the project directory, create a build directory and enter it
|
||||||
```sh
|
```sh
|
||||||
mkdir build
|
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.
|
1. Generate build files. To enable Lua plugins in your build add `-DCHATTERINO_PLUGINS=ON` to this command.
|
||||||
```sh
|
```sh
|
||||||
cmake ..
|
cmake -DBUILD_WITH_QT6=ON ..
|
||||||
```
|
```
|
||||||
1. Build the project
|
1. Build the project
|
||||||
```sh
|
```sh
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Linux
|
# 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
|
## 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.
|
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
|
### Debian 12 (bookworm) or later
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Building on macOS
|
# 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.
|
Local dev machines for testing are available on Apple Silicon on macOS 13.
|
||||||
|
|
||||||
## Installing dependencies
|
## Installing dependencies
|
||||||
|
|
|
@ -24,7 +24,7 @@ Notes:
|
||||||
|
|
||||||
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
|
#### Components
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ When prompted which components to install, do the following:
|
||||||
1. Unfold the tree element that says "Qt"
|
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`)
|
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:
|
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`
|
- `Qt 5 Compatibility Module`
|
||||||
- `Additional Libraries` > `Qt Image Formats`
|
- `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)
|
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/).
|
- Visit the downloads list on [SourceForge](https://sourceforge.net/projects/boost/files/boost-binaries/).
|
||||||
- Select the latest version from the list.
|
- 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).
|
- 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`.
|
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`).
|
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.
|
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.
|
write `portable` into it.
|
||||||
|
|
||||||
#### Debugging
|
#### Debugging
|
||||||
|
|
|
@ -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)
|
See [VCPKG_ROOT documentation](https://learn.microsoft.com/en-gb/vcpkg/users/config-environment#vcpkg_root)
|
||||||
- Append the vcpkg path to your path
|
- Append the vcpkg path to your path
|
||||||
e.g. `setx PATH "%PATH%;<path to vcpkg>"`
|
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.
|
1. You may need to restart your computer to ensure all your environment variables and what-not are loaded everywhere.
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
- Dev: The MSVC CRT is now bundled with Chatterino as it depends on having a recent version installed. (#5447)
|
- 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: Refactor/unsingletonize `UserDataController`. (#5459)
|
||||||
- Dev: Cleanup `BrowserExtension`. (#5465)
|
- Dev: Cleanup `BrowserExtension`. (#5465)
|
||||||
|
- Dev: Deprecate Qt 5.12. (#5396)
|
||||||
|
|
||||||
## 2.5.1
|
## 2.5.1
|
||||||
|
|
||||||
|
|
|
@ -124,15 +124,6 @@ LinkParser::LinkParser(const QString &unparsedString)
|
||||||
QStringView remaining(unparsedString);
|
QStringView remaining(unparsedString);
|
||||||
QStringView protocol(remaining);
|
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?://
|
// Check protocol for https?://
|
||||||
if (remaining.startsWith(QStringLiteral("http"), Qt::CaseInsensitive) &&
|
if (remaining.startsWith(QStringLiteral("http"), Qt::CaseInsensitive) &&
|
||||||
remaining.length() >= 4 + 3 + 1) // 'http' + '://' + [any]
|
remaining.length() >= 4 + 3 + 1) // 'http' + '://' + [any]
|
||||||
|
@ -149,12 +140,7 @@ LinkParser::LinkParser(const QString &unparsedString)
|
||||||
{
|
{
|
||||||
// there's really a protocol => consume it
|
// there's really a protocol => consume it
|
||||||
remaining = withProto.mid(3);
|
remaining = withProto.mid(3);
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
|
||||||
result.protocol = {protocol.begin(), remaining.begin()};
|
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)) ||
|
if ((nDots == 3 && isValidIpv4(host)) ||
|
||||||
isValidTld(host.mid(lastDotPos + 1)))
|
isValidTld(host.mid(lastDotPos + 1)))
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
|
||||||
result.host = host;
|
result.host = host;
|
||||||
result.rest = rest;
|
result.rest = rest;
|
||||||
#else
|
|
||||||
result.host = refFromView(host);
|
|
||||||
result.rest = refFromView(rest);
|
|
||||||
#endif
|
|
||||||
result.source = unparsedString;
|
result.source = unparsedString;
|
||||||
this->result_ = std::move(result);
|
this->result_ = std::move(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,28 +7,23 @@
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
struct ParsedLink {
|
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.
|
/// The parsed protocol of the link. Can be empty.
|
||||||
///
|
///
|
||||||
/// https://www.forsen.tv/commands
|
/// https://www.forsen.tv/commands
|
||||||
/// ^------^
|
/// ^------^
|
||||||
StringView protocol;
|
QStringView protocol;
|
||||||
|
|
||||||
/// The parsed host of the link. Can not be empty.
|
/// The parsed host of the link. Can not be empty.
|
||||||
///
|
///
|
||||||
/// https://www.forsen.tv/commands
|
/// https://www.forsen.tv/commands
|
||||||
/// ^-----------^
|
/// ^-----------^
|
||||||
StringView host;
|
QStringView host;
|
||||||
|
|
||||||
/// The remainder of the link. Can be empty.
|
/// The remainder of the link. Can be empty.
|
||||||
///
|
///
|
||||||
/// https://www.forsen.tv/commands
|
/// https://www.forsen.tv/commands
|
||||||
/// ^-------^
|
/// ^-------^
|
||||||
StringView rest;
|
QStringView rest;
|
||||||
|
|
||||||
/// The original unparsed link.
|
/// The original unparsed link.
|
||||||
///
|
///
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
#include "singletons/Paths.hpp"
|
#include "singletons/Paths.hpp"
|
||||||
#include "util/CombinePath.hpp"
|
#include "util/CombinePath.hpp"
|
||||||
#include "util/QStringHash.hpp"
|
#include "util/QStringHash.hpp"
|
||||||
#include "util/Qt.hpp"
|
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include "singletons/Resources.hpp"
|
#include "singletons/Resources.hpp"
|
||||||
#include "singletons/Theme.hpp"
|
#include "singletons/Theme.hpp"
|
||||||
#include "util/FormatTime.hpp"
|
#include "util/FormatTime.hpp"
|
||||||
#include "util/Qt.hpp"
|
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
#include "singletons/StreamerMode.hpp"
|
#include "singletons/StreamerMode.hpp"
|
||||||
#include "singletons/WindowManager.hpp"
|
#include "singletons/WindowManager.hpp"
|
||||||
#include "util/Helpers.hpp"
|
#include "util/Helpers.hpp"
|
||||||
#include "util/Qt.hpp"
|
|
||||||
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#include "messages/search/AuthorPredicate.hpp"
|
#include "messages/search/AuthorPredicate.hpp"
|
||||||
|
|
||||||
#include "messages/Message.hpp"
|
#include "messages/Message.hpp"
|
||||||
#include "util/Qt.hpp"
|
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#include "messages/Message.hpp"
|
#include "messages/Message.hpp"
|
||||||
#include "providers/twitch/TwitchBadge.hpp"
|
#include "providers/twitch/TwitchBadge.hpp"
|
||||||
#include "util/Qt.hpp"
|
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#include "messages/search/ChannelPredicate.hpp"
|
#include "messages/search/ChannelPredicate.hpp"
|
||||||
|
|
||||||
#include "messages/Message.hpp"
|
#include "messages/Message.hpp"
|
||||||
#include "util/Qt.hpp"
|
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#include "common/LinkParser.hpp"
|
#include "common/LinkParser.hpp"
|
||||||
#include "messages/Message.hpp"
|
#include "messages/Message.hpp"
|
||||||
#include "util/Qt.hpp"
|
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#include "messages/search/MessageFlagsPredicate.hpp"
|
#include "messages/search/MessageFlagsPredicate.hpp"
|
||||||
|
|
||||||
#include "util/Qt.hpp"
|
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
MessageFlagsPredicate::MessageFlagsPredicate(const QString &flags, bool negate)
|
MessageFlagsPredicate::MessageFlagsPredicate(const QString &flags, bool negate)
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#include "messages/Message.hpp"
|
#include "messages/Message.hpp"
|
||||||
#include "providers/twitch/TwitchBadge.hpp"
|
#include "providers/twitch/TwitchBadge.hpp"
|
||||||
#include "util/Qt.hpp"
|
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include "util/Helpers.hpp"
|
#include "util/Helpers.hpp"
|
||||||
#include "util/IrcHelpers.hpp"
|
#include "util/IrcHelpers.hpp"
|
||||||
#include "util/QStringHash.hpp"
|
#include "util/QStringHash.hpp"
|
||||||
#include "util/Qt.hpp"
|
|
||||||
#include "widgets/Window.hpp"
|
#include "widgets/Window.hpp"
|
||||||
|
|
||||||
#include <boost/variant.hpp>
|
#include <boost/variant.hpp>
|
||||||
|
@ -382,13 +381,7 @@ namespace {
|
||||||
dst.reserve(newLength);
|
dst.reserve(newLength);
|
||||||
for (const QStringView &chunk : std::as_const(chunks))
|
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;
|
dst += chunk;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
@ -1178,13 +1171,8 @@ void TwitchMessageBuilder::processIgnorePhrases(
|
||||||
shiftIndicesAfter(static_cast<int>(from + length),
|
shiftIndicesAfter(static_cast<int>(from + length),
|
||||||
static_cast<int>(replacement.length() - length));
|
static_cast<int>(replacement.length() - length));
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
|
||||||
auto midExtendedRef =
|
auto midExtendedRef =
|
||||||
QStringView{originalMessage}.mid(wordStart, wordEnd - wordStart);
|
QStringView{originalMessage}.mid(wordStart, wordEnd - wordStart);
|
||||||
#else
|
|
||||||
auto midExtendedRef =
|
|
||||||
originalMessage.midRef(wordStart, wordEnd - wordStart);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (auto &emote : removedEmotes)
|
for (auto &emote : removedEmotes)
|
||||||
{
|
{
|
||||||
|
|
|
@ -85,11 +85,7 @@ void DebugCount::decrease(const QString &name, const int64_t &amount)
|
||||||
|
|
||||||
QString DebugCount::getDebugText()
|
QString DebugCount::getDebugText()
|
||||||
{
|
{
|
||||||
#if QT_VERSION > QT_VERSION_CHECK(5, 13, 0)
|
|
||||||
static const QLocale locale(QLocale::English);
|
static const QLocale locale(QLocale::English);
|
||||||
#else
|
|
||||||
static QLocale locale(QLocale::English);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
auto counts = COUNTS.access();
|
auto counts = COUNTS.access();
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace chatterino {
|
||||||
|
|
||||||
namespace _helpers_internal {
|
namespace _helpers_internal {
|
||||||
|
|
||||||
SizeType skipSpace(StringView view, SizeType startPos)
|
SizeType skipSpace(QStringView view, SizeType startPos)
|
||||||
{
|
{
|
||||||
while (startPos < view.length() && view.at(startPos).isSpace())
|
while (startPos < view.length() && view.at(startPos).isSpace())
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@ namespace _helpers_internal {
|
||||||
return startPos - 1;
|
return startPos - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool matchesIgnorePlural(StringView word, const QString &expected)
|
bool matchesIgnorePlural(QStringView word, const QString &expected)
|
||||||
{
|
{
|
||||||
if (!word.startsWith(expected))
|
if (!word.startsWith(expected))
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@ namespace _helpers_internal {
|
||||||
word.at(word.length() - 1).toLatin1() == 's';
|
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)
|
SizeType &pos)
|
||||||
{
|
{
|
||||||
// Step 1. find end of unit
|
// Step 1. find end of unit
|
||||||
|
@ -207,11 +207,7 @@ int64_t parseDurationToSeconds(const QString &inputString,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 2)
|
QStringView input(inputString);
|
||||||
StringView input(inputString);
|
|
||||||
#else
|
|
||||||
StringView input(&inputString);
|
|
||||||
#endif
|
|
||||||
input = input.trimmed();
|
input = input.trimmed();
|
||||||
|
|
||||||
uint64_t currentValue = 0;
|
uint64_t currentValue = 0;
|
||||||
|
|
|
@ -4,10 +4,6 @@
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 2)
|
|
||||||
# include <QStringRef>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -17,12 +13,7 @@ namespace chatterino {
|
||||||
// only qualified for tests
|
// only qualified for tests
|
||||||
namespace _helpers_internal {
|
namespace _helpers_internal {
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 2)
|
using SizeType = QStringView::size_type;
|
||||||
using StringView = QStringView;
|
|
||||||
#else
|
|
||||||
using StringView = QStringRef;
|
|
||||||
#endif
|
|
||||||
using SizeType = StringView::size_type;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skips all spaces.
|
* Skips all spaces.
|
||||||
|
@ -32,7 +23,7 @@ namespace _helpers_internal {
|
||||||
* @param startPos The starting position (there must be a space in the view).
|
* @param startPos The starting position (there must be a space in the view).
|
||||||
* @return The position of the last space.
|
* @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).
|
* Checks if `word` equals `expected` (singular) or `expected` + 's' (plural).
|
||||||
|
@ -41,7 +32,7 @@ namespace _helpers_internal {
|
||||||
* @param expected Singular of the expected word.
|
* @param expected Singular of the expected word.
|
||||||
* @return true if `word` is singular or plural of `expected`.
|
* @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
|
* 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.
|
* if it's a valid unit, undefined otherwise.
|
||||||
* @return (multiplier, ok)
|
* @return (multiplier, ok)
|
||||||
*/
|
*/
|
||||||
std::pair<uint64_t, bool> findUnitMultiplierToSec(StringView view,
|
std::pair<uint64_t, bool> findUnitMultiplierToSec(QStringView view,
|
||||||
SizeType &pos);
|
SizeType &pos);
|
||||||
|
|
||||||
} // namespace _helpers_internal
|
} // namespace _helpers_internal
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
@ -17,17 +15,3 @@ struct hash<QString> {
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace boost
|
} // 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
|
|
||||||
|
|
|
@ -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,7 +1,6 @@
|
||||||
#include "util/XDGDirectory.hpp"
|
#include "util/XDGDirectory.hpp"
|
||||||
|
|
||||||
#include "util/CombinePath.hpp"
|
#include "util/CombinePath.hpp"
|
||||||
#include "util/Qt.hpp"
|
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include "common/Literals.hpp"
|
#include "common/Literals.hpp"
|
||||||
#include "common/QLogging.hpp"
|
#include "common/QLogging.hpp"
|
||||||
#include "util/CombinePath.hpp"
|
#include "util/CombinePath.hpp"
|
||||||
#include "util/Qt.hpp"
|
|
||||||
#include "util/XDGDesktopFile.hpp"
|
#include "util/XDGDesktopFile.hpp"
|
||||||
#include "util/XDGDirectory.hpp"
|
#include "util/XDGDirectory.hpp"
|
||||||
|
|
||||||
|
|
|
@ -77,11 +77,7 @@ QString ResizingTextEdit::textUnderCursor(bool *hadSpace) const
|
||||||
|
|
||||||
auto textUpToCursor = currentText.left(tc.selectionStart());
|
auto textUpToCursor = currentText.left(tc.selectionStart());
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
|
||||||
auto words = QStringView{textUpToCursor}.split(' ');
|
auto words = QStringView{textUpToCursor}.split(' ');
|
||||||
#else
|
|
||||||
auto words = textUpToCursor.splitRef(' ');
|
|
||||||
#endif
|
|
||||||
if (words.size() == 0)
|
if (words.size() == 0)
|
||||||
{
|
{
|
||||||
return QString();
|
return QString();
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include "singletons/Settings.hpp"
|
#include "singletons/Settings.hpp"
|
||||||
#include "util/CombinePath.hpp"
|
#include "util/CombinePath.hpp"
|
||||||
#include "util/LayoutCreator.hpp"
|
#include "util/LayoutCreator.hpp"
|
||||||
#include "util/Qt.hpp"
|
|
||||||
#include "util/StandardItemHelper.hpp"
|
#include "util/StandardItemHelper.hpp"
|
||||||
#include "widgets/helper/EditableModelView.hpp"
|
#include "widgets/helper/EditableModelView.hpp"
|
||||||
|
|
||||||
|
|
|
@ -226,20 +226,16 @@ void SplitInput::themeChangedEvent()
|
||||||
QPalette placeholderPalette;
|
QPalette placeholderPalette;
|
||||||
|
|
||||||
palette.setColor(QPalette::WindowText, this->theme->splits.input.text);
|
palette.setColor(QPalette::WindowText, this->theme->splits.input.text);
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
|
||||||
placeholderPalette.setColor(
|
placeholderPalette.setColor(
|
||||||
QPalette::PlaceholderText,
|
QPalette::PlaceholderText,
|
||||||
this->theme->messages.textColors.chatPlaceholder);
|
this->theme->messages.textColors.chatPlaceholder);
|
||||||
#endif
|
|
||||||
|
|
||||||
this->updateEmoteButton();
|
this->updateEmoteButton();
|
||||||
this->updateCancelReplyButton();
|
this->updateCancelReplyButton();
|
||||||
this->ui_.textEditLength->setPalette(palette);
|
this->ui_.textEditLength->setPalette(palette);
|
||||||
|
|
||||||
this->ui_.textEdit->setStyleSheet(this->theme->splits.input.styleSheet);
|
this->ui_.textEdit->setStyleSheet(this->theme->splits.input.styleSheet);
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
|
||||||
this->ui_.textEdit->setPalette(placeholderPalette);
|
this->ui_.textEdit->setPalette(placeholderPalette);
|
||||||
#endif
|
|
||||||
auto marginPx = static_cast<int>(2.F * this->scale());
|
auto marginPx = static_cast<int>(2.F * this->scale());
|
||||||
this->ui_.vbox->setContentsMargins(marginPx, marginPx, marginPx, marginPx);
|
this->ui_.vbox->setContentsMargins(marginPx, marginPx, marginPx, marginPx);
|
||||||
|
|
||||||
|
|
|
@ -252,12 +252,6 @@ TEST(Helpers, BatchDifferentInputType)
|
||||||
EXPECT_EQ(result, expectation);
|
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)
|
TEST(Helpers, skipSpace)
|
||||||
{
|
{
|
||||||
struct TestCase {
|
struct TestCase {
|
||||||
|
@ -272,7 +266,7 @@ TEST(Helpers, skipSpace)
|
||||||
|
|
||||||
for (const auto &c : tests)
|
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)
|
EXPECT_EQ(actual, c.expected)
|
||||||
<< actual << " (" << c.input << ") did not match expected value "
|
<< actual << " (" << c.input << ") did not match expected value "
|
||||||
|
@ -414,7 +408,7 @@ TEST(Helpers, findUnitMultiplierToSec)
|
||||||
for (const auto &c : tests)
|
for (const auto &c : tests)
|
||||||
{
|
{
|
||||||
SizeType pos = c.startPos;
|
SizeType pos = c.startPos;
|
||||||
const auto actual = findUnitMultiplierToSec(makeView(c.input), pos);
|
const auto actual = findUnitMultiplierToSec(c.input, pos);
|
||||||
|
|
||||||
if (c.expectedMultiplier == bad)
|
if (c.expectedMultiplier == bad)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue