Skip to content
Snippets Groups Projects
Commit 5a91a25e authored by Lyndon Brown's avatar Lyndon Brown Committed by Hugo Beauzée-Luyssen
Browse files

qt: use preferred order for adv prefs tree cat nodes

up until now the entire tree has been simply sorted alphabetically. this is
not at all ideal because this means that the "advanced" category comes
first, when logically it should come last. this is particularly unfortunate
because upon switching to advanced/complete/"all" view, the panel shown is
one titled "advanced settings" with a warning underneath saying "use with
care". this category also happens to be a particularly messy one in terms
of its organisation. this mess and warning gives a bad impression and
potential scares off users.

so, let's allow the subcat and plugin nodes to remain alphabetical, but
let's sort the root category nodes into a preferred order. we can do this
simply by resorting to match the order of entries within the category
lookup table in `vlc_config_cat.h`, which was reorganised into a suitable
order in the previous commit.

note that the solution accounts for the possibility that not all cats will
be in use in the tree.
parent 5788c60e
No related branches found
No related tags found
No related merge requests found
......@@ -158,8 +158,24 @@ PrefsTree::PrefsTree( qt_intf_t *_p_intf, QWidget *_parent,
createPluginNode( subcat_item, p_module );
}
/* We got everything, just sort a bit */
// We got everything, just sort a bit.
// We allow the subcat and plugin nodes to be alphabetical, but we force
// the top-level cat nodes into a preferred order.
sortItems( 0, Qt::AscendingOrder );
unsigned index = 0;
for (unsigned i = 0; i < ARRAY_SIZE(categories_array); i++)
{
cat_item = findCatItem( categories_array[i].id );
if ( cat_item == NULL )
continue;
unsigned cur_index = (unsigned)indexOfTopLevelItem( cat_item );
if (cur_index != index)
{
insertTopLevelItem( index, takeTopLevelItem( cur_index ) );
expandItem( cat_item );
}
++index;
}
resizeColumnToContents( 0 );
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment