summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-02-28 21:04:26 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-02-28 21:04:26 +0100
commit322f49caece344889919061b365700f989e8c338 (patch)
tree96abd6fc3e6b60409bb5579191c8d7090c82a497
parentb1321507992009bcdc0ad72d604cb005c284ce32 (diff)
downloadserenity-322f49caece344889919061b365700f989e8c338.zip
ProcessManager: Use icons for the process priorities.
-rw-r--r--Applications/ProcessManager/ProcessTableModel.cpp17
-rw-r--r--Applications/ProcessManager/ProcessTableModel.h3
-rw-r--r--Base/res/icons/highpriority16.pngbin0 -> 207 bytes
-rw-r--r--Base/res/icons/highpriority16.rgbbin0 -> 1024 bytes
-rw-r--r--Base/res/icons/lowpriority16.pngbin0 -> 201 bytes
-rw-r--r--Base/res/icons/lowpriority16.rgbbin0 -> 1024 bytes
-rw-r--r--Base/res/icons/normalpriority16.pngbin0 -> 172 bytes
-rw-r--r--Base/res/icons/normalpriority16.rgbbin0 -> 1024 bytes
8 files changed, 16 insertions, 4 deletions
diff --git a/Applications/ProcessManager/ProcessTableModel.cpp b/Applications/ProcessManager/ProcessTableModel.cpp
index a5bd507abc..a2aa5ff29a 100644
--- a/Applications/ProcessManager/ProcessTableModel.cpp
+++ b/Applications/ProcessManager/ProcessTableModel.cpp
@@ -24,7 +24,9 @@ ProcessTableModel::ProcessTableModel()
endpwent();
m_generic_process_icon = GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, "/res/icons/gear16.rgb", { 16, 16 });
- ASSERT(m_generic_process_icon);
+ m_high_priority_icon = GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, "/res/icons/highpriority16.rgb", { 16, 16 });
+ m_low_priority_icon = GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, "/res/icons/lowpriority16.rgb", { 16, 16 });
+ m_normal_priority_icon = GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, "/res/icons/normalpriority16.rgb", { 16, 16 });
}
ProcessTableModel::~ProcessTableModel()
@@ -48,7 +50,7 @@ String ProcessTableModel::column_name(int column) const
case Column::PID: return "PID";
case Column::State: return "State";
case Column::User: return "User";
- case Column::Priority: return "Priority";
+ case Column::Priority: return "Pr";
case Column::Linear: return "Linear";
case Column::Physical: return "Physical";
case Column::CPU: return "CPU";
@@ -63,7 +65,7 @@ GTableModel::ColumnMetadata ProcessTableModel::column_metadata(int column) const
case Column::Icon: return { 16, TextAlignment::CenterLeft };
case Column::PID: return { 25, TextAlignment::CenterRight };
case Column::State: return { 75, TextAlignment::CenterLeft };
- case Column::Priority: return { 65, TextAlignment::CenterLeft };
+ case Column::Priority: return { 16, TextAlignment::CenterLeft };
case Column::User: return { 50, TextAlignment::CenterLeft };
case Column::Linear: return { 65, TextAlignment::CenterRight };
case Column::Physical: return { 65, TextAlignment::CenterRight };
@@ -103,7 +105,14 @@ GVariant ProcessTableModel::data(int row, int column) const
case Column::PID: return process.current_state.pid;
case Column::State: return process.current_state.state;
case Column::User: return process.current_state.user;
- case Column::Priority: return process.current_state.priority;
+ case Column::Priority:
+ if (process.current_state.priority == "High")
+ return *m_high_priority_icon;
+ if (process.current_state.priority == "Low")
+ return *m_low_priority_icon;
+ if (process.current_state.priority == "Normal")
+ return *m_normal_priority_icon;
+ return process.current_state.priority;
case Column::Linear: return pretty_byte_size(process.current_state.linear);
case Column::Physical: return pretty_byte_size(process.current_state.physical);
case Column::CPU: return process.current_state.cpu_percent;
diff --git a/Applications/ProcessManager/ProcessTableModel.h b/Applications/ProcessManager/ProcessTableModel.h
index 0246f521ed..41185cc67f 100644
--- a/Applications/ProcessManager/ProcessTableModel.h
+++ b/Applications/ProcessManager/ProcessTableModel.h
@@ -45,4 +45,7 @@ private:
Vector<pid_t> m_pids;
int m_selected_row { -1 };
RetainPtr<GraphicsBitmap> m_generic_process_icon;
+ RetainPtr<GraphicsBitmap> m_high_priority_icon;
+ RetainPtr<GraphicsBitmap> m_low_priority_icon;
+ RetainPtr<GraphicsBitmap> m_normal_priority_icon;
};
diff --git a/Base/res/icons/highpriority16.png b/Base/res/icons/highpriority16.png
new file mode 100644
index 0000000000..c44c15c434
--- /dev/null
+++ b/Base/res/icons/highpriority16.png
Binary files differ
diff --git a/Base/res/icons/highpriority16.rgb b/Base/res/icons/highpriority16.rgb
new file mode 100644
index 0000000000..e7ec3be362
--- /dev/null
+++ b/Base/res/icons/highpriority16.rgb
Binary files differ
diff --git a/Base/res/icons/lowpriority16.png b/Base/res/icons/lowpriority16.png
new file mode 100644
index 0000000000..7e8c024cf3
--- /dev/null
+++ b/Base/res/icons/lowpriority16.png
Binary files differ
diff --git a/Base/res/icons/lowpriority16.rgb b/Base/res/icons/lowpriority16.rgb
new file mode 100644
index 0000000000..31bd72312c
--- /dev/null
+++ b/Base/res/icons/lowpriority16.rgb
Binary files differ
diff --git a/Base/res/icons/normalpriority16.png b/Base/res/icons/normalpriority16.png
new file mode 100644
index 0000000000..43dc5231b3
--- /dev/null
+++ b/Base/res/icons/normalpriority16.png
Binary files differ
diff --git a/Base/res/icons/normalpriority16.rgb b/Base/res/icons/normalpriority16.rgb
new file mode 100644
index 0000000000..d95738f057
--- /dev/null
+++ b/Base/res/icons/normalpriority16.rgb
Binary files differ