Replace QRegExp with QRegularExpression

This commit is contained in:
Jonas Kvinge
2020-07-18 04:05:07 +02:00
parent cf5259e218
commit e5b3df41e9
25 changed files with 102 additions and 96 deletions

View File

@@ -30,7 +30,7 @@
#include <QVariant>
#include <QPoint>
#include <QString>
#include <QRegExp>
#include <QRegularExpression>
#include <QSize>
#include <QFont>
#include <QIcon>
@@ -46,6 +46,9 @@
#include <QUndoStack>
#include <QtEvents>
#include <QSettings>
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
# include <QRegExp>
#endif
#include "core/iconloader.h"
#include "playlist.h"
@@ -197,7 +200,11 @@ void PlaylistContainer::SetViewModel(Playlist *playlist) {
emit ViewSelectionModelChanged();
// Update filter
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
ui_->filter->setText(playlist->proxy()->filterRegularExpression().pattern());
#else
ui_->filter->setText(playlist->proxy()->filterRegExp().pattern());
#endif
// Update the no matches label
connect(playlist_->proxy(), SIGNAL(modelReset()), SLOT(UpdateNoMatchesLabel()));

View File

@@ -22,9 +22,12 @@
#include <QObject>
#include <QString>
#include <QRegExp>
#include <QRegularExpression>
#include <QAbstractItemModel>
#include <QSortFilterProxyModel>
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
# include <QRegExp>
#endif
#include "playlist/playlist.h"
#include "playlistfilter.h"
@@ -78,7 +81,11 @@ void PlaylistFilter::sort(int column, Qt::SortOrder order) {
bool PlaylistFilter::filterAcceptsRow(int row, const QModelIndex &parent) const {
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
QString filter = filterRegularExpression().pattern();
#else
QString filter = filterRegExp().pattern();
#endif
uint hash = qHash(filter);
if (hash != query_hash_) {

View File

@@ -35,7 +35,7 @@
#include <QVariant>
#include <QString>
#include <QStringBuilder>
#include <QRegExp>
#include <QRegularExpression>
#include <QUrl>
#include <QAbstractItemModel>
#include <QSettings>
@@ -212,7 +212,6 @@ void PlaylistManager::Save(int id, const QString &filename, Playlist::Path path_
else {
// Playlist is not in the playlist manager: probably save action was triggered from the left side bar and the playlist isn't loaded.
QFuture<QList<Song>> future = QtConcurrent::run(playlist_backend_, &PlaylistBackend::GetPlaylistSongs, id);
NewClosure(future, this, SLOT(ItemsLoadedForSavePlaylist(QFuture<SongList>, QString, Playlist::Path)), future, filename, path_type);
}
@@ -233,7 +232,7 @@ void PlaylistManager::SaveWithUI(int id, const QString &playlist_name) {
QString filter = settings.value("last_save_filter", parser()->default_filter()).toString();
QString suggested_filename = playlist_name;
suggested_filename.replace(QRegExp("\\W"), "");
suggested_filename.replace(QRegularExpression("\\W"), "");
qLog(Debug) << "Using extension:" << extension;