Use Qt::endl with Qt 5.14 and higher

This commit is contained in:
Jonas Kvinge 2020-05-29 18:04:31 +02:00
parent 046512eb3d
commit 94430883ad
2 changed files with 20 additions and 8 deletions

View File

@ -31,6 +31,12 @@
class CollectionBackendInterface;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
# define qt_endl Qt::endl
#else
# define qt_endl std::endl
#endif
AsxIniParser::AsxIniParser(CollectionBackendInterface *collection, QObject *parent)
: ParserBase(collection, parent) {}
@ -65,11 +71,11 @@ SongList AsxIniParser::Load(QIODevice *device, const QString &playlist_path, con
void AsxIniParser::Save(const SongList &songs, QIODevice *device, const QDir &dir, Playlist::Path 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

@ -34,6 +34,12 @@
class CollectionBackendInterface;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
# define qt_endl Qt::endl
#else
# define qt_endl std::endl
#endif
PLSParser::PLSParser(CollectionBackendInterface *collection, QObject *parent)
: ParserBase(collection, parent) {}
@ -81,15 +87,15 @@ SongList PLSParser::Load(QIODevice *device, const QString &playlist_path, const
void PLSParser::Save(const SongList &songs, QIODevice *device, const QDir &dir, Playlist::Path 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;
}