Fix grouped playqueue when we have repeated instances of an album. Now when

an album is expanded/collapsed - all instances are expanded/collapsed.
This commit is contained in:
craig
2012-04-10 16:16:06 +00:00
committed by craig
parent 5c98640598
commit 4e7da14d65
5 changed files with 32 additions and 14 deletions

View File

@@ -11,7 +11,7 @@ set(DEBIAN_PACKAGE_SECTION "kde4")
set(CPACK_SOURCE_GENERATOR "TBZ2")
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "6")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_PACKAGE_VERSION_PATCH "1")
set(CPACK_PACKAGE_CONTACT "Craig Drummond <craig.p.drummond@gmail.com>")
set(CANTATA_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
set(CANTATA_VERSION_FULL "${CANTATA_VERSION}.${CPACK_PACKAGE_VERSION_PATCH}")

View File

@@ -1,3 +1,8 @@
0.6.1
-----
1. Fix grouped playqueue when we have repeated instances of an album. Now when
an album is expanded/collapsed - all instances are expanded/collapsed.
0.6.0
-----
1. Grouped style for playlists.

View File

@@ -391,7 +391,7 @@ bool Settings::playQueueAutoExpand()
bool Settings::playQueueStartClosed()
{
return GET_BOOL("playQueueStartClosed", true);
return GET_BOOL("playQueueStartClosed", version()<CANTATA_MAKE_VERSION(0, 6, 1));
}
bool Settings::playQueueScroll()

View File

@@ -254,12 +254,22 @@ QVariant PlayQueueModel::data(const QModelIndex &index, int role) const
return count;
}
case GroupedView::Role_CurrentStatus: {
switch (mpdState) {
case MPDState_Inactive:
case MPDState_Stopped: return (int)GroupedView::State_Stopped;
case MPDState_Playing: return (int)GroupedView::State_Playing;
case MPDState_Paused: return (int)GroupedView::State_Paused;
quint16 key=songs.at(index.row()).key;
for (int i=index.row()+1; i<songs.count(); ++i) {
const Song &s=songs.at(i);
if (s.key!=key) {
return QVariant();
}
if (s.id==currentSongId) {
switch (mpdState) {
case MPDState_Inactive:
case MPDState_Stopped: return (int)GroupedView::State_Stopped;
case MPDState_Playing: return (int)GroupedView::State_Playing;
case MPDState_Paused: return (int)GroupedView::State_Paused;
}
}
}
return QVariant();
}
case GroupedView::Role_Status:
if (songs.at(index.row()).id == currentSongId) {

View File

@@ -163,7 +163,10 @@ public:
QApplication::style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, 0L);
painter->restore();
if (!state && !view->isExpanded(song.key, collection) && view->isCurrentAlbum(song.key)) {
state=index.data(GroupedView::Role_CurrentStatus).toInt();
QVariant cs=index.data(GroupedView::Role_CurrentStatus);
if (cs.isValid()) {
state=cs.toInt();
}
}
} else {
QApplication::style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, 0L);
@@ -493,13 +496,13 @@ void GroupedView::toggle(const QModelIndex &idx)
}
if (model()) {
QModelIndex parent=idx.parent();
quint32 count=model()->rowCount(idx.parent());
for (quint32 i=idx.row()+1; i<count; ++i) {
quint16 key=model()->index(i, 0, idx.parent()).data(GroupedView::Role_Key).toUInt();
if (indexKey==key) {
setRowHidden(i, idx.parent(), toBeHidden);
} else {
break;
for (quint32 i=0; i<count; ++i) {
QModelIndex index=model()->index(i, 0, parent);
quint16 key=index.data(GroupedView::Role_Key).toUInt();
if (indexKey==key && !isAlbumHeader(index)) {
setRowHidden(i, parent, toBeHidden);
}
}