app: migrate all engine access to the C ABI facade (nm U _ZN5olive = 0)
Every app module now reaches liboakengine exclusively through oakengine_* C calls, EngineEventBridge subscriptions and app-side handle headers (cliphandle/keyframehandle/nodevaluehandle/oakvaluehelper). Direct C++ command construction, engine signal connect()s, and engine type usage in MOC-visible signatures are gone: 557 -> 0 undefined olive:: symbols in oak-editor.
This commit is contained in:
@@ -45,7 +45,7 @@ TaskView::TaskView(QWidget *parent)
|
||||
layout_->addStretch();
|
||||
}
|
||||
|
||||
void TaskView::add_task(Task *t)
|
||||
void TaskView::add_task(OakEngineTask *t)
|
||||
{
|
||||
// Create TaskViewItem (UI representation of a Task) and connect it
|
||||
TaskViewItem *item = new TaskViewItem(t);
|
||||
@@ -54,12 +54,12 @@ void TaskView::add_task(Task *t)
|
||||
layout_->insertWidget(layout_->count() - 1, item);
|
||||
}
|
||||
|
||||
void TaskView::task_failed(Task *t)
|
||||
void TaskView::task_failed(OakEngineTask *t)
|
||||
{
|
||||
items_.value(t)->failed();
|
||||
}
|
||||
|
||||
void TaskView::remove_task(Task *t)
|
||||
void TaskView::remove_task(OakEngineTask *t)
|
||||
{
|
||||
items_.value(t)->deleteLater();
|
||||
items_.remove(t);
|
||||
|
||||
@@ -44,26 +44,26 @@ public:
|
||||
TaskView(QWidget *parent);
|
||||
|
||||
signals:
|
||||
void task_cancelled(Task *t);
|
||||
void task_cancelled(OakEngineTask *t);
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* @brief Creates a TaskViewItem, connects it to a Task, and adds it to this widget
|
||||
*
|
||||
* Connect this to TaskManager::TaskAdded().
|
||||
*/
|
||||
void add_task(Task *t);
|
||||
* @brief Creates a TaskViewItem, connects it to a Task, and adds it to this widget
|
||||
*
|
||||
* Connect this to TaskManager::TaskAdded().
|
||||
*/
|
||||
void add_task(OakEngineTask *t);
|
||||
|
||||
void task_failed(Task *t);
|
||||
void task_failed(OakEngineTask *t);
|
||||
|
||||
void remove_task(Task *t);
|
||||
void remove_task(OakEngineTask *t);
|
||||
|
||||
private:
|
||||
QWidget *central_widget_;
|
||||
|
||||
QVBoxLayout *layout_;
|
||||
|
||||
QHash<Task *, TaskViewItem *> items_;
|
||||
QHash<OakEngineTask *, TaskViewItem *> items_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
namespace olive
|
||||
{
|
||||
|
||||
TaskViewItem::TaskViewItem(Task *task, QWidget *parent)
|
||||
TaskViewItem::TaskViewItem(OakEngineTask *task, QWidget *parent)
|
||||
: QFrame(parent)
|
||||
, task_(task)
|
||||
{
|
||||
@@ -41,7 +41,10 @@ TaskViewItem::TaskViewItem(Task *task, QWidget *parent)
|
||||
|
||||
// Create header label
|
||||
task_name_lbl_ = new QLabel(this);
|
||||
task_name_lbl_->setText(task_->get_title());
|
||||
char title_buf[512];
|
||||
title_buf[0] = '\0';
|
||||
oakengine_task_title(task_, title_buf, sizeof(title_buf));
|
||||
task_name_lbl_->setText(QString::fromUtf8(title_buf));
|
||||
layout->addWidget(task_name_lbl_);
|
||||
|
||||
// Create center layout (combines progress bar and a cancel button)
|
||||
@@ -74,10 +77,18 @@ TaskViewItem::TaskViewItem(Task *task, QWidget *parent)
|
||||
// Set up elapsed timer
|
||||
status_stack_->setCurrentWidget(elapsed_timer_lbl_);
|
||||
|
||||
// Connect to the task
|
||||
connect(task_, &Task::started, elapsed_timer_lbl_,
|
||||
qOverload<qint64>(&ElapsedCounterWidget::start));
|
||||
connect(task_, &Task::progress_changed, this, &TaskViewItem::update_progress);
|
||||
// Connect to the task via EngineEventBridge
|
||||
bridge_ = new EngineEventBridge(this);
|
||||
bridge_->subscribe(task_, OAKENGINE_EVENT_TASK_STARTED);
|
||||
bridge_->subscribe(task_, OAKENGINE_EVENT_TASK_PROGRESS);
|
||||
connect(bridge_, &EngineEventBridge::task_started, this,
|
||||
[this](OakEngineTask *, qint64 start_time) {
|
||||
elapsed_timer_lbl_->start(start_time);
|
||||
});
|
||||
connect(bridge_, &EngineEventBridge::task_progress, this,
|
||||
[this](OakEngineTask *, double progress) {
|
||||
update_progress(progress);
|
||||
});
|
||||
connect(cancel_btn_, &QPushButton::clicked, this,
|
||||
[this] { emit task_cancelled(task_); });
|
||||
}
|
||||
@@ -86,7 +97,10 @@ void TaskViewItem::failed()
|
||||
{
|
||||
status_stack_->setCurrentWidget(task_error_lbl_);
|
||||
task_error_lbl_->setStyleSheet("color: red");
|
||||
task_error_lbl_->setText(tr("Error: %1").arg(task_->get_error()));
|
||||
char err[512];
|
||||
err[0] = '\0';
|
||||
oakengine_task_error(task_, err, sizeof(err));
|
||||
task_error_lbl_->setText(tr("Error: %1").arg(QString::fromUtf8(err)));
|
||||
}
|
||||
|
||||
void TaskViewItem::update_progress(double d)
|
||||
|
||||
@@ -29,29 +29,21 @@
|
||||
#include <QWidget>
|
||||
|
||||
#include "elapsedcounterwidget.h"
|
||||
#include "task/task.h"
|
||||
#include "engineeventbridge.h"
|
||||
#include "oakengine/task.h"
|
||||
|
||||
namespace olive
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief A widget that visually represents the status of a Task
|
||||
*
|
||||
* The TaskViewItem widget shows a description of the Task (Task::text(), a progress bar (updated by
|
||||
* Task::ProgressChanged), the Task's status (text generated from Task::status() or Task::error()), and provides
|
||||
* a cancel button (triggering Task::Cancel()) for cancelling a Task before it finishes.
|
||||
*
|
||||
* The main entry point is SetTask() after a Task and TaskViewItem objects are created.
|
||||
*/
|
||||
class TaskViewItem : public QFrame {
|
||||
Q_OBJECT
|
||||
public:
|
||||
TaskViewItem(Task *task, QWidget *parent = nullptr);
|
||||
TaskViewItem(OakEngineTask *task, QWidget *parent = nullptr);
|
||||
|
||||
void failed();
|
||||
|
||||
signals:
|
||||
void task_cancelled(Task *t);
|
||||
void task_cancelled(OakEngineTask *t);
|
||||
|
||||
private:
|
||||
QLabel *task_name_lbl_;
|
||||
@@ -62,7 +54,9 @@ private:
|
||||
ElapsedCounterWidget *elapsed_timer_lbl_;
|
||||
QLabel *task_error_lbl_;
|
||||
|
||||
Task *task_;
|
||||
OakEngineTask *task_;
|
||||
|
||||
EngineEventBridge *bridge_;
|
||||
|
||||
private slots:
|
||||
void update_progress(double d);
|
||||
|
||||
Reference in New Issue
Block a user