summaryrefslogtreecommitdiff
path: root/Applications
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-08-16 10:44:10 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-16 16:44:09 +0200
commite1ed71ef9e50909f29dc4aa984e8544c7f7077c4 (patch)
tree70661e54eb0e786b5152618433ee43bca1623721 /Applications
parent370624bc376824c0c9d0966df62e0e1438aca08f (diff)
downloadserenity-e1ed71ef9e50909f29dc4aa984e8544c7f7077c4.zip
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.
Diffstat (limited to 'Applications')
-rw-r--r--Applications/FileManager/DirectoryView.cpp2
-rw-r--r--Applications/SystemMonitor/ProcessMemoryMapWidget.cpp2
-rw-r--r--Applications/SystemMonitor/main.cpp2
3 files changed, 3 insertions, 3 deletions
diff --git a/Applications/FileManager/DirectoryView.cpp b/Applications/FileManager/DirectoryView.cpp
index a9350f6001..d9b0ff07a3 100644
--- a/Applications/FileManager/DirectoryView.cpp
+++ b/Applications/FileManager/DirectoryView.cpp
@@ -127,7 +127,7 @@ DirectoryView::DirectoryView()
m_table_view = add<GUI::TableView>();
m_table_view->set_model(m_sorting_model);
- m_table_view->model()->set_key_column_and_sort_order(GUI::FileSystemModel::Column::Name, GUI::SortOrder::Ascending);
+ m_table_view->set_key_column_and_sort_order(GUI::FileSystemModel::Column::Name, GUI::SortOrder::Ascending);
m_icon_view->set_model_column(GUI::FileSystemModel::Column::Name);
m_columns_view->set_model_column(GUI::FileSystemModel::Column::Name);
diff --git a/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp b/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp
index 37043909ec..d0412954a5 100644
--- a/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp
+++ b/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp
@@ -120,7 +120,7 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget()
m_table_view->set_cell_painting_delegate(7, make<PagemapPaintingDelegate>());
- m_table_view->model()->set_key_column_and_sort_order(0, GUI::SortOrder::Ascending);
+ m_table_view->set_key_column_and_sort_order(0, GUI::SortOrder::Ascending);
m_timer = add<Core::Timer>(1000, [this] { refresh(); });
}
diff --git a/Applications/SystemMonitor/main.cpp b/Applications/SystemMonitor/main.cpp
index 916daf7c72..9f35c8f835 100644
--- a/Applications/SystemMonitor/main.cpp
+++ b/Applications/SystemMonitor/main.cpp
@@ -179,7 +179,7 @@ int main(int argc, char** argv)
auto& process_table_view = process_table_container.add<GUI::TableView>();
process_table_view.set_headers_visible(true);
process_table_view.set_model(GUI::SortingProxyModel::create(ProcessModel::create()));
- process_table_view.model()->set_key_column_and_sort_order(ProcessModel::Column::CPU, GUI::SortOrder::Descending);
+ process_table_view.set_key_column_and_sort_order(ProcessModel::Column::CPU, GUI::SortOrder::Descending);
process_table_view.model()->update();
auto& refresh_timer = window->add<Core::Timer>(