diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2017-08-25 21:10:06 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2017-08-25 21:10:06 +0000 |
| commit | a8de6bc53396f50aa3f7f0af05e6bd91824f6a33 (patch) | |
| tree | d8564d8eaa3ead1c3ef3f340df4206a28b75e720 /src/qmmpui | |
| parent | 3cc55bb058875aa84a39747f2b928d227ed46f45 (diff) | |
| download | qmmp-a8de6bc53396f50aa3f7f0af05e6bd91824f6a33.tar.gz qmmp-a8de6bc53396f50aa3f7f0af05e6bd91824f6a33.tar.bz2 qmmp-a8de6bc53396f50aa3f7f0af05e6bd91824f6a33.zip | |
improved scrolling api
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@7389 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/qmmpui')
| -rw-r--r-- | src/qmmpui/playlistmodel.cpp | 12 | ||||
| -rw-r--r-- | src/qmmpui/playlistmodel.h | 11 |
2 files changed, 14 insertions, 9 deletions
diff --git a/src/qmmpui/playlistmodel.cpp b/src/qmmpui/playlistmodel.cpp index 4033aaa20..4710d1066 100644 --- a/src/qmmpui/playlistmodel.cpp +++ b/src/qmmpui/playlistmodel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright(C) 2006-2016 by Ilya Kotov * + * Copyright(C) 2006-2017 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -928,8 +928,14 @@ void PlayListModel::onTaskFinished() void PlayListModel::doCurrentVisibleRequest() { - if(!m_container->isEmpty()) - emit currentVisibleRequest(); + if(!m_container->isEmpty() && m_current >= 0) + emit scrollToRequest(currentIndex()); +} + +void PlayListModel::scrollTo(int index) +{ + if(index >= 0 && index < m_container->count()) + emit scrollToRequest(index); } void PlayListModel::loadPlaylist(const QString &f_name) diff --git a/src/qmmpui/playlistmodel.h b/src/qmmpui/playlistmodel.h index 1ad03d613..fe5da58f6 100644 --- a/src/qmmpui/playlistmodel.h +++ b/src/qmmpui/playlistmodel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006-2016 by Ilya Kotov * + * Copyright (C) 2006-2017 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -65,7 +65,7 @@ struct SimpleSelection */ inline void dump()const { - qWarning("top: %d\tbotom: %d", m_top, m_bottom); + qDebug("top: %d\tbotom: %d", m_top, m_bottom); } /*! * Returns number of selected items. @@ -365,10 +365,8 @@ signals: * Emitted when playlist loader thread has finished. */ void loaderFinished(); - /*! - * Emitted to ensure that the current track is visible. - */ - void currentVisibleRequest(); + + void scrollToRequest(int index); /*! * Emitted when sorting by column is finished. * @param column Column index. @@ -476,6 +474,7 @@ public slots: * Ensures that the current track is visible. */ void doCurrentVisibleRequest(); + void scrollTo(int index); /*! * Randomly changes items order. */ |
