From cda0f909b32538ec98b891590ae17c4115da0846 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Fri, 6 Mar 2009 10:39:45 +0000 Subject: playlist api changes and optimizations git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@822 90c681e8-e032-0410-971d-27865f9a5e38 --- src/qmmpui/playlistmodel.cpp | 54 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 6 deletions(-) (limited to 'src/qmmpui/playlistmodel.cpp') diff --git a/src/qmmpui/playlistmodel.cpp b/src/qmmpui/playlistmodel.cpp index efcf2cbd7..0b1ed5361 100644 --- a/src/qmmpui/playlistmodel.cpp +++ b/src/qmmpui/playlistmodel.cpp @@ -41,6 +41,7 @@ #include "playlistmodel.h" #include "playlistitem.h" #include "playstate.h" +#include "playlistsettings.h" #include @@ -96,6 +97,7 @@ PlayListModel::~PlayListModel() l->wait(); } } + delete PlaylistSettings::instance(); } void PlayListModel::load(PlayListItem *item) @@ -424,7 +426,7 @@ void PlayListModel::readSettings() m_current = 0; m_block_update_signals = TRUE; foreach(FileInfo *info, infoList) - load(new PlayListItem(info, &settings)); //using one and the same settings object for all playlist items + load(new PlayListItem(info)); m_block_update_signals = FALSE; doCurrentVisibleRequest(); } @@ -454,11 +456,7 @@ void PlayListModel::addFile(const QString& path) { if (path.isEmpty()) return; - /*if(path.startsWith("http://")) - load(new PlayListItem(path)); - else if(Decoder::supports(path)) - load(new PlayListItem(path));*/ - QList playList = Decoder::createPlayList(path); + QList playList = Decoder::createPlayList(path, PlaylistSettings::instance()->useMetadata()); foreach(FileInfo *info, playList) emit load(new PlayListItem(info)); @@ -952,3 +950,47 @@ void PlayListModel::preparePlayState() { m_play_state->prepare(); } + +bool PlayListModel::convertUnderscore() +{ + return PlaylistSettings::instance()->convertUnderscore(); +} + +bool PlayListModel::convertTwenty() +{ + return PlaylistSettings::instance()->convertTwenty(); +} + +bool PlayListModel::useMetadata() +{ + return PlaylistSettings::instance()->useMetadata(); +} + +const QString PlayListModel::format() const +{ + return PlaylistSettings::instance()->format(); +} + +void PlayListModel::setConvertUnderscore(bool yes) +{ + PlaylistSettings::instance()->setConvertUnderscore(yes); + emit settingsChanged(); +} + +void PlayListModel::setConvertTwenty(bool yes) +{ + PlaylistSettings::instance()->setConvertTwenty(yes); + emit settingsChanged(); +} + +void PlayListModel::setUseMetadata(bool yes) +{ + PlaylistSettings::instance()->setUseMetadata(yes); + emit settingsChanged(); +} + +void PlayListModel::setFormat(const QString &format) +{ + PlaylistSettings::instance()->setFormat(format); + emit settingsChanged(); +} -- cgit v1.2.3-13-gbd6f