1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 05:35:06 +00:00

LibGUI: Make model sorting imperative and move order to AbstractView

Instead of SortingProxyModel having a column+order, we move that state
to AbstractView. When you click on a column header, the view tells the
model to resort the relevant column with the new order.

This is implemented in SortingProxyModel by simply walking all the
reified source/proxy mappings and resorting their row indexes.
This commit is contained in:
Andreas Kling 2020-08-16 10:44:10 +02:00
parent 370624bc37
commit e1ed71ef9e
15 changed files with 85 additions and 55 deletions

View file

@ -127,7 +127,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, Options options, const
m_view->set_multi_select(m_mode == Mode::OpenMultiple);
m_view->set_model(SortingProxyModel::create(*m_model));
m_view->set_model_column(FileSystemModel::Column::Name);
m_view->model()->set_key_column_and_sort_order(GUI::FileSystemModel::Column::Name, GUI::SortOrder::Ascending);
m_view->set_key_column_and_sort_order(GUI::FileSystemModel::Column::Name, GUI::SortOrder::Ascending);
m_view->set_column_hidden(FileSystemModel::Column::Owner, true);
m_view->set_column_hidden(FileSystemModel::Column::Group, true);
m_view->set_column_hidden(FileSystemModel::Column::Permissions, true);