summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/multimedia/playback/qplaylistfileparser.cpp13
-rw-r--r--src/multimedia/qmediastoragelocation.cpp2
-rw-r--r--src/plugins/alsa/qalsaaudiodeviceinfo.cpp2
-rw-r--r--src/plugins/android/src/mediaplayer/qandroidmetadatareadercontrol.cpp2
-rw-r--r--src/plugins/audiocapture/audiocapturesession.cpp2
-rw-r--r--src/plugins/avfoundation/camera/avfstoragelocation.mm2
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.cpp2
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp2
-rw-r--r--src/plugins/qnx/camera/bbmediastoragelocation.cpp2
9 files changed, 15 insertions, 14 deletions
diff --git a/src/multimedia/playback/qplaylistfileparser.cpp b/src/multimedia/playback/qplaylistfileparser.cpp
index 1408fbe90..b60e9778c 100644
--- a/src/multimedia/playback/qplaylistfileparser.cpp
+++ b/src/multimedia/playback/qplaylistfileparser.cpp
@@ -141,7 +141,8 @@ public:
m_extraInfo.clear();
int artistStart = line.indexOf(QLatin1String(","), 8);
bool ok = false;
- int length = line.midRef(8, artistStart < 8 ? -1 : artistStart - 8).trimmed().toInt(&ok);
+ QStringView lineView { line };
+ int length = lineView.mid(8, artistStart < 8 ? -1 : artistStart - 8).trimmed().toInt(&ok);
if (ok && length > 0) {
//convert from second to milisecond
m_extraInfo[QMediaMetaData::Duration] = QVariant(length * 1000);
@@ -149,13 +150,13 @@ public:
if (artistStart > 0) {
int titleStart = getSplitIndex(line, artistStart);
if (titleStart > artistStart) {
- m_extraInfo[QMediaMetaData::Author] = line.midRef(artistStart + 1,
+ m_extraInfo[QMediaMetaData::Author] = lineView.mid(artistStart + 1,
titleStart - artistStart - 1).trimmed().toString().
replace(QLatin1String("--"), QLatin1String("-"));
- m_extraInfo[QMediaMetaData::Title] = line.midRef(titleStart + 1).trimmed().toString().
+ m_extraInfo[QMediaMetaData::Title] = lineView.mid(titleStart + 1).trimmed().toString().
replace(QLatin1String("--"), QLatin1String("-"));
} else {
- m_extraInfo[QMediaMetaData::Title] = line.midRef(artistStart + 1).trimmed().toString().
+ m_extraInfo[QMediaMetaData::Title] = lineView.mid(artistStart + 1).trimmed().toString().
replace(QLatin1String("--"), QLatin1String("-"));
}
}
@@ -255,11 +256,11 @@ Version=2
return true;
}
- QString getValue(const QString& line) {
+ QString getValue(QStringView line) {
int start = line.indexOf('=');
if (start < 0)
return QString();
- return line.midRef(start + 1).trimmed().toString();
+ return line.mid(start + 1).trimmed().toString();
}
};
}
diff --git a/src/multimedia/qmediastoragelocation.cpp b/src/multimedia/qmediastoragelocation.cpp
index 7bd1e84f4..c77ad5dba 100644
--- a/src/multimedia/qmediastoragelocation.cpp
+++ b/src/multimedia/qmediastoragelocation.cpp
@@ -118,7 +118,7 @@ QString QMediaStorageLocation::generateFileName(const QString &prefix,
// first run, find the maximum media number during the fist capture
const auto list = dir.entryList(QStringList() << QString(QLatin1String("%1*.%2")).arg(prefix).arg(extension));
for (const QString &fileName : list) {
- const qint64 mediaIndex = fileName.midRef(prefix.length(), fileName.size() - prefix.length() - extension.length() - 1).toInt();
+ const qint64 mediaIndex = QStringView{fileName}.mid(prefix.length(), fileName.size() - prefix.length() - extension.length() - 1).toInt();
lastMediaIndex = qMax(lastMediaIndex, mediaIndex);
}
}
diff --git a/src/plugins/alsa/qalsaaudiodeviceinfo.cpp b/src/plugins/alsa/qalsaaudiodeviceinfo.cpp
index 474fd6bde..5cfcb27e0 100644
--- a/src/plugins/alsa/qalsaaudiodeviceinfo.cpp
+++ b/src/plugins/alsa/qalsaaudiodeviceinfo.cpp
@@ -416,7 +416,7 @@ QString QAlsaAudioDeviceInfo::deviceFromCardName(const QString &card)
int idx = 0;
char *name;
- QStringRef shortName = card.midRef(card.indexOf(QLatin1String("="), 0) + 1);
+ QStringView shortName = QStringView{card}.mid(card.indexOf(QLatin1String("="), 0) + 1);
while (snd_card_get_name(idx, &name) == 0) {
if (shortName.compare(QLatin1String(name)) == 0)
diff --git a/src/plugins/android/src/mediaplayer/qandroidmetadatareadercontrol.cpp b/src/plugins/android/src/mediaplayer/qandroidmetadatareadercontrol.cpp
index 66eafc765..1c7003020 100644
--- a/src/plugins/android/src/mediaplayer/qandroidmetadatareadercontrol.cpp
+++ b/src/plugins/android/src/mediaplayer/qandroidmetadatareadercontrol.cpp
@@ -211,7 +211,7 @@ void QAndroidMetaDataReaderControl::extractMetadata(QAndroidMetaDataReaderContro
// The genre can be returned as an ID3v2 id, get the name for it in that case
if (string.startsWith('(') && string.endsWith(')')) {
bool ok = false;
- const int genreId = string.midRef(1, string.length() - 2).toInt(&ok);
+ const int genreId = QStringView{string}.mid(1, string.length() - 2).toInt(&ok);
if (ok && genreId >= 0 && genreId <= 125)
string = QLatin1String(qt_ID3GenreNames[genreId]);
}
diff --git a/src/plugins/audiocapture/audiocapturesession.cpp b/src/plugins/audiocapture/audiocapturesession.cpp
index 7ed3313d8..9bdb5a92d 100644
--- a/src/plugins/audiocapture/audiocapturesession.cpp
+++ b/src/plugins/audiocapture/audiocapturesession.cpp
@@ -247,7 +247,7 @@ QString AudioCaptureSession::generateFileName(const QDir &dir,
int lastClip = 0;
const auto list = dir.entryList(QStringList() << QString("clip_*.%1").arg(ext));
for (const QString &fileName : list) {
- int imgNumber = fileName.midRef(5, fileName.size()-6-ext.length()).toInt();
+ int imgNumber = QStringView{fileName}.mid(5, fileName.size()-6-ext.length()).toInt();
lastClip = qMax(lastClip, imgNumber);
}
diff --git a/src/plugins/avfoundation/camera/avfstoragelocation.mm b/src/plugins/avfoundation/camera/avfstoragelocation.mm
index c74ffe3aa..6a1cdca17 100644
--- a/src/plugins/avfoundation/camera/avfstoragelocation.mm
+++ b/src/plugins/avfoundation/camera/avfstoragelocation.mm
@@ -104,7 +104,7 @@ QString AVFStorageLocation::generateFileName(const QString &prefix, const QDir &
//first run, find the maximum clip number during the fist capture
const auto list = dir.entryList(QStringList() << QString("%1*.%2").arg(prefix).arg(ext));
for (const QString &fileName : list) {
- int imgNumber = fileName.midRef(prefix.length(), fileName.size()-prefix.length()-ext.length()-1).toInt();
+ int imgNumber = QStringView{fileName}.mid(prefix.length(), fileName.size()-prefix.length()-ext.length()-1).toInt();
lastClip = qMax(lastClip, imgNumber);
}
}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.cpp b/src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.cpp
index ae2b0201b..120c19af6 100644
--- a/src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.cpp
+++ b/src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.cpp
@@ -82,7 +82,7 @@ int QGstreamerImageCaptureControl::capture(const QString &fileName)
QDir outputDir = QDir::currentPath();
const auto list = outputDir.entryList(QStringList() << "img_*.jpg");
for (const QString &fileName : list) {
- int imgNumber = fileName.midRef(4, fileName.size()-8).toInt();
+ int imgNumber = QStringView{fileName}.mid(4, fileName.size()-8).toInt();
lastImage = qMax(lastImage, imgNumber);
}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp b/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp
index 640f659b6..d7f4ec035 100644
--- a/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp
+++ b/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp
@@ -359,7 +359,7 @@ QString QGstreamerRecorderControl::generateFileName(const QDir &dir, const QStri
int lastClip = 0;
const auto list = dir.entryList(QStringList() << QString("clip_*.%1").arg(ext));
for (const QString &fileName : list) {
- int imgNumber = fileName.midRef(5, fileName.size()-6-ext.length()).toInt();
+ int imgNumber = QStringView{fileName}.mid(5, fileName.size()-6-ext.length()).toInt();
lastClip = qMax(lastClip, imgNumber);
}
diff --git a/src/plugins/qnx/camera/bbmediastoragelocation.cpp b/src/plugins/qnx/camera/bbmediastoragelocation.cpp
index 88f5cb518..c3aaed55d 100644
--- a/src/plugins/qnx/camera/bbmediastoragelocation.cpp
+++ b/src/plugins/qnx/camera/bbmediastoragelocation.cpp
@@ -91,7 +91,7 @@ QString BbMediaStorageLocation::generateFileName(const QString &prefix, const QD
// first run, find the maximum media number during the fist capture
const auto list = dir.entryList(QStringList() << QString("%1*.%2").arg(prefix).arg(extension));
for (const QString &fileName : list) {
- const qint64 mediaIndex = fileName.midRef(prefix.length(), fileName.size() - prefix.length() - extension.length() - 1).toInt();
+ const qint64 mediaIndex = QStringView{fileName}.mid(prefix.length(), fileName.size() - prefix.length() - extension.length() - 1).toInt();
lastMediaIndex = qMax(lastMediaIndex, mediaIndex);
}
}