refactor: split Core into EngineCore (engine) and Core (UI)

EngineCore (new app/coreengine.{h,cpp}) owns every engine-safe part of
the old Core singleton: CoreParams, lifecycle of the engine managers,
UndoStack, tool/snapping/timecode state, locale, autorecovery, recent
projects, footage filters, clipboard, project registry, type
declarations, and the proxy toggle. UI dependencies are inverted
through hooks instead: status-bar/cache-full signals and std::function
handlers for image-sequence confirmation, footage relink, OTIO import,
project save/close and layout load (same pattern as
Config::ErrorHandler).

Core (app/) now derives from EngineCore and keeps only UI behavior:
the main window, dialogs, panel heuristics, import/export flows and
project lifecycle presentation. Its public API is unchanged (all
inherited), and Core::instance() covariantly static_casts the engine
singleton. The render worker constructs EngineCore directly, making it
the first binary that no longer needs the UI side of Core.

~25 engine call sites move from core.h to coreengine.h; a dozen more
drop a vestigial core.h include (gaining direct includes for symbols
they were borrowing transitively). Full gtest suite green (1986 tests,
0 failures).
This commit is contained in:
2026-07-20 01:38:42 +08:00
parent 5109dd2995
commit bff06e00e5
34 changed files with 1764 additions and 1313 deletions
+1 -1
View File
@@ -27,7 +27,7 @@
#include "common/define.h"
#include "common/filefunctions.h"
#include "config/config.h"
#include "core.h"
#include "node/project.h"
namespace olive
{
+3 -3
View File
@@ -25,7 +25,7 @@
#include <QMetaObject>
#include "core.h"
#include "coreengine.h"
#include "node/color/colormanager/colormanager.h"
#include "render/lutlibrary.h"
#include "render/previewautocacher.h"
@@ -204,8 +204,8 @@ void OCIOLutNode::set_last_error(const QString &error) const
// Make the error visible to the user instead of failing silently, but only
// from the main process (the render worker has no status bar)
if (!error.isEmpty() && is_main_process() && Core::instance()) {
Core::instance()->show_status_bar_message(error, 10000);
if (!error.isEmpty() && is_main_process() && EngineCore::instance()) {
EngineCore::instance()->show_status_bar_message(error, 10000);
}
}
@@ -22,7 +22,6 @@
#include "cornerpindistortnode.h"
#include "common/lerp.h"
#include "core.h"
namespace olive
{
@@ -22,7 +22,6 @@
#include "cropdistortnode.h"
#include "common/util.h"
#include "core.h"
#include "node/sliderdisplaytype.h"
namespace olive
@@ -25,7 +25,6 @@
#include <QVector2D>
#include "common/util.h"
#include "core.h"
#include "node/nodeundo.h"
namespace olive
+2 -2
View File
@@ -26,7 +26,7 @@
#include <QTextDocument>
#include "common/html.h"
#include "core.h"
#include "coreengine.h"
#include "node/project.h"
#include "node/nodeundo.h"
@@ -300,7 +300,7 @@ void TextGeneratorV3::gizmo_deactivated()
void TextGeneratorV3::set_vertical_alignment_undoable(Qt::Alignment a)
{
Core::instance()->undo_stack()->push(
EngineCore::instance()->undo_stack()->push(
new NodeParamSetStandardValueCommand(NodeInput(this,
k_vertical_alignment_input),
get_our_alignment_from_qts(a)),
+2 -2
View File
@@ -21,7 +21,7 @@
#include "text.h"
#include "core.h"
#include "coreengine.h"
#include "undo/undocommand.h"
namespace olive
@@ -45,7 +45,7 @@ void TextGizmo::update_input_html(const QString &s, const Rational &time)
MultiUndoCommand *command = new MultiUndoCommand();
Node::set_value_at_time(input_.input(), time, s, input_.track(), command,
true);
Core::instance()->undo_stack()->push(command, tr("Edit Text"));
EngineCore::instance()->undo_stack()->push(command, tr("Edit Text"));
}
}
-1
View File
@@ -21,7 +21,6 @@
#include "inputdragger.h"
#include "core.h"
#include "node.h"
#include "nodeundo.h"
-1
View File
@@ -27,7 +27,6 @@
#include <QFile>
#include "common/lerp.h"
#include "core.h"
#include "config/config.h"
#include "node/group/group.h"
#include "node/project/serializer/typeserializer.h"
+2 -2
View File
@@ -22,7 +22,7 @@
#include "viewer.h"
#include "config/config.h"
#include "core.h"
#include "coreengine.h"
#include "node/traverser.h"
namespace olive
@@ -107,7 +107,7 @@ QVariant ViewerOutput::data(const DataType &d) const
case duration: {
Rational using_timebase;
Timecode::Display using_display =
Core::instance()->get_timecode_display();
EngineCore::instance()->get_timecode_display();
// Get first enabled streams
VideoParams video = get_first_enabled_video_stream();
-1
View File
@@ -27,7 +27,6 @@
#include "common/current.h"
#include "common/qtutils.h"
#include "common/xmlutils.h"
#include "core.h"
#include "node/color/ociobase/ociobase.h"
#include "node/factory.h"
#include "node/group/group.h"
+3 -1
View File
@@ -27,13 +27,15 @@
#include <QImage>
#include <QPainter>
#include <QStandardPaths>
#include <QTimer>
#include "codec/decoder.h"
#include "common/filefunctions.h"
#include "common/qtutils.h"
#include "common/xmlutils.h"
#include "config/config.h"
#include "core.h"
#include "node/color/colormanager/colormanager.h"
#include "node/project.h"
#include "render/job/footagejob.h"
#include "ui/icons/icons.h"
+3 -3
View File
@@ -26,7 +26,7 @@
#include <QXmlStreamReader>
#include "common/xmlutils.h"
#include "core.h"
#include "coreengine.h"
#include "node/group/group.h"
#include "serializer190219.h"
#include "serializer210528.h"
@@ -156,7 +156,7 @@ ProjectSerializer::Result ProjectSerializer::load(Project *project,
ProjectSerializer::Result ProjectSerializer::paste(LoadType load_type,
Project *project)
{
QString clipboard = Core::paste_string_from_clipboard();
QString clipboard = EngineCore::paste_string_from_clipboard();
if (clipboard.isEmpty()) {
return k_no_data;
}
@@ -257,7 +257,7 @@ ProjectSerializer::Result ProjectSerializer::copy(const SaveData &data)
ProjectSerializer::Result res = ProjectSerializer::save(&writer, data);
if (res == k_success) {
Core::copy_string_to_clipboard(copy_str);
EngineCore::copy_string_to_clipboard(copy_str);
}
return res;