refactor: invert the last engine-to-UI dependencies

- NodeFactory's menu creation moves to UI-side widget/menu/factorymenu
  (the factory only exposes its node library read-only now)
- DiskManager's cache-settings dialog is created through a registered
  std::function handler (registered by Core at startup)
- OlivePluginInstance creates progress UIs through a
  PluginProgressReporter interface (Null fallback headless) and queries
  the active viewer through a provider callback, both registered by Core
- factory.h, diskmanager and pluginSupport no longer reference any
  widget//dialog//panel//window headers or classes
This commit is contained in:
2026-07-20 02:05:01 +08:00
parent bff06e00e5
commit 026ff94b5e
21 changed files with 630 additions and 179 deletions
+8 -7
View File
@@ -31,6 +31,7 @@
#include "node/serializeddata.h"
#include "core.h"
#include "render/diskmanager.h"
#include "widget/menu/factorymenu.h"
#include "widget/menu/menu.h"
namespace
@@ -532,15 +533,15 @@ TEST(NodeFactory, CreateMenuWithNoneItem)
olive::NodeFactory::initialize();
std::unique_ptr<olive::Menu> menu(
olive::NodeFactory::create_menu(nullptr, true));
olive::create_node_menu(nullptr, true));
ASSERT_NE(menu, nullptr);
ASSERT_FALSE(menu->actions().isEmpty());
// The "None" item is inserted at the very top and maps to nothing
QAction *none_item = menu->actions().first();
EXPECT_EQ(none_item->data().toInt(), -1);
EXPECT_EQ(olive::NodeFactory::CreateFromMenuAction(none_item), nullptr);
EXPECT_TRUE(olive::NodeFactory::GetIDFromMenuAction(none_item).isEmpty());
EXPECT_EQ(olive::create_node_from_menu_action(none_item), nullptr);
EXPECT_TRUE(olive::get_node_id_from_menu_action(none_item).isEmpty());
// Leaf actions carry a library index that maps back to node ids
QList<QAction *> leaves;
@@ -552,10 +553,10 @@ TEST(NodeFactory, CreateMenuWithNoneItem)
if (leaf->data().toInt() < 0) {
continue;
}
const QString id = olive::NodeFactory::GetIDFromMenuAction(leaf);
const QString id = olive::get_node_id_from_menu_action(leaf);
EXPECT_FALSE(id.isEmpty());
std::unique_ptr<olive::Node> node(
olive::NodeFactory::CreateFromMenuAction(leaf));
olive::create_node_from_menu_action(leaf));
ASSERT_NE(node, nullptr);
EXPECT_EQ(node->id(), id);
++created;
@@ -569,7 +570,7 @@ TEST(NodeFactory, CreateMenuRestrictedToCategory)
{
olive::NodeFactory::initialize();
std::unique_ptr<olive::Menu> menu(olive::NodeFactory::create_menu(
std::unique_ptr<olive::Menu> menu(olive::create_node_menu(
nullptr, false, olive::Node::k_category_math));
ASSERT_NE(menu, nullptr);
@@ -579,7 +580,7 @@ TEST(NodeFactory, CreateMenuRestrictedToCategory)
for (QAction *leaf : leaves) {
std::unique_ptr<olive::Node> node(
olive::NodeFactory::CreateFromMenuAction(leaf));
olive::create_node_from_menu_action(leaf));
ASSERT_NE(node, nullptr);
EXPECT_TRUE(node->category().contains(olive::Node::k_category_math))
<< node->id().toStdString();