Search improvements. Code refactoring so its easier to maintain. Experimental features for speed dial: connect/disconnect from printer.

This commit is contained in:
Lam Wei Lun
2026-09-09 16:53:58 +08:00
parent c3a21fa0d4
commit 3985200672
15 changed files with 968 additions and 770 deletions
+31
View File
@@ -0,0 +1,31 @@
#pragma once
#include <functional>
#include <string>
#include <vector>
#include "ActionRegistry.hpp" // for AppActionRunResult
namespace Slic3r { namespace GUI {
// A built-in speed-dial command: identity + how to run it. The registry keeps commands as thin
// values (CommandAction) and routes run() here, so this catalog is the single source of truth for
// the behaviour (runner => an owner method) and the presentation (title/group/input).
struct NativeCommand
{
std::string key;
std::string title;
std::string group;
std::string input; // "settings"/"percent"/"tab" or "" for immediate run
std::function<AppActionRunResult(const std::string& param)> runner;
};
namespace NativeCommands {
// The full built-in command catalog, built once (init()). UI thread only.
const std::vector<NativeCommand>& catalog();
// Dispatches `key` to its runner (unknown keys return a quiet Info). UI thread only.
AppActionRunResult run(const std::string& key, const std::string& param = {});
} // namespace NativeCommands
}} // namespace Slic3r::GUI