diff options
| -rw-r--r-- | src/qmmpui/playlistmanager.cpp | 4 | ||||
| -rw-r--r-- | src/qmmpui/playlistmanager.h | 4 | ||||
| -rw-r--r-- | src/qmmpui/playlistmodel.cpp | 12 | ||||
| -rw-r--r-- | src/qmmpui/playlistmodel.h | 21 | ||||
| -rw-r--r-- | src/ui/playlist.cpp | 4 |
5 files changed, 35 insertions, 10 deletions
diff --git a/src/qmmpui/playlistmanager.cpp b/src/qmmpui/playlistmanager.cpp index 7aac05b41..0d240c2a6 100644 --- a/src/qmmpui/playlistmanager.cpp +++ b/src/qmmpui/playlistmanager.cpp @@ -453,7 +453,7 @@ void PlayListManager::addToQueue() m_selected->addToQueue(); } -void PlayListManager::clearInvalidItems() +void PlayListManager::removeInvalidItems() { - m_selected->clearInvalidItems(); + m_selected->removeInvalidItems(); } diff --git a/src/qmmpui/playlistmanager.h b/src/qmmpui/playlistmanager.h index db887acc5..0a33b577a 100644 --- a/src/qmmpui/playlistmanager.h +++ b/src/qmmpui/playlistmanager.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 by Ilya Kotov * + * Copyright (C) 2009-2010 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -190,7 +190,7 @@ public slots: /*! * This is a convenience function and is the same as calling \b selectedPlayList()->clearInvalidItems() */ - void clearInvalidItems(); + void removeInvalidItems(); private: diff --git a/src/qmmpui/playlistmodel.cpp b/src/qmmpui/playlistmodel.cpp index 1db931f2f..01ec148f1 100644 --- a/src/qmmpui/playlistmodel.cpp +++ b/src/qmmpui/playlistmodel.cpp @@ -262,6 +262,16 @@ bool PlayListModel::isSelected(int row) return false; } +bool PlayListModel::contains(const QString &url) +{ + foreach (PlayListItem *item, m_items) + { + if(item->url() == url) + return true; + } + return false; +} + void PlayListModel::setSelected(int row, bool yes) { if (m_items.count() > row && row >= 0) @@ -897,7 +907,7 @@ void PlayListModel::preparePlayState() m_play_state->prepare(); } -void PlayListModel::clearInvalidItems() +void PlayListModel::removeInvalidItems() { foreach(PlayListItem *item, m_items) { diff --git a/src/qmmpui/playlistmodel.h b/src/qmmpui/playlistmodel.h index c26572fe4..d61dea152 100644 --- a/src/qmmpui/playlistmodel.h +++ b/src/qmmpui/playlistmodel.h @@ -108,8 +108,13 @@ public: * Object destructor. */ ~PlayListModel(); - + /*! + * Returns playlist name. + */ QString name() const; + /*! + * Sets the name of the playlist to \b name. + */ void setName(const QString &name); /*! * Returns number of items. @@ -119,7 +124,9 @@ public: * Returns the current item. */ PlayListItem* currentItem(); - + /*! + * Returns the next playing item or 0 if next item is unknown. + */ PlayListItem* nextItem(); /*! * Returns the row of the \b item @@ -249,6 +256,10 @@ public: */ bool isShuffle() const; /*! + * Returns \b true if the playlist contains an item with URL \b url; otherwise returns \b false. + */ + bool contains(const QString &url); + /*! * Enum of available sort modes */ enum SortMode @@ -388,7 +399,11 @@ public slots: /*! * Removes invalid items from playlist */ - void clearInvalidItems(); + void removeInvalidItems(); + /*! + * Removes duplicate items by URL. + */ + //void removeDuplicates(); private: /*! diff --git a/src/ui/playlist.cpp b/src/ui/playlist.cpp index 273eec5e1..32892385f 100644 --- a/src/ui/playlist.cpp +++ b/src/ui/playlist.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006-2009 by Ilya Kotov * + * Copyright (C) 2006-2010 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -207,7 +207,7 @@ void PlayList::createActions() connect (remUnselAct, SIGNAL (triggered()), m_pl_manager, SLOT (removeUnselected ())); m_subMenu->addSeparator(); - m_subMenu->addAction (tr("Remove unavailable files"), m_pl_manager, SLOT(clearInvalidItems())); + m_subMenu->addAction (tr("Remove unavailable files"), m_pl_manager, SLOT(removeInvalidItems())); //listwidget menu QAction *detailsAct = new QAction (tr ("&View Track Details"),this); |
