mirror of
https://github.com/RGBCube/serenity
synced 2025-07-07 20:07:35 +00:00
SystemMonitor: Make the process list searchable
This commit is contained in:
parent
52ed43d139
commit
000c74e6a8
2 changed files with 20 additions and 0 deletions
|
@ -313,6 +313,24 @@ GUI::Variant ProcessModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vector<GUI::ModelIndex, 1> ProcessModel::matches(const StringView& searching, unsigned flags, const GUI::ModelIndex&)
|
||||||
|
{
|
||||||
|
Vector<GUI::ModelIndex, 1> found_indices;
|
||||||
|
|
||||||
|
for (auto& thread : m_threads) {
|
||||||
|
if (string_matches(thread.value->current_state.name, searching, flags)) {
|
||||||
|
auto maybe_tid_index = m_tids.find_first_index(thread.key);
|
||||||
|
if (!maybe_tid_index.has_value())
|
||||||
|
continue;
|
||||||
|
found_indices.append(create_index(maybe_tid_index.value(), Column::Name));
|
||||||
|
if (flags & FirstMatchOnly)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return found_indices;
|
||||||
|
}
|
||||||
|
|
||||||
void ProcessModel::update()
|
void ProcessModel::update()
|
||||||
{
|
{
|
||||||
auto previous_tid_count = m_tids.size();
|
auto previous_tid_count = m_tids.size();
|
||||||
|
|
|
@ -60,6 +60,8 @@ public:
|
||||||
virtual int column_count(const GUI::ModelIndex&) const override;
|
virtual int column_count(const GUI::ModelIndex&) const override;
|
||||||
virtual String column_name(int column) const override;
|
virtual String column_name(int column) const override;
|
||||||
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
|
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
|
||||||
|
virtual bool is_searchable() const override { return true; }
|
||||||
|
virtual Vector<GUI::ModelIndex, 1> matches(const StringView&, unsigned = MatchesFlag::AllMatching, const GUI::ModelIndex& = GUI::ModelIndex()) override;
|
||||||
virtual bool is_column_sortable(int column_index) const override { return column_index != Column::Icon; }
|
virtual bool is_column_sortable(int column_index) const override { return column_index != Column::Icon; }
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue