From 883075834d6225933db812abcefcca0481d4a3da Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Tue, 6 Aug 2013 12:13:13 +0000 Subject: fixed "save playlist" action git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@3571 90c681e8-e032-0410-971d-27865f9a5e38 --- src/qmmpui/playlistmodel.cpp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/qmmpui/playlistmodel.cpp b/src/qmmpui/playlistmodel.cpp index 6bb043963..c60c7da00 100644 --- a/src/qmmpui/playlistmodel.cpp +++ b/src/qmmpui/playlistmodel.cpp @@ -891,22 +891,27 @@ void PlayListModel::loadPlaylist(const QString &f_name) void PlayListModel::savePlaylist(const QString & f_name) { - /*PlayListFormat* prs = PlayListParser::findByPath(f_name); - if (prs) + PlayListFormat* prs = PlayListParser::findByPath(f_name); + if (!prs) + return; + + QFile file(f_name); + if (file.open(QIODevice::WriteOnly)) { - QFile file(f_name); - if (file.open(QIODevice::WriteOnly)) + QTextStream ts(&file); + QList songs; + for(int i = 0; i < m_container.count(); ++i) { - QTextStream ts(&file); - QList songs; - foreach(PlayListItem* item, m_items) - songs << item; - ts << prs->encode(songs); - file.close(); + if(!isTrack(i)) + continue; + songs << m_container.track(i); } - else - qWarning("Error opening %s",f_name.toLocal8Bit().data()); - }*/ + ts << prs->encode(songs); + file.close(); + } + else + qWarning("Error opening %s",f_name.toLocal8Bit().data()); + } bool PlayListModel::isRepeatableList() const -- cgit v1.2.3-13-gbd6f