[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: rename playlist current item change callback in `PlaylistController`
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Sun Nov 23 16:58:31 UTC 2025
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
8dd97ec2 by Fatih Uzunoglu at 2025-11-23T17:34:41+01:00
qt: rename playlist current item change callback in `PlaylistController`
- - - - -
31b9abc4 by Fatih Uzunoglu at 2025-11-23T17:34:41+01:00
qt: do not signal current item change unnecessarily in `PlaylistController` #2
This was missed in 776121f3 because I thought, as the
callback name implied, it would be called when the current
item changed so checking if the current item changed
would be redundant. However, the callback is actually
for current index change, so we also have to compare
the current item there before signalling the change
to prevent unnecessarily signalling the change.
- - - - -
1 changed file:
- modules/gui/qt/playlist/playlist_controller.cpp
Changes:
=====================================
modules/gui/qt/playlist/playlist_controller.cpp
=====================================
@@ -269,7 +269,7 @@ on_playlist_playback_order_changed(vlc_playlist_t *playlist,
}
static void
-on_playlist_current_item_changed(vlc_playlist_t *playlist, ssize_t index,
+on_playlist_current_index_changed(vlc_playlist_t *playlist, ssize_t index,
void *userdata)
{
PlaylistControllerPrivate *that = static_cast<PlaylistControllerPrivate *>(userdata);
@@ -290,8 +290,15 @@ on_playlist_current_item_changed(vlc_playlist_t *playlist, ssize_t index,
that->m_currentIndex = index;
emit q->currentIndexChanged(that->m_currentIndex);
}
- that->m_currentItem = newItem;
- emit q->currentItemChanged();
+
+ // Unlike items updated callback, we should not need to unconditionally
+ // set the current item to update data because this is only a current
+ // index changed callback.
+ if (that->m_currentItem.raw() != newItem.raw())
+ {
+ that->m_currentItem = newItem;
+ emit q->currentItemChanged();
+ }
});
}
@@ -355,7 +362,7 @@ static const struct vlc_playlist_callbacks playlist_callbacks = []{
cbs.on_items_updated = on_playlist_items_updated;
cbs.on_playback_repeat_changed = on_playlist_playback_repeat_changed;
cbs.on_playback_order_changed= on_playlist_playback_order_changed;
- cbs.on_current_index_changed = on_playlist_current_item_changed;
+ cbs.on_current_index_changed = on_playlist_current_index_changed;
cbs.on_has_next_changed = on_playlist_has_next_changed;
cbs.on_has_prev_changed = on_playlist_has_prev_changed;
cbs.on_media_stopped_action_changed = on_media_stopped_action_changed;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/de6a6b6e29afe5b3cf79f02483c24aa12baa9b24...31b9abc49c938252c24c05871468df5444ea4bed
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/de6a6b6e29afe5b3cf79f02483c24aa12baa9b24...31b9abc49c938252c24c05871468df5444ea4bed
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list