mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:37:45 +00:00
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.
This commit is contained in:
parent
af581cbd91
commit
2e5d5eb3d8
2 changed files with 4 additions and 6 deletions
|
@ -43,7 +43,6 @@ ProcessModel::ProcessModel()
|
||||||
{
|
{
|
||||||
VERIFY(!s_the);
|
VERIFY(!s_the);
|
||||||
s_the = this;
|
s_the = this;
|
||||||
m_generic_process_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/gear.png");
|
|
||||||
|
|
||||||
auto file = Core::File::construct("/proc/cpuinfo");
|
auto file = Core::File::construct("/proc/cpuinfo");
|
||||||
if (file->open(Core::IODevice::ReadOnly)) {
|
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) {
|
if (role == GUI::ModelRole::Display) {
|
||||||
switch (index.column()) {
|
switch (index.column()) {
|
||||||
case Column::Icon: {
|
case Column::Icon: {
|
||||||
auto icon = GUI::FileIconProvider::icon_for_executable(thread.current_state.executable);
|
auto icon = GUI::FileIconProvider::icon_for_executable(thread.current_state.executable).bitmap_for_size(16);
|
||||||
if (auto* bitmap = icon.bitmap_for_size(16))
|
if (!icon)
|
||||||
return *bitmap;
|
return GUI::Icon();
|
||||||
return *m_generic_process_icon;
|
return GUI::Icon(*icon);
|
||||||
}
|
}
|
||||||
case Column::PID:
|
case Column::PID:
|
||||||
return thread.current_state.pid;
|
return thread.current_state.pid;
|
||||||
|
|
|
@ -144,6 +144,5 @@ private:
|
||||||
HashMap<int, NonnullOwnPtr<Thread>> m_threads;
|
HashMap<int, NonnullOwnPtr<Thread>> m_threads;
|
||||||
NonnullOwnPtrVector<CpuInfo> m_cpus;
|
NonnullOwnPtrVector<CpuInfo> m_cpus;
|
||||||
Vector<int> m_tids;
|
Vector<int> m_tids;
|
||||||
RefPtr<Gfx::Bitmap> m_generic_process_icon;
|
|
||||||
RefPtr<Core::File> m_proc_all;
|
RefPtr<Core::File> m_proc_all;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue