Replace QRegExp with QRegularExpression
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user