/* * Copyright (c) 2021, Nick Vella * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include namespace HackStudio { class ProjectTemplatesModel final : public GUI::Model { public: static NonnullRefPtr create() { return adopt_ref(*new ProjectTemplatesModel()); } enum Column { Icon = 0, Id, Name, __Count }; virtual ~ProjectTemplatesModel() override = default; RefPtr template_for_index(const GUI::ModelIndex& index); virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; void update(); void rescan_templates(); private: explicit ProjectTemplatesModel(); Vector> m_templates; Vector m_mapping; RefPtr m_file_watcher; }; }