Replace QRegExp with QRegularExpression
This commit is contained in:
parent
cf5259e218
commit
e5b3df41e9
@ -38,7 +38,7 @@
|
||||
#include <QUrl>
|
||||
#include <QFileInfo>
|
||||
#include <QDateTime>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QSqlDatabase>
|
||||
#include <QSqlQuery>
|
||||
|
||||
@ -1031,7 +1031,7 @@ CollectionBackend::AlbumList CollectionBackend::GetAlbums(const QString &artist,
|
||||
info.first_url = QUrl::fromEncoded(query.Value(7).toByteArray());
|
||||
|
||||
QString art_automatic = query.Value(5).toString();
|
||||
if (art_automatic.contains(QRegExp("..+:.*"))) {
|
||||
if (art_automatic.contains(QRegularExpression("..+:.*"))) {
|
||||
info.art_automatic = QUrl::fromEncoded(art_automatic.toUtf8());
|
||||
}
|
||||
else {
|
||||
@ -1039,7 +1039,7 @@ CollectionBackend::AlbumList CollectionBackend::GetAlbums(const QString &artist,
|
||||
}
|
||||
|
||||
QString art_manual = query.Value(6).toString();
|
||||
if (art_manual.contains(QRegExp("..+:.*"))) {
|
||||
if (art_manual.contains(QRegularExpression("..+:.*"))) {
|
||||
info.art_manual = QUrl::fromEncoded(art_manual.toUtf8());
|
||||
}
|
||||
else {
|
||||
@ -1228,7 +1228,7 @@ void CollectionBackend::IncrementPlayCount(int id) {
|
||||
|
||||
QSqlQuery q(db);
|
||||
q.prepare(QString("UPDATE %1 SET playcount = playcount + 1, lastplayed = :now WHERE ROWID = :id").arg(songs_table_));
|
||||
q.bindValue(":now", QDateTime::currentDateTime().toTime_t());
|
||||
q.bindValue(":now", QDateTime::currentDateTime().toSecsSinceEpoch());
|
||||
q.bindValue(":id", id);
|
||||
q.exec();
|
||||
if (db_->CheckErrors(q)) return;
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QInputDialog>
|
||||
#include <QList>
|
||||
#include <QTimer>
|
||||
@ -63,7 +63,7 @@ CollectionFilterWidget::CollectionFilterWidget(QWidget *parent)
|
||||
|
||||
ui_->setupUi(this);
|
||||
|
||||
QString available_fields = Song::kFtsColumns.join(", ").replace(QRegExp("\\bfts"), "");
|
||||
QString available_fields = Song::kFtsColumns.join(", ").replace(QRegularExpression("\\bfts"), "");
|
||||
|
||||
ui_->filter->setToolTip(
|
||||
"<html><head/><body><p>" +
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include <QUrl>
|
||||
#include <QImage>
|
||||
#include <QChar>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QPixmapCache>
|
||||
#include <QNetworkDiskCache>
|
||||
#include <QSettings>
|
||||
@ -861,7 +861,6 @@ void CollectionModel::LazyPopulate(CollectionItem *parent, const bool signal) {
|
||||
void CollectionModel::ResetAsync() {
|
||||
QFuture<CollectionModel::QueryResult> future = QtConcurrent::run(this, &CollectionModel::RunQuery, root_);
|
||||
NewClosure(future, this, SLOT(ResetAsyncQueryFinished(QFuture<CollectionModel::QueryResult>)), future);
|
||||
|
||||
}
|
||||
|
||||
void CollectionModel::ResetAsyncQueryFinished(QFuture<CollectionModel::QueryResult> future) {
|
||||
@ -1421,7 +1420,7 @@ QString CollectionModel::PrettyYearAlbum(const int year, const QString &album) {
|
||||
|
||||
QString CollectionModel::PrettyAlbumDisc(const QString &album, const int disc) {
|
||||
|
||||
if (disc <= 0 || album.contains(QRegExp(Song::kAlbumRemoveDisc))) return TextOrUnknown(album);
|
||||
if (disc <= 0 || album.contains(QRegularExpression(Song::kAlbumRemoveDisc))) return TextOrUnknown(album);
|
||||
else return TextOrUnknown(album) + " - (Disc " + QString::number(disc) + ")";
|
||||
|
||||
}
|
||||
@ -1433,7 +1432,7 @@ QString CollectionModel::PrettyYearAlbumDisc(const int year, const QString &albu
|
||||
if (year <= 0) str = TextOrUnknown(album);
|
||||
else str = QString::number(year) + " - " + TextOrUnknown(album);
|
||||
|
||||
if (!album.contains(QRegExp(Song::kAlbumRemoveDisc)) && disc > 0) str += " - (Disc " + QString::number(disc) + ")";
|
||||
if (!album.contains(QRegularExpression(Song::kAlbumRemoveDisc)) && disc > 0) str += " - (Disc " + QString::number(disc) + ")";
|
||||
|
||||
return str;
|
||||
|
||||
@ -1447,7 +1446,7 @@ QString CollectionModel::SortText(QString text) {
|
||||
else {
|
||||
text = text.toLower();
|
||||
}
|
||||
text = text.remove(QRegExp("[^\\w ]"));
|
||||
text = text.remove(QRegularExpression("[^\\w ]"));
|
||||
|
||||
return text;
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QStringBuilder>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QSqlDatabase>
|
||||
#include <QSqlQuery>
|
||||
|
||||
@ -46,9 +46,9 @@ CollectionQuery::CollectionQuery(const QueryOptions &options)
|
||||
|
||||
// Split on whitespace
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
QStringList tokens(options.filter().split(QRegExp("\\s+"), Qt::SkipEmptyParts));
|
||||
QStringList tokens(options.filter().split(QRegularExpression("\\s+"), Qt::SkipEmptyParts));
|
||||
#else
|
||||
QStringList tokens(options.filter().split(QRegExp("\\s+"), QString::SkipEmptyParts));
|
||||
QStringList tokens(options.filter().split(QRegularExpression("\\s+"), QString::SkipEmptyParts));
|
||||
#endif
|
||||
QString query;
|
||||
for (QString token : tokens) {
|
||||
@ -86,7 +86,7 @@ CollectionQuery::CollectionQuery(const QueryOptions &options)
|
||||
}
|
||||
|
||||
if (options.max_age() != -1) {
|
||||
int cutoff = QDateTime::currentDateTime().toTime_t() - options.max_age();
|
||||
int cutoff = QDateTime::currentDateTime().toSecsSinceEpoch() - options.max_age();
|
||||
|
||||
where_clauses_ << "ctime > ?";
|
||||
bound_values_ << cutoff;
|
||||
@ -202,7 +202,7 @@ QVariant CollectionQuery::Value(int column) const { return query_.value(column);
|
||||
bool QueryOptions::Matches(const Song &song) const {
|
||||
|
||||
if (max_age_ != -1) {
|
||||
const uint cutoff = QDateTime::currentDateTime().toTime_t() - max_age_;
|
||||
const uint cutoff = QDateTime::currentDateTime().toSecsSinceEpoch() - max_age_;
|
||||
if (song.ctime() <= cutoff) return false;
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <QVariant>
|
||||
#include <QList>
|
||||
#include <QSet>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
@ -370,7 +370,7 @@ QString ContextAlbumsModel::SortText(QString text) {
|
||||
else {
|
||||
text = text.toLower();
|
||||
}
|
||||
text = text.remove(QRegExp("[^\\w ]"));
|
||||
text = text.remove(QRegularExpression("[^\\w ]"));
|
||||
|
||||
return text;
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include <QString>
|
||||
#include <QStringBuilder>
|
||||
#include <QStringList>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QUrl>
|
||||
#include <QSqlDriver>
|
||||
#include <QSqlDatabase>
|
||||
@ -392,7 +392,7 @@ void Database::ExecSchemaCommandsFromFile(QSqlDatabase &db, const QString &filen
|
||||
void Database::ExecSchemaCommands(QSqlDatabase &db, const QString &schema, int schema_version, bool in_transaction) {
|
||||
|
||||
// Run each command
|
||||
const QStringList commands(schema.split(QRegExp("; *\n\n")));
|
||||
const QStringList commands(schema.split(QRegularExpression("; *\n\n")));
|
||||
|
||||
// We don't want this list to reflect possible DB schema changes so we initialize it before executing any statements.
|
||||
// If no outer transaction is provided the song tables need to be queried before beginning an inner transaction! Otherwise
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QRegularExpression>
|
||||
#include <QRegExp>
|
||||
#include <QUrl>
|
||||
#include <QImage>
|
||||
@ -148,9 +149,9 @@ const QString Song::kFtsUpdateSpec = Utilities::Updateify(Song::kFtsColumns).joi
|
||||
const QString Song::kManuallyUnsetCover = "(unset)";
|
||||
const QString Song::kEmbeddedCover = "(embedded)";
|
||||
|
||||
const QRegExp Song::kAlbumRemoveDisc(" ?-? ((\\(|\\[)?)(Disc|CD) ?([0-9]{1,2})((\\)|\\])?)$");
|
||||
const QRegExp Song::kAlbumRemoveMisc(" ?-? ((\\(|\\[)?)(Remastered|([0-9]{1,4}) *Remaster) ?((\\)|\\])?)$");
|
||||
const QRegExp Song::kTitleRemoveMisc(" ?-? ((\\(|\\[)?)(Remastered|Live|Remastered Version|([0-9]{1,4}) *Remaster) ?((\\)|\\])?)$");
|
||||
const QRegularExpression Song::kAlbumRemoveDisc(" ?-? ((\\(|\\[)?)(Disc|CD) ?([0-9]{1,2})((\\)|\\])?)$");
|
||||
const QRegularExpression Song::kAlbumRemoveMisc(" ?-? ((\\(|\\[)?)(Remastered|([0-9]{1,4}) *Remaster) ?((\\)|\\])?)$");
|
||||
const QRegularExpression Song::kTitleRemoveMisc(" ?-? ((\\(|\\[)?)(Remastered|Live|Remastered Version|([0-9]{1,4}) *Remaster) ?((\\)|\\])?)$");
|
||||
const QString Song::kVariousArtists("various artists");
|
||||
|
||||
const QStringList Song::kArticles = QStringList() << "the " << "a " << "an ";
|
||||
@ -322,8 +323,8 @@ const QUrl &Song::url() const { return d->url_; }
|
||||
const QString &Song::basefilename() const { return d->basefilename_; }
|
||||
Song::FileType Song::filetype() const { return d->filetype_; }
|
||||
int Song::filesize() const { return d->filesize_; }
|
||||
uint Song::mtime() const { return d->mtime_; }
|
||||
uint Song::ctime() const { return d->ctime_; }
|
||||
quint64 Song::mtime() const { return d->mtime_; }
|
||||
quint64 Song::ctime() const { return d->ctime_; }
|
||||
|
||||
int Song::playcount() const { return d->playcount_; }
|
||||
int Song::skipcount() const { return d->skipcount_; }
|
||||
@ -958,7 +959,7 @@ void Song::InitFromQuery(const SqlRow &q, bool reliable_metadata, int col) {
|
||||
|
||||
else if (Song::kColumns.value(i) == "art_automatic") {
|
||||
QString art_automatic = tostr(x);
|
||||
if (art_automatic.contains(QRegExp("..+:.*"))) {
|
||||
if (art_automatic.contains(QRegularExpression("..+:.*"))) {
|
||||
set_art_automatic(QUrl::fromEncoded(art_automatic.toUtf8()));
|
||||
}
|
||||
else {
|
||||
@ -967,7 +968,7 @@ void Song::InitFromQuery(const SqlRow &q, bool reliable_metadata, int col) {
|
||||
}
|
||||
else if (Song::kColumns.value(i) == "art_manual") {
|
||||
QString art_manual = tostr(x);
|
||||
if (art_manual.contains(QRegExp("..+:.*"))) {
|
||||
if (art_manual.contains(QRegularExpression("..+:.*"))) {
|
||||
set_art_manual(QUrl::fromEncoded(art_manual.toUtf8()));
|
||||
}
|
||||
else {
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QUrl>
|
||||
#include <QImage>
|
||||
#include <QIcon>
|
||||
@ -120,10 +120,9 @@ class Song {
|
||||
static const QString kManuallyUnsetCover;
|
||||
static const QString kEmbeddedCover;
|
||||
|
||||
static const QRegExp kAlbumRemoveDisc;
|
||||
static const QRegExp kAlbumRemoveMisc;
|
||||
static const QRegExp kTitleRemoveMisc;
|
||||
static const QRegExp kFilenameRemoveNonFatChars;
|
||||
static const QRegularExpression kAlbumRemoveDisc;
|
||||
static const QRegularExpression kAlbumRemoveMisc;
|
||||
static const QRegularExpression kTitleRemoveMisc;
|
||||
|
||||
static const QString kVariousArtists;
|
||||
|
||||
@ -228,8 +227,8 @@ class Song {
|
||||
const QString &basefilename() const;
|
||||
FileType filetype() const;
|
||||
int filesize() const;
|
||||
uint mtime() const;
|
||||
uint ctime() const;
|
||||
quint64 mtime() const;
|
||||
quint64 ctime() const;
|
||||
|
||||
int playcount() const;
|
||||
int skipcount() const;
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
#include <QRegularExpression>
|
||||
#include <QRegExp>
|
||||
#include <QTcpServer>
|
||||
#include <QTemporaryFile>
|
||||
@ -157,7 +158,7 @@ QString WordyTimeNanosec(qint64 nanoseconds) {
|
||||
QString Ago(int seconds_since_epoch, const QLocale &locale) {
|
||||
|
||||
const QDateTime now = QDateTime::currentDateTime();
|
||||
const QDateTime then = QDateTime::fromTime_t(seconds_since_epoch);
|
||||
const QDateTime then = QDateTime::fromSecsSinceEpoch(seconds_since_epoch);
|
||||
const int days_ago = then.date().daysTo(now.date());
|
||||
const QString time = then.time().toString(locale.timeFormat(QLocale::ShortFormat));
|
||||
|
||||
@ -533,16 +534,6 @@ QString PrettySize(const QSize &size) {
|
||||
return QString::number(size.width()) + "x" + QString::number(size.height());
|
||||
}
|
||||
|
||||
void ForwardMouseEvent(const QMouseEvent *e, QWidget *target) {
|
||||
QMouseEvent c(e->type(), target->mapFromGlobal(e->globalPos()), e->globalPos(), e->button(), e->buttons(), e->modifiers());
|
||||
|
||||
QApplication::sendEvent(target, &c);
|
||||
}
|
||||
|
||||
bool IsMouseEventInWidget(const QMouseEvent *e, const QWidget *widget) {
|
||||
return widget->rect().contains(widget->mapFromGlobal(e->globalPos()));
|
||||
}
|
||||
|
||||
quint16 PickUnusedPort() {
|
||||
|
||||
forever {
|
||||
@ -944,7 +935,7 @@ QString ReplaceMessage(const QString &message, const Song &song, const QString &
|
||||
pos += variable_replacer.matchedLength();
|
||||
}
|
||||
|
||||
int index_of = copy.indexOf(QRegExp(" - (>|$)"));
|
||||
int index_of = copy.indexOf(QRegularExpression(" - (>|$)"));
|
||||
if (index_of >= 0) copy = copy.remove(index_of, 3);
|
||||
|
||||
return copy;
|
||||
|
@ -85,12 +85,6 @@ QByteArray Sha1CoverHash(const QString &artist, const QString &album);
|
||||
// Picks an unused ephemeral port number. Doesn't hold the port open so there's the obvious race condition
|
||||
quint16 PickUnusedPort();
|
||||
|
||||
// Forwards a mouse event to a different widget, remapping the event's widget coordinates relative to those of the target widget.
|
||||
void ForwardMouseEvent(const QMouseEvent *e, QWidget *target);
|
||||
|
||||
// Checks if the mouse event was inside the widget's rectangle.
|
||||
bool IsMouseEventInWidget(const QMouseEvent *e, const QWidget *widget);
|
||||
|
||||
// Reads all children of the current element,
|
||||
// and returns with the stream reader either on the EndElement for the current element, or the end of the file - whichever came first.
|
||||
void ConsumeCurrentElement(QXmlStreamReader *reader);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QRegularExpression>
|
||||
#include <QRegExp>
|
||||
#include <QUrl>
|
||||
#include <QUrlQuery>
|
||||
@ -218,11 +219,11 @@ QList<QUrl> GioLister::MakeDeviceUrls(const QString &id) {
|
||||
for (QString uri : uris) {
|
||||
|
||||
// gphoto2 gives invalid hostnames with []:, characters in
|
||||
uri.replace(QRegExp("//\\[usb:(\\d+),(\\d+)\\]"), "//usb-\\1-\\2");
|
||||
uri.replace(QRegularExpression("//\\[usb:(\\d+),(\\d+)\\]"), "//usb-\\1-\\2");
|
||||
|
||||
QUrl url;
|
||||
|
||||
if (uri.contains(QRegExp("..+:.*"))) {
|
||||
if (uri.contains(QRegularExpression("..+:.*"))) {
|
||||
url = QUrl::fromEncoded(uri.toUtf8());
|
||||
}
|
||||
else {
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QUrl>
|
||||
#include <QImage>
|
||||
#include <QPixmap>
|
||||
@ -427,7 +427,7 @@ void InternetSearchView::SwapModels() {
|
||||
|
||||
QStringList InternetSearchView::TokenizeQuery(const QString &query) {
|
||||
|
||||
QStringList tokens(query.split(QRegExp("\\s+")));
|
||||
QStringList tokens(query.split(QRegularExpression("\\s+")));
|
||||
|
||||
for (QStringList::iterator it = tokens.begin(); it != tokens.end(); ++it) {
|
||||
(*it).remove('(');
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <QTextCodec>
|
||||
#include <QDesktopServices>
|
||||
#include <QCryptographicHash>
|
||||
#include <QRegularExpression>
|
||||
#include <QSettings>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
@ -501,7 +502,7 @@ void GeniusLyricsProvider::HandleLyricReply(QNetworkReply *reply, const int sear
|
||||
begin_idx += tag_begin.length();
|
||||
int end_idx = content.indexOf(tag_end, begin_idx);
|
||||
lyrics = content.mid(begin_idx, end_idx - begin_idx);
|
||||
lyrics = lyrics.remove(QRegExp("<[^>]*>"));
|
||||
lyrics = lyrics.remove(QRegularExpression("<[^>]*>"));
|
||||
lyrics = lyrics.trimmed();
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <QString>
|
||||
#include <QStringBuilder>
|
||||
#include <QStringList>
|
||||
#include <QRegularExpression>
|
||||
#include <QRegExp>
|
||||
#include <QUrl>
|
||||
#include <QFileInfo>
|
||||
@ -68,10 +69,10 @@ const QStringList OrganiseFormat::kKnownTags = QStringList() << "title"
|
||||
<< "grouping"
|
||||
<< "lyrics";
|
||||
|
||||
const QRegExp OrganiseFormat::kInvalidDirCharacters("[/\\\\]");
|
||||
const QRegExp OrganiseFormat::kProblematicCharacters("[:?*\"<>|]");
|
||||
const QRegularExpression OrganiseFormat::kInvalidDirCharacters("[/\\\\]");
|
||||
const QRegularExpression OrganiseFormat::kProblematicCharacters("[:?*\"<>|]");
|
||||
// From http://en.wikipedia.org/wiki/8.3_filename#Directory_table
|
||||
const QRegExp OrganiseFormat::kInvalidFatCharacters("[^a-zA-Z0-9!#\\$%&'()\\-@\\^_`{}~/. ]");
|
||||
const QRegularExpression OrganiseFormat::kInvalidFatCharacters("[^a-zA-Z0-9!#\\$%&'()\\-@\\^_`{}~/. ]");
|
||||
|
||||
const char OrganiseFormat::kInvalidPrefixCharacters[] = ".";
|
||||
const int OrganiseFormat::kInvalidPrefixCharactersCount = arraysize(OrganiseFormat::kInvalidPrefixCharacters) - 1;
|
||||
@ -126,7 +127,7 @@ QString OrganiseFormat::GetFilenameForSong(const Song &song) const {
|
||||
if (allow_ascii_ext_) ascii = 255;
|
||||
QString stripped;
|
||||
for (int i = 0 ; i < filename.length() ; ++i) {
|
||||
const QCharRef c = filename[i];
|
||||
const QChar c = filename[i];
|
||||
if (c < ascii) {
|
||||
stripped.append(c);
|
||||
}
|
||||
@ -167,7 +168,7 @@ QString OrganiseFormat::GetFilenameForSong(const Song &song) const {
|
||||
}
|
||||
filename = parts_new.join("/");
|
||||
|
||||
if (replace_spaces_) filename.replace(QRegExp("\\s"), "_");
|
||||
if (replace_spaces_) filename.replace(QRegularExpression("\\s"), "_");
|
||||
|
||||
if (!extension.isEmpty()) {
|
||||
filename.append(QString(".%1").arg(extension));
|
||||
@ -254,7 +255,7 @@ QString OrganiseFormat::TagValue(const QString &tag, const Song &song) const {
|
||||
else if (tag == "artistinitial") {
|
||||
value = song.effective_albumartist().trimmed();
|
||||
if (!value.isEmpty()) {
|
||||
value.replace(QRegExp("^the\\s+", Qt::CaseInsensitive), "");
|
||||
value.replace(QRegularExpression("^the\\s+", QRegularExpression::CaseInsensitiveOption), "");
|
||||
value = value[0].toUpper();
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QRgb>
|
||||
#include <QSyntaxHighlighter>
|
||||
#include <QValidator>
|
||||
@ -43,9 +43,9 @@ class OrganiseFormat {
|
||||
static const char *kTagPattern;
|
||||
static const char *kBlockPattern;
|
||||
static const QStringList kKnownTags;
|
||||
static const QRegExp kInvalidDirCharacters;
|
||||
static const QRegExp kProblematicCharacters;
|
||||
static const QRegExp kInvalidFatCharacters;
|
||||
static const QRegularExpression kInvalidDirCharacters;
|
||||
static const QRegularExpression kProblematicCharacters;
|
||||
static const QRegularExpression kInvalidFatCharacters;
|
||||
|
||||
static const char kInvalidPrefixCharacters[];
|
||||
static const int kInvalidPrefixCharactersCount;
|
||||
|
@ -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()));
|
||||
|
@ -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_) {
|
||||
|
@ -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;
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
#include <QStringBuilder>
|
||||
#include <QRegularExpression>
|
||||
#include <QRegExp>
|
||||
#include <QUrl>
|
||||
#include <QXmlStreamReader>
|
||||
@ -52,7 +53,7 @@ SongList ASXParser::Load(QIODevice *device, const QString &playlist_path, const
|
||||
int index = 0;
|
||||
while ((index = ex.indexIn(data, index)) != -1) {
|
||||
QString url = ex.cap(2);
|
||||
url.replace(QRegExp("&(?!amp;|quot;|apos;|lt;|gt;)"), "&");
|
||||
url.replace(QRegularExpression("&(?!amp;|quot;|apos;|lt;|gt;)"), "&");
|
||||
|
||||
QByteArray replacement = QString(ex.cap(1) + url + "\"").toLocal8Bit();
|
||||
data.replace(ex.cap(0).toLocal8Bit(), replacement);
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QRegularExpression>
|
||||
#include <QRegExp>
|
||||
#include <QTextCodec>
|
||||
#include <QTextStream>
|
||||
@ -62,7 +63,9 @@ SongList CueParser::Load(QIODevice *device, const QString &playlist_path, const
|
||||
SongList ret;
|
||||
|
||||
QTextStream text_stream(device);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
text_stream.setCodec(QTextCodec::codecForUtfText(device->peek(1024), QTextCodec::codecForName("UTF-8")));
|
||||
#endif
|
||||
|
||||
QString dir_path = dir.absolutePath();
|
||||
// read the first line already
|
||||
@ -234,7 +237,7 @@ SongList CueParser::Load(QIODevice *device, const QString &playlist_path, const
|
||||
|
||||
// Cue song has mtime equal to qMax(media_file_mtime, cue_sheet_mtime)
|
||||
if (cue_mtime.isValid()) {
|
||||
song.set_mtime(qMax(cue_mtime.toTime_t(), song.mtime()));
|
||||
song.set_mtime(qMax(static_cast<quint64>(cue_mtime.toSecsSinceEpoch()), song.mtime()));
|
||||
}
|
||||
song.set_cue_path(playlist_path);
|
||||
|
||||
@ -275,7 +278,7 @@ QStringList CueParser::SplitCueLine(const QString &line) const {
|
||||
}
|
||||
|
||||
// Let's remove the empty entries while we're at it
|
||||
return line_regexp.capturedTexts().filter(QRegExp(".+")).mid(1, -1);
|
||||
return line_regexp.capturedTexts().filter(QRegularExpression(".+")).mid(1, -1);
|
||||
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QString>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QUrl>
|
||||
|
||||
#include "core/logging.h"
|
||||
@ -43,7 +43,7 @@ void ParserBase::LoadSong(const QString &filename_or_url, qint64 beginning, cons
|
||||
|
||||
QString filename = filename_or_url;
|
||||
|
||||
if (filename_or_url.contains(QRegExp("^[a-z]{2,}:"))) {
|
||||
if (filename_or_url.contains(QRegularExpression("^[a-z]{2,}:"))) {
|
||||
QUrl url(filename_or_url);
|
||||
song->set_source(Song::SourceFromURL(url));
|
||||
if (song->source() == Song::Source_LocalFile) {
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QFontMetrics>
|
||||
#include <QAbstractItemView>
|
||||
#include <QListView>
|
||||
@ -311,7 +311,7 @@ void BackendSettingsPage::Load_Device(QString output, QVariant device) {
|
||||
if (engine()->ALSADeviceSupport(output)) {
|
||||
ui_->radiobutton_alsa_hw->setEnabled(true);
|
||||
ui_->radiobutton_alsa_plughw->setEnabled(true);
|
||||
if (device.toString().contains(QRegExp("^plughw:.*"))) {
|
||||
if (device.toString().contains(QRegularExpression("^plughw:.*"))) {
|
||||
ui_->radiobutton_alsa_hw->setChecked(false);
|
||||
ui_->radiobutton_alsa_plughw->setChecked(true);
|
||||
SwitchALSADevices(alsa_plugin::alsa_plughw);
|
||||
@ -476,11 +476,11 @@ void BackendSettingsPage::DeviceStringChanged() {
|
||||
|
||||
#ifdef HAVE_ALSA
|
||||
if (engine()->ALSADeviceSupport(output.name)) {
|
||||
if (ui_->lineedit_device->text().contains(QRegExp("^hw:.*")) && !ui_->radiobutton_alsa_hw->isChecked()) {
|
||||
if (ui_->lineedit_device->text().contains(QRegularExpression("^hw:.*")) && !ui_->radiobutton_alsa_hw->isChecked()) {
|
||||
ui_->radiobutton_alsa_hw->setChecked(true);
|
||||
SwitchALSADevices(alsa_plugin::alsa_hw);
|
||||
}
|
||||
else if (ui_->lineedit_device->text().contains(QRegExp("^plughw:.*")) && !ui_->radiobutton_alsa_plughw->isChecked()) {
|
||||
else if (ui_->lineedit_device->text().contains(QRegularExpression("^plughw:.*")) && !ui_->radiobutton_alsa_plughw->isChecked()) {
|
||||
ui_->radiobutton_alsa_plughw->setChecked(true);
|
||||
SwitchALSADevices(alsa_plugin::alsa_plughw);
|
||||
}
|
||||
@ -542,10 +542,10 @@ void BackendSettingsPage::SwitchALSADevices(alsa_plugin alsaplugin) {
|
||||
for (int i = 0; i < ui_->combobox_device->count(); ++i) {
|
||||
QListView *view = qobject_cast<QListView *>(ui_->combobox_device->view());
|
||||
if (!view) continue;
|
||||
if (alsaplugin == alsa_plugin::alsa_hw && ui_->combobox_device->itemData(i).toString().contains(QRegExp("^plughw:.*"))) {
|
||||
if (alsaplugin == alsa_plugin::alsa_hw && ui_->combobox_device->itemData(i).toString().contains(QRegularExpression("^plughw:.*"))) {
|
||||
view->setRowHidden(i, true);
|
||||
}
|
||||
else if (alsaplugin == alsa_plugin::alsa_plughw && ui_->combobox_device->itemData(i).toString().contains(QRegExp("^hw:.*"))) {
|
||||
else if (alsaplugin == alsa_plugin::alsa_plughw && ui_->combobox_device->itemData(i).toString().contains(QRegularExpression("^hw:.*"))) {
|
||||
view->setRowHidden(i, true);
|
||||
}
|
||||
else {
|
||||
@ -567,9 +567,9 @@ void BackendSettingsPage::radiobutton_alsa_hw_clicked(bool checked) {
|
||||
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
||||
if (!engine()->ALSADeviceSupport(output.name)) return;
|
||||
|
||||
if (ui_->lineedit_device->text().contains(QRegExp("^plughw:.*"))) {
|
||||
if (ui_->lineedit_device->text().contains(QRegularExpression("^plughw:.*"))) {
|
||||
SwitchALSADevices(alsa_plugin::alsa_hw);
|
||||
QString device_new = ui_->lineedit_device->text().replace(QRegExp("^plughw:"), "hw:");
|
||||
QString device_new = ui_->lineedit_device->text().replace(QRegularExpression("^plughw:"), "hw:");
|
||||
bool found(false);
|
||||
for (int i = 0; i < ui_->combobox_device->count(); ++i) {
|
||||
QVariant device = ui_->combobox_device->itemData(i).value<QVariant>();
|
||||
@ -598,9 +598,9 @@ void BackendSettingsPage::radiobutton_alsa_plughw_clicked(bool checked) {
|
||||
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
||||
if (!engine()->ALSADeviceSupport(output.name)) return;
|
||||
|
||||
if (ui_->lineedit_device->text().contains(QRegExp("^hw:.*"))) {
|
||||
if (ui_->lineedit_device->text().contains(QRegularExpression("^hw:.*"))) {
|
||||
SwitchALSADevices(alsa_plugin::alsa_plughw);
|
||||
QString device_new = ui_->lineedit_device->text().replace(QRegExp("^hw:"), "plughw:");
|
||||
QString device_new = ui_->lineedit_device->text().replace(QRegularExpression("^hw:"), "plughw:");
|
||||
bool found(false);
|
||||
for (int i = 0; i < ui_->combobox_device->count(); ++i) {
|
||||
QVariant device = ui_->combobox_device->itemData(i).value<QVariant>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user