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:
2026-07-19 16:10:54 +08:00
parent cb1718a103
commit bb40b4923e
1014 changed files with 44257 additions and 44220 deletions
+46 -46
View File
@@ -30,33 +30,33 @@
namespace olive
{
const QString Sequence::kTrackInputFormat = QStringLiteral("track_in_%1");
const QString Sequence::k_track_input_format = QStringLiteral("track_in_%1");
#define super ViewerOutput
Sequence::Sequence()
{
SetFlag(kIsItem);
set_flag(k_is_item);
// Create TrackList instances
track_lists_.resize(Track::kCount);
track_lists_.resize(Track::k_count);
for (int i = 0; i < Track::kCount; i++) {
for (int i = 0; i < Track::k_count; i++) {
// Create track input
QString track_input_id = kTrackInputFormat.arg(i);
QString track_input_id = k_track_input_format.arg(i);
AddInput(track_input_id, NodeValue::kNone,
InputFlags(kInputFlagNotKeyframable | kInputFlagArray |
kInputFlagHidden | kInputFlagIgnoreInvalidations));
add_input(track_input_id, NodeValue::k_none,
InputFlags(k_input_flag_not_keyframable | k_input_flag_array |
k_input_flag_hidden | k_input_flag_ignore_invalidations));
TrackList *list =
new TrackList(this, static_cast<Track::Type>(i), track_input_id);
track_lists_.replace(i, list);
connect(list, &TrackList::TrackListChanged, this,
&Sequence::UpdateTrackCache);
connect(list, &TrackList::LengthChanged, this, &Sequence::VerifyLength);
connect(list, &TrackList::TrackAdded, this, &Sequence::TrackAdded);
connect(list, &TrackList::TrackRemoved, this, &Sequence::TrackRemoved);
connect(list, &TrackList::track_list_changed, this,
&Sequence::update_track_cache);
connect(list, &TrackList::length_changed, this, &Sequence::verify_length);
connect(list, &TrackList::track_added, this, &Sequence::track_added);
connect(list, &TrackList::track_removed, this, &Sequence::track_removed);
}
}
@@ -64,9 +64,9 @@ void Sequence::add_default_nodes(MultiUndoCommand *command)
{
// Create tracks and connect them to the viewer
UndoCommand *video_track_command =
new TimelineAddTrackCommand(track_list(Track::kVideo));
new TimelineAddTrackCommand(track_list(Track::k_video));
UndoCommand *audio_track_command =
new TimelineAddTrackCommand(track_list(Track::kAudio));
new TimelineAddTrackCommand(track_list(Track::k_audio));
if (command) {
command->add_child(video_track_command);
@@ -81,19 +81,19 @@ void Sequence::add_default_nodes(MultiUndoCommand *command)
QVariant Sequence::data(const DataType &d) const
{
if (d == ICON) {
return icon::Sequence;
if (d == icon) {
return icon::sequence;
}
return super::data(d);
}
QVector<Track *> Sequence::GetUnlockedTracks() const
QVector<Track *> Sequence::get_unlocked_tracks() const
{
QVector<Track *> tracks = GetTracks();
QVector<Track *> tracks = get_tracks();
for (int i = 0; i < tracks.size(); i++) {
if (tracks.at(i)->IsLocked()) {
if (tracks.at(i)->is_locked()) {
tracks.removeAt(i);
i--;
}
@@ -102,56 +102,56 @@ QVector<Track *> Sequence::GetUnlockedTracks() const
return tracks;
}
void Sequence::Retranslate()
void Sequence::retranslate()
{
super::Retranslate();
super::retranslate();
for (int i = 0; i < Track::kCount; i++) {
for (int i = 0; i < Track::k_count; i++) {
QString input_name;
switch (static_cast<Track::Type>(i)) {
case Track::kVideo:
case Track::k_video:
input_name = tr("Video Tracks");
break;
case Track::kAudio:
case Track::k_audio:
input_name = tr("Audio Tracks");
break;
case Track::kSubtitle:
case Track::k_subtitle:
input_name = tr("Subtitle Tracks");
break;
case Track::kNone:
case Track::kCount:
case Track::k_none:
case Track::k_count:
break;
}
if (!input_name.isEmpty()) {
SetInputName(kTrackInputFormat.arg(i), input_name);
set_input_name(k_track_input_format.arg(i), input_name);
}
}
}
void Sequence::InvalidateCache(const TimeRange &range, const QString &from,
void Sequence::invalidate_cache(const TimeRange &range, const QString &from,
int element, InvalidateCacheOptions options)
{
if (from == kTrackInputFormat.arg(Track::kSubtitle)) {
emit SubtitlesChanged(range);
if (from == k_track_input_format.arg(Track::k_subtitle)) {
emit subtitles_changed(range);
}
super::InvalidateCache(range, from, element, options);
super::invalidate_cache(range, from, element, options);
}
rational Sequence::VerifyLengthInternal(Track::Type type) const
Rational Sequence::verify_length_internal(Track::Type type) const
{
if (!track_lists_.isEmpty()) {
switch (type) {
case Track::kVideo:
return track_lists_.at(Track::kVideo)->GetTotalLength();
case Track::kAudio:
return track_lists_.at(Track::kAudio)->GetTotalLength();
case Track::kSubtitle:
return track_lists_.at(Track::kSubtitle)->GetTotalLength();
case Track::kNone:
case Track::kCount:
case Track::k_video:
return track_lists_.at(Track::k_video)->get_total_length();
case Track::k_audio:
return track_lists_.at(Track::k_audio)->get_total_length();
case Track::k_subtitle:
return track_lists_.at(Track::k_subtitle)->get_total_length();
case Track::k_none:
case Track::k_count:
break;
}
}
@@ -165,7 +165,7 @@ void Sequence::InputConnectedEvent(const QString &input, int element,
foreach (TrackList *list, track_lists_) {
if (list->track_input() == input) {
// Return because we found our input
list->TrackConnected(output, element);
list->track_connected(output, element);
return;
}
}
@@ -179,7 +179,7 @@ void Sequence::InputDisconnectedEvent(const QString &input, int element,
foreach (TrackList *list, track_lists_) {
if (list->track_input() == input) {
// Return because we found our input
list->TrackDisconnected(output, element);
list->track_disconnected(output, element);
return;
}
}
@@ -187,12 +187,12 @@ void Sequence::InputDisconnectedEvent(const QString &input, int element,
super::InputDisconnectedEvent(input, element, output);
}
void Sequence::UpdateTrackCache()
void Sequence::update_track_cache()
{
track_cache_.clear();
foreach (TrackList *list, track_lists_) {
foreach (Track *track, list->GetTracks()) {
foreach (Track *track, list->get_tracks()) {
track_cache_.append(track);
}
}