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
+15 -3
View File
@@ -31,13 +31,15 @@
#include "common/filefunctions.h"
#include "config/config.h"
#include "coreengine.h"
#include "dialog/diskcache/diskcachedialog.h"
namespace olive
{
DiskManager *DiskManager::instance_ = nullptr;
DiskManager::ShowDiskCacheSettingsHandler
DiskManager::show_disk_cache_settings_handler_;
DiskManager::DiskManager()
{
// Add default cache location
@@ -181,11 +183,21 @@ QString DiskManager::get_default_disk_cache_path()
.filePath("mediacache");
}
void DiskManager::set_show_disk_cache_settings_handler(
ShowDiskCacheSettingsHandler handler)
{
show_disk_cache_settings_handler_ = std::move(handler);
}
void DiskManager::show_disk_cache_settings_dialog(DiskCacheFolder *folder,
QWidget *parent)
{
DiskCacheDialog d(folder, parent);
d.exec();
if (show_disk_cache_settings_handler_) {
show_disk_cache_settings_handler_(folder, parent);
return;
}
qWarning() << "No disk cache settings dialog handler registered, skipping";
}
void DiskManager::show_disk_cache_settings_dialog(const QString &path,
+17
View File
@@ -27,6 +27,8 @@
#include <QObject>
#include <QTimer>
#include <functional>
#include "common/define.h"
#include "node/project.h"
@@ -143,6 +145,19 @@ public:
static QString get_default_disk_cache_path();
/**
* @brief Handler showing the disk cache settings dialog for a folder
*
* Registered by the UI layer (e.g. a DiskCacheDialog-based
* implementation), since the engine cannot show dialogs itself. Without
* a handler, the request is logged and skipped.
*/
using ShowDiskCacheSettingsHandler =
std::function<void(DiskCacheFolder *folder, QWidget *parent)>;
static void set_show_disk_cache_settings_handler(
ShowDiskCacheSettingsHandler handler);
void show_disk_cache_settings_dialog(DiskCacheFolder *folder, QWidget *parent);
void show_disk_cache_settings_dialog(const QString &path, QWidget *parent);
@@ -165,6 +180,8 @@ private:
static DiskManager *instance_;
static ShowDiskCacheSettingsHandler show_disk_cache_settings_handler_;
QVector<DiskCacheFolder *> open_folders_;
};