diff options
Diffstat (limited to 'src/qmmpui')
| -rw-r--r-- | src/qmmpui/playlistmodel.cpp | 17 | ||||
| -rw-r--r-- | src/qmmpui/playlistmodel.h | 9 |
2 files changed, 25 insertions, 1 deletions
diff --git a/src/qmmpui/playlistmodel.cpp b/src/qmmpui/playlistmodel.cpp index 62a5003e6..b3118c62c 100644 --- a/src/qmmpui/playlistmodel.cpp +++ b/src/qmmpui/playlistmodel.cpp @@ -421,6 +421,23 @@ void PlayListModel::setSelected(QList<PlayListItem *> items, bool selected) emit listChanged(); } +void PlayListModel::setSelected(int first, int last, bool selected) +{ + if(first > last) + { + setSelected(last, first, selected); + return; + } + for(int index = first; index <= last; ++index) + { + PlayListItem *i = item(index); + if(!i) + continue; + i->setSelected(selected); + } + emit listChanged(); +} + void PlayListModel::removeSelected() { removeSelection(false); diff --git a/src/qmmpui/playlistmodel.h b/src/qmmpui/playlistmodel.h index 63eb9fc77..77ad9c50a 100644 --- a/src/qmmpui/playlistmodel.h +++ b/src/qmmpui/playlistmodel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006-2013 by Ilya Kotov * + * Copyright (C) 2006-2014 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -183,6 +183,13 @@ public: */ void setSelected(QList<PlayListItem *> items, bool selected = true); /*! + * Sets the selected state of the list of items range + * @param firts Firts item in the range + * @param last Last item in the range + * @param selected Selection state (\b true - select, \b false - unselect) + */ + void setSelected(int first, int last, bool selected = true); + /*! * Advances to the next item. Returns \b false if next iten doesn't exist, * otherwise returns \b true */ |
