Drop Qt 5 support

Qt 6 has been available for almost 4 years. Qt 5 is no longer officially supported by Qt for opensource, it's time to drop Qt 5.
This commit is contained in:
Jonas Kvinge
2024-09-07 00:12:56 +02:00
parent eb30c654c5
commit e3e6a22172
91 changed files with 76 additions and 760 deletions

View File

@@ -33,12 +33,6 @@
class CollectionBackendInterface;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
constexpr auto qt_endl = Qt::endl;
#else
constexpr auto qt_endl = endl;
#endif
AsxIniParser::AsxIniParser(SharedPtr<CollectionBackendInterface> collection_backend, QObject *parent)
: ParserBase(collection_backend, parent) {}
@@ -73,11 +67,11 @@ SongList AsxIniParser::Load(QIODevice *device, const QString &playlist_path, con
void AsxIniParser::Save(const SongList &songs, QIODevice *device, const QDir &dir, const PlaylistSettingsPage::PathType path_type) const {
QTextStream s(device);
s << "[Reference]" << qt_endl;
s << "[Reference]" << Qt::endl;
int n = 1;
for (const Song &song : songs) {
s << "Ref" << n << "=" << URLOrFilename(song.url(), dir, path_type) << qt_endl;
s << "Ref" << n << "=" << URLOrFilename(song.url(), dir, path_type) << Qt::endl;
++n;
}

View File

@@ -30,11 +30,7 @@
#include <QStringList>
#include <QRegularExpression>
#include <QTextStream>
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
# include <QStringConverter>
#else
# include <QTextCodec>
#endif
#include <QStringConverter>
#include "core/shared_ptr.h"
#include "core/logging.h"
@@ -76,7 +72,6 @@ SongList CueParser::Load(QIODevice *device, const QString &playlist_path, const
const QByteArray data_chunk = device->peek(1024);
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
std::optional<QStringConverter::Encoding> encoding = QStringConverter::encodingForData(data_chunk);
if (encoding.has_value()) {
text_stream.setEncoding(encoding.value());
@@ -90,12 +85,6 @@ SongList CueParser::Load(QIODevice *device, const QString &playlist_path, const
}
}
}
#else
const QByteArray encoding_name = Utilities::TextEncodingFromData(data_chunk);
if (!encoding_name.isEmpty()) {
text_stream.setCodec(encoding_name.constData());
}
#endif
QString dir_path = dir.absolutePath();
// Read the first line already

View File

@@ -36,12 +36,6 @@
class CollectionBackendInterface;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
constexpr auto qt_endl = Qt::endl;
#else
constexpr auto qt_endl = endl;
#endif
PLSParser::PLSParser(SharedPtr<CollectionBackendInterface> collection_backend, QObject *parent)
: ParserBase(collection_backend, parent) {}
@@ -90,15 +84,15 @@ SongList PLSParser::Load(QIODevice *device, const QString &playlist_path, const
void PLSParser::Save(const SongList &songs, QIODevice *device, const QDir &dir, const PlaylistSettingsPage::PathType path_type) const {
QTextStream s(device);
s << "[playlist]" << qt_endl;
s << "Version=2" << qt_endl;
s << "NumberOfEntries=" << songs.count() << qt_endl;
s << "[playlist]" << Qt::endl;
s << "Version=2" << Qt::endl;
s << "NumberOfEntries=" << songs.count() << Qt::endl;
int n = 1;
for (const Song &song : songs) {
s << "File" << n << "=" << URLOrFilename(song.url(), dir, path_type) << qt_endl;
s << "Title" << n << "=" << song.title() << qt_endl;
s << "Length" << n << "=" << song.length_nanosec() / kNsecPerSec << qt_endl;
s << "File" << n << "=" << URLOrFilename(song.url(), dir, path_type) << Qt::endl;
s << "Title" << n << "=" << song.title() << Qt::endl;
s << "Length" << n << "=" << song.length_nanosec() / kNsecPerSec << Qt::endl;
++n;
}