summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2021-03-03 23:50:06 -0500
committerAndreas Kling <kling@serenityos.org>2021-03-04 16:28:12 +0100
commit2e5d5eb3d8bc40b310783fae110b79ec38f86dcb (patch)
tree1d108883df731dbd36bf2cd1602b483f5655facc
parentaf581cbd91185aabd2f4c054d00a0bcb0a26e460 (diff)
downloadserenity-2e5d5eb3d8bc40b310783fae110b79ec38f86dcb.zip
SystemMonitor: Return icon display data as GUI::Icons
And delete the generic icon member which has been dormant since switching to FileIconProvider. Fixes icon column not being properly painted as icon cells.
-rw-r--r--Userland/Applications/SystemMonitor/ProcessModel.cpp9
-rw-r--r--Userland/Applications/SystemMonitor/ProcessModel.h1
2 files changed, 4 insertions, 6 deletions
diff --git a/Userland/Applications/SystemMonitor/ProcessModel.cpp b/Userland/Applications/SystemMonitor/ProcessModel.cpp
index 2cee462db4..51894ac269 100644
--- a/Userland/Applications/SystemMonitor/ProcessModel.cpp
+++ b/Userland/Applications/SystemMonitor/ProcessModel.cpp
@@ -43,7 +43,6 @@ ProcessModel::ProcessModel()
{
VERIFY(!s_the);
s_the = this;
- m_generic_process_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/gear.png");
auto file = Core::File::construct("/proc/cpuinfo");
if (file->open(Core::IODevice::ReadOnly)) {
@@ -262,10 +261,10 @@ GUI::Variant ProcessModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
if (role == GUI::ModelRole::Display) {
switch (index.column()) {
case Column::Icon: {
- auto icon = GUI::FileIconProvider::icon_for_executable(thread.current_state.executable);
- if (auto* bitmap = icon.bitmap_for_size(16))
- return *bitmap;
- return *m_generic_process_icon;
+ auto icon = GUI::FileIconProvider::icon_for_executable(thread.current_state.executable).bitmap_for_size(16);
+ if (!icon)
+ return GUI::Icon();
+ return GUI::Icon(*icon);
}
case Column::PID:
return thread.current_state.pid;
diff --git a/Userland/Applications/SystemMonitor/ProcessModel.h b/Userland/Applications/SystemMonitor/ProcessModel.h
index bde8cd8b88..803b9bdfcd 100644
--- a/Userland/Applications/SystemMonitor/ProcessModel.h
+++ b/Userland/Applications/SystemMonitor/ProcessModel.h
@@ -144,6 +144,5 @@ private:
HashMap<int, NonnullOwnPtr<Thread>> m_threads;
NonnullOwnPtrVector<CpuInfo> m_cpus;
Vector<int> m_tids;
- RefPtr<Gfx::Bitmap> m_generic_process_icon;
RefPtr<Core::File> m_proc_all;
};