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
@@ -19,8 +19,8 @@
***/
#ifndef CHANNELLAYOUTCOMBOBOX_H
#define CHANNELLAYOUTCOMBOBOX_H
#ifndef OAK_CHANNELLAYOUTCOMBOBOX_H
#define OAK_CHANNELLAYOUTCOMBOBOX_H
#include <olive/core/core.h>
#include <QComboBox>
@@ -38,16 +38,16 @@ public:
: QComboBox(parent)
{
foreach (const uint64_t &ch_layout,
AudioParams::kSupportedChannelLayouts) {
this->addItem(HumanStrings::ChannelLayoutToString(ch_layout),
AudioParams::k_supported_channel_layouts) {
this->addItem(HumanStrings::channel_layout_to_string(ch_layout),
QVariant::fromValue(ch_layout));
}
}
[[nodiscard]] uint64_t GetChannelLayout() const
[[nodiscard]] uint64_t get_channel_layout() const
{
return this->currentData().toULongLong();
}
void SetChannelLayout(uint64_t ch)
void set_channel_layout(uint64_t ch)
{
for (int i = 0; i < this->count(); i++) {
if (this->itemData(i).toULongLong() == ch) {
@@ -62,4 +62,4 @@ private:
}
#endif // CHANNELLAYOUTCOMBOBOX_H
#endif // OAK_CHANNELLAYOUTCOMBOBOX_H
+30 -30
View File
@@ -19,8 +19,8 @@
***/
#ifndef FRAMERATECOMBOBOX_H
#define FRAMERATECOMBOBOX_H
#ifndef OAK_FRAMERATECOMBOBOX_H
#define OAK_FRAMERATECOMBOBOX_H
#include <QComboBox>
#include <QEvent>
@@ -46,33 +46,33 @@ public:
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(inner_);
RepopulateList();
repopulate_list();
old_index_ = 0;
connect(inner_,
static_cast<void (QComboBox::*)(int)>(
&QComboBox::currentIndexChanged),
this, &FrameRateComboBox::IndexChanged);
this, &FrameRateComboBox::index_changed);
}
rational GetFrameRate() const
Rational get_frame_rate() const
{
if (inner_->currentIndex() == inner_->count() - 1) {
return custom_rate_;
} else {
return inner_->currentData().value<rational>();
return inner_->currentData().value<Rational>();
}
}
void SetFrameRate(const rational &r)
void set_frame_rate(const Rational &r)
{
int standard_rates = inner_->count() - 1;
for (int i = 0; i < standard_rates; i++) {
if (inner_->itemData(i).value<rational>() == r) {
if (inner_->itemData(i).value<Rational>() == r) {
// Set standard frame rate
old_index_ = i;
SetInnerIndexWithoutSignal(i);
set_inner_index_without_signal(i);
return;
}
}
@@ -80,12 +80,12 @@ public:
// If we're here, set a custom rate
custom_rate_ = r;
old_index_ = inner_->count() - 1;
SetInnerIndexWithoutSignal(old_index_);
RepopulateList();
set_inner_index_without_signal(old_index_);
repopulate_list();
}
signals:
void FrameRateChanged(const rational &frame_rate);
void frame_rate_changed(const Rational &frame_rate);
protected:
virtual void changeEvent(QEvent *event) override
@@ -93,12 +93,12 @@ protected:
QWidget::changeEvent(event);
if (event->type() == QEvent::LanguageChange) {
RepopulateList();
repopulate_list();
}
}
private slots:
void IndexChanged(int index)
void index_changed(int index)
{
if (index == inner_->count() - 1) {
// Custom
@@ -106,7 +106,7 @@ private slots:
bool ok;
if (!custom_rate_.isNull()) {
s = QString::number(custom_rate_.toDouble());
s = QString::number(custom_rate_.to_double());
}
while (true) {
@@ -115,24 +115,24 @@ private slots:
QLineEdit::Normal, s, &ok);
if (ok) {
rational r;
Rational r;
// Try converting to double, assuming most users will input frame rates this way
double d = s.toDouble(&ok);
if (ok) {
// Try converting from double
r = rational::fromDouble(d, &ok);
r = Rational::from_double(d, &ok);
} else {
// Try converting to rational in case someone formatted that way
r = rational::fromString(s.toStdString(), &ok);
// Try converting to Rational in case someone formatted that way
r = Rational::from_string(s.toStdString(), &ok);
}
if (ok) {
custom_rate_ = r;
emit FrameRateChanged(r);
emit frame_rate_changed(r);
old_index_ = index;
RepopulateList();
repopulate_list();
break;
} else {
@@ -145,18 +145,18 @@ private slots:
} else {
// User cancelled, revert to original value
SetInnerIndexWithoutSignal(old_index_);
set_inner_index_without_signal(old_index_);
break;
}
}
} else {
old_index_ = index;
emit FrameRateChanged(GetFrameRate());
emit frame_rate_changed(get_frame_rate());
}
}
private:
void RepopulateList()
void repopulate_list()
{
int temp_index = inner_->currentIndex();
@@ -164,8 +164,8 @@ private:
inner_->clear();
foreach (const rational &fr, VideoParams::kSupportedFrameRates) {
inner_->addItem(VideoParams::FrameRateToString(fr),
foreach (const Rational &fr, VideoParams::k_supported_frame_rates) {
inner_->addItem(VideoParams::frame_rate_to_string(fr),
QVariant::fromValue(fr));
}
@@ -174,7 +174,7 @@ private:
} else {
inner_->addItem(
tr("Custom (%1)")
.arg(VideoParams::FrameRateToString(custom_rate_)));
.arg(VideoParams::frame_rate_to_string(custom_rate_)));
}
// On the first populate there is no current index (-1); select the
@@ -184,7 +184,7 @@ private:
inner_->blockSignals(false);
}
void SetInnerIndexWithoutSignal(int index)
void set_inner_index_without_signal(int index)
{
inner_->blockSignals(true);
inner_->setCurrentIndex(index);
@@ -193,11 +193,11 @@ private:
QComboBox *inner_;
rational custom_rate_;
Rational custom_rate_;
int old_index_;
};
}
#endif // FRAMERATECOMBOBOX_H
#endif // OAK_FRAMERATECOMBOBOX_H
@@ -19,8 +19,8 @@
***/
#ifndef INTERLACEDCOMBOBOX_H
#define INTERLACEDCOMBOBOX_H
#ifndef OAK_INTERLACEDCOMBOBOX_H
#define OAK_INTERLACEDCOMBOBOX_H
#include <QComboBox>
@@ -41,12 +41,12 @@ public:
this->addItem(tr("Bottom-Field First"));
}
VideoParams::Interlacing GetInterlaceMode() const
VideoParams::Interlacing get_interlace_mode() const
{
return static_cast<VideoParams::Interlacing>(this->currentIndex());
}
void SetInterlaceMode(VideoParams::Interlacing mode)
void set_interlace_mode(VideoParams::Interlacing mode)
{
this->setCurrentIndex(mode);
}
@@ -54,4 +54,4 @@ public:
}
#endif // INTERLACEDCOMBOBOX_H
#endif // OAK_INTERLACEDCOMBOBOX_H
@@ -19,8 +19,8 @@
***/
#ifndef PIXELASPECTRATIOCOMBOBOX_H
#define PIXELASPECTRATIOCOMBOBOX_H
#ifndef OAK_PIXELASPECTRATIOCOMBOBOX_H
#define OAK_PIXELASPECTRATIOCOMBOBOX_H
#include <QComboBox>
@@ -37,9 +37,9 @@ public:
: QComboBox(parent)
, dont_prompt_custom_par_(false)
{
QStringList par_names = VideoParams::GetStandardPixelAspectRatioNames();
for (int i = 0; i < VideoParams::kStandardPixelAspects.size(); i++) {
const rational &ratio = VideoParams::kStandardPixelAspects.at(i);
QStringList par_names = VideoParams::get_standard_pixel_aspect_ratio_names();
for (int i = 0; i < VideoParams::k_standard_pixel_aspects.size(); i++) {
const Rational &ratio = VideoParams::k_standard_pixel_aspects.at(i);
this->addItem(par_names.at(i), QVariant::fromValue(ratio));
}
@@ -47,39 +47,39 @@ public:
// Always add custom item last, much of the logic relies on this. Set this to the current AR so
// that if none of the above are ==, it will eventually select this item
this->addItem(QString());
UpdateCustomItem(rational());
update_custom_item(Rational());
// Pick up index signal to query for custom aspect ratio if requested
connect(this,
static_cast<void (QComboBox::*)(int)>(
&QComboBox::currentIndexChanged),
this, &PixelAspectRatioComboBox::IndexChanged);
this, &PixelAspectRatioComboBox::index_changed);
}
rational GetPixelAspectRatio() const
Rational get_pixel_aspect_ratio() const
{
return this->currentData().value<rational>();
return this->currentData().value<Rational>();
}
void SetPixelAspectRatio(const rational &r)
void set_pixel_aspect_ratio(const Rational &r)
{
// Determine which index to select on startup
for (int i = 0; i < this->count(); i++) {
if (this->itemData(i).value<rational>() == r) {
if (this->itemData(i).value<Rational>() == r) {
this->setCurrentIndex(i);
return;
}
}
// Must not have found the ratio, so it must be custom
UpdateCustomItem(r);
update_custom_item(r);
dont_prompt_custom_par_ = true;
this->setCurrentIndex(this->count() - 1);
dont_prompt_custom_par_ = false;
}
private slots:
void IndexChanged(int index)
void index_changed(int index)
{
if (dont_prompt_custom_par_) {
return;
@@ -90,17 +90,17 @@ private slots:
// Query for custom pixel aspect ratio
bool ok;
double custom_ratio = GetFloatRatioFromUser(
double custom_ratio = get_float_ratio_from_user(
this, tr("Set Custom Pixel Aspect Ratio"), &ok);
if (ok) {
UpdateCustomItem(rational::fromDouble(custom_ratio));
update_custom_item(Rational::from_double(custom_ratio));
}
}
}
private:
void UpdateCustomItem(const rational &ratio)
void update_custom_item(const Rational &ratio)
{
const int custom_index = this->count() - 1;
@@ -108,10 +108,10 @@ private:
this->setItemText(custom_index, tr("Custom..."));
// Use 1:1 to prevent any real chance of the PAR being set to 0
this->setItemData(custom_index, QVariant::fromValue(rational(1)));
this->setItemData(custom_index, QVariant::fromValue(Rational(1)));
} else {
this->setItemText(custom_index,
VideoParams::FormatPixelAspectRatioString(
VideoParams::format_pixel_aspect_ratio_string(
tr("Custom (%1)"), ratio));
this->setItemData(custom_index, QVariant::fromValue(ratio));
}
@@ -122,4 +122,4 @@ private:
}
#endif // PIXELASPECTRATIOCOMBOBOX_H
#endif // OAK_PIXELASPECTRATIOCOMBOBOX_H
@@ -19,8 +19,8 @@
***/
#ifndef PIXELFORMATCOMBOBOX_H
#define PIXELFORMATCOMBOBOX_H
#ifndef OAK_PIXELFORMATCOMBOBOX_H
#define OAK_PIXELFORMATCOMBOBOX_H
#include <QComboBox>
@@ -36,22 +36,22 @@ public:
: QComboBox(parent)
{
// Set up preview formats
for (int i = 0; i < PixelFormat::COUNT; i++) {
for (int i = 0; i < PixelFormat::count; i++) {
PixelFormat pix_fmt = static_cast<PixelFormat::Format>(i);
if (!float_only || pix_fmt.is_float()) {
this->addItem(VideoParams::GetFormatName(pix_fmt),
this->addItem(VideoParams::get_format_name(pix_fmt),
static_cast<PixelFormat::Format>(pix_fmt));
}
}
}
PixelFormat GetPixelFormat() const
PixelFormat get_pixel_format() const
{
return static_cast<PixelFormat::Format>(this->currentData().toInt());
}
void SetPixelFormat(PixelFormat fmt)
void set_pixel_format(PixelFormat fmt)
{
for (int i = 0; i < this->count(); i++) {
if (this->itemData(i).toInt() == fmt) {
@@ -64,4 +64,4 @@ public:
}
#endif // PIXELFORMATCOMBOBOX_H
#endif // OAK_PIXELFORMATCOMBOBOX_H
@@ -19,8 +19,8 @@
***/
#ifndef SAMPLEFORMATCOMBOBOX_H
#define SAMPLEFORMATCOMBOBOX_H
#ifndef OAK_SAMPLEFORMATCOMBOBOX_H
#define OAK_SAMPLEFORMATCOMBOBOX_H
#include <olive/core/core.h>
#include <QComboBox>
@@ -41,54 +41,54 @@ public:
{
}
void SetAttemptToRestoreFormat(bool e)
void set_attempt_to_restore_format(bool e)
{
attempt_to_restore_format_ = e;
}
void SetAvailableFormats(const std::vector<SampleFormat> &formats)
void set_available_formats(const std::vector<SampleFormat> &formats)
{
SampleFormat tmp = SampleFormat::INVALID;
SampleFormat tmp = SampleFormat::invalid;
if (attempt_to_restore_format_) {
tmp = GetSampleFormat();
tmp = get_sample_format();
}
clear();
foreach (const SampleFormat &of, formats) {
AddFormatItem(of);
add_format_item(of);
}
if (attempt_to_restore_format_) {
SetSampleFormat(tmp);
set_sample_format(tmp);
}
}
void SetPackedFormats()
void set_packed_formats()
{
SampleFormat tmp = SampleFormat::INVALID;
SampleFormat tmp = SampleFormat::invalid;
if (attempt_to_restore_format_) {
tmp = GetSampleFormat();
tmp = get_sample_format();
}
clear();
for (int i = SampleFormat::PACKED_START; i < SampleFormat::PACKED_END;
for (int i = SampleFormat::packed_start; i < SampleFormat::packed_end;
i++) {
AddFormatItem(static_cast<SampleFormat::Format>(i));
add_format_item(static_cast<SampleFormat::Format>(i));
}
if (attempt_to_restore_format_) {
SetSampleFormat(tmp);
set_sample_format(tmp);
}
}
SampleFormat GetSampleFormat() const
SampleFormat get_sample_format() const
{
return static_cast<SampleFormat::Format>(this->currentData().toInt());
}
void SetSampleFormat(SampleFormat fmt)
void set_sample_format(SampleFormat fmt)
{
for (int i = 0; i < this->count(); i++) {
if (this->itemData(i).toInt() == fmt) {
@@ -99,9 +99,9 @@ public:
}
private:
void AddFormatItem(SampleFormat f)
void add_format_item(SampleFormat f)
{
this->addItem(HumanStrings::FormatToString(f),
this->addItem(HumanStrings::format_to_string(f),
static_cast<SampleFormat::Format>(f));
}
@@ -110,4 +110,4 @@ private:
}
#endif // SAMPLEFORMATCOMBOBOX_H
#endif // OAK_SAMPLEFORMATCOMBOBOX_H
@@ -19,8 +19,8 @@
***/
#ifndef SAMPLERATECOMBOBOX_H
#define SAMPLERATECOMBOBOX_H
#ifndef OAK_SAMPLERATECOMBOBOX_H
#define OAK_SAMPLERATECOMBOBOX_H
#include <olive/core/core.h>
#include <QComboBox>
@@ -38,17 +38,17 @@ public:
SampleRateComboBox(QWidget *parent = nullptr)
: QComboBox(parent)
{
foreach (int sr, AudioParams::kSupportedSampleRates) {
this->addItem(HumanStrings::SampleRateToString(sr), sr);
foreach (int sr, AudioParams::k_supported_sample_rates) {
this->addItem(HumanStrings::sample_rate_to_string(sr), sr);
}
}
int GetSampleRate() const
int get_sample_rate() const
{
return this->currentData().toInt();
}
void SetSampleRate(int rate)
void set_sample_rate(int rate)
{
for (int i = 0; i < this->count(); i++) {
if (this->itemData(i).toInt() == rate) {
@@ -61,4 +61,4 @@ public:
}
#endif // SAMPLERATECOMBOBOX_H
#endif // OAK_SAMPLERATECOMBOBOX_H
+3 -3
View File
@@ -18,8 +18,8 @@
***/
#ifndef STANDARDCOMBOS_H
#define STANDARDCOMBOS_H
#ifndef OAK_STANDARDCOMBOS_H
#define OAK_STANDARDCOMBOS_H
#include "channellayoutcombobox.h"
#include "frameratecombobox.h"
@@ -30,4 +30,4 @@
#include "sampleratecombobox.h"
#include "videodividercombobox.h"
#endif // STANDARDCOMBOS_H
#endif // OAK_STANDARDCOMBOS_H
@@ -19,8 +19,8 @@
***/
#ifndef VIDEODIVIDERCOMBOBOX_H
#define VIDEODIVIDERCOMBOBOX_H
#ifndef OAK_VIDEODIVIDERCOMBOBOX_H
#define OAK_VIDEODIVIDERCOMBOBOX_H
#include <QComboBox>
@@ -35,17 +35,17 @@ public:
VideoDividerComboBox(QWidget *parent = nullptr)
: QComboBox(parent)
{
foreach (int d, VideoParams::kSupportedDividers) {
this->addItem(VideoParams::GetNameForDivider(d), d);
foreach (int d, VideoParams::k_supported_dividers) {
this->addItem(VideoParams::get_name_for_divider(d), d);
}
}
int GetDivider() const
int get_divider() const
{
return this->currentData().toInt();
}
void SetDivider(int d)
void set_divider(int d)
{
for (int i = 0; i < this->count(); i++) {
if (this->itemData(i).toInt() == d) {
@@ -58,4 +58,4 @@ public:
}
#endif // VIDEODIVIDERCOMBOBOX_H
#endif // OAK_VIDEODIVIDERCOMBOBOX_H