Replace QRegExp with QRegularExpression
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QUrl>
|
||||
#include <QImage>
|
||||
#include <QImageWriter>
|
||||
@@ -163,7 +163,7 @@ void AlbumCoverChoiceController::SaveCoverToFileManual(const Song &song, const Q
|
||||
}
|
||||
initial_file_name = initial_file_name + "-" + (song.effective_album().isEmpty() ? tr("unknown") : song.effective_album()) + ".jpg";
|
||||
initial_file_name = initial_file_name.toLower();
|
||||
initial_file_name.replace(QRegExp("\\s"), "-");
|
||||
initial_file_name.replace(QRegularExpression("\\s"), "-");
|
||||
initial_file_name.remove(OrganiseFormat::kInvalidFatCharacters);
|
||||
|
||||
QString save_filename = QFileDialog::getSaveFileName(this, tr("Save album cover"), GetInitialPathForFileDialog(song, initial_file_name), tr(kSaveImageFileFilter) + ";;" + tr(kAllFilesFilter));
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <QQueue>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QRegularExpression>
|
||||
#include <QUrl>
|
||||
#include <QImage>
|
||||
#include <QPixmap>
|
||||
@@ -150,7 +151,7 @@ QString AlbumCoverLoader::CoverFilePath(const Song::Source source, const QString
|
||||
filename = CoverFilenameFromVariable(artist, album);
|
||||
filename.remove(OrganiseFormat::kInvalidFatCharacters);
|
||||
if (cover_lowercase_) filename = filename.toLower();
|
||||
if (cover_replace_spaces_) filename.replace(QRegExp("\\s"), "-");
|
||||
if (cover_replace_spaces_) filename.replace(QRegularExpression("\\s"), "-");
|
||||
if (!extension.isEmpty()) {
|
||||
filename.append('.');
|
||||
filename.append(extension);
|
||||
|
||||
@@ -25,10 +25,11 @@
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <QUrlQuery>
|
||||
#include <QRegularExpression>
|
||||
#include <QTextCodec>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
#include <QTextCodec>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonParseError>
|
||||
#include <QJsonObject>
|
||||
@@ -61,17 +62,17 @@ bool MusixmatchCoverProvider::StartSearch(const QString &artist, const QString &
|
||||
QString album_stripped = album;
|
||||
|
||||
artist_stripped = artist_stripped.replace('/', '-');
|
||||
artist_stripped = artist_stripped.remove(QRegExp("[^A-Za-z0-9\\- ]"));
|
||||
artist_stripped = artist_stripped.remove(QRegularExpression("[^A-Za-z0-9\\- ]"));
|
||||
artist_stripped = artist_stripped.simplified();
|
||||
artist_stripped = artist_stripped.replace(' ', '-');
|
||||
artist_stripped = artist_stripped.replace(QRegExp("(-)\\1+"), "-");
|
||||
artist_stripped = artist_stripped.replace(QRegularExpression("(-)\\1+"), "-");
|
||||
artist_stripped = artist_stripped.toLower();
|
||||
|
||||
album_stripped = album_stripped.replace('/', '-');
|
||||
album_stripped = album_stripped.remove(QRegExp("[^a-zA-Z0-9\\- ]"));
|
||||
album_stripped = album_stripped.remove(QRegularExpression("[^a-zA-Z0-9\\- ]"));
|
||||
album_stripped = album_stripped.simplified();
|
||||
album_stripped = album_stripped.replace(' ', '-').toLower();
|
||||
album_stripped = album_stripped.replace(QRegExp("(-)\\1+"), "-");
|
||||
album_stripped = album_stripped.replace(QRegularExpression("(-)\\1+"), "-");
|
||||
album_stripped = album_stripped.toLower();
|
||||
|
||||
if (artist_stripped.isEmpty() || album_stripped.isEmpty()) return false;
|
||||
@@ -142,7 +143,7 @@ void MusixmatchCoverProvider::HandleSearchReply(QNetworkReply *reply, const int
|
||||
return;
|
||||
}
|
||||
|
||||
if (content_json.contains(QRegExp("<[^>]*>"))) { // Make sure it's not HTML code.
|
||||
if (content_json.contains(QRegularExpression("<[^>]*>"))) { // Make sure it's not HTML code.
|
||||
emit SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user