change: change code style to Linux style except indent.

This commit is contained in:
Mike Solar
2025-08-03 03:09:40 +08:00
parent 65ab76edc8
commit 74f73ab3be
789 changed files with 77113 additions and 68888 deletions
+49 -43
View File
@@ -4,82 +4,88 @@
#include "node/traverser.h"
namespace olive {
namespace olive
{
#define super QTreeWidget
NodeValueTree::NodeValueTree(QWidget *parent) :
super(parent)
NodeValueTree::NodeValueTree(QWidget *parent)
: super(parent)
{
setColumnWidth(0, 0);
setColumnCount(4);
setColumnWidth(0, 0);
setColumnCount(4);
QSizePolicy p = sizePolicy();
p.setHorizontalStretch(1);
setSizePolicy(p);
QSizePolicy p = sizePolicy();
p.setHorizontalStretch(1);
setSizePolicy(p);
static const int kMinimumRows = 10;
setMinimumHeight(fontMetrics().height() * kMinimumRows);
static const int kMinimumRows = 10;
setMinimumHeight(fontMetrics().height() * kMinimumRows);
Retranslate();
Retranslate();
}
void NodeValueTree::SetNode(const NodeInput &input, const rational &time)
{
clear();
clear();
NodeTraverser traverser;
NodeTraverser traverser;
Node *connected_node = input.GetConnectedOutput();
Node *connected_node = input.GetConnectedOutput();
NodeValueTable table = traverser.GenerateTable(connected_node, TimeRange(time, time));
NodeValueTable table =
traverser.GenerateTable(connected_node, TimeRange(time, time));
int index = traverser.GenerateRowValueElementIndex(input.node(), input.input(), input.element(), &table);
int index = traverser.GenerateRowValueElementIndex(
input.node(), input.input(), input.element(), &table);
for (int i=0; i<table.Count(); i++) {
const NodeValue &value = table.at(i);
QTreeWidgetItem *item = new QTreeWidgetItem(this);
for (int i = 0; i < table.Count(); i++) {
const NodeValue &value = table.at(i);
QTreeWidgetItem *item = new QTreeWidgetItem(this);
Node::ValueHint hint({value.type()}, table.Count()-1-i, value.tag());
Node::ValueHint hint({ value.type() }, table.Count() - 1 - i,
value.tag());
QRadioButton *radio = new QRadioButton(this);
radio->setProperty("input", QVariant::fromValue(input));
radio->setProperty("hint", QVariant::fromValue(hint));
if (i == index) {
radio->setChecked(true);
}
connect(radio, &QRadioButton::clicked, this, &NodeValueTree::RadioButtonChecked);
QRadioButton *radio = new QRadioButton(this);
radio->setProperty("input", QVariant::fromValue(input));
radio->setProperty("hint", QVariant::fromValue(hint));
if (i == index) {
radio->setChecked(true);
}
connect(radio, &QRadioButton::clicked, this,
&NodeValueTree::RadioButtonChecked);
setItemWidget(item, 0, radio);
item->setText(1, NodeValue::GetPrettyDataTypeName(value.type()));
item->setText(2, NodeValue::ValueToString(value, false));
item->setText(3, value.source()->GetLabelAndName());
}
setItemWidget(item, 0, radio);
item->setText(1, NodeValue::GetPrettyDataTypeName(value.type()));
item->setText(2, NodeValue::ValueToString(value, false));
item->setText(3, value.source()->GetLabelAndName());
}
}
void NodeValueTree::changeEvent(QEvent *event)
{
if (event->type() == QEvent::LanguageChange) {
Retranslate();
}
if (event->type() == QEvent::LanguageChange) {
Retranslate();
}
super::changeEvent(event);
super::changeEvent(event);
}
void NodeValueTree::Retranslate()
{
setHeaderLabels({QString(), tr("Type"), tr("Value"), tr("Source")});
setHeaderLabels({ QString(), tr("Type"), tr("Value"), tr("Source") });
}
void NodeValueTree::RadioButtonChecked(bool e)
{
if (e) {
QRadioButton *btn = static_cast<QRadioButton*>(sender());
Node::ValueHint hint = btn->property("hint").value<Node::ValueHint>();
NodeInput input = btn->property("input").value<NodeInput>();
if (e) {
QRadioButton *btn = static_cast<QRadioButton *>(sender());
Node::ValueHint hint = btn->property("hint").value<Node::ValueHint>();
NodeInput input = btn->property("input").value<NodeInput>();
input.node()->SetValueHintForInput(input.input(), hint, input.element());
}
input.node()->SetValueHintForInput(input.input(), hint,
input.element());
}
}
}