diff --git a/src/playlistparsers/cueparser.cpp b/src/playlistparsers/cueparser.cpp index c460297c6..ab066cd91 100644 --- a/src/playlistparsers/cueparser.cpp +++ b/src/playlistparsers/cueparser.cpp @@ -348,7 +348,9 @@ qint64 CueParser::IndexToMarker(const QString& index) const { void CueParser::Save(const SongList& songs, QIODevice* device, const QDir& dir, Playlist::Path path_type) const { - // TODO + // TODO: Not yet implemented. Cue files represent tracks within a single + // file, so the song list would need to be composed properly. + emit Error(tr("Saving cue files is not yet supported.")); } // Looks for a track starting with one of the .cue's keywords. diff --git a/src/playlistparsers/parserbase.h b/src/playlistparsers/parserbase.h index 476bc6d54..567098145 100644 --- a/src/playlistparsers/parserbase.h +++ b/src/playlistparsers/parserbase.h @@ -55,6 +55,9 @@ class ParserBase : public QObject { const SongList& songs, QIODevice* device, const QDir& dir = QDir(), Playlist::Path path_type = Playlist::Path_Automatic) const = 0; + signals: + void Error(const QString& msg) const; + protected: // Loads a song. If filename_or_url is a URL (with a scheme other than // "file") then it is set on the song and the song marked as a stream. diff --git a/src/playlistparsers/playlistparser.cpp b/src/playlistparsers/playlistparser.cpp index 5a00c6a1c..e96963d7e 100644 --- a/src/playlistparsers/playlistparser.cpp +++ b/src/playlistparsers/playlistparser.cpp @@ -35,13 +35,18 @@ PlaylistParser::PlaylistParser(LibraryBackendInterface* library, QObject* parent) : QObject(parent) { default_parser_ = new XSPFParser(library, this); - parsers_ << new M3UParser(library, this); - parsers_ << default_parser_; - parsers_ << new PLSParser(library, this); - parsers_ << new ASXParser(library, this); - parsers_ << new AsxIniParser(library, this); - parsers_ << new CueParser(library, this); - parsers_ << new WplParser(library, this); + AddParser(new M3UParser(library, this)); + AddParser(default_parser_); + AddParser(new PLSParser(library, this)); + AddParser(new ASXParser(library, this)); + AddParser(new AsxIniParser(library, this)); + AddParser(new CueParser(library, this)); + AddParser(new WplParser(library, this)); +} + +void PlaylistParser::AddParser(ParserBase* parser) { + parsers_ << parser; + connect(parser, SIGNAL(Error(QString)), this, SIGNAL(Error(QString))); } QStringList PlaylistParser::file_extensions() const { diff --git a/src/playlistparsers/playlistparser.h b/src/playlistparsers/playlistparser.h index 897ceb98d..ae5207865 100644 --- a/src/playlistparsers/playlistparser.h +++ b/src/playlistparsers/playlistparser.h @@ -59,6 +59,8 @@ class PlaylistParser : public QObject { void Error(const QString& msg) const; private: + void AddParser(ParserBase* parser); + QString FilterForParser(const ParserBase* parser, QStringList* all_extensions = nullptr) const;