aboutsummaryrefslogtreecommitdiff
path: root/src/qmmpui/playlistmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qmmpui/playlistmodel.cpp')
-rw-r--r--src/qmmpui/playlistmodel.cpp39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/qmmpui/playlistmodel.cpp b/src/qmmpui/playlistmodel.cpp
index 541fd3f26..2df8d9ef2 100644
--- a/src/qmmpui/playlistmodel.cpp
+++ b/src/qmmpui/playlistmodel.cpp
@@ -112,8 +112,7 @@ void PlayListModel::add(PlayListItem *item)
m_items << item;
m_current = m_items.indexOf(m_currentItem);
- if (m_items.size() == 1)
- emit firstAdded();
+ emit itemAdded(item);
emit listChanged();
}
@@ -124,29 +123,27 @@ void PlayListModel::add(QList <PlayListItem *> items)
if (m_items.isEmpty())
m_currentItem = items.at(0);
- foreach(PlayListItem *item, items)
- m_total_length += item->length();
m_items << items;
-
- if (m_items.size() == items.size())
- emit firstAdded();
m_current = m_items.indexOf(m_currentItem);
+ foreach(PlayListItem *item, items)
+ {
+ m_total_length += item->length();
+ emit itemAdded(item);
+ }
emit listChanged();
}
void PlayListModel::add(const QString &path)
{
QFileInfo f_info(path);
- //if (f_info.exists() || path.contains("://"))
+ if (f_info.isDir())
+ m_loader->loadDirectory(path);
+ else
{
- if (f_info.isDir())
- m_loader->loadDirectory(path);
- else
- {
- m_loader->loadFile(path);
- loadPlaylist(path);
- }
+ m_loader->loadFile(path);
+ loadPlaylist(path);
}
+
}
void PlayListModel::add(const QStringList &paths)
@@ -202,6 +199,13 @@ bool PlayListModel::setCurrent(int c)
return true;
}
+bool PlayListModel::setCurrent(PlayListItem *item)
+{
+ if(!m_items.contains(item))
+ return false;
+ return setCurrent(m_items.indexOf(item));
+}
+
bool PlayListModel::next()
{
if(m_stop_item == currentItem())
@@ -858,6 +862,11 @@ bool PlayListModel::isShuffle() const
return m_shuffle;
}
+bool PlayListModel::isLoaderRunning() const
+{
+ return m_loader->isRunning();
+}
+
void PlayListModel::preparePlayState()
{
m_play_state->prepare();