mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 00:07:34 +00:00
ProcessManager: Move ProcessTableModel class to its own files.
This commit is contained in:
parent
a202ed88f6
commit
6e571b66f1
5 changed files with 204 additions and 163 deletions
46
Applications/ProcessManager/ProcessTableModel.h
Normal file
46
Applications/ProcessManager/ProcessTableModel.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/AKString.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGUI/GTableModel.h>
|
||||
#include <unistd.h>
|
||||
|
||||
class ProcessTableModel final : public GTableModel {
|
||||
public:
|
||||
ProcessTableModel();
|
||||
virtual ~ProcessTableModel() override;
|
||||
|
||||
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 GModelIndex selected_index() const override;
|
||||
virtual void set_selected_index(GModelIndex) override;
|
||||
virtual String data(int row, int column) const override;
|
||||
virtual void update() override;
|
||||
|
||||
pid_t selected_pid() const;
|
||||
|
||||
private:
|
||||
struct ProcessState {
|
||||
pid_t pid;
|
||||
unsigned nsched;
|
||||
String name;
|
||||
String state;
|
||||
String user;
|
||||
String priority;
|
||||
unsigned linear;
|
||||
unsigned committed;
|
||||
float cpu_percent;
|
||||
};
|
||||
|
||||
struct Process {
|
||||
ProcessState current_state;
|
||||
ProcessState previous_state;
|
||||
};
|
||||
|
||||
HashMap<pid_t, OwnPtr<Process>> m_processes;
|
||||
Vector<pid_t> m_pids;
|
||||
int m_selected_row { -1 };
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue