Files
oak-editor/app/widget/nodetableview/nodetableview.cpp
T
Mike-Solar 712badbaa7 build/ci: green builds and tests on all three platforms
Compiler hygiene (all platforms):
- Silence warnings across the tree: missing override, -Wreorder ctor
  init, -Wshadow, -Wsign-compare, missing switch cases, unused
  functions/captures, Qt 6.11 deprecations (QMouseEvent/QDropEvent
  accessors, qAsConst, Q_FOREACH over non-shared containers,
  AA_UseHighDpiPixmaps) and the .bak/ backup tree removal.
- Fix regressions from the cleanup: missing clip decls in
  capi/timeline.cpp, plugin.cpp rename fallout, panel setFocus
  ambiguity, QGraphicsItem::pos vs event->position(), duplicate
  k_push_button case, boolean test variable.

Windows:
- Qt portability: CommandLineParser is_set/add_option, QTimeZone
  systemTimeZone (QTimeZone::LocalTime is 6.11-only), k_progress_* enum.
- Linking: stop adding oakengine to OLIVE_LIBRARIES (import lib plus
  oakengine-obj caused multiple definitions); add OAKENGINE_STATIC so
  internal consumers no longer reference __imp_* stubs.
- oakengine.ver: export olive::Renderer typeinfo so liboakgl.so can be
  dlopened (Linux), DynamicRenderer no longer dlcloses backend libraries
  (crash in RenderManager's dtor calling into unmapped memory).
- OTIO runtime: copy DLLs next to every binary on Windows instead of
  relying on PATH (0xc0000135 in gtest discovery).
- Headless GL: the runner only has GDI OpenGL 1.1, killing every render
  worker. Deploy Mesa llvmpipe as opengl32sw.dll (Qt's software-GL
  channel) with QT_OPENGL=software, and let QT_OPENGL override the
  AA_UseDesktopOpenGL default. ExportTask fails fast after 8 consecutive
  undelivered frames instead of segfaulting or grinding forever;
  FFmpegEncoder::write_frame tolerates null frames.
- Tests: GetTempPathA+PID temp dirs, GetLongPathNameA for 8.3 names,
  forward-slash normalization when comparing project filenames.

Linux:
- Install libshaderc-dev so oakvulkan compiles GLSL (Vulkan tests).
- Accept UNORM floor-or-round (63/64) in the blit ping-pong test.
- Skip MainWindow construction test on the offscreen QPA (cannot paint
  QOpenGLWidget).

Also: oak_cli_transcode gets a 300s ctest timeout, worker logs GL
context version and LoadGraph/render_frame stages, and
docs/plans/eliminate-event-bridge-issues.md (English translation).
2026-08-04 21:34:31 +08:00

212 lines
5.5 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/>.
***/
#include "nodetableview.h"
#include <QCheckBox>
#include <QHeaderView>
#include "oakengine/traverse.h"
#include "oakengine/node.h"
#include "oakutil/oaknode.h"
namespace olive
{
NodeTableView::NodeTableView(QWidget *parent)
: QTreeWidget(parent)
{
setColumnCount(3);
setHeaderLabels({ tr("Type"), tr("Source"), tr("R/X"), tr("G/Y"), tr("B/Z"),
tr("A/W") });
}
void NodeTableView::select_nodes(const QVector<OakEngineNode *> &nodes)
{
foreach (OakEngineNode *n, nodes) {
QTreeWidgetItem *top_item = new QTreeWidgetItem();
top_item->setText(0, oak::Node(n).label_and_name());
top_item->setFirstColumnSpanned(true);
this->addTopLevelItem(top_item);
top_level_item_map_.insert(n, top_item);
}
set_time(last_time_);
}
void NodeTableView::deselect_nodes(const QVector<OakEngineNode *> &nodes)
{
foreach (OakEngineNode *n, nodes) {
delete top_level_item_map_.take(n);
}
}
void NodeTableView::set_time(const Rational &time)
{
last_time_ = time;
for (auto i = top_level_item_map_.constBegin();
i != top_level_item_map_.constEnd(); i++) {
OakEngineNode *node = i.key();
QTreeWidgetItem *item = i.value();
// WRAPPER-GAP: oakengine_traverse_* (traverse API has no oak:: wrapper)
OakEngineTraverseDb *db = oakengine_traverse_generate_database(
node, time.numerator(),
time.denominator(), time.numerator(), time.denominator());
int input_count = oakengine_traverse_db_input_count(db);
// Delete any children of this item that aren't in this database
for (int j = 0; j < item->childCount(); j++) {
QString child_id =
item->child(j)->data(0, Qt::UserRole).toString();
bool found = false;
for (int k = 0; k < input_count; k++) {
if (child_id ==
QString::fromUtf8(
oakengine_traverse_db_input_id(db, k))) {
found = true;
break;
}
}
if (!found) {
delete item->takeChild(j);
j--;
}
}
// Update all inputs
for (int l = 0; l < input_count; l++) {
const char *input_id_c = oakengine_traverse_db_input_id(db, l);
QString input_id = QString::fromUtf8(input_id_c);
if (!oak::Node(node).input_count()) {
continue;
}
{
bool found_input = false;
const int nic = oak::Node(node).input_count();
for (int ni = 0; ni < nic; ni++) {
if (input_id == oak::Node(node).input_id(ni)) {
found_input = true;
break;
}
}
if (!found_input) {
continue;
}
}
int row_count = oakengine_traverse_db_row_count(db, l);
QTreeWidgetItem *input_item = nullptr;
for (int j = 0; j < item->childCount(); j++) {
QTreeWidgetItem *compare = item->child(j);
if (compare->data(0, Qt::UserRole).toString() == input_id) {
input_item = compare;
break;
}
}
if (!input_item) {
input_item = new QTreeWidgetItem();
input_item->setText(0, oak::Input(node, input_id).name());
input_item->setData(0, Qt::UserRole, input_id);
input_item->setFirstColumnSpanned(true);
item->addChild(input_item);
}
// Create children if necessary
while (input_item->childCount() < row_count) {
input_item->addChild(new QTreeWidgetItem());
}
// Remove children if necessary
while (input_item->childCount() > row_count) {
delete input_item->takeChild(
input_item->childCount() - 1);
}
for (int j = 0; j < row_count; j++) {
int actual_row = row_count - 1 - j;
QTreeWidgetItem *sub_item = input_item->child(j);
int type =
oakengine_traverse_row_type(db, l, actual_row);
// Set data type name
char name_buf[64];
int len = oakengine_node_value_pretty_type_name(type, name_buf, sizeof(name_buf));
if (len > 0 && len < static_cast<int>(sizeof(name_buf))) {
name_buf[len] = '\0';
} else {
snprintf(name_buf, sizeof(name_buf), "Type %d", type);
}
sub_item->setText(0, QString::fromUtf8(name_buf));
// Determine source
OakEngineNode *source =
oakengine_traverse_row_source(db, l, actual_row);
QString source_name;
if (source) {
source_name = oak::Node(source).label_and_name();
} else {
source_name = tr("(unknown)");
}
sub_item->setText(1, source_name);
switch (type) {
case OAK_NODE_VALUE_VIDEO_PARAMS:
case OAK_NODE_VALUE_AUDIO_PARAMS:
// These types have no string representation
break;
case OAK_NODE_VALUE_TEXTURE: {
for (int k = 0; k < 4; k++) {
this->setItemWidget(sub_item, 2 + k,
new QCheckBox());
}
break;
}
default: {
int split_count =
oakengine_traverse_row_split_count(db, l,
actual_row);
for (int k = 0; k < split_count; k++) {
const char *split_str =
oakengine_traverse_row_split_string(
db, l, actual_row, k);
sub_item->setText(2 + k,
QString(split_str));
}
}
}
}
}
oakengine_traverse_db_free(db);
}
}
}