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:
@@ -32,41 +32,41 @@ namespace olive
|
||||
|
||||
#define super Node
|
||||
|
||||
const QString Folder::kChildInput = QStringLiteral("child_in");
|
||||
const QString Folder::k_child_input = QStringLiteral("child_in");
|
||||
|
||||
Folder::Folder()
|
||||
{
|
||||
SetFlag(kIsItem);
|
||||
set_flag(k_is_item);
|
||||
|
||||
AddInput(kChildInput, NodeValue::kNone,
|
||||
InputFlags(kInputFlagArray | kInputFlagNotKeyframable));
|
||||
add_input(k_child_input, NodeValue::k_none,
|
||||
InputFlags(k_input_flag_array | k_input_flag_not_keyframable));
|
||||
}
|
||||
|
||||
QVariant Folder::data(const DataType &d) const
|
||||
{
|
||||
if (d == ICON) {
|
||||
return icon::Folder;
|
||||
if (d == icon) {
|
||||
return icon::folder;
|
||||
}
|
||||
|
||||
return super::data(d);
|
||||
}
|
||||
|
||||
void Folder::Retranslate()
|
||||
void Folder::retranslate()
|
||||
{
|
||||
super::Retranslate();
|
||||
super::retranslate();
|
||||
|
||||
SetInputName(kChildInput, tr("Children"));
|
||||
set_input_name(k_child_input, tr("Children"));
|
||||
}
|
||||
|
||||
Node *GetChildWithNameInternal(const Folder *n, const QString &s)
|
||||
Node *get_child_with_name_internal(const Folder *n, const QString &s)
|
||||
{
|
||||
for (int i = 0; i < n->item_child_count(); i++) {
|
||||
Node *child = n->item_child(i);
|
||||
|
||||
if (child->GetLabel() == s) {
|
||||
if (child->get_label() == s) {
|
||||
return child;
|
||||
} else if (Folder *subfolder = dynamic_cast<Folder *>(child)) {
|
||||
if (Node *n2 = GetChildWithNameInternal(subfolder, s)) {
|
||||
if (Node *n2 = get_child_with_name_internal(subfolder, s)) {
|
||||
return n2;
|
||||
}
|
||||
}
|
||||
@@ -75,18 +75,18 @@ Node *GetChildWithNameInternal(const Folder *n, const QString &s)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Node *Folder::GetChildWithName(const QString &s) const
|
||||
Node *Folder::get_child_with_name(const QString &s) const
|
||||
{
|
||||
return GetChildWithNameInternal(this, s);
|
||||
return get_child_with_name_internal(this, s);
|
||||
}
|
||||
|
||||
bool Folder::HasChildRecursive(Node *child) const
|
||||
bool Folder::has_child_recursive(Node *child) const
|
||||
{
|
||||
for (Node *i : item_children_) {
|
||||
if (i == child) {
|
||||
return true;
|
||||
} else if (Folder *f = dynamic_cast<Folder *>(i)) {
|
||||
if (f->HasChildRecursive(child)) {
|
||||
if (f->has_child_recursive(child)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -109,31 +109,31 @@ int Folder::index_of_child_in_array(Node *item) const
|
||||
void Folder::InputConnectedEvent(const QString &input, int element,
|
||||
Node *output)
|
||||
{
|
||||
if (input == kChildInput && element != -1) {
|
||||
if (input == k_child_input && element != -1) {
|
||||
Node *item = output;
|
||||
|
||||
// The insert index is always our "count" because we only support appending in our internal
|
||||
// model. For sorting/organizing, a QSortFilterProxyModel is used instead.
|
||||
emit BeginInsertItem(item, item_child_count());
|
||||
emit begin_insert_item(item, item_child_count());
|
||||
item_children_.append(item);
|
||||
item_element_index_.append(element);
|
||||
item->SetFolder(this);
|
||||
emit EndInsertItem();
|
||||
item->set_folder(this);
|
||||
emit end_insert_item();
|
||||
}
|
||||
}
|
||||
|
||||
void Folder::InputDisconnectedEvent(const QString &input, int element,
|
||||
Node *output)
|
||||
{
|
||||
if (input == kChildInput && element != -1) {
|
||||
if (input == k_child_input && element != -1) {
|
||||
Node *item = output;
|
||||
|
||||
int child_index = item_children_.indexOf(item);
|
||||
emit BeginRemoveItem(item, child_index);
|
||||
emit begin_remove_item(item, child_index);
|
||||
item_children_.removeAt(child_index);
|
||||
item_element_index_.removeAt(child_index);
|
||||
item->SetFolder(nullptr);
|
||||
emit EndRemoveItem();
|
||||
item->set_folder(nullptr);
|
||||
emit end_remove_item();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,25 +143,25 @@ FolderAddChild::FolderAddChild(Folder *folder, Node *child)
|
||||
{
|
||||
}
|
||||
|
||||
Project *FolderAddChild::GetRelevantProject() const
|
||||
Project *FolderAddChild::get_relevant_project() const
|
||||
{
|
||||
return folder_->project();
|
||||
}
|
||||
|
||||
void FolderAddChild::redo()
|
||||
{
|
||||
int array_index = folder_->InputArraySize(Folder::kChildInput);
|
||||
folder_->InputArrayAppend(Folder::kChildInput);
|
||||
Node::ConnectEdge(child_,
|
||||
NodeInput(folder_, Folder::kChildInput, array_index));
|
||||
int array_index = folder_->input_array_size(Folder::k_child_input);
|
||||
folder_->input_array_append(Folder::k_child_input);
|
||||
Node::connect_edge(child_,
|
||||
NodeInput(folder_, Folder::k_child_input, array_index));
|
||||
}
|
||||
|
||||
void FolderAddChild::undo()
|
||||
{
|
||||
Node::DisconnectEdge(
|
||||
child_, NodeInput(folder_, Folder::kChildInput,
|
||||
folder_->InputArraySize(Folder::kChildInput) - 1));
|
||||
folder_->InputArrayRemoveLast(Folder::kChildInput);
|
||||
Node::disconnect_edge(
|
||||
child_, NodeInput(folder_, Folder::k_child_input,
|
||||
folder_->input_array_size(Folder::k_child_input) - 1));
|
||||
folder_->input_array_remove_last(Folder::k_child_input);
|
||||
}
|
||||
|
||||
void Folder::RemoveElementCommand::redo()
|
||||
@@ -169,13 +169,13 @@ void Folder::RemoveElementCommand::redo()
|
||||
if (!subcommand_) {
|
||||
remove_index_ = folder_->index_of_child_in_array(child_);
|
||||
if (remove_index_ != -1) {
|
||||
NodeInput connected_input(folder_, Folder::kChildInput,
|
||||
NodeInput connected_input(folder_, Folder::k_child_input,
|
||||
remove_index_);
|
||||
subcommand_ = new MultiUndoCommand();
|
||||
subcommand_->add_child(new NodeEdgeRemoveCommand(
|
||||
folder_->GetConnectedOutput(connected_input), connected_input));
|
||||
folder_->get_connected_output(connected_input), connected_input));
|
||||
subcommand_->add_child(new NodeArrayRemoveCommand(
|
||||
folder_, Folder::kChildInput, remove_index_));
|
||||
folder_, Folder::k_child_input, remove_index_));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef FOLDER_H
|
||||
#define FOLDER_H
|
||||
#ifndef OAK_FOLDER_H
|
||||
#define OAK_FOLDER_H
|
||||
|
||||
#include "node/node.h"
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
|
||||
NODE_DEFAULT_FUNCTIONS(Folder)
|
||||
|
||||
virtual QString Name() const override
|
||||
virtual QString name() const override
|
||||
{
|
||||
return tr("Folder");
|
||||
}
|
||||
@@ -50,27 +50,27 @@ public:
|
||||
return QStringLiteral("org.olivevideoeditor.Olive.folder");
|
||||
}
|
||||
|
||||
virtual QVector<CategoryID> Category() const override
|
||||
virtual QVector<CategoryID> category() const override
|
||||
{
|
||||
return { kCategoryProject };
|
||||
return { k_category_project };
|
||||
}
|
||||
|
||||
virtual QString Description() const override
|
||||
virtual QString description() const override
|
||||
{
|
||||
return tr("Organize several items into a single collection.");
|
||||
}
|
||||
|
||||
virtual QVariant data(const DataType &d) const override;
|
||||
|
||||
virtual void Retranslate() override;
|
||||
virtual void retranslate() override;
|
||||
|
||||
Node *GetChildWithName(const QString &s) const;
|
||||
bool ChildExistsWithName(const QString &s) const
|
||||
Node *get_child_with_name(const QString &s) const;
|
||||
bool child_exists_with_name(const QString &s) const
|
||||
{
|
||||
return GetChildWithName(s);
|
||||
return get_child_with_name(s);
|
||||
}
|
||||
|
||||
bool HasChildRecursive(Node *child) const;
|
||||
bool has_child_recursive(Node *child) const;
|
||||
|
||||
int item_child_count() const
|
||||
{
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
|
||||
int index_of_child_in_array(Node *item) const;
|
||||
|
||||
template <typename T> QVector<T *> ListChildrenOfType() const
|
||||
template <typename T> QVector<T *> list_children_of_type() const
|
||||
{
|
||||
QVector<T *> list;
|
||||
|
||||
@@ -106,14 +106,14 @@ public:
|
||||
|
||||
Folder *folder_test = dynamic_cast<Folder *>(node);
|
||||
if (folder_test) {
|
||||
list.append(folder_test->ListChildrenOfType<T>());
|
||||
list.append(folder_test->list_children_of_type<T>());
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
static const QString kChildInput;
|
||||
static const QString k_child_input;
|
||||
|
||||
class RemoveElementCommand : public UndoCommand {
|
||||
public:
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
delete subcommand_;
|
||||
}
|
||||
|
||||
virtual Project *GetRelevantProject() const override
|
||||
virtual Project *get_relevant_project() const override
|
||||
{
|
||||
return folder_->project();
|
||||
}
|
||||
@@ -155,13 +155,13 @@ public:
|
||||
};
|
||||
|
||||
signals:
|
||||
void BeginInsertItem(Node *n, int index);
|
||||
void begin_insert_item(Node *n, int index);
|
||||
|
||||
void EndInsertItem();
|
||||
void end_insert_item();
|
||||
|
||||
void BeginRemoveItem(Node *n, int index);
|
||||
void begin_remove_item(Node *n, int index);
|
||||
|
||||
void EndRemoveItem();
|
||||
void end_remove_item();
|
||||
|
||||
protected:
|
||||
virtual void InputConnectedEvent(const QString &input, int element,
|
||||
@@ -172,7 +172,7 @@ protected:
|
||||
|
||||
private:
|
||||
template <typename T>
|
||||
static void ListOutputsOfTypeInternal(const Folder *n, QVector<T *> &list,
|
||||
static void list_outputs_of_type_internal(const Folder *n, QVector<T *> &list,
|
||||
bool recursive)
|
||||
{
|
||||
foreach (const Node::OutputConnection &c, n->output_connections()) {
|
||||
@@ -205,7 +205,7 @@ class FolderAddChild : public UndoCommand {
|
||||
public:
|
||||
FolderAddChild(Folder *folder, Node *child);
|
||||
|
||||
virtual Project *GetRelevantProject() const override;
|
||||
virtual Project *get_relevant_project() const override;
|
||||
|
||||
protected:
|
||||
virtual void redo() override;
|
||||
@@ -220,4 +220,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif // FOLDER_H
|
||||
#endif // OAK_FOLDER_H
|
||||
|
||||
Reference in New Issue
Block a user