Commit 147abbfb authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port QStringRef to QStringView in qt6

parent dbd172bc
......@@ -178,7 +178,11 @@ bool DocumentChecker::hasErrorInClips()
// MLT 7 now generates lumas on the fly for files named luma01.pgm to luma22.pgm, so don't detect these as missing
if (lumaName.length() == 10 && lumaName.startsWith(QLatin1String("luma")) && lumaName.endsWith(QLatin1String(".pgm"))) {
bool ok;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
int lumaNumber = lumaName.midRef(4, 2).toInt(&ok);
#else
int lumaNumber = QStringView(lumaName).mid(4, 2).toInt(&ok);
#endif
if (ok && lumaNumber > 0 && lumaNumber < 23) {
continue;
}
......
......@@ -418,8 +418,11 @@ QString SlideshowClip::selectedPath(const QUrl &url, bool isMime, QString extens
// Find number of digits in sequence
int precision = fullSize - filter.size();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
int firstFrame = firstFrameData.rightRef(precision).toInt();
#else
int firstFrame = QStringView(firstFrameData).right(precision).toInt();
#endif
// Check how many files we have
QDir dir(folder);
QString path;
......
......@@ -131,13 +131,27 @@ int Timecode::getFrameCount(const QString &duration) const
int offset = 0;
if (duration.at(0) == '-') {
offset = 1;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
hours = duration.midRef(1, 2).toInt();
#else
hours = QStringView(duration).mid(1, 2).toInt();
#endif
} else {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
hours = duration.leftRef(2).toInt();
#else
hours = QStringView(duration).left(2).toInt();
#endif
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
minutes = duration.midRef(3 + offset, 2).toInt();
seconds = duration.midRef(6 + offset, 2).toInt();
frames = duration.rightRef(2).toInt();
#else
minutes = QStringView(duration).mid(3 + offset, 2).toInt();
seconds = QStringView(duration).mid(6 + offset, 2).toInt();
frames = QStringView(duration).right(2).toInt();
#endif
if (m_dropFrameTimecode) {
// CONVERT DROP FRAME TIMECODE TO A FRAME NUMBER
// Code by David Heidelberger, adapted from Andrew Duncan
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment