Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) Library sidebar: fix History label update #12882

Merged
merged 2 commits into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/library/trackset/baseplaylistfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ void BasePlaylistFeature::connectPlaylistDAO() {
connect(&m_playlistDao,
&PlaylistDAO::renamed,
this,
// In "History") just the item is renamed, while in "Playlists" the
// entire sidebar model is rebuilt to resort items by name
// In "History" just the item is renamed, while in "Playlists" the
// entire sidebar model is rebuilt to re-sort items by name
&BasePlaylistFeature::slotPlaylistTableRenamed);
}

Expand Down Expand Up @@ -738,6 +738,7 @@ void BasePlaylistFeature::updateChildModel(const QSet<int>& playlistIds) {
}
}
}
m_pSidebarModel->triggerRepaint();
}

/// Clears the child model dynamically, but the invisible root item remains
Expand Down
12 changes: 7 additions & 5 deletions src/library/trackset/playlistfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ QString PlaylistFeature::fetchPlaylistLabel(int playlistId) {
/// This method queries the database and does dynamic insertion
/// @param selectedId entry which should be selected
QModelIndex PlaylistFeature::constructChildModel(int selectedId) {
// qDebug() << "PlaylistFeature::constructChildModel() id:" << selectedId;
std::vector<std::unique_ptr<TreeItem>> childrenToAdd;
int selectedRow = -1;

Expand Down Expand Up @@ -269,7 +270,7 @@ void PlaylistFeature::decorateChild(TreeItem* item, int playlistId) {
}

void PlaylistFeature::slotPlaylistTableChanged(int playlistId) {
//qDebug() << "slotPlaylistTableChanged() playlistId:" << playlistId;
// qDebug() << "PlaylistFeature::slotPlaylistTableChanged() playlistId:" << playlistId;
enum PlaylistDAO::HiddenType type = m_playlistDao.getHiddenType(playlistId);
if (type != PlaylistDAO::PLHT_NOT_HIDDEN && // not a regular playlist
type != PlaylistDAO::PLHT_UNKNOWN) { // not a deleted playlist
Expand Down Expand Up @@ -302,7 +303,7 @@ void PlaylistFeature::slotPlaylistTableChanged(int playlistId) {
}

void PlaylistFeature::slotPlaylistContentOrLockChanged(const QSet<int>& playlistIds) {
// qDebug() << "slotPlaylistContentOrLockChanged() playlistId:" << playlistId;
// qDebug() << "PlaylistFeature::slotPlaylistContentOrLockChanged() playlistId:" << playlistIds;
QSet<int> idsToBeUpdated;
for (const auto playlistId : std::as_const(playlistIds)) {
if (m_playlistDao.getHiddenType(playlistId) == PlaylistDAO::PLHT_NOT_HIDDEN) {
Expand All @@ -312,11 +313,12 @@ void PlaylistFeature::slotPlaylistContentOrLockChanged(const QSet<int>& playlist
updateChildModel(idsToBeUpdated);
}

void PlaylistFeature::slotPlaylistTableRenamed(
int playlistId, const QString& newName) {
void PlaylistFeature::slotPlaylistTableRenamed(int playlistId, const QString& newName) {
Q_UNUSED(newName);
// qDebug() << "slotPlaylistTableRenamed() playlistId:" << playlistId;
// qDebug() << "PlaylistFeature::slotPlaylistTableRenamed() playlistId:" << playlistId;
if (m_playlistDao.getHiddenType(playlistId) == PlaylistDAO::PLHT_NOT_HIDDEN) {
// Maybe we need to re-sort the sidebar items, so call slotPlaylistTableChanged()
// in order to rebuild the model, not just updateChildModel()
slotPlaylistTableChanged(playlistId);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/library/trackset/setlogfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ void SetlogFeature::slotPlaylistTableChanged(int playlistId) {
}

void SetlogFeature::slotPlaylistContentOrLockChanged(const QSet<int>& playlistIds) {
// qDebug() << "slotPlaylistContentOrLockChanged() for"
// qDebug() << "SetlogFeature::slotPlaylistContentOrLockChanged() for"
// << playlistIds.count() << "playlist(s)";
QSet<int> idsToBeUpdated;
for (const auto playlistId : std::as_const(playlistIds)) {
Expand All @@ -699,7 +699,7 @@ void SetlogFeature::slotPlaylistContentOrLockChanged(const QSet<int>& playlistId

void SetlogFeature::slotPlaylistTableRenamed(int playlistId, const QString& newName) {
Q_UNUSED(newName);
//qDebug() << "slotPlaylistTableRenamed() playlistId:" << playlistId;
// qDebug() << "SetlogFeature::slotPlaylistTableRenamed() Id:" << playlistId;
if (m_playlistDao.getHiddenType(playlistId) == PlaylistDAO::PLHT_SET_LOG) {
updateChildModel(QSet<int>{playlistId});
}
Expand Down
Loading