diff options
author | Andreas Kling <kling@serenityos.org> | 2020-05-21 19:52:04 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-21 19:55:44 +0200 |
commit | 2adb0a07e53695e1f636384a3323aba828d48e52 (patch) | |
tree | d1affc27e33ec70daaa4d317d39ee2c6c781415b /Applications/SystemMonitor | |
parent | c666c251c89f9d63a4855494cc2cf0f92e524db0 (diff) | |
download | serenity-2adb0a07e53695e1f636384a3323aba828d48e52.zip |
LibGUI: Get rid of Model::ColumnMetadata and always use auto-sizing
Auto-sizing of view columns is now enabled by default. This removes the
last remaining need for ColumnMetadata, so this patch gets rid of it.
Diffstat (limited to 'Applications/SystemMonitor')
-rw-r--r-- | Applications/SystemMonitor/DevicesModel.cpp | 18 | ||||
-rw-r--r-- | Applications/SystemMonitor/DevicesModel.h | 1 | ||||
-rw-r--r-- | Applications/SystemMonitor/NetworkStatisticsWidget.cpp | 2 | ||||
-rw-r--r-- | Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp | 1 | ||||
-rw-r--r-- | Applications/SystemMonitor/ProcessMemoryMapWidget.cpp | 1 | ||||
-rw-r--r-- | Applications/SystemMonitor/ProcessModel.cpp | 62 | ||||
-rw-r--r-- | Applications/SystemMonitor/ProcessModel.h | 1 | ||||
-rw-r--r-- | Applications/SystemMonitor/ProcessTableView.cpp | 1 | ||||
-rw-r--r-- | Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp | 1 | ||||
-rw-r--r-- | Applications/SystemMonitor/main.cpp | 3 |
10 files changed, 0 insertions, 91 deletions
diff --git a/Applications/SystemMonitor/DevicesModel.cpp b/Applications/SystemMonitor/DevicesModel.cpp index d4049baf38..69091402cc 100644 --- a/Applications/SystemMonitor/DevicesModel.cpp +++ b/Applications/SystemMonitor/DevicesModel.cpp @@ -73,24 +73,6 @@ String DevicesModel::column_name(int column) const } } -GUI::Model::ColumnMetadata DevicesModel::column_metadata(int column) const -{ - switch (column) { - case Column::Device: - return { 70 }; - case Column::Major: - return { 32 }; - case Column::Minor: - return { 32 }; - case Column::ClassName: - return { 120 }; - case Column::Type: - return { 120 }; - default: - ASSERT_NOT_REACHED(); - } -} - GUI::Variant DevicesModel::data(const GUI::ModelIndex& index, Role role) const { ASSERT(is_valid(index)); diff --git a/Applications/SystemMonitor/DevicesModel.h b/Applications/SystemMonitor/DevicesModel.h index 61f17f705a..dde59df53e 100644 --- a/Applications/SystemMonitor/DevicesModel.h +++ b/Applications/SystemMonitor/DevicesModel.h @@ -47,7 +47,6 @@ public: virtual int row_count(const GUI::ModelIndex&) const override; virtual int column_count(const GUI::ModelIndex&) const override; virtual String column_name(int column) const override; - virtual ColumnMetadata column_metadata(int column) const override; virtual GUI::Variant data(const GUI::ModelIndex&, Role = Role::Display) const override; virtual void update() override; diff --git a/Applications/SystemMonitor/NetworkStatisticsWidget.cpp b/Applications/SystemMonitor/NetworkStatisticsWidget.cpp index b5abb54702..0908239e81 100644 --- a/Applications/SystemMonitor/NetworkStatisticsWidget.cpp +++ b/Applications/SystemMonitor/NetworkStatisticsWidget.cpp @@ -44,7 +44,6 @@ NetworkStatisticsWidget::NetworkStatisticsWidget() adapters_group_box.set_preferred_size(0, 120); m_adapter_table_view = adapters_group_box.add<GUI::TableView>(); - m_adapter_table_view->set_size_columns_to_fit_content(true); Vector<GUI::JsonArrayModel::FieldSpec> net_adapters_fields; net_adapters_fields.empend("name", "Name", Gfx::TextAlignment::CenterLeft); @@ -64,7 +63,6 @@ NetworkStatisticsWidget::NetworkStatisticsWidget() sockets_group_box.set_preferred_size(0, 0); m_socket_table_view = sockets_group_box.add<GUI::TableView>(); - m_socket_table_view->set_size_columns_to_fit_content(true); Vector<GUI::JsonArrayModel::FieldSpec> net_tcp_fields; net_tcp_fields.empend("peer_address", "Peer", Gfx::TextAlignment::CenterLeft); diff --git a/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp b/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp index cd8487873b..9e8505f5dc 100644 --- a/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp +++ b/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp @@ -34,7 +34,6 @@ ProcessFileDescriptorMapWidget::ProcessFileDescriptorMapWidget() set_layout<GUI::VerticalBoxLayout>(); layout()->set_margins({ 4, 4, 4, 4 }); m_table_view = add<GUI::TableView>(); - m_table_view->set_size_columns_to_fit_content(true); Vector<GUI::JsonArrayModel::FieldSpec> pid_fds_fields; pid_fds_fields.empend("fd", "FD", Gfx::TextAlignment::CenterRight); diff --git a/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp b/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp index 9c5e92c16d..bd5b4fbabb 100644 --- a/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp +++ b/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp @@ -69,7 +69,6 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget() set_layout<GUI::VerticalBoxLayout>(); layout()->set_margins({ 4, 4, 4, 4 }); m_table_view = add<GUI::TableView>(); - m_table_view->set_size_columns_to_fit_content(true); Vector<GUI::JsonArrayModel::FieldSpec> pid_vm_fields; pid_vm_fields.empend("Address", Gfx::TextAlignment::CenterLeft, [](auto& object) { return String::format("%#x", object.get("address").to_u32()); diff --git a/Applications/SystemMonitor/ProcessModel.cpp b/Applications/SystemMonitor/ProcessModel.cpp index 4cbfd95a99..9af7d1f5fc 100644 --- a/Applications/SystemMonitor/ProcessModel.cpp +++ b/Applications/SystemMonitor/ProcessModel.cpp @@ -128,68 +128,6 @@ String ProcessModel::column_name(int column) const } } -GUI::Model::ColumnMetadata ProcessModel::column_metadata(int column) const -{ - switch (column) { - case Column::Icon: - return { 16 }; - case Column::PID: - return { 32 }; - case Column::TID: - return { 32 }; - case Column::State: - return { 75 }; - case Column::Priority: - return { 16 }; - case Column::EffectivePriority: - return { 16 }; - case Column::User: - return { 50 }; - case Column::Virtual: - return { 65 }; - case Column::Physical: - return { 65 }; - case Column::DirtyPrivate: - return { 65 }; - case Column::CleanInode: - return { 65 }; - case Column::PurgeableVolatile: - return { 65 }; - case Column::PurgeableNonvolatile: - return { 65 }; - case Column::CPU: - return { 32 }; - case Column::Name: - return { 140 }; - case Column::Syscalls: - return { 60 }; - case Column::InodeFaults: - return { 60 }; - case Column::ZeroFaults: - return { 60 }; - case Column::CowFaults: - return { 60 }; - case Column::FileReadBytes: - return { 60 }; - case Column::FileWriteBytes: - return { 60 }; - case Column::UnixSocketReadBytes: - return { 60 }; - case Column::UnixSocketWriteBytes: - return { 60 }; - case Column::IPv4SocketReadBytes: - return { 60 }; - case Column::IPv4SocketWriteBytes: - return { 60 }; - case Column::Pledge: - return { 60 }; - case Column::Veil: - return { 60 }; - default: - ASSERT_NOT_REACHED(); - } -} - static String pretty_byte_size(size_t size) { return String::format("%uK", size / 1024); diff --git a/Applications/SystemMonitor/ProcessModel.h b/Applications/SystemMonitor/ProcessModel.h index 9da382822d..61d1f4056a 100644 --- a/Applications/SystemMonitor/ProcessModel.h +++ b/Applications/SystemMonitor/ProcessModel.h @@ -84,7 +84,6 @@ public: virtual int row_count(const GUI::ModelIndex&) const override; virtual int column_count(const GUI::ModelIndex&) const override; virtual String column_name(int column) const override; - virtual ColumnMetadata column_metadata(int column) const override; virtual GUI::Variant data(const GUI::ModelIndex&, Role = Role::Display) const override; virtual void update() override; diff --git a/Applications/SystemMonitor/ProcessTableView.cpp b/Applications/SystemMonitor/ProcessTableView.cpp index f8cf68955b..74fc1485d0 100644 --- a/Applications/SystemMonitor/ProcessTableView.cpp +++ b/Applications/SystemMonitor/ProcessTableView.cpp @@ -31,7 +31,6 @@ ProcessTableView::ProcessTableView() { - set_size_columns_to_fit_content(true); set_model(GUI::SortingProxyModel::create(ProcessModel::create())); model()->set_key_column_and_sort_order(ProcessModel::Column::CPU, GUI::SortOrder::Descending); refresh(); diff --git a/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp b/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp index 7423e50e6b..4121057fef 100644 --- a/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp +++ b/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp @@ -34,7 +34,6 @@ ProcessUnveiledPathsWidget::ProcessUnveiledPathsWidget() set_layout<GUI::VerticalBoxLayout>(); layout()->set_margins({ 4, 4, 4, 4 }); m_table_view = add<GUI::TableView>(); - m_table_view->set_size_columns_to_fit_content(true); Vector<GUI::JsonArrayModel::FieldSpec> pid_unveil_fields; pid_unveil_fields.empend("path", "Path", Gfx::TextAlignment::CenterLeft); diff --git a/Applications/SystemMonitor/main.cpp b/Applications/SystemMonitor/main.cpp index 180bd00133..9bf95ca2dc 100644 --- a/Applications/SystemMonitor/main.cpp +++ b/Applications/SystemMonitor/main.cpp @@ -309,7 +309,6 @@ NonnullRefPtr<GUI::Widget> build_file_systems_tab() self.set_layout<GUI::VerticalBoxLayout>(); self.layout()->set_margins({ 4, 4, 4, 4 }); auto& fs_table_view = self.add<GUI::TableView>(); - fs_table_view.set_size_columns_to_fit_content(true); Vector<GUI::JsonArrayModel::FieldSpec> df_fields; df_fields.empend("mount_point", "Mount point", Gfx::TextAlignment::CenterLeft); @@ -402,7 +401,6 @@ NonnullRefPtr<GUI::Widget> build_pci_devices_tab() self.set_layout<GUI::VerticalBoxLayout>(); self.layout()->set_margins({ 4, 4, 4, 4 }); auto& pci_table_view = self.add<GUI::TableView>(); - pci_table_view.set_size_columns_to_fit_content(true); auto db = PCIDB::Database::open(); @@ -461,7 +459,6 @@ NonnullRefPtr<GUI::Widget> build_devices_tab() self.layout()->set_margins({ 4, 4, 4, 4 }); auto& devices_table_view = self.add<GUI::TableView>(); - devices_table_view.set_size_columns_to_fit_content(true); devices_table_view.set_model(GUI::SortingProxyModel::create(DevicesModel::create())); devices_table_view.model()->update(); }; |