diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-02-28 11:27:04 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-02-28 11:27:04 +0100 |
commit | b4c20789fb82639b5bc679cc17af90a65f721aeb (patch) | |
tree | 76f6e0d59c82ada4fb49473cb556a6ffbe12ad25 /Applications | |
parent | ce7019f38c8ad5f4adfe9ea0baa5cdf3ecb5e8e7 (diff) | |
download | serenity-b4c20789fb82639b5bc679cc17af90a65f721aeb.zip |
LibGUI: Allow specifying per-column text alignment.
Diffstat (limited to 'Applications')
-rw-r--r-- | Applications/ProcessManager/ProcessTableModel.cpp | 24 | ||||
-rw-r--r-- | Applications/ProcessManager/ProcessTableModel.h | 6 |
2 files changed, 15 insertions, 15 deletions
diff --git a/Applications/ProcessManager/ProcessTableModel.cpp b/Applications/ProcessManager/ProcessTableModel.cpp index 8d447e9543..864849dc1c 100644 --- a/Applications/ProcessManager/ProcessTableModel.cpp +++ b/Applications/ProcessManager/ProcessTableModel.cpp @@ -7,7 +7,7 @@ enum Column { State, Priority, Linear, - Committed, + Physical, CPU, Name, __Count @@ -38,23 +38,23 @@ String ProcessTableModel::column_name(int column) const case Column::State: return "State"; case Column::Priority: return "Priority"; case Column::Linear: return "Linear"; - case Column::Committed: return "Committed"; + case Column::Physical: return "Physical"; case Column::CPU: return "CPU"; case Column::Name: return "Name"; default: ASSERT_NOT_REACHED(); } } -int ProcessTableModel::column_width(int column) const +GTableModel::ColumnMetadata ProcessTableModel::column_metadata(int column) const { switch (column) { - case Column::PID: return 30; - case Column::State: return 80; - case Column::Priority: return 80; - case Column::Linear: return 80; - case Column::Committed: return 80; - case Column::CPU: return 30; - case Column::Name: return 200; + case Column::PID: return { 30, TextAlignment::CenterRight }; + case Column::State: return { 80, TextAlignment::CenterLeft }; + case Column::Priority: return { 80, TextAlignment::CenterLeft }; + case Column::Linear: return { 70, TextAlignment::CenterRight }; + case Column::Physical: return { 70, TextAlignment::CenterRight }; + case Column::CPU: return { 30, TextAlignment::CenterRight }; + case Column::Name: return { 200, TextAlignment::CenterLeft }; default: ASSERT_NOT_REACHED(); } } @@ -85,7 +85,7 @@ String ProcessTableModel::data(int row, int column) const case Column::State: return process.current_state.state; case Column::Priority: return process.current_state.priority; case Column::Linear: return pretty_byte_size(process.current_state.linear); - case Column::Committed: return pretty_byte_size(process.current_state.committed); + case Column::Physical: return pretty_byte_size(process.current_state.physical); case Column::CPU: return String::format("%d", (int)process.current_state.cpu_percent); case Column::Name: return process.current_state.name; } @@ -131,7 +131,7 @@ void ProcessTableModel::update() state.name = parts[11]; state.linear = parts[12].to_uint(ok); ASSERT(ok); - state.committed = parts[13].to_uint(ok); + state.physical = parts[13].to_uint(ok); ASSERT(ok); { diff --git a/Applications/ProcessManager/ProcessTableModel.h b/Applications/ProcessManager/ProcessTableModel.h index 009c9bcabe..4449a2bbc7 100644 --- a/Applications/ProcessManager/ProcessTableModel.h +++ b/Applications/ProcessManager/ProcessTableModel.h @@ -14,7 +14,7 @@ public: virtual int row_count() const override; virtual int column_count() const override; virtual String column_name(int column) const override; - virtual int column_width(int column) const override; + virtual ColumnMetadata column_metadata(int column) const override; virtual GModelIndex selected_index() const override; virtual void set_selected_index(GModelIndex) override; virtual String data(int row, int column) const override; @@ -30,8 +30,8 @@ private: String state; String user; String priority; - unsigned linear; - unsigned committed; + size_t linear; + size_t physical; float cpu_percent; }; |