feat(plugin): add a Plugin Manager window listing installed add-ons

Read-only inventory of the add-ons compiled into the build — name, version,
id, API level, description, command prefixes — built from the extracted
`ocs_plugin_api` manifest. Opened with the `PLUGINS` / `PLUGINMANAGER` command
or the Start-page "Plugins" button.

Adds `installed_manifests()` to the plugin registry and wires the window the
same way as the existing About / Shortcuts windows.

Part of #100 (phase-1 plugin manager UI stub).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-06-15 01:46:09 +03:00
commit ec865a95aa
9 changed files with 221 additions and 2 deletions

View file

@ -36,6 +36,7 @@ impl OpenCADStudio {
&& !matches!(
cmd,
"NEW" | "OPEN" | "EXIT" | "QUIT" | "REPORT" | "CHANGELOG" | "ABOUT"
| "PLUGINS" | "PLUGINMANAGER"
)
{
self.command_line
@ -2675,6 +2676,10 @@ impl OpenCADStudio {
return Task::done(Message::AboutOpen);
}
"PLUGINS" | "PLUGINMANAGER" => {
return Task::done(Message::PluginManagerOpen);
}
"CHANGELOG" => {
let _ = open::that("https://github.com/HakanSeven12/OpenCADStudio/releases");
self.command_line.push_info("Opening release notes...");

View file

@ -292,6 +292,7 @@ pub(super) struct OpenCADStudio {
color_pick_target: Option<ColorPickTarget>,
shortcuts_window: Option<window::Id>,
about_window: Option<window::Id>,
plugin_manager_window: Option<window::Id>,
/// New-release notification window — opened on startup when the
/// GitHub releases API reports a newer version than this build.
update_notice_window: Option<window::Id>,
@ -987,6 +988,10 @@ pub enum Message {
// ── About window ────────────────────────────────────────────────────
AboutOpen,
AboutCopyInfo,
// ── Plugin Manager window ───────────────────────────────────────────
PluginManagerOpen,
#[allow(dead_code)]
PluginManagerClose,
// ── Quick Select / Select Similar ───────────────────────────────────
/// Extend the current selection with every entity in the active
/// layout that matches a selected entity by (type, layer).
@ -1402,6 +1407,7 @@ impl OpenCADStudio {
color_pick_target: None,
shortcuts_window: None,
about_window: None,
plugin_manager_window: None,
update_notice_window: None,
assoc_prompt_window: None,
default_assoc_prompted: false,
@ -1712,6 +1718,9 @@ pub fn run() -> iced::Result {
if Some(window_id) == state.about_window {
return "About Open CAD Studio".into();
}
if Some(window_id) == state.plugin_manager_window {
return "Plugin Manager".into();
}
if Some(window_id) == state.update_notice_window {
return "Update Available".into();
}

View file

@ -1640,6 +1640,9 @@ impl OpenCADStudio {
self.about_window = None;
self.ribbon.deactivate_tool_if("ABOUT");
}
if self.plugin_manager_window == Some(id) {
self.plugin_manager_window = None;
}
if self.update_notice_window == Some(id) {
self.update_notice_window = None;
}
@ -5394,6 +5397,28 @@ impl OpenCADStudio {
iced::clipboard::write(info)
}
// ── Plugin Manager window ─────────────────────────────────────
Message::PluginManagerOpen => {
if let Some(id) = self.plugin_manager_window {
return window::gain_focus(id);
}
let (id, task) = window::open(window::Settings {
size: iced::Size::new(520.0, 460.0),
resizable: true,
level: window::Level::AlwaysOnTop,
..Default::default()
});
self.plugin_manager_window = Some(id);
task.map(|_| Message::Noop)
}
Message::PluginManagerClose => {
if let Some(id) = self.plugin_manager_window.take() {
window::close(id)
} else {
Task::none()
}
}
Message::EnterViewport(handle) => {
let i = self.active_tab;
// Clear paper-space selection before entering model space.

View file

@ -474,6 +474,9 @@ impl OpenCADStudio {
if Some(window_id) == self.about_window {
return crate::ui::about::view_window();
}
if Some(window_id) == self.plugin_manager_window {
return crate::ui::plugin_manager::view_window(&crate::plugin::installed_manifests());
}
if Some(window_id) == self.update_notice_window {
let latest = self.update_notice_version.as_deref().unwrap_or("?");
let body = self.update_notice_body.as_deref().unwrap_or("");
@ -3743,6 +3746,7 @@ pub(super) fn start_page_view<'a>() -> Element<'a, Message> {
event: crate::modules::ModuleEvent::Command("CHANGELOG".to_string()),
},
),
outline_btn("Plugins", Message::PluginManagerOpen),
outline_btn("About", Message::AboutOpen),
]
.spacing(12)