Skip to content

Refactor embedded sidebar category to make use of ViewsProxyModel

Jack Hill requested to merge jackh/elisa:sidebar-proxy-model into master

Reason for the change

In this patch I make more use of the existing ViewsProxyModel to

  1. Correctly sort the embedded sidebar items
  2. Hide the embedded category without having to faff around with the source model
  3. Hide all embedded items on mobile mode (and still show the embedded category)
  4. Clean up ViewsListData.

Test plan

Autotests have been updated: ctest --output-on-failure -R view

Test 1

  • Set the embedded category to Albums and the initial view to Tracks.
  • Restart Elisa

Before: genres view is opened

Now: tracks view is opened

Test 2

  • Set the embedded category to Genres and the initial view to Genres.
  • Restart Elisa

Before: files view is opened

Now: genres view is opened

Test 3

  • Set the embedded category to genres
  • Open the radio stations view
  • Set the embedded category to Nothing

Before: ye initial view is opened, sidebar is reset

Now: view stack is unchanged, sidebar is reset but radio stations sidebar item is still highlighted

Test 4

  • Open the albums view
  • Set the embedded category to albums
  • Set the embedded category to Nothing

Before: ye initial view is opened, sidebar is reset

Now: view stack is unchanged, 1st the albums category hides and no sidebar item is highlighted, 2nd the albums category reappears and is highlighted

Test 5

  • Set the embedded category to albums
  • Select the first album in the list
  • Set the embedded category to artists

Before: ye initial view is opened, sidebar is reset

Now: view stack is unchanged, no sidebar item is highlighted

Test 6

  • Set the embedded category to albums
  • Add a file to your music folder with the album title "G Album"
  • Modify the file's album title to "S Album"

Before: album is appended to the bottom of the sidebar

Now: album is inserted into the sidebar alphabetically. After editing the file, the album is re-sorted.

Mobile Test 1:

  • Set the embedded category in desktop mode to Albums
  • Open elisa with QT_QUICK_CONTROLS_MOBILE=1 elisa

Before: For a large enough music collection elisa will stop responding, eat up as much RAM as it can find, and crash your PC

Now: No crashes

Mobile Test 2:

Can't do this test due to the drawer-in-a-loader bug, but here are the steps I would take:

  • Set the embedded category in desktop mode to Nothing
  • Run elisa in mobile mode & click all sidebar items
  • Repeat the above two steps for each embedded category mode & each initial view

Bugs fixed

BUG: 457999

Edited by Nate Graham

Merge request reports