diff options
author | Lennon Donaghy <donaghylennon@gmail.com> | 2021-08-01 21:19:26 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-22 10:30:06 +0200 |
commit | 6076deae1d2af6ccc7ff5a9b6a5ac1c3e679c975 (patch) | |
tree | abcf82fce5d51008c4131a502dd4a87c3282a2ff | |
parent | d48bd490025db62e3d2a0801c3fb745fff013891 (diff) | |
download | serenity-6076deae1d2af6ccc7ff5a9b6a5ac1c3e679c975.zip |
HackStudio: Clear ToDo entries upon opening new project
The ToDoEntries and ToDoEntriesWidget classes now have methods for
clearing the entries, before entries would stay permanently, even after
switching to a new project.
-rw-r--r-- | Userland/DevTools/HackStudio/HackStudioWidget.cpp | 1 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/ToDoEntries.cpp | 5 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/ToDoEntries.h | 2 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/ToDoEntriesWidget.cpp | 6 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/ToDoEntriesWidget.h | 2 |
5 files changed, 16 insertions, 0 deletions
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index 3ec2c9455c..bf6186cd29 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -199,6 +199,7 @@ void HackStudioWidget::open_project(const String& root_path) m_open_files.clear(); m_open_files_vector.clear(); add_new_editor(*m_editors_splitter); + m_todo_entries_widget->clear(); } m_project = Project::open_with_root_path(root_path); VERIFY(m_project); diff --git a/Userland/DevTools/HackStudio/ToDoEntries.cpp b/Userland/DevTools/HackStudio/ToDoEntries.cpp index 1a706bbf7e..1eeb3133ba 100644 --- a/Userland/DevTools/HackStudio/ToDoEntries.cpp +++ b/Userland/DevTools/HackStudio/ToDoEntries.cpp @@ -31,4 +31,9 @@ Vector<Cpp::Parser::TodoEntry> ToDoEntries::get_entries() return ret; } +void ToDoEntries::clear_entries() +{ + m_document_to_entries.clear(); +} + } diff --git a/Userland/DevTools/HackStudio/ToDoEntries.h b/Userland/DevTools/HackStudio/ToDoEntries.h index 8efe89e414..b90d3a8161 100644 --- a/Userland/DevTools/HackStudio/ToDoEntries.h +++ b/Userland/DevTools/HackStudio/ToDoEntries.h @@ -24,6 +24,8 @@ public: Vector<Cpp::Parser::TodoEntry> get_entries(); + void clear_entries(); + Function<void()> on_update = nullptr; private: diff --git a/Userland/DevTools/HackStudio/ToDoEntriesWidget.cpp b/Userland/DevTools/HackStudio/ToDoEntriesWidget.cpp index 88fd1336d9..f734e45247 100644 --- a/Userland/DevTools/HackStudio/ToDoEntriesWidget.cpp +++ b/Userland/DevTools/HackStudio/ToDoEntriesWidget.cpp @@ -91,6 +91,12 @@ void ToDoEntriesWidget::refresh() m_result_view->set_model(results_model); } +void ToDoEntriesWidget::clear() +{ + ToDoEntries::the().clear_entries(); + refresh(); +} + ToDoEntriesWidget::ToDoEntriesWidget() { set_layout<GUI::VerticalBoxLayout>(); diff --git a/Userland/DevTools/HackStudio/ToDoEntriesWidget.h b/Userland/DevTools/HackStudio/ToDoEntriesWidget.h index f62f8d5d2f..881b7cf369 100644 --- a/Userland/DevTools/HackStudio/ToDoEntriesWidget.h +++ b/Userland/DevTools/HackStudio/ToDoEntriesWidget.h @@ -18,6 +18,8 @@ public: void refresh(); + void clear(); + private: explicit ToDoEntriesWidget(); |