mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-20 14:33:19 +01:00
Don't ignore Folder (so we don't ignore playlists they contain and we don't end up with dangling pointers in playlists_by_id_)
(cherry picked from commit fb78321c16
)
This commit is contained in:
parent
06e8160fd2
commit
ce117da026
@ -65,22 +65,28 @@ void PlaylistListModel::AddRowMappings(const QModelIndex& begin,
|
|||||||
for (int i=begin.row() ; i<=end.row() ; ++i) {
|
for (int i=begin.row() ; i<=end.row() ; ++i) {
|
||||||
const QModelIndex index = begin.sibling(i, 0);
|
const QModelIndex index = begin.sibling(i, 0);
|
||||||
QStandardItem* item = itemFromIndex(index);
|
QStandardItem* item = itemFromIndex(index);
|
||||||
|
AddRowItem(item, parent_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (index.data(Role_Type).toInt()) {
|
void PlaylistListModel::AddRowItem(QStandardItem* item, const QString& parent_path) {
|
||||||
case Type_Playlist: {
|
switch (item->data(Role_Type).toInt()) {
|
||||||
const int id = index.data(Role_PlaylistId).toInt();
|
case Type_Playlist: {
|
||||||
|
const int id = item->data(Role_PlaylistId).toInt();
|
||||||
playlists_by_id_[id] = item;
|
playlists_by_id_[id] = item;
|
||||||
if (dropping_rows_) {
|
if (dropping_rows_) {
|
||||||
emit PlaylistPathChanged(id, parent_path);
|
emit PlaylistPathChanged(id, parent_path);
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case Type_Folder:
|
break;
|
||||||
break;
|
}
|
||||||
|
|
||||||
|
case Type_Folder:
|
||||||
|
for (int j=0; j<item->rowCount(); ++j) {
|
||||||
|
QStandardItem* child_item = item->child(j);
|
||||||
|
AddRowItem(child_item, parent_path);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void AddRowMappings(const QModelIndex& begin, const QModelIndex& end);
|
void AddRowMappings(const QModelIndex& begin, const QModelIndex& end);
|
||||||
|
void AddRowItem(QStandardItem* item, const QString& parent_path);
|
||||||
void UpdatePathsRecursive(const QModelIndex& parent);
|
void UpdatePathsRecursive(const QModelIndex& parent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user