Merge branch 'release-1.2' into portable

This commit is contained in:
Andreas 2013-10-05 12:03:57 +02:00
commit 77ac74c3f5
3 changed files with 24 additions and 13 deletions

View File

@ -268,7 +268,11 @@ void PlaylistListContainer::CurrentChanged(Playlist* new_playlist) {
void PlaylistListContainer::PlaylistPathChanged(int id, const QString& new_path) {
// Update the path in the database
app_->playlist_backend()->SetPlaylistUiPath(id, new_path);
app_->playlist_manager()->playlist(id)->set_ui_path(new_path);
Playlist* playlist = app_->playlist_manager()->playlist(id);
// Check the playlist exists (if it's not opened it's not in the manager)
if (playlist) {
playlist->set_ui_path(new_path);
}
}
void PlaylistListContainer::ItemDoubleClicked(const QModelIndex& proxy_index) {

View File

@ -65,22 +65,28 @@ void PlaylistListModel::AddRowMappings(const QModelIndex& begin,
for (int i=begin.row() ; i<=end.row() ; ++i) {
const QModelIndex index = begin.sibling(i, 0);
QStandardItem* item = itemFromIndex(index);
AddRowItem(item, parent_path);
}
}
switch (index.data(Role_Type).toInt()) {
case Type_Playlist: {
const int id = index.data(Role_PlaylistId).toInt();
playlists_by_id_[id] = item;
if (dropping_rows_) {
emit PlaylistPathChanged(id, parent_path);
}
break;
void PlaylistListModel::AddRowItem(QStandardItem* item, const QString& parent_path) {
switch (item->data(Role_Type).toInt()) {
case Type_Playlist: {
const int id = item->data(Role_PlaylistId).toInt();
playlists_by_id_[id] = item;
if (dropping_rows_) {
emit PlaylistPathChanged(id, parent_path);
}
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;
}
}

View File

@ -61,6 +61,7 @@ private slots:
private:
void AddRowMappings(const QModelIndex& begin, const QModelIndex& end);
void AddRowItem(QStandardItem* item, const QString& parent_path);
void UpdatePathsRecursive(const QModelIndex& parent);
private: