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).
This commit is contained in:
2026-08-04 21:34:31 +08:00
parent 5006382790
commit 712badbaa7
127 changed files with 826 additions and 8498 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ namespace olive {
* Replaces engine's olive::debug_handler so oak-editor doesn't import
* that symbol. Only used in main.cpp's qInstallMessageHandler.
*/
static void debug_handler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
[[maybe_unused]] [[maybe_unused]] static void debug_handler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
// Suppress noisy warnings from Qt's QXcbIntegration
if (type == QtWarningMsg && msg.contains("QXcbIntegration")) {
+1 -1
View File
@@ -17,7 +17,7 @@
*/
#ifndef OAK_HTMLAPP_H
#define OAK_HTML_H
#define OAK_HTMLAPP_H
#include <QTextDocument>
#include <QTextFragment>
+2 -2
View File
@@ -98,7 +98,7 @@ Core::Core(const OakEngineAppParams *params)
if (params) {
oakengine_app_create(params);
} else {
static const OakEngineAppParams default_params = {0};
static const OakEngineAppParams default_params = {};
oakengine_app_create(&default_params);
}
@@ -773,7 +773,7 @@ void Core::start_gui(bool full_screen)
main_window_ = new MainWindow();
// Route engine notifications to the UI
connect(this, &Core::tool_changed, this, [this](const Tool::Item &) {});
connect(this, &Core::tool_changed, this, [](const Tool::Item &) {});
// Status-bar and lifecycle notifications are handled through the facade
// (oakengine_app_show_status_message, oakengine_app_clear_status_message)
// which the engine forwards through registered callbacks. The main window
+2 -3
View File
@@ -61,7 +61,7 @@ namespace
// pix_fmt string (e.g. "yuv420p") to its index in the codec's supported
// list; 0 (the codec's preferred format) when absent.
int pix_fmt_index(int codec, const QString &pix_fmt)
[[maybe_unused]] [[maybe_unused]] int pix_fmt_index(int codec, const QString &pix_fmt)
{
if (pix_fmt.isEmpty()) {
return 0;
@@ -87,7 +87,7 @@ Rational export_viewer_length(const OakEngineNode *viewer)
// OakEngineEncodingParams (assembled by the dialog) -> facade POD. One-to-one with
// oak_export_options_ex; see oakengine/exporter.h for the field docs.
oak_export_options_ex params_to_ex(const OakEngineEncodingParams *p)
[[maybe_unused]] [[maybe_unused]] oak_export_options_ex params_to_ex(const OakEngineEncodingParams *p)
{
oak_export_options_ex o = {};
@@ -939,7 +939,6 @@ OakEngineEncodingParams *ExportDialog::generate_params() const
const int vh = static_cast<int>(video_tab_->height_slider()->get_value());
const Rational tb = get_selected_timebase();
const int pix_fmt = video_tab_->pixel_format_field()->get_pixel_format();
const int ch_count = oakengine_video_params_internal_channel_count();
const Rational par = video_tab_->pixel_aspect_combobox()->get_pixel_aspect_ratio();
const int interlace = video_tab_->interlaced_combobox()->get_interlace_mode();
@@ -145,7 +145,7 @@ void MarkerPropertiesDialog::accept()
// Batch-set properties via facade (one undoable command)
{
QVector<OakEngineMarker *> oak_markers;
foreach (OakEngineMarker *m, markers_) {
for (OakEngineMarker *m : markers_) {
oak_markers.append(m);
}
int color = color_menu_->get_selected_color();
+9 -5
View File
@@ -228,7 +228,7 @@ int main(int argc, char *argv[])
"main", "Decompress project file (No GUI)"));
#ifdef _WIN32
auto console_option = parser.AddOption(
auto console_option = parser.add_option(
{ QStringLiteral("c"), QStringLiteral("-console") },
QCoreApplication::translate("main", "Launch with debug console"));
#endif // _WIN32
@@ -333,15 +333,19 @@ int main(int argc, char *argv[])
// so far.
//
// https://bugreports.qt.io/browse/QTBUG-46140
QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
// An explicit QT_OPENGL (e.g. "software" on GPU-less CI runners with
// Mesa deployed as opengl32sw.dll) takes precedence over this default.
if (!qEnvironmentVariableIsSet("QT_OPENGL")) {
QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
}
format.setVersion(3, 2);
format.setProfile(QSurfaceFormat::CoreProfile);
format.setDepthBufferSize(24);
QSurfaceFormat::setDefaultFormat(format);
// Enable application automatically using higher resolution images from icons
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
// High-DPI pixmaps are always enabled in Qt 6 (AA_UseHighDpiPixmaps is
// deprecated and has no effect).
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
@@ -352,7 +356,7 @@ int main(int argc, char *argv[])
#ifdef _WIN32
// Since Oak Video Editor is linked with the console subsystem (for better POSIX compatibility), a console
// is created by default. If the user didn't request one, we free it here.
if (!console_option->IsSet()) {
if (!console_option->is_set()) {
FreeConsole();
}
#endif // _WIN32
+1 -2
View File
@@ -49,8 +49,7 @@ PanelWidget::PanelWidget(const QString &object_name)
View<QWidget>::setFocusPolicy(Qt::ClickFocus);
connect(this, &PanelWidget::shown, this,
reinterpret_cast<void (PanelWidget::*)()>(&PanelWidget::setFocus));
connect(this, &PanelWidget::shown, this, [this]() { QWidget::setFocus(); });
PanelManager::instance()->register_panel(this);
}
+2 -2
View File
@@ -334,7 +334,7 @@ void CurveView::ContextMenuEvent(Menu &m)
void CurveView::SceneRectUpdateEvent(QRectF &r)
{
double min_val, max_val;
double min_val = 0, max_val = 0;
bool got_val = false;
foreach (KeyframeViewInputConnection *con, track_connections_) {
@@ -694,7 +694,7 @@ void CurveView::zoom_to_fit_internal(bool selected_only)
bool got_val = false;
Rational min_time, max_time;
double min_val, max_val;
double min_val = 0, max_val = 0;
foreach (KeyframeViewInputConnection *con, track_connections_) {
foreach (const oak::Keyframe &key, con->get_keyframes()) {
+1 -1
View File
@@ -355,7 +355,7 @@ void CurveWidget::keyframe_type_button_triggered(bool checked)
QVector<int> tracks;
};
QVector<TypeGroup> groups;
foreach (OakEngineKeyframe *item, selected) {
for (OakEngineKeyframe *item : selected) {
const oak::Keyframe key(item);
OakEngineNode *node = key.node().handle();
int g = 0;
+17 -13
View File
@@ -64,8 +64,10 @@ bool HandMovableView::hand_press(QMouseEvent *event)
setInteractive(false);
// Transform mouse event to act like the left button is pressed
QMouseEvent transformed(event->type(), event->pos(), Qt::LeftButton,
Qt::LeftButton, event->modifiers());
QMouseEvent transformed(event->type(), event->position(),
event->globalPosition(), Qt::LeftButton,
Qt::LeftButton, event->modifiers(),
event->pointingDevice());
transformed_pos_ = QPoint(0, 0);
@@ -83,22 +85,24 @@ bool HandMovableView::hand_move(QMouseEvent *event)
// Transform mouse event to act like the left button is pressed
QPoint adjustment(0, 0);
QMouseEvent transformed(event->type(), event->pos() - transformed_pos_,
Qt::LeftButton, Qt::LeftButton,
event->modifiers());
QMouseEvent transformed(event->type(),
event->position() - transformed_pos_,
event->globalPosition(), Qt::LeftButton,
Qt::LeftButton, event->modifiers(),
event->pointingDevice());
if (event->pos().x() < 0) {
if (event->position().toPoint().x() < 0) {
transformed_pos_.setX(transformed_pos_.x() + width());
adjustment.setX(width());
} else if (event->pos().x() >= width()) {
} else if (event->position().toPoint().x() >= width()) {
transformed_pos_.setX(transformed_pos_.x() - width());
adjustment.setX(-width());
}
if (event->pos().y() < 0) {
if (event->position().toPoint().y() < 0) {
transformed_pos_.setY(transformed_pos_.y() + height());
adjustment.setY(height());
} else if (event->pos().y() >= height()) {
} else if (event->position().toPoint().y() >= height()) {
transformed_pos_.setY(transformed_pos_.y() - height());
adjustment.setY(-height());
}
@@ -116,8 +120,8 @@ bool HandMovableView::hand_release(QMouseEvent *event)
{
if (dragging_hand_) {
// Transform mouse event to act like the left button is pressed
QMouseEvent transformed(event->type(), event->localPos(),
event->windowPos(), event->screenPos(),
QMouseEvent transformed(event->type(), event->position(),
event->scenePosition(), event->globalPosition(),
Qt::LeftButton, Qt::LeftButton,
event->modifiers(), event->source());
@@ -194,7 +198,7 @@ void HandMovableView::wheelEvent(QWheelEvent *event)
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
event->position(), event->globalPosition(),
#else
event->pos(), event->globalPos(),
event->position().toPoint(), event->globalPos(),
#endif
event->pixelDelta(), angle_delta, event->buttons(),
event->modifiers(), event->phase(), event->inverted(),
@@ -209,7 +213,7 @@ void HandMovableView::wheelEvent(QWheelEvent *event)
Qt::Horizontal;
}
QWheelEvent e(event->pos(), event->globalPos(), event->pixelDelta(),
QWheelEvent e(event->position().toPoint(), event->globalPos(), event->pixelDelta(),
event->angleDelta(), event->delta(), orientation,
event->buttons(), event->modifiers());
#endif
+13 -13
View File
@@ -83,7 +83,7 @@ void KeyframeView::delete_selected()
get_selected_keyframes();
QVector<OakEngineKeyframe *> keys;
keys.reserve(int(selected.size()));
foreach (OakEngineKeyframe *key, selected) {
for (OakEngineKeyframe *key : selected) {
keys.append(key);
}
oakengine_keyframes_remove_many(
@@ -289,9 +289,9 @@ bool KeyframeView::paste(
oakengine_clipboard_foreach_keyframe(
cb,
[](const char *, OakEngineKeyframe *kf, void *userdata) -> int {
auto *ctx = static_cast<PasteCtx *>(userdata);
ctx->min = std::min(ctx->min, key_time(kf));
ctx->total++;
auto *paste_ctx = static_cast<PasteCtx *>(userdata);
paste_ctx->min = std::min(paste_ctx->min, key_time(kf));
paste_ctx->total++;
return 0;
},
&ctx);
@@ -303,17 +303,17 @@ bool KeyframeView::paste(
cb,
[](const char *node_id, OakEngineKeyframe *kf,
void *userdata) -> int {
auto *ctx = static_cast<PasteCtx *>(userdata);
auto *paste_ctx = static_cast<PasteCtx *>(userdata);
auto &find_fn =
*static_cast<std::function<oak::Node(const QString &)> *>(
ctx->find_fn);
paste_ctx->find_fn);
oak::Node node_with_id =
find_fn(QString::fromUtf8(node_id));
if (!node_with_id.is_null()) {
Rational t = key_time(kf) - ctx->min;
t = ctx->self->get_adjusted_time(
ctx->self->get_time_target(),
Rational t = key_time(kf) - paste_ctx->min;
t = paste_ctx->self->get_adjusted_time(
paste_ctx->self->get_time_target(),
node_with_id.handle(), t,
k_transform_towards_input);
key_set_time_live(kf, t);
@@ -333,7 +333,7 @@ bool KeyframeView::paste(
void *rm = oakengine_node_remove_keyframe_command(
existing);
oakengine_undo_command_multi_add_child(
ctx->command, rm);
paste_ctx->command, rm);
}
oak_node_value v;
@@ -357,7 +357,7 @@ bool KeyframeView::paste(
static_cast<float>(cp_in.y()),
static_cast<float>(cp_out.x()),
static_cast<float>(cp_out.y()));
oakengine_undo_command_multi_add_child(ctx->command, cmd);
oakengine_undo_command_multi_add_child(paste_ctx->command, cmd);
} else {
oakengine_keyframe_dispose(kf);
}
@@ -760,7 +760,7 @@ void KeyframeView::show_context_menu()
QVector<int> tracks;
};
QVector<TypeGroup> groups;
foreach (OakEngineKeyframe *item, get_selected_keyframes()) {
for (OakEngineKeyframe *item : get_selected_keyframes()) {
const oak::Keyframe key(item);
OakEngineNode *node = key.node().handle();
int g = 0;
@@ -797,7 +797,7 @@ void KeyframeView::show_keyframe_properties_dialog()
if (!get_selected_keyframes().empty()) {
QVector<oak::Keyframe> keys;
keys.reserve(int(get_selected_keyframes().size()));
foreach (OakEngineKeyframe *key, get_selected_keyframes()) {
for (OakEngineKeyframe *key : get_selected_keyframes()) {
keys.append(oak::Keyframe(key));
}
KeyframePropertiesDialog kd(keys, timebase(), this);
+2 -2
View File
@@ -50,8 +50,8 @@ ManagedDisplayWidget::ManagedDisplayWidget(QWidget *parent)
#ifdef OAK_ENABLE_DYNAMIC_RENDER_BACKEND
{
const QString backend = oak_query_string([](char *buf, int sz) {
int backend = oakengine_render_manager_requested_backend();
return oakengine_render_manager_backend_to_string(backend, buf,
int backend_id = oakengine_render_manager_requested_backend();
return oakengine_render_manager_backend_to_string(backend_id, buf,
sz);
});
attached_renderer_ =
+3 -2
View File
@@ -19,6 +19,7 @@
***/
#include <utility>
#include "menushared.h"
#include <QActionGroup>
@@ -202,7 +203,7 @@ void MenuShared::add_items_for_edit_menu(Menu *m, bool for_clips)
void MenuShared::add_items_for_addable_objects_menu(Menu *m)
{
for (QAction *a : qAsConst(addable_items_)) {
for (QAction *a : std::as_const(addable_items_)) {
a->setChecked((a->data().toInt() ==
Core::instance()->get_selected_addable_object()));
m->addAction(a);
@@ -425,7 +426,7 @@ void MenuShared::retranslate()
edit_split_item_->setText(tr("Split"));
edit_speedduration_item_->setText(tr("Speed/Duration"));
for (QAction *a : qAsConst(addable_items_)) {
for (QAction *a : std::as_const(addable_items_)) {
a->setText(Tool::get_addable_object_name(
static_cast<Tool::AddableObject>(a->data().toInt())));
}
@@ -43,9 +43,9 @@ NodeParamViewArrayWidget::NodeParamViewArrayWidget(oak::Node node,
bridge_->subscribe(reinterpret_cast<void *>(node_.handle()),
OAKENGINE_EVENT_NODE_INPUT_ARRAY_SIZE_CHANGED);
connect(bridge_, &EngineEventBridge::node_input_array_size_changed, this,
[this](OakEngineNode *, const QString &input, int old_size,
[this](OakEngineNode *, const QString &input_id, int old_size,
int new_size) {
update_counter(input, old_size, new_size);
update_counter(input_id, old_size, new_size);
});
update_counter(input_, 0, oak::Input(node_.handle(), input_).array_size());
@@ -58,11 +58,11 @@ void NodeParamViewArrayWidget::mouseDoubleClickEvent(QMouseEvent *event)
emit double_clicked();
}
void NodeParamViewArrayWidget::update_counter(const QString &input, int old_size,
void NodeParamViewArrayWidget::update_counter(const QString &changed_input, int old_size,
int new_size)
{
Q_UNUSED(old_size)
if (input == input_) {
if (changed_input == input_) {
count_lbl_->setText(tr("%n element(s)", nullptr, new_size));
}
}
@@ -93,15 +93,15 @@ NodeParamViewConnectedLabel::NodeParamViewConnectedLabel(const oak::Input &input
OAKENGINE_EVENT_NODE_INPUT_DISCONNECTED);
connect(bridge_, &EngineEventBridge::node_input_connected, this,
[this](OakEngineNode *source, OakEngineNode *output,
const QString &input, int element) {
const QString &input_id, int element) {
input_connected(output,
oak::Input(source, input, element));
oak::Input(source, input_id, element));
});
connect(bridge_, &EngineEventBridge::node_input_disconnected, this,
[this](OakEngineNode *source, OakEngineNode *output,
const QString &input, int element) {
const QString &input_id, int element) {
input_disconnected(output,
oak::Input(source, input, element));
oak::Input(source, input_id, element));
});
// Creating the tree is expensive, hold off until the user specifically requests it
@@ -161,8 +161,8 @@ NodeParamViewWidgetBridge::NodeParamViewWidgetBridge(const oak::Input &input,
connect(bridge_, &EngineEventBridge::node_input_value_changed, this,
&NodeParamViewWidgetBridge::input_value_changed);
connect(bridge_, &EngineEventBridge::node_input_property_changed, this,
[this](OakEngineNode *, const QString &input) {
property_changed(input);
[this](OakEngineNode *, const QString &input_id) {
property_changed(input_id);
});
connect(bridge_, &EngineEventBridge::node_input_data_type_changed, this,
&NodeParamViewWidgetBridge::input_data_type_changed);
@@ -728,6 +728,7 @@ void NodeParamViewWidgetBridge::widget_callback()
case NodeValueType::k_samples:
case NodeValueType::k_video_params:
case NodeValueType::k_audio_params:
case NodeValueType::k_push_button:
case NodeValueType::k_subtitle_params:
case NodeValueType::k_data_type_count:
break;
@@ -946,6 +947,7 @@ void NodeParamViewWidgetBridge::update_widget_values()
case NodeValueType::k_samples:
case NodeValueType::k_video_params:
case NodeValueType::k_audio_params:
case NodeValueType::k_push_button:
case NodeValueType::k_subtitle_params:
case NodeValueType::k_data_type_count:
break;
+1 -1
View File
@@ -158,7 +158,7 @@ void NodeTableView::set_time(const Rational &time)
// 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 < 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);
+1 -1
View File
@@ -106,7 +106,7 @@ void NodeValueTree::set_node(const oak::Input &input, const Rational &time)
setItemWidget(item, 0, radio);
char name_buf[64];
int len = oakengine_node_value_pretty_type_name(type, name_buf, sizeof(name_buf));
if (len > 0 && len < 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);
+18 -17
View File
@@ -19,6 +19,7 @@
***/
#include <utility>
#include "nodeview.h"
#include <QInputDialog>
@@ -75,8 +76,8 @@ NodeView::NodeView(QWidget *parent)
, overlay_view_(nullptr)
, scale_(1.0)
, dont_emit_selection_signals_(false)
, show_in_param_editor_action_(nullptr)
, bridge_(new EngineEventBridge(this))
, show_in_param_editor_action_(nullptr)
{
setScene(&scene_);
set_default_drag_mode(RubberBandDrag);
@@ -499,7 +500,7 @@ void NodeView::set_color_label(int index)
// WRAPPER-GAP: oakengine_undo_* command assembly (no wrapper)
void *command = oakengine_undo_command_create_multi();
for (const oak::Node &node : qAsConst(selected_nodes_)) {
for (const oak::Node &node : std::as_const(selected_nodes_)) {
oakengine_undo_command_multi_add_child(
command,
oakengine_node_set_color_label_command(node.handle(), index));
@@ -528,8 +529,8 @@ void NodeView::keyPressEvent(QKeyEvent *event)
case Qt::Key_Down: {
// WRAPPER-GAP: oakengine_undo_* command assembly (no wrapper)
void *pos_command = oakengine_undo_command_create_multi();
for (const oak::Node &n : qAsConst(selected_nodes_)) {
for (const oak::Node &context : qAsConst(contexts_)) {
for (const oak::Node &n : std::as_const(selected_nodes_)) {
for (const oak::Node &context : std::as_const(contexts_)) {
QPointF old_pos;
bool old_expanded = false;
if (context.context_position_of(n, &old_pos, &old_expanded)) {
@@ -595,7 +596,7 @@ void NodeView::mousePressEvent(QMouseEvent *event)
return;
// Get the item that the user clicked on, if any
QGraphicsItem *item = itemAt(event->pos());
QGraphicsItem *item = itemAt(event->position().toPoint());
if (event->button() == Qt::LeftButton) {
// Sane defaults
@@ -657,7 +658,7 @@ void NodeView::mousePressEvent(QMouseEvent *event)
scene_.addItem(create_edge_);
// Position edge to mouse cursor
position_new_edge(event->pos());
position_new_edge(event->position().toPoint());
return;
}
}
@@ -698,7 +699,7 @@ void NodeView::mouseMoveEvent(QMouseEvent *event)
return;
if (create_edge_) {
position_new_edge(event->pos());
position_new_edge(event->position().toPoint());
return;
}
@@ -708,7 +709,7 @@ void NodeView::mouseMoveEvent(QMouseEvent *event)
// See if there are any items attached
if (!attached_items_.isEmpty()) {
process_moving_attached_nodes(event->pos());
process_moving_attached_nodes(event->position().toPoint());
}
}
void NodeView::mouseReleaseEvent(QMouseEvent *event)
@@ -729,11 +730,11 @@ void NodeView::mouseReleaseEvent(QMouseEvent *event)
bool had_attached_items = !attached_items_.isEmpty();
if (!attached_items_.isEmpty()) {
select_context = get_context_at_mouse_pos(event->pos());
select_context = get_context_at_mouse_pos(event->position().toPoint());
if (!select_context.is_null()) {
select_nodes = process_dropping_attached_nodes(command, select_context,
event->pos());
event->position().toPoint());
} else {
QToolTip::showText(QCursor::pos(),
tr("Nodes must be placed inside a context."));
@@ -780,7 +781,7 @@ void NodeView::mouseDoubleClickEvent(QMouseEvent *event)
if (!(event->modifiers() & Qt::ControlModifier)) {
NodeViewItem *item_at_cursor =
dynamic_cast<NodeViewItem *>(itemAt(event->pos()));
dynamic_cast<NodeViewItem *>(itemAt(event->position().toPoint()));
if (item_at_cursor) {
item_at_cursor->toggle_expanded();
}
@@ -841,9 +842,9 @@ void NodeView::dragMoveEvent(QDragMoveEvent *event)
if (attached_items_.empty()) {
event->ignore();
} else {
process_moving_attached_nodes(event->pos());
process_moving_attached_nodes(event->position().toPoint());
if (get_context_at_mouse_pos(event->pos())) {
if (get_context_at_mouse_pos(event->position().toPoint())) {
event->accept();
} else {
event->ignore();
@@ -853,12 +854,12 @@ void NodeView::dragMoveEvent(QDragMoveEvent *event)
void NodeView::dropEvent(QDropEvent *event)
{
oak::Node drop_ctx = get_context_at_mouse_pos(event->pos());
oak::Node drop_ctx = get_context_at_mouse_pos(event->position().toPoint());
if (!drop_ctx.is_null()) {
// WRAPPER-GAP: oakengine_undo_* command assembly (no wrapper)
void *command = oakengine_undo_command_create_multi();
QVector<oak::Node> select_nodes =
process_dropping_attached_nodes(command, drop_ctx, event->pos());
process_dropping_attached_nodes(command, drop_ctx, event->position().toPoint());
oakengine_undo_push(
command, tr("Dropped %1 Node(s)").arg(select_nodes.size()).toUtf8().constData());
@@ -1192,7 +1193,7 @@ void NodeView::move_attached_nodes_to_cursor(const QPoint &p)
{
QPointF item_pos = mapToScene(p);
for (const AttachedItem &i : qAsConst(attached_items_)) {
for (const AttachedItem &i : std::as_const(attached_items_)) {
if (i.item) {
i.item->setPos(item_pos + i.original_pos);
}
@@ -1219,7 +1220,7 @@ void NodeView::process_moving_attached_nodes(const QPoint &pos)
NodeViewEdge *new_drop_edge = nullptr;
// See if there is an edge here
for (QGraphicsItem *item : qAsConst(items)) {
for (QGraphicsItem *item : std::as_const(items)) {
new_drop_edge = dynamic_cast<NodeViewEdge *>(item);
if (new_drop_edge) {
+2 -2
View File
@@ -118,8 +118,8 @@ NodeViewItem::NodeViewItem(oak::Node node, const QString &input,
bridge_->subscribe(node_.handle(), OAKENGINE_EVENT_NODE_INPUT_ARRAY_SIZE_CHANGED);
connect(bridge_, &EngineEventBridge::node_input_array_size_changed, this,
[this](OakEngineNode *, const QString &input, int, int) {
input_array_size_changed(input);
[this](OakEngineNode *, const QString &changed_input, int, int) {
input_array_size_changed(changed_input);
});
}
@@ -37,8 +37,8 @@ public:
ChannelLayoutComboBox(QWidget *parent = nullptr)
: QComboBox(parent)
{
foreach (const uint64_t &ch_layout,
AudioParams::k_supported_channel_layouts) {
for (const uint64_t &ch_layout :
AudioParams::k_supported_channel_layouts) {
this->addItem(HumanStrings::channel_layout_to_string(ch_layout),
QVariant::fromValue(ch_layout));
}
@@ -55,7 +55,7 @@ public:
}
clear();
foreach (const SampleFormat &of, formats) {
for (const SampleFormat &of : formats) {
add_format_item(of);
}
@@ -38,7 +38,7 @@ public:
SampleRateComboBox(QWidget *parent = nullptr)
: QComboBox(parent)
{
foreach (int sr, AudioParams::k_supported_sample_rates) {
for (int sr : AudioParams::k_supported_sample_rates) {
this->addItem(HumanStrings::sample_rate_to_string(sr), sr);
}
}
+1 -1
View File
@@ -215,7 +215,7 @@ void TimeBasedView::drawForeground(QPainter *painter, const QRectF &rect)
if (snapped_) {
painter->setPen(palette().text().color());
foreach (const Rational &r, snap_time_) {
for (const Rational &r : snap_time_) {
double x = time_to_scene(r);
painter->drawLine(x, rect.top(), x, rect.height());
@@ -405,7 +405,7 @@ public:
QRectF(rubberband_scene_start_, current).normalized();
selected_ = rubberband_preselected_;
foreach (const DrawnObject &kp, drawn_objects_) {
for (const DrawnObject &kp : drawn_objects_) {
if (scene_rect.intersects(kp.second)) {
select(kp.first);
}
+4 -3
View File
@@ -19,6 +19,7 @@
***/
#include <utility>
#include "timebasedwidget.h"
#include <QInputDialog>
@@ -48,8 +49,8 @@ TimeBasedWidget::TimeBasedWidget(bool ruler_text_visible,
bool ruler_cache_status_visible,
QWidget *parent)
: TimelineScaledWidget(parent)
, viewer_node_(nullptr)
, bridge_(new EngineEventBridge(this))
, viewer_node_(nullptr)
, auto_max_scrollbar_(false)
, toggle_show_all_(false)
, auto_set_timebase_(true)
@@ -408,7 +409,7 @@ void TimeBasedWidget::connect_timeline_view(TimeBasedView *base)
&QScrollBar::setValue);
// Connect scrollbar to other scrollbars
for (TimeBasedView *other : qAsConst(timeline_views_)) {
for (TimeBasedView *other : std::as_const(timeline_views_)) {
connect(other->horizontalScrollBar(), &QScrollBar::valueChanged,
base->horizontalScrollBar(), &QScrollBar::setValue);
connect(base->horizontalScrollBar(), &QScrollBar::valueChanged,
@@ -1229,7 +1230,7 @@ bool TimeBasedWidget::snap_point(const std::vector<Rational> &start_times,
// Find all points at this movement
std::vector<Rational> snap_times;
foreach (const SnapData &d, potential_snaps) {
for (const SnapData &d : potential_snaps) {
if (d.movement == *movement) {
snap_times.push_back(d.time);
}
+4 -3
View File
@@ -19,6 +19,7 @@
***/
#include <utility>
#include "timelinewidget.h"
#include "timelinewidgetwaveformsync.h"
@@ -2715,7 +2716,7 @@ void TimelineWidget::cache_clips_in_out()
const TimeRange r(Rational(int(wa.in_num), int(wa.in_den)),
Rational(int(wa.out_num), int(wa.out_den)));
for (OakEngineBlock *b : qAsConst(selected_blocks_)) {
for (OakEngineBlock *b : std::as_const(selected_blocks_)) {
if (OakEngineBlock *clip = block_as_clip(b)) {
if (OakEngineNode *connected = clip_connected_node(clip)) {
TimeRange adjusted =
@@ -2751,7 +2752,7 @@ void TimelineWidget::multicam_enabled_triggered(bool e)
{
void *command = oakengine_undo_command_create_multi();
for (OakEngineBlock *b : qAsConst(selected_blocks_)) {
for (OakEngineBlock *b : std::as_const(selected_blocks_)) {
if (OakEngineBlock *c = block_as_clip(b)) {
OakEngineNode *viewer = oakengine_clip_get_connected_viewer(c);
OakEngineSequence *s = oakengine_node_is_sequence(viewer) ?
@@ -3399,7 +3400,7 @@ TimelineWidget::generate_existing_paste_map(void *clipboard)
for (int i = 0; i < node_count; i++) {
OakEngineNode *n = oakengine_clipboard_get_loaded_node_at(cb, i);
for (OakEngineBlock *b : qAsConst(this->selected_blocks_)) {
for (OakEngineBlock *b : std::as_const(this->selected_blocks_)) {
// WRAPPER-GAP: no C ABI for Node::get_context_positions(); the
// block's track-owning sequence is the context that matters here
// (blocks on a timeline always live in their sequence's context).
@@ -263,7 +263,7 @@ TimelineView::TimelineView(Qt::Alignment vertical_alignment, QWidget *parent)
void TimelineView::mousePressEvent(QMouseEvent *event)
{
// If we click on marker, jump to that point in the timeline
QPointF scene_pos = mapToScene(event->pos());
QPointF scene_pos = mapToScene(event->position().toPoint());
for (auto it = clip_marker_rects_.cbegin(); it != clip_marker_rects_.cend();
it++) {
if (it.value().contains(scene_pos)) {
@@ -358,7 +358,7 @@ void TimelineView::mouseDoubleClickEvent(QMouseEvent *event)
void TimelineView::dragEnterEvent(QDragEnterEvent *event)
{
TimelineViewMouseEvent timeline_event = CreateMouseEvent(
event->pos(), Qt::NoButton, event->keyboardModifiers());
event->position().toPoint(), Qt::NoButton, event->modifiers());
timeline_event.set_mime_data(event->mimeData());
timeline_event.SetEvent(event);
@@ -369,7 +369,7 @@ void TimelineView::dragEnterEvent(QDragEnterEvent *event)
void TimelineView::dragMoveEvent(QDragMoveEvent *event)
{
TimelineViewMouseEvent timeline_event = CreateMouseEvent(
event->pos(), Qt::NoButton, event->keyboardModifiers());
event->position().toPoint(), Qt::NoButton, event->modifiers());
timeline_event.set_mime_data(event->mimeData());
timeline_event.SetEvent(event);
@@ -385,7 +385,7 @@ void TimelineView::dragLeaveEvent(QDragLeaveEvent *event)
void TimelineView::dropEvent(QDropEvent *event)
{
TimelineViewMouseEvent timeline_event = CreateMouseEvent(
event->pos(), Qt::NoButton, event->keyboardModifiers());
event->position().toPoint(), Qt::NoButton, event->modifiers());
timeline_event.set_mime_data(event->mimeData());
timeline_event.SetEvent(event);
@@ -446,7 +446,7 @@ void TimelineView::drawForeground(QPainter *painter, const QRectF &rect)
static_cast<TrackReference::Type>(connected_track_type_)) {
int track_index = it.key().index();
foreach (const TimeRange &range, it.value()) {
for (const TimeRange &range : it.value()) {
painter->drawRect(time_to_scene(range.in()),
get_track_y(track_index),
time_to_scene(range.length()),
@@ -594,7 +594,7 @@ TimelineCoordinate TimelineView::scene_to_coordinate(const QPointF &pt)
TimelineViewMouseEvent TimelineView::CreateMouseEvent(QMouseEvent *event)
{
return CreateMouseEvent(event->pos(), event->button(), event->modifiers());
return CreateMouseEvent(event->position().toPoint(), event->button(), event->modifiers());
}
TimelineViewMouseEvent
+2 -2
View File
@@ -499,8 +499,8 @@ void SeekableWidget::deselect_all_markers()
void SeekableWidget::set_marker_color(int c)
{
QVector<OakEngineMarker *> oak_markers;
foreach (OakEngineMarker *marker,
selection_manager_.get_selected_objects()) {
for (OakEngineMarker *marker :
selection_manager_.get_selected_objects()) {
oak_markers.append(marker);
}
oakengine_marker_set_properties(
+9 -8
View File
@@ -19,6 +19,7 @@
***/
#include <utility>
#include "viewer.h"
#include <QDateTime>
@@ -172,11 +173,16 @@ const Rational k_video_playback_interval = Rational(1, 10);
ViewerWidget::ViewerWidget(ViewerDisplayWidget *display, QWidget *parent)
: super(false, true, parent)
, overlay_(nullptr)
, info_chip_(nullptr)
, safe_frame_btn_(nullptr)
, overlay_zoom_index_(5)
, playback_speed_(0)
, color_menu_enabled_(true)
, time_changed_from_timer_(false)
, prequeuing_video_(false)
, prequeuing_audio_(0)
, audio_processor_(oakengine_audio_processor_create())
, record_armed_(false)
, recording_(false)
, first_requeue_watcher_(nullptr)
@@ -185,11 +191,6 @@ ViewerWidget::ViewerWidget(ViewerDisplayWidget *display, QWidget *parent)
, ignore_scrub_(0)
, multicam_panel_(nullptr)
, bridge_(new EngineEventBridge(this))
, audio_processor_(oakengine_audio_processor_create())
, overlay_(nullptr)
, info_chip_(nullptr)
, safe_frame_btn_(nullptr)
, overlay_zoom_index_(5)
{
// Set up main layout
QVBoxLayout *layout = new QVBoxLayout(this);
@@ -958,13 +959,13 @@ void ViewerWidget::detect_multicam_node(const Rational &time)
const Rational seq_tb = sequence_timebase(seq);
// Prefer selected nodes
for (OakEngineNode *n : qAsConst(node_view_selected_)) {
for (OakEngineNode *n : std::as_const(node_view_selected_)) {
// MultiCam check via facade predicate (replaces
// dynamic_cast<MultiCamNode*>)
if (oakengine_node_is_multicam(n)) {
multicam = n;
// Found multicam, now try to find corresponding clip from selected timeline blocks
for (OakEngineBlock *b : qAsConst(timeline_selected_blocks_)) {
for (OakEngineBlock *b : std::as_const(timeline_selected_blocks_)) {
// Clip check via facade predicate (replaces
// dynamic_cast<ClipBlock*>)
if (oakengine_node_is_clip(
@@ -983,7 +984,7 @@ void ViewerWidget::detect_multicam_node(const Rational &time)
// Next, prefer multicam from selected block
if (!multicam) {
for (OakEngineBlock *b : qAsConst(timeline_selected_blocks_)) {
for (OakEngineBlock *b : std::as_const(timeline_selected_blocks_)) {
if (block_range_contains(b, seq_tb, time) &&
oakengine_node_is_clip(
reinterpret_cast<OakEngineNode *>(b))) {
+23 -23
View File
@@ -69,6 +69,7 @@ ViewerDisplayWidget::ViewerDisplayWidget(QWidget *parent)
, blank_shader_(nullptr)
, signal_cursor_color_(false)
, gizmos_(nullptr)
, gizmo_params_(empty_video_params())
, current_gizmo_(nullptr)
, gizmo_drag_started_(false)
, show_subtitles_(true)
@@ -83,7 +84,6 @@ ViewerDisplayWidget::ViewerDisplayWidget(QWidget *parent)
, add_band_(false)
, queue_starved_(false)
, text_edit_(nullptr)
, gizmo_params_(empty_video_params())
{
connect(Core::instance(), &Core::tool_changed, this,
&ViewerDisplayWidget::tool_changed);
@@ -1083,7 +1083,7 @@ void ViewerDisplayWidget::open_text_gizmo(void *text, QMouseEvent *event)
// Start text cursor where the user clicked
if (event) {
QPoint click_pos = text_transform_inverted_.map(event->pos()) -
QPoint click_pos = text_transform_inverted_.map(event->position().toPoint()) -
text_edit_pos_.toPoint();
text_edit_->setTextCursor(text_edit_->cursorForPosition(click_pos));
}
@@ -1099,7 +1099,7 @@ bool ViewerDisplayWidget::on_mouse_press(QMouseEvent *event)
{
if (is_hand_drag(event)) {
// Handle hand drag
hand_last_drag_pos_ = event->pos();
hand_last_drag_pos_ = event->position().toPoint();
hand_dragging_ = true;
emit hand_drag_started();
inner_widget()->setCursor(Qt::ClosedHandCursor);
@@ -1115,15 +1115,15 @@ bool ViewerDisplayWidget::on_mouse_press(QMouseEvent *event)
Tool::k_addable_shape ||
Core::instance()->get_selected_addable_object() ==
Tool::k_addable_title)) {
add_band_start_ = event->pos();
add_band_start_ = event->position().toPoint();
add_band_end_ = add_band_start_;
add_band_ = true;
} else if ((current_gizmo_ = try_gizmo_press(
gizmo_last_draw_transform_inverted_.map(
event->pos())))) {
event->position().toPoint())))) {
// Handle gizmo click
gizmo_start_drag_ = event->pos();
gizmo_start_drag_ = event->position().toPoint();
gizmo_last_drag_ = gizmo_start_drag_;
const TimeRange gizmo_time = generate_gizmo_time();
oakengine_gizmo_set_globals(
@@ -1132,7 +1132,7 @@ bool ViewerDisplayWidget::on_mouse_press(QMouseEvent *event)
} else {
// Handle standard drag
emit drag_started(event->pos());
emit drag_started(event->position().toPoint());
}
return true;
@@ -1146,10 +1146,10 @@ bool ViewerDisplayWidget::on_mouse_move(QMouseEvent *event)
// Handle hand dragging
if (hand_dragging_) {
// Emit movement
emit hand_drag_moved(event->x() - hand_last_drag_pos_.x(),
event->y() - hand_last_drag_pos_.y());
emit hand_drag_moved(event->position().toPoint().x() - hand_last_drag_pos_.x(),
event->position().toPoint().y() - hand_last_drag_pos_.y());
hand_last_drag_pos_ = event->pos();
hand_last_drag_pos_ = event->position().toPoint();
return true;
@@ -1157,7 +1157,7 @@ bool ViewerDisplayWidget::on_mouse_move(QMouseEvent *event)
return true;
} else if (add_band_) {
add_band_end_ = event->pos();
add_band_end_ = event->position().toPoint();
update();
return true;
@@ -1184,11 +1184,11 @@ bool ViewerDisplayWidget::on_mouse_move(QMouseEvent *event)
gizmo_drag_started_ = true;
}
QPointF v = screen_to_scene_point(event->pos());
QPointF v = screen_to_scene_point(event->position().toPoint());
switch (drag_behavior) {
case 1:
v -= screen_to_scene_point(gizmo_last_drag_);
gizmo_last_drag_ = event->pos();
gizmo_last_drag_ = event->position().toPoint();
break;
case 2:
v -= screen_to_scene_point(gizmo_start_drag_);
@@ -1249,7 +1249,7 @@ bool ViewerDisplayWidget::on_mouse_double_click(QMouseEvent *event)
if (text_edit_ && forward_mouse_event_to_text_edit(event)) {
return true;
} else if (event->button() == Qt::LeftButton && gizmos_) {
QPointF ptr = transform_viewer_space_to_buffer_space(event->pos());
QPointF ptr = transform_viewer_space_to_buffer_space(event->position().toPoint());
OakEngineNode *gizmos_handle =
gizmos_;
// A text gizmo only exists on a text v3 node, so the node type id is
@@ -1303,7 +1303,7 @@ void ViewerDisplayWidget::emit_color_at_cursor(QMouseEvent *e)
if (texture_) {
QPointF pixel_pos =
generate_display_transform().inverted().map(e->pos());
generate_display_transform().inverted().map(e->position().toPoint());
oak_video_params tp = {};
oakengine_display_texture_get_params(texture_, &tp);
pixel_pos /= (tp.divider > 0 ? tp.divider : 1);
@@ -1458,9 +1458,9 @@ template <typename T> void ViewerDisplayWidget::forward_drag_event_to_text_edit(
if constexpr (std::is_same_v<T, QDragLeaveEvent>) {
text_edit_->dragLeaveEvent(e);
} else {
T relay(adjust_pos_by_v_align(get_virtual_pos_for_text_edit(e->pos())).toPoint(),
e->possibleActions(), e->mimeData(), e->mouseButtons(),
e->keyboardModifiers());
T relay(adjust_pos_by_v_align(get_virtual_pos_for_text_edit(e->position().toPoint())).toPoint(),
e->possibleActions(), e->mimeData(), e->buttons(),
e->modifiers());
if (e->type() == QEvent::DragEnter) {
text_edit_->dragEnterEvent(static_cast<QDragEnterEvent *>(&relay));
@@ -1484,12 +1484,12 @@ bool ViewerDisplayWidget::forward_mouse_event_to_text_edit(QMouseEvent *event,
}
// Transform screen mouse coords to world mouse coords
QPointF local_pos = get_virtual_pos_for_text_edit(event->pos());
QPointF local_pos = get_virtual_pos_for_text_edit(event->position().toPoint());
if (event->type() == QEvent::MouseMove &&
event->buttons() == Qt::NoButton) {
QPointF mapped =
text_transform_inverted_.map(event->pos()) - text_edit_pos_;
text_transform_inverted_.map(event->position().toPoint()) - text_edit_pos_;
if (mapped.x() >= 0 && mapped.y() >= 0 &&
mapped.x() < text_edit_->width() &&
mapped.y() < text_edit_->height()) {
@@ -1504,7 +1504,7 @@ bool ViewerDisplayWidget::forward_mouse_event_to_text_edit(QMouseEvent *event,
local_pos.y() < 0 || local_pos.y() >= text_edit_->height()) {
// Allow clicking other gizmos so the user can resize while the text editor is active
if ((current_gizmo_ = try_gizmo_press(
gizmo_last_draw_transform_inverted_.map(event->pos())))) {
gizmo_last_draw_transform_inverted_.map(event->position().toPoint())))) {
return false;
} else {
close_text_editor();
@@ -1515,8 +1515,8 @@ bool ViewerDisplayWidget::forward_mouse_event_to_text_edit(QMouseEvent *event,
local_pos = adjust_pos_by_v_align(local_pos);
QMouseEvent derived(event->type(), local_pos, event->windowPos(),
event->screenPos(), event->button(), event->buttons(),
QMouseEvent derived(event->type(), local_pos, event->scenePosition(),
event->globalPosition(), event->button(), event->buttons(),
event->modifiers(), event->source());
return forward_event_to_text_edit(&derived);
}
+4 -4
View File
@@ -185,7 +185,7 @@ void ViewerTextEditor::update_tool_bar(ViewerTextEditorToolBar *toolbar,
}
QString style = f.fontStyleName().toString();
QStringList styles = QFontDatabase().styles(family);
QStringList styles = QFontDatabase::styles(family);
if (!styles.isEmpty() && (style.isEmpty() || !styles.contains(style))) {
// There seems to be no better way to find the "regular" style outside of this heuristic.
// Feel free to add more if a font isn't working right.
@@ -298,8 +298,8 @@ void ViewerTextEditor::apply_style(QTextCharFormat *format,
{
// NOTE: Windows appears to require setting weight and italic manually, while macOS and Linux are
// perfectly fine with just the style name
format->setFontWeight(QFontDatabase().weight(family, style));
format->setFontItalic(QFontDatabase().italic(family, style));
format->setFontWeight(QFontDatabase::weight(family, style));
format->setFontItalic(QFontDatabase::italic(family, style));
format->setFontStyleName(style);
}
@@ -594,7 +594,7 @@ void ViewerTextEditorToolBar::update_font_style_list(const QString &family)
style_combo_->blockSignals(true);
style_combo_->clear();
QStringList l = QFontDatabase().styles(family);
QStringList l = QFontDatabase::styles(family);
foreach (const QString &style, l) {
style_combo_->addItem(style);
}
+6 -6
View File
@@ -164,15 +164,15 @@ MainWindow::~MainWindow()
void MainWindow::load_layout(const SerializedLayoutInfo &info)
{
foreach (OakEngineNode *folder, info.open_folders) {
for (OakEngineNode *folder : info.open_folders) {
open_folder(folder, true);
}
foreach (OakEngineNode *sequence, info.open_sequences) {
for (OakEngineNode *sequence : info.open_sequences) {
open_sequence(sequence, info.open_sequences.size() == 1);
}
foreach (OakEngineNode *viewer, info.open_viewers) {
for (OakEngineNode *viewer : info.open_viewers) {
open_node_in_viewer(viewer);
}
@@ -470,15 +470,15 @@ void MainWindow::set_application_progress_status(ProgressStatus status)
#if defined(Q_OS_WINDOWS)
if (taskbar_interface_) {
switch (status) {
case kProgressShow:
case k_progress_show:
taskbar_interface_->SetProgressState(
reinterpret_cast<HWND>(this->winId()), TBPF_NORMAL);
break;
case kProgressNone:
case k_progress_none:
taskbar_interface_->SetProgressState(
reinterpret_cast<HWND>(this->winId()), TBPF_NOPROGRESS);
break;
case kProgressError:
case k_progress_error:
taskbar_interface_->SetProgressState(
reinterpret_cast<HWND>(this->winId()), TBPF_ERROR);
break;