2020-07-01 20:49:51 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
2022-02-26 10:50:04 -07:00
|
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
2020-07-01 20:49:51 +02:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-07-01 20:49:51 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <LibGUI/Model.h>
|
|
|
|
|
#include <LibGfx/Bitmap.h>
|
|
|
|
|
|
2020-07-28 06:09:19 -04:00
|
|
|
namespace GUI {
|
2020-07-01 20:49:51 +02:00
|
|
|
|
|
|
|
|
class RunningProcessesModel final : public GUI::Model {
|
|
|
|
|
public:
|
|
|
|
|
static NonnullRefPtr<RunningProcessesModel> create();
|
2022-02-26 10:50:04 -07:00
|
|
|
virtual ~RunningProcessesModel() override = default;
|
2020-07-01 20:49:51 +02:00
|
|
|
|
|
|
|
|
enum Column {
|
|
|
|
|
Icon,
|
|
|
|
|
PID,
|
|
|
|
|
UID,
|
|
|
|
|
Name,
|
|
|
|
|
__Count,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
virtual int row_count(const GUI::ModelIndex&) const override;
|
|
|
|
|
virtual int column_count(const GUI::ModelIndex&) const override;
|
2023-06-13 16:30:15 +01:00
|
|
|
virtual ErrorOr<String> column_name(int column_index) const override;
|
2020-08-16 16:00:07 +02:00
|
|
|
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
|
2021-05-25 14:13:19 +00:00
|
|
|
|
|
|
|
|
void update();
|
2020-07-01 20:49:51 +02:00
|
|
|
|
|
|
|
|
private:
|
2022-02-26 10:50:04 -07:00
|
|
|
RunningProcessesModel() = default;
|
2020-07-01 20:49:51 +02:00
|
|
|
|
|
|
|
|
struct Process {
|
|
|
|
|
pid_t pid;
|
|
|
|
|
uid_t uid;
|
2023-02-20 19:03:44 +01:00
|
|
|
RefPtr<Gfx::Bitmap const> icon;
|
2022-12-04 18:02:33 +00:00
|
|
|
DeprecatedString name;
|
2020-07-01 20:49:51 +02:00
|
|
|
};
|
|
|
|
|
Vector<Process> m_processes;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|