Files
oak-editor/app/widget/nodeparamview/nodeparamviewitem.h
T
Mike-Solar 66d761b4b7 R8: finish app/ pure C ABI migration (P3-P9) and make OTIO required
- app/ no longer includes engine C++ headers nor holds engine C++ types:
  engine access goes through the oakengine C ABI plus C++ wrappers
  (oakutil/oaknode.h, oakutil/oakvideo.h) and app-local mirror types
  (tooltypes, trackreferencehandle, timelinecommonapp, keyframetypes,
  subtitleapp, serializedlayoutinfoapp, nodevaluehandle, sliderdisplaytypeapp)
- engine: new C ABI functions for block/track/clip/transition navigation
  and predicates, links, caches, waveform/playback, disk folder,
  sequence_track_list, node_free, footage_is_valid, block_get_track,
  get_brush; loadotio/saveotio ported to the current engine API
- OTIO is now a required dependency: CI and CD build it on every
  platform, FindOpenTimelineIO fixed for OTIO 0.16/0.19 (the old deps
  include requirement silently disabled OTIO everywhere), runtime
  libraries are bundled into packages and copied next to macOS binaries
  (oak_copy_otio_runtime)
- fix ProjectViewModel drag&drop mime read/write size mismatch (segfault)
- unify color label naming (k_olive -> "Oak") in the app-side mirror
- docs: OTIO required, FFmpeg minimum corrected to 6.0 (en/zh)
- gtest suite: 1925 passed, 0 failed
2026-07-31 22:46:52 +08:00

269 lines
6.2 KiB
C++

/***
Olive - Non-Linear Video Editor
Copyright (C) 2022 Olive Team
Modifications Copyright (C) 2025 mikesolar
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef OAK_NODEPARAMVIEWITEM_H
#define OAK_NODEPARAMVIEWITEM_H
#include <QCheckBox>
#include <QGridLayout>
#include <QLabel>
#include <QPushButton>
#include <QVBoxLayout>
#include <QWidget>
#include "engineeventbridge.h"
#include "nodeparamviewarraywidget.h"
#include "nodeparamviewconnectedlabel.h"
#include "nodeparamviewkeyframecontrol.h"
#include "nodeparamviewitembase.h"
#include "nodeparamviewwidgetbridge.h"
#include "oakutil/oaknode.h"
#include "widget/clickablelabel/clickablelabel.h"
#include "widget/collapsebutton/collapsebutton.h"
#include "widget/keyframeview/keyframeview.h"
namespace olive
{
enum NodeParamViewCheckBoxBehavior {
k_no_check_boxes,
k_check_boxes_on,
k_check_boxes_on_non_connected
};
class NodeParamViewItemBody : public QWidget {
Q_OBJECT
public:
NodeParamViewItemBody(oak::Node node,
NodeParamViewCheckBoxBehavior create_checkboxes,
QWidget *parent = nullptr);
void set_time_target(OakEngineNode *target);
void retranslate();
int get_element_y(oak::Input c) const;
// Set the timebase of any timebased widgets contained here
void set_timebase(const Rational &timebase);
void set_input_checked(const oak::Input &input, bool e);
signals:
void request_select_node(OakEngineNode *node);
void array_expanded_changed(bool e);
void input_checked_changed(const oak::Input &input, bool e);
void request_edit_text_in_viewer();
private:
void create_widgets(QGridLayout *layout, oak::Node node, const QString &input,
int element, int row_index);
void update_ui_for_edge_connection(const oak::Input &input);
void place_widgets_from_bridge(QGridLayout *layout,
NodeParamViewWidgetBridge *bridge, int row);
void input_array_size_changed_internal(oak::Node node, const QString &input,
int size);
struct InputUI {
InputUI();
QLabel *main_label;
NodeParamViewWidgetBridge *widget_bridge;
NodeParamViewConnectedLabel *connected_label;
NodeParamViewKeyframeControl *key_control;
QGridLayout *layout;
int row;
QPushButton *extra_btn;
QCheckBox *optional_checkbox;
NodeParamViewArrayButton *array_insert_btn;
NodeParamViewArrayButton *array_remove_btn;
};
QHash<oak::Input, InputUI> input_ui_map_;
struct ArrayUI {
QWidget *widget;
int count;
NodeParamViewArrayButton *append_btn;
};
void set_time_target_on_input_ui(const InputUI &ui);
void set_timebase_on_input_ui(const InputUI &ui);
oak::Node node_;
QHash<oak::InputPair, ArrayUI> array_ui_;
QHash<oak::InputPair, CollapseButton *> array_collapse_buttons_;
Rational timebase_;
OakEngineNode *time_target_;
NodeParamViewCheckBoxBehavior create_checkboxes_;
QHash<oak::InputPair, oak::InputPair> input_group_lookup_;
EngineEventBridge *bridge_ = nullptr;
/**
* @brief The column to place the keyframe controls in
*
* Serves as an effective "maximum column" index because the keyframe button is always aligned
* to the right edge.
*/
static const int k_key_control_column;
static const int k_array_insert_column;
static const int k_array_remove_column;
static const int k_extra_button_column;
static const int k_optional_check_box;
static const int k_array_collapse_btn_column;
static const int k_label_column;
static const int k_widget_start_column;
static const int k_max_widget_column;
private slots:
void edge_changed(OakEngineNode *output, const oak::Input &input);
void array_collapse_btn_pressed(bool checked);
void input_array_size_changed(OakEngineNode *source,
const QString &input, int old_sz, int size);
void array_append_clicked();
void array_insert_clicked();
void array_remove_clicked();
void toggle_array_expanded();
void replace_widgets(const oak::Input &input);
void show_speed_duration_dialog_for_node();
void optional_check_box_clicked(bool e);
};
class NodeParamViewItem : public NodeParamViewItemBase {
Q_OBJECT
public:
NodeParamViewItem(oak::Node node,
NodeParamViewCheckBoxBehavior create_checkboxes,
QWidget *parent = nullptr);
void set_time_target(OakEngineNode *target)
{
time_target_ = target;
body_->set_time_target(target);
}
void set_timebase(const Rational &timebase)
{
timebase_ = timebase;
body_->set_timebase(timebase);
}
oak::Node get_context() const
{
return ctx_;
}
void set_context(oak::Node ctx)
{
ctx_ = ctx;
}
oak::Node get_node() const
{
return node_;
}
int get_element_y(const oak::Input &c) const;
void set_input_checked(const oak::Input &input, bool e);
KeyframeView::NodeConnections &get_keyframe_connections()
{
return keyframe_connections_;
}
void set_keyframe_connections(const KeyframeView::NodeConnections &c)
{
keyframe_connections_ = c;
}
signals:
void request_select_node(OakEngineNode *node);
void array_expanded_changed(bool e);
void input_checked_changed(const oak::Input &input, bool e);
void request_edit_text_in_viewer();
void input_array_size_changed(const QString &input, int old_size,
int new_size);
protected slots:
virtual void retranslate() override;
private:
NodeParamViewItemBody *body_;
QLabel *message_label_;
QPushButton *message_clear_button_;
QWidget *message_container_;
oak::Node node_;
NodeParamViewCheckBoxBehavior create_checkboxes_;
oak::Node ctx_;
OakEngineNode *time_target_;
Rational timebase_;
KeyframeView::NodeConnections keyframe_connections_;
EngineEventBridge *bridge_ = nullptr;
private slots:
void recreate_body();
void update_message_panel();
void clear_messages();
};
}
#endif // OAK_NODEPARAMVIEWITEM_H