Skip to content

Commit

Permalink
Merge pull request #912 from reupen/item-details-props-fromhook
Browse files Browse the repository at this point in the history
Update Item details and Item properties on custom field change
  • Loading branch information
reupen authored Jul 11, 2024
2 parents 596117b + 677c572 commit 2986bde
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,21 @@
Note: An item group of ‘None’ is used to execute a context menu command
without any tracks, which isn’t normally useful.

- Item details now updates when it’s tracking the current selection and a
component indicates a custom title formatting field has changed.
[[#912](https://github.com/reupen/columns_ui/pull/912)]

- The Item details options dialogue box now respects the current dark mode
setting when opened from the Layout preferences page.
[[#909](https://github.com/reupen/columns_ui/pull/909)]

- Item properties now updates when a component indicates a custom title
formatting field has changed.
[[#912](https://github.com/reupen/columns_ui/pull/912)]

(Although Item properties doesn’t use title formatting, this change makes the
panel update when things like playback statistics change.)

- A bug where dynamic internet radio artwork may not have been immediately shown
after changing the ‘Displayed track’ in the Artwork view panel was fixed.
[[#854](https://github.com/reupen/columns_ui/pull/854)]
Expand Down
16 changes: 7 additions & 9 deletions foo_ui_columns/item_details.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,16 +508,14 @@ void ItemDetails::on_items_selection_change(const bit_array& p_affected, const b

void ItemDetails::on_changed_sorted(metadb_handle_list_cref p_items_sorted, bool p_fromhook)
{
if (!p_fromhook && !m_nowplaying_active) {
bool b_refresh = false;
size_t count = m_handles.get_count();
for (size_t i = 0; i < count && !b_refresh; i++) {
size_t index = pfc_infinite;
if (p_items_sorted.bsearch_t(pfc::compare_t<metadb_handle_ptr, metadb_handle_ptr>, m_handles[i], index))
b_refresh = true;
}
if (b_refresh) {
if (m_nowplaying_active)
return;

for (auto&& track : m_handles) {
if (size_t index{};
p_items_sorted.bsearch_t(pfc::compare_t<metadb_handle_ptr, metadb_handle_ptr>, track, index)) {
refresh_contents();
break;
}
}
}
Expand Down
13 changes: 4 additions & 9 deletions foo_ui_columns/item_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,16 +616,11 @@ void ItemProperties::on_playback_stop(play_control::t_stop_reason p_reason)

void ItemProperties::on_changed_sorted(metadb_handle_list_cref p_items_sorted, bool p_fromhook)
{
if (!p_fromhook) {
bool b_refresh = false;
size_t count = m_handles.get_count();
for (size_t i = 0; i < count && !b_refresh; i++) {
size_t index = pfc_infinite;
if (p_items_sorted.bsearch_t(pfc::compare_t<metadb_handle_ptr, metadb_handle_ptr>, m_handles[i], index))
b_refresh = true;
}
if (b_refresh) {
for (auto&& track : m_handles) {
if (size_t index{};
p_items_sorted.bsearch_t(pfc::compare_t<metadb_handle_ptr, metadb_handle_ptr>, track, index)) {
refresh_contents();
break;
}
}
}
Expand Down

0 comments on commit 2986bde

Please sign in to comment.