aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2013-07-03 16:06:05 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2013-07-03 16:06:05 +0000
commit10cf99e346ecb30ce7a701ca062856cd18d05dea (patch)
tree39004b0d08aec0c19d25cb2b0dd6f22b82dd5658
parente14146d9ab7368dbb428b7ea02f4a8ff48a128bf (diff)
downloadqmmp-10cf99e346ecb30ce7a701ca062856cd18d05dea.tar.gz
qmmp-10cf99e346ecb30ce7a701ca062856cd18d05dea.tar.bz2
qmmp-10cf99e346ecb30ce7a701ca062856cd18d05dea.zip
added function mid() to the playlist model
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@3534 90c681e8-e032-0410-971d-27865f9a5e38
-rw-r--r--src/qmmpui/playlistmodel.cpp13
-rw-r--r--src/qmmpui/playlistmodel.h8
2 files changed, 16 insertions, 5 deletions
diff --git a/src/qmmpui/playlistmodel.cpp b/src/qmmpui/playlistmodel.cpp
index 5d2004c4e..9eb247349 100644
--- a/src/qmmpui/playlistmodel.cpp
+++ b/src/qmmpui/playlistmodel.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright(C) 2006-2012 by Ilya Kotov *
+ * Copyright(C) 2006-2013 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -282,7 +282,7 @@ QStringList PlayListModel::getTitles(int b,int l)
QStringList PlayListModel::getTimes(int b,int l)
{
- QList <QString> m_times;
+ QStringList times;
int d = 0;
QString str;
for (int i = b; (i < b + l) && (i < m_items.size()); ++i)
@@ -295,10 +295,15 @@ QStringList PlayListModel::getTimes(int b,int l)
str += QString(":%1").arg(d%60, 2, 10, QChar('0'));
if(!d)
str.clear();
- m_times << str;
+ times << str;
str.clear();
}
- return m_times;
+ return times;
+}
+
+QList<PlayListItem *> PlayListModel::mid(int pos, int count)
+{
+ return m_items.mid(pos, count);
}
bool PlayListModel::isSelected(int index)
diff --git a/src/qmmpui/playlistmodel.h b/src/qmmpui/playlistmodel.h
index 783a44dfb..6ea3efa33 100644
--- a/src/qmmpui/playlistmodel.h
+++ b/src/qmmpui/playlistmodel.h
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2006-2012 by Ilya Kotov *
+ * Copyright (C) 2006-2013 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -186,6 +186,12 @@ public:
*/
QStringList getTimes(int first,int last);
/*!
+ * Returns a list of the items, starting at position \b pos
+ * \param pos First item position.
+ * \param count A number of items. If \b count is -1 (the default), all items from pos are returned.
+ */
+ QList<PlayListItem *> mid(int pos, int count = -1);
+ /*!
* Moves the item at index position \b from to index position \b to.
*/
void moveItems(int from, int to);