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
+23 -23
View File
@@ -4,35 +4,35 @@
TEST(UIHumanStrings, SampleRateToStringAppendsHz)
{
EXPECT_EQ(olive::HumanStrings::SampleRateToString(44100),
EXPECT_EQ(olive::HumanStrings::sample_rate_to_string(44100),
QStringLiteral("44100 Hz"));
EXPECT_EQ(olive::HumanStrings::SampleRateToString(48000),
EXPECT_EQ(olive::HumanStrings::sample_rate_to_string(48000),
QStringLiteral("48000 Hz"));
EXPECT_EQ(olive::HumanStrings::SampleRateToString(0), QStringLiteral("0 Hz"));
EXPECT_EQ(olive::HumanStrings::sample_rate_to_string(0), QStringLiteral("0 Hz"));
}
TEST(UIHumanStrings, KnownChannelLayoutsHaveNames)
{
EXPECT_EQ(olive::HumanStrings::ChannelLayoutToString(
olive::kChannelLayoutMono),
EXPECT_EQ(olive::HumanStrings::channel_layout_to_string(
olive::k_channel_layout_mono),
QStringLiteral("Mono"));
EXPECT_EQ(olive::HumanStrings::ChannelLayoutToString(
olive::kChannelLayoutStereo),
EXPECT_EQ(olive::HumanStrings::channel_layout_to_string(
olive::k_channel_layout_stereo),
QStringLiteral("Stereo"));
EXPECT_EQ(olive::HumanStrings::ChannelLayoutToString(
olive::kChannelLayout2_1),
EXPECT_EQ(olive::HumanStrings::channel_layout_to_string(
olive::k_channel_layout2_1),
QStringLiteral("2.1"));
EXPECT_EQ(olive::HumanStrings::ChannelLayoutToString(
olive::kChannelLayout5Point1),
EXPECT_EQ(olive::HumanStrings::channel_layout_to_string(
olive::k_channel_layout5_point1),
QStringLiteral("5.1"));
EXPECT_EQ(olive::HumanStrings::ChannelLayoutToString(
olive::kChannelLayout7Point1),
EXPECT_EQ(olive::HumanStrings::channel_layout_to_string(
olive::k_channel_layout7_point1),
QStringLiteral("7.1"));
}
TEST(UIHumanStrings, UnknownChannelLayoutFallsBackToHex)
{
const QString s = olive::HumanStrings::ChannelLayoutToString(0x1234);
const QString s = olive::HumanStrings::channel_layout_to_string(0x1234);
EXPECT_TRUE(s.startsWith(QStringLiteral("Unknown (0x")));
EXPECT_TRUE(s.contains(QStringLiteral("1234")));
@@ -43,11 +43,11 @@ TEST(UIHumanStrings, AllSampleFormatsHaveNonEmptyNames)
using olive::core::SampleFormat;
for (SampleFormat fmt :
{ SampleFormat::U8, SampleFormat::S16, SampleFormat::S32,
SampleFormat::S64, SampleFormat::F32, SampleFormat::F64,
SampleFormat::U8P, SampleFormat::S16P, SampleFormat::S32P,
SampleFormat::S64P, SampleFormat::F32P, SampleFormat::F64P }) {
const QString s = olive::HumanStrings::FormatToString(fmt);
{ SampleFormat::u8, SampleFormat::s16, SampleFormat::s32,
SampleFormat::s64, SampleFormat::f32, SampleFormat::f64,
SampleFormat::u8_p, SampleFormat::s16_p, SampleFormat::s32_p,
SampleFormat::s64_p, SampleFormat::f32_p, SampleFormat::f64_p }) {
const QString s = olive::HumanStrings::format_to_string(fmt);
EXPECT_FALSE(s.isEmpty());
EXPECT_FALSE(s.startsWith(QStringLiteral("Unknown")));
}
@@ -57,16 +57,16 @@ TEST(UIHumanStrings, PackedAndPlanarFormatsAreDistinguished)
{
using olive::core::SampleFormat;
EXPECT_TRUE(olive::HumanStrings::FormatToString(SampleFormat::F32)
EXPECT_TRUE(olive::HumanStrings::format_to_string(SampleFormat::f32)
.contains(QStringLiteral("Packed")));
EXPECT_TRUE(olive::HumanStrings::FormatToString(SampleFormat::F32P)
EXPECT_TRUE(olive::HumanStrings::format_to_string(SampleFormat::f32_p)
.contains(QStringLiteral("Planar")));
}
TEST(UIHumanStrings, InvalidSampleFormatFallsBackToHex)
{
const QString s = olive::HumanStrings::FormatToString(
olive::core::SampleFormat::INVALID);
const QString s = olive::HumanStrings::format_to_string(
olive::core::SampleFormat::invalid);
EXPECT_TRUE(s.startsWith(QStringLiteral("Unknown (0x")));
}