mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Fix Qt::SkipEmptyParts
deprecation warning (#3726)
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
parent
d6148381eb
commit
46a5c9509e
7 changed files with 29 additions and 11 deletions
|
@ -21,6 +21,7 @@
|
|||
#include "util/FormatTime.hpp"
|
||||
#include "util/Helpers.hpp"
|
||||
#include "util/IncognitoBrowser.hpp"
|
||||
#include "util/Qt.hpp"
|
||||
#include "util/StreamLink.hpp"
|
||||
#include "util/Twitch.hpp"
|
||||
#include "widgets/Window.hpp"
|
||||
|
@ -156,7 +157,7 @@ bool appendWhisperMessageWordsLocally(const QStringList &words)
|
|||
bool appendWhisperMessageStringLocally(const QString &textNoEmoji)
|
||||
{
|
||||
QString text = getApp()->emotes->emojis.replaceShortCodes(textNoEmoji);
|
||||
QStringList words = text.split(' ', QString::SkipEmptyParts);
|
||||
QStringList words = text.split(' ', Qt::SkipEmptyParts);
|
||||
|
||||
if (words.length() == 0)
|
||||
{
|
||||
|
@ -970,7 +971,7 @@ QString CommandController::execCommand(const QString &textNoEmoji,
|
|||
ChannelPtr channel, bool dryRun)
|
||||
{
|
||||
QString text = getApp()->emotes->emojis.replaceShortCodes(textNoEmoji);
|
||||
QStringList words = text.split(' ', QString::SkipEmptyParts);
|
||||
QStringList words = text.split(' ', Qt::SkipEmptyParts);
|
||||
|
||||
if (words.length() == 0)
|
||||
{
|
||||
|
@ -1007,7 +1008,7 @@ QString CommandController::execCommand(const QString &textNoEmoji,
|
|||
text = getApp()->emotes->emojis.replaceShortCodes(
|
||||
this->execCustomCommand(words, it.value(), dryRun, channel));
|
||||
|
||||
words = text.split(' ', QString::SkipEmptyParts);
|
||||
words = text.split(' ', Qt::SkipEmptyParts);
|
||||
|
||||
if (words.length() == 0)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "messages/search/AuthorPredicate.hpp"
|
||||
|
||||
#include "util/Qt.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
AuthorPredicate::AuthorPredicate(const QStringList &authors)
|
||||
|
@ -8,7 +10,7 @@ AuthorPredicate::AuthorPredicate(const QStringList &authors)
|
|||
// Check if any comma-seperated values were passed and transform those
|
||||
for (const auto &entry : authors)
|
||||
{
|
||||
for (const auto &author : entry.split(',', QString::SkipEmptyParts))
|
||||
for (const auto &author : entry.split(',', Qt::SkipEmptyParts))
|
||||
{
|
||||
this->authors_ << author;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "messages/search/ChannelPredicate.hpp"
|
||||
|
||||
#include "util/Qt.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
ChannelPredicate::ChannelPredicate(const QStringList &channels)
|
||||
|
@ -8,7 +10,7 @@ ChannelPredicate::ChannelPredicate(const QStringList &channels)
|
|||
// Check if any comma-seperated values were passed and transform those
|
||||
for (const auto &entry : channels)
|
||||
{
|
||||
for (const auto &channel : entry.split(',', QString::SkipEmptyParts))
|
||||
for (const auto &channel : entry.split(',', Qt::SkipEmptyParts))
|
||||
{
|
||||
this->channels_ << channel;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "messages/search/LinkPredicate.hpp"
|
||||
|
||||
#include "common/LinkParser.hpp"
|
||||
#include "util/Qt.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
|
@ -9,8 +11,7 @@ LinkPredicate::LinkPredicate()
|
|||
|
||||
bool LinkPredicate::appliesTo(const Message &message)
|
||||
{
|
||||
for (const auto &word :
|
||||
message.messageText.split(' ', QString::SkipEmptyParts))
|
||||
for (const auto &word : message.messageText.split(' ', Qt::SkipEmptyParts))
|
||||
{
|
||||
if (LinkParser(word).hasMatch())
|
||||
return true;
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
#include "messages/search/MessageFlagsPredicate.hpp"
|
||||
|
||||
#include "util/Qt.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
MessageFlagsPredicate::MessageFlagsPredicate(const QString &flags)
|
||||
: flags_()
|
||||
{
|
||||
// Check if any comma-seperated values were passed and transform those
|
||||
for (const auto &flag : flags.split(',', QString::SkipEmptyParts))
|
||||
for (const auto &flag : flags.split(',', Qt::SkipEmptyParts))
|
||||
{
|
||||
if (flag == "deleted" || flag == "disabled")
|
||||
{
|
||||
|
|
9
src/util/Qt.hpp
Normal file
9
src/util/Qt.hpp
Normal file
|
@ -0,0 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
namespace Qt {
|
||||
const QString::SplitBehavior SkipEmptyParts = QString::SkipEmptyParts;
|
||||
}
|
||||
#endif
|
|
@ -15,6 +15,7 @@
|
|||
#include "widgets/helper/EditableModelView.hpp"
|
||||
//#include "widgets/helper/ComboBoxItemDelegate.hpp"
|
||||
#include "util/CombinePath.hpp"
|
||||
#include "util/Qt.hpp"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QTextEdit>
|
||||
|
@ -59,9 +60,9 @@ CommandPage::CommandPage()
|
|||
QObject::connect(button, &QPushButton::clicked, this, [] {
|
||||
QFile c1settings = c1settingsPath();
|
||||
c1settings.open(QIODevice::ReadOnly);
|
||||
for (auto line : QString(c1settings.readAll())
|
||||
.split(QRegularExpression("[\r\n]"),
|
||||
QString::SkipEmptyParts))
|
||||
for (auto line :
|
||||
QString(c1settings.readAll())
|
||||
.split(QRegularExpression("[\r\n]"), Qt::SkipEmptyParts))
|
||||
{
|
||||
if (int index = line.indexOf(' '); index != -1)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue