style: unify identifier naming per updated conventions
Automated with clang-tidy readability-identifier-naming (config added to .clang-tidy) plus scripted passes, per the updated rules now documented in CONTRIBUTING.md: - types (class/struct/enum/alias/template params): PascalCase - functions, variables, members: snake_case (incl. rational -> Rational) - private/protected members: trailing underscore; static member variables likewise (instance_, available_themes_) - constants and enum values: snake_case (kLinear -> k_linear, F32P -> f32p); ALL_CAPS reserved for macros - macros: OAK_ prefix (OLIVE_ADD_TEST/OLIVE_ASSERT/OLIVE_CONFIG -> OAK_ADD_TEST/OAK_ASSERT/OAK_CONFIG, GL_PREAMBLE -> OAK_GL_PREAMBLE, include guards -> OAK_*) - file names: all lowercase (Current/Plugin/OliveHost/OliveClip/ OlivePluginInstance -> current/plugin/olivehost/oliveclip/ oliveplugininstance) - getters share the member name sans underscore, setters set_foo() - Qt and third-party (OpenFX) virtual overrides and framework callbacks keep their original names (exempt in .clang-tidy) Manual follow-ups required where automation could not reach: - string-based QMetaObject/SIGNAL/SLOT references updated to renamed methods (AddTask, CreatedFile, DeleteSpecificFile, moveSelectionUp, ...) - macro bodies referencing renamed methods (OLIVE_CONFIG, NODE_DEFAULT_DESTRUCTOR, MANAGEDDISPLAYWIDGET_*) - self-shadowing locals renamed where signals/methods became same-named (size_changed, worker_count, selected_items, import param, filters) - third_party OFX member/namespace usages restored (OFX::Host::*, _created, _clipPrefsDirty, createInstance, clearPersistentMessage) - STL protocol aliases restored (const_iterator) with .clang-tidy ignore rules; qHash overloads restored Full build and test suite pass: ctest 4/4, ~1960 gtest cases green.
This commit is contained in:
@@ -39,112 +39,112 @@ AddTool::AddTool(TimelineWidget *parent)
|
||||
{
|
||||
}
|
||||
|
||||
void AddTool::MousePress(TimelineViewMouseEvent *event)
|
||||
void AddTool::mouse_press(TimelineViewMouseEvent *event)
|
||||
{
|
||||
const Track::Reference &track = event->GetTrack();
|
||||
const Track::Reference &track = event->get_track();
|
||||
|
||||
// Check if track is locked
|
||||
Track *t = parent()->GetTrackFromReference(track);
|
||||
if (t && t->IsLocked()) {
|
||||
Track *t = parent()->get_track_from_reference(track);
|
||||
if (t && t->is_locked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Track::Type add_type = Track::kNone;
|
||||
Track::Type add_type = Track::k_none;
|
||||
|
||||
switch (Core::instance()->GetSelectedAddableObject()) {
|
||||
case Tool::kAddableBars:
|
||||
case Tool::kAddableSolid:
|
||||
case Tool::kAddableTitle:
|
||||
case Tool::kAddableShape:
|
||||
add_type = Track::kVideo;
|
||||
switch (Core::instance()->get_selected_addable_object()) {
|
||||
case Tool::k_addable_bars:
|
||||
case Tool::k_addable_solid:
|
||||
case Tool::k_addable_title:
|
||||
case Tool::k_addable_shape:
|
||||
add_type = Track::k_video;
|
||||
break;
|
||||
case Tool::kAddableTone:
|
||||
add_type = Track::kAudio;
|
||||
case Tool::k_addable_tone:
|
||||
add_type = Track::k_audio;
|
||||
break;
|
||||
case Tool::kAddableSubtitle:
|
||||
add_type = Track::kSubtitle;
|
||||
case Tool::k_addable_subtitle:
|
||||
add_type = Track::k_subtitle;
|
||||
break;
|
||||
case Tool::kAddableEmpty:
|
||||
case Tool::k_addable_empty:
|
||||
// Leave as "none", which means this block can be placed on any track
|
||||
break;
|
||||
case Tool::kAddableCount:
|
||||
case Tool::k_addable_count:
|
||||
// Return so we do nothing
|
||||
return;
|
||||
}
|
||||
|
||||
if (add_type == Track::kNone || add_type == track.type()) {
|
||||
if (add_type == Track::k_none || add_type == track.type()) {
|
||||
drag_start_point_ =
|
||||
ValidatedCoordinate(event->GetCoordinates(true)).GetFrame();
|
||||
validated_coordinate(event->get_coordinates(true)).get_frame();
|
||||
|
||||
ghost_ = new TimelineViewGhostItem();
|
||||
ghost_->SetIn(drag_start_point_);
|
||||
ghost_->SetOut(drag_start_point_);
|
||||
ghost_->SetTrack(track);
|
||||
parent()->AddGhost(ghost_);
|
||||
ghost_->set_in(drag_start_point_);
|
||||
ghost_->set_out(drag_start_point_);
|
||||
ghost_->set_track(track);
|
||||
parent()->add_ghost(ghost_);
|
||||
|
||||
snap_points_.push_back(drag_start_point_);
|
||||
}
|
||||
}
|
||||
|
||||
void AddTool::MouseMove(TimelineViewMouseEvent *event)
|
||||
void AddTool::mouse_move(TimelineViewMouseEvent *event)
|
||||
{
|
||||
if (!ghost_) {
|
||||
return;
|
||||
}
|
||||
|
||||
MouseMoveInternal(event->GetFrame(),
|
||||
event->GetModifiers() & Qt::AltModifier);
|
||||
mouse_move_internal(event->get_frame(),
|
||||
event->get_modifiers() & Qt::AltModifier);
|
||||
}
|
||||
|
||||
void AddTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
void AddTool::mouse_release(TimelineViewMouseEvent *event)
|
||||
{
|
||||
if (ghost_) {
|
||||
if (!ghost_->GetAdjustedLength().isNull()) {
|
||||
if (!ghost_->get_adjusted_length().isNull()) {
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
|
||||
if (MultiUndoCommand *subtitle_section_command =
|
||||
parent()->TakeSubtitleSectionCommand()) {
|
||||
parent()->take_subtitle_section_command()) {
|
||||
command->add_child(subtitle_section_command);
|
||||
}
|
||||
|
||||
Sequence *s = parent()->sequence();
|
||||
|
||||
QRectF r;
|
||||
if (Core::instance()->GetSelectedAddableObject() ==
|
||||
Tool::kAddableTitle) {
|
||||
VideoParams svp = s->GetVideoParams();
|
||||
if (Core::instance()->get_selected_addable_object() ==
|
||||
Tool::k_addable_title) {
|
||||
VideoParams svp = s->get_video_params();
|
||||
r = QRectF(0, 0, svp.width(), svp.height());
|
||||
r.adjust(svp.width() / 10, svp.height() / 10, -svp.width() / 10,
|
||||
-svp.height() / 10);
|
||||
}
|
||||
|
||||
CreateAddableClip(command, s, ghost_->GetTrack(),
|
||||
ghost_->GetAdjustedIn(),
|
||||
ghost_->GetAdjustedLength(), r);
|
||||
create_addable_clip(command, s, ghost_->get_track(),
|
||||
ghost_->get_adjusted_in(),
|
||||
ghost_->get_adjusted_length(), r);
|
||||
|
||||
Core::instance()->undo_stack()->push(
|
||||
command, qApp->translate("AddTool", "Added Clip"));
|
||||
}
|
||||
|
||||
parent()->ClearGhosts();
|
||||
parent()->clear_ghosts();
|
||||
snap_points_.clear();
|
||||
ghost_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Node *AddTool::CreateAddableClip(MultiUndoCommand *command, Sequence *sequence,
|
||||
Node *AddTool::create_addable_clip(MultiUndoCommand *command, Sequence *sequence,
|
||||
const Track::Reference &track,
|
||||
const rational &in, const rational &length,
|
||||
const Rational &in, const Rational &length,
|
||||
const QRectF &rect)
|
||||
{
|
||||
ClipBlock *clip;
|
||||
if (Core::instance()->GetSelectedAddableObject() ==
|
||||
Tool::kAddableSubtitle) {
|
||||
if (Core::instance()->get_selected_addable_object() ==
|
||||
Tool::k_addable_subtitle) {
|
||||
clip = new SubtitleBlock();
|
||||
} else {
|
||||
clip = new ClipBlock();
|
||||
clip->SetLabel(olive::Tool::GetAddableObjectName(
|
||||
Core::instance()->GetSelectedAddableObject()));
|
||||
clip->set_label(olive::Tool::get_addable_object_name(
|
||||
Core::instance()->get_selected_addable_object()));
|
||||
}
|
||||
clip->set_length_and_media_out(length);
|
||||
|
||||
@@ -157,45 +157,45 @@ Node *AddTool::CreateAddableClip(MultiUndoCommand *command, Sequence *sequence,
|
||||
|
||||
Node *node_to_add = nullptr;
|
||||
|
||||
switch (Core::instance()->GetSelectedAddableObject()) {
|
||||
case Tool::kAddableEmpty:
|
||||
switch (Core::instance()->get_selected_addable_object()) {
|
||||
case Tool::k_addable_empty:
|
||||
// Empty, nothing to be done
|
||||
break;
|
||||
case Tool::kAddableSolid:
|
||||
case Tool::k_addable_solid:
|
||||
node_to_add = new SolidGenerator();
|
||||
break;
|
||||
case Tool::kAddableShape:
|
||||
case Tool::k_addable_shape:
|
||||
node_to_add = new ShapeNode();
|
||||
break;
|
||||
case Tool::kAddableTitle:
|
||||
case Tool::k_addable_title:
|
||||
node_to_add = new TextGeneratorV3();
|
||||
break;
|
||||
case Tool::kAddableBars:
|
||||
case Tool::kAddableTone:
|
||||
case Tool::k_addable_bars:
|
||||
case Tool::k_addable_tone:
|
||||
// Not implemented yet
|
||||
qWarning() << "Unimplemented add object:"
|
||||
<< Core::instance()->GetSelectedAddableObject();
|
||||
<< Core::instance()->get_selected_addable_object();
|
||||
break;
|
||||
case Tool::kAddableSubtitle:
|
||||
case Tool::k_addable_subtitle:
|
||||
// The block itself is the node we want
|
||||
break;
|
||||
case Tool::kAddableCount:
|
||||
case Tool::k_addable_count:
|
||||
// Invalid value, do nothing
|
||||
break;
|
||||
}
|
||||
|
||||
if (node_to_add) {
|
||||
QPointF extra_node_offset(kDefaultDistanceFromOutput, 0);
|
||||
QPointF extra_node_offset(k_default_distance_from_output, 0);
|
||||
command->add_child(new NodeAddCommand(graph, node_to_add));
|
||||
command->add_child(new NodeEdgeAddCommand(
|
||||
node_to_add, NodeInput(clip, ClipBlock::kBufferIn)));
|
||||
node_to_add, NodeInput(clip, ClipBlock::k_buffer_in)));
|
||||
command->add_child(
|
||||
new NodeSetPositionCommand(node_to_add, clip, extra_node_offset));
|
||||
|
||||
if (!rect.isNull()) {
|
||||
if (ShapeNodeBase *shape =
|
||||
dynamic_cast<ShapeNodeBase *>(node_to_add)) {
|
||||
shape->SetRect(rect, sequence->GetVideoParams(), command);
|
||||
shape->set_rect(rect, sequence->get_video_params(), command);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -203,22 +203,22 @@ Node *AddTool::CreateAddableClip(MultiUndoCommand *command, Sequence *sequence,
|
||||
return node_to_add;
|
||||
}
|
||||
|
||||
void AddTool::MouseMoveInternal(const rational &cursor_frame, bool outwards)
|
||||
void AddTool::mouse_move_internal(const Rational &cursor_frame, bool outwards)
|
||||
{
|
||||
// Calculate movement
|
||||
rational movement = cursor_frame - drag_start_point_;
|
||||
Rational movement = cursor_frame - drag_start_point_;
|
||||
|
||||
// Validation: Ensure in point never goes below 0
|
||||
if (movement < -ghost_->GetIn() ||
|
||||
(outwards && -movement < -ghost_->GetIn())) {
|
||||
movement = -ghost_->GetIn();
|
||||
if (movement < -ghost_->get_in() ||
|
||||
(outwards && -movement < -ghost_->get_in())) {
|
||||
movement = -ghost_->get_in();
|
||||
}
|
||||
|
||||
// Snap movement
|
||||
bool snapped;
|
||||
|
||||
if (Core::instance()->snapping()) {
|
||||
snapped = parent()->SnapPoint(snap_points_, &movement);
|
||||
snapped = parent()->snap_point(snap_points_, &movement);
|
||||
} else {
|
||||
snapped = false;
|
||||
}
|
||||
@@ -227,20 +227,20 @@ void AddTool::MouseMoveInternal(const rational &cursor_frame, bool outwards)
|
||||
if (!snapped && outwards) {
|
||||
// Snap backwards too
|
||||
movement = -movement;
|
||||
parent()->SnapPoint(snap_points_, &movement);
|
||||
parent()->snap_point(snap_points_, &movement);
|
||||
// We don't need to un-neg here because outwards means all future processing will be done both pos and neg
|
||||
}
|
||||
|
||||
// Make adjustment
|
||||
if (!movement) {
|
||||
ghost_->SetInAdjustment(0);
|
||||
ghost_->SetOutAdjustment(0);
|
||||
ghost_->set_in_adjustment(0);
|
||||
ghost_->set_out_adjustment(0);
|
||||
} else if (movement > 0) {
|
||||
ghost_->SetInAdjustment(outwards ? -movement : 0);
|
||||
ghost_->SetOutAdjustment(movement);
|
||||
ghost_->set_in_adjustment(outwards ? -movement : 0);
|
||||
ghost_->set_out_adjustment(movement);
|
||||
} else if (movement < 0) {
|
||||
ghost_->SetInAdjustment(movement);
|
||||
ghost_->SetOutAdjustment(outwards ? -movement : 0);
|
||||
ghost_->set_in_adjustment(movement);
|
||||
ghost_->set_out_adjustment(outwards ? -movement : 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user