Skip to content

Commit

Permalink
Removing field name from the field's properties, using the protocol d…
Browse files Browse the repository at this point in the history
…efinition to get the field name.
  • Loading branch information
arobenko committed Oct 14, 2024
1 parent 92dde11 commit ee87ee5
Show file tree
Hide file tree
Showing 56 changed files with 205 additions and 151 deletions.
6 changes: 6 additions & 0 deletions app/cc_view/src/widget/field/ArrayListFieldWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ ArrayListFieldWidget::ArrayListFieldWidget(

ArrayListFieldWidget::~ArrayListFieldWidget() noexcept = default;

ToolsField& ArrayListFieldWidget::fieldImpl()
{
assert(m_wrapper);
return *m_wrapper;
}

void ArrayListFieldWidget::refreshImpl()
{
while (!m_elements.empty()) {
Expand Down
1 change: 1 addition & 0 deletions app/cc_view/src/widget/field/ArrayListFieldWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class ArrayListFieldWidget : public FieldWidget
}

protected:
virtual ToolsField& fieldImpl() override;
virtual void refreshImpl() override;
virtual void editEnabledUpdatedImpl() override;
virtual void updatePropertiesImpl(const QVariantMap& props) override;
Expand Down
6 changes: 6 additions & 0 deletions app/cc_view/src/widget/field/ArrayListRawDataFieldWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ ArrayListRawDataFieldWidget::ArrayListRawDataFieldWidget(

ArrayListRawDataFieldWidget::~ArrayListRawDataFieldWidget() noexcept = default;

ToolsField& ArrayListRawDataFieldWidget::fieldImpl()
{
assert(m_wrapper);
return *m_wrapper;
}

void ArrayListRawDataFieldWidget::refreshImpl()
{
assert(m_wrapper->canWrite());
Expand Down
1 change: 1 addition & 0 deletions app/cc_view/src/widget/field/ArrayListRawDataFieldWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class ArrayListRawDataFieldWidget : public FieldWidget
~ArrayListRawDataFieldWidget() noexcept;

protected:
virtual ToolsField& fieldImpl() override;
virtual void refreshImpl() override;
virtual void editEnabledUpdatedImpl() override;

Expand Down
6 changes: 6 additions & 0 deletions app/cc_view/src/widget/field/BitfieldFieldWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ void BitfieldFieldWidget::addMemberField(FieldWidget* memberFieldWidget)
this, SLOT(memberFieldUpdated()));
}

ToolsField& BitfieldFieldWidget::fieldImpl()
{
assert(m_wrapper);
return *m_wrapper;
}

void BitfieldFieldWidget::refreshImpl()
{
refreshInternal();
Expand Down
1 change: 1 addition & 0 deletions app/cc_view/src/widget/field/BitfieldFieldWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class BitfieldFieldWidget : public FieldWidget
void addMemberField(FieldWidget* memberFieldWidget);

protected:
virtual ToolsField& fieldImpl() override;
virtual void refreshImpl() override;
virtual void editEnabledUpdatedImpl() override;
virtual void updatePropertiesImpl(const QVariantMap& props) override;
Expand Down
6 changes: 6 additions & 0 deletions app/cc_view/src/widget/field/BitmaskValueFieldWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ BitmaskValueFieldWidget::BitmaskValueFieldWidget(

BitmaskValueFieldWidget::~BitmaskValueFieldWidget() noexcept = default;

ToolsField& BitmaskValueFieldWidget::fieldImpl()
{
assert(m_wrapper);
return *m_wrapper;
}

void BitmaskValueFieldWidget::refreshImpl()
{
assert(m_wrapper->canWrite());
Expand Down
1 change: 1 addition & 0 deletions app/cc_view/src/widget/field/BitmaskValueFieldWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class BitmaskValueFieldWidget : public FieldWidget
~BitmaskValueFieldWidget() noexcept;

protected:
virtual ToolsField& fieldImpl() override;
virtual void refreshImpl() override;
virtual void editEnabledUpdatedImpl() override;
virtual void updatePropertiesImpl(const QVariantMap& props) override;
Expand Down
6 changes: 6 additions & 0 deletions app/cc_view/src/widget/field/BundleFieldWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ void BundleFieldWidget::addMemberField(FieldWidget* memberFieldWidget)
this, SLOT(memberFieldUpdated()));
}

ToolsField& BundleFieldWidget::fieldImpl()
{
assert(m_wrapper);
return *m_wrapper;
}

void BundleFieldWidget::refreshImpl()
{
for (auto* memberFieldWidget : m_members) {
Expand Down
1 change: 1 addition & 0 deletions app/cc_view/src/widget/field/BundleFieldWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class BundleFieldWidget : public FieldWidget
void addMemberField(FieldWidget* memberFieldWidget);

protected:
virtual ToolsField& fieldImpl() override;
virtual void refreshImpl() override;
virtual void editEnabledUpdatedImpl() override;
virtual void updatePropertiesImpl(const QVariantMap& props) override;
Expand Down
6 changes: 6 additions & 0 deletions app/cc_view/src/widget/field/EnumValueFieldWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ EnumValueFieldWidget::EnumValueFieldWidget(

EnumValueFieldWidget::~EnumValueFieldWidget() noexcept = default;

ToolsField& EnumValueFieldWidget::fieldImpl()
{
assert(m_wrapper);
return *m_wrapper;
}

void EnumValueFieldWidget::refreshImpl()
{
assert(m_wrapper->canWrite());
Expand Down
1 change: 1 addition & 0 deletions app/cc_view/src/widget/field/EnumValueFieldWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class EnumValueFieldWidget : public FieldWidget
~EnumValueFieldWidget() noexcept;

protected:
virtual ToolsField& fieldImpl() override;
virtual void refreshImpl() override;
virtual void editEnabledUpdatedImpl() override;
virtual void updatePropertiesImpl(const QVariantMap& props) override;
Expand Down
7 changes: 4 additions & 3 deletions app/cc_view/src/widget/field/FieldWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void FieldWidget::updateProperties(const QVariantMap& props)
{
property::field::Common commonProps(props);
m_hiddenWhenReadOnly = commonProps.isHiddenWhenReadOnly();
performNameLabelUpdate(commonProps);
performNameLabelUpdate();
updatePropertiesImpl(props);
performUiElementsVisibilityCheck(commonProps);
performUiReadOnlyCheck(commonProps);
Expand Down Expand Up @@ -203,13 +203,14 @@ void FieldWidget::performUiReadOnlyCheck(const property::field::Common& props)
}
}

void FieldWidget::performNameLabelUpdate(const property::field::Common& props)
void FieldWidget::performNameLabelUpdate()
{
if (m_nameLabel == nullptr) {
return;
}

auto str = props.name();
auto& f = fieldImpl();
QString str = f.name();
if (str.isEmpty()) {
m_nameLabel->hide();
return;
Expand Down
3 changes: 2 additions & 1 deletion app/cc_view/src/widget/field/FieldWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,15 @@ public slots:
m_serValueWidget = widget;
}

virtual ToolsField& fieldImpl() = 0;
virtual void refreshImpl() = 0;
virtual void editEnabledUpdatedImpl();
virtual void updatePropertiesImpl(const QVariantMap& props);

private:
void performUiElementsVisibilityCheck(const property::field::Common& props);
void performUiReadOnlyCheck(const property::field::Common& props);
void performNameLabelUpdate(const property::field::Common& props);
void performNameLabelUpdate();

bool m_forcedReadOnly = false;
bool m_editEnabled = true;
Expand Down
6 changes: 6 additions & 0 deletions app/cc_view/src/widget/field/FloatValueFieldWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ FloatValueFieldWidget::FloatValueFieldWidget(

FloatValueFieldWidget::~FloatValueFieldWidget() noexcept = default;

ToolsField& FloatValueFieldWidget::fieldImpl()
{
assert(m_wrapper);
return *m_wrapper;
}

void FloatValueFieldWidget::refreshImpl()
{
assert(m_wrapper->canWrite());
Expand Down
1 change: 1 addition & 0 deletions app/cc_view/src/widget/field/FloatValueFieldWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class FloatValueFieldWidget : public FieldWidget
~FloatValueFieldWidget() noexcept;

protected:
virtual ToolsField& fieldImpl() override;
virtual void refreshImpl() override;
virtual void editEnabledUpdatedImpl() override;
virtual void updatePropertiesImpl(const QVariantMap& props) override;
Expand Down
6 changes: 6 additions & 0 deletions app/cc_view/src/widget/field/IntValueFieldWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ IntValueFieldWidget::~IntValueFieldWidget() noexcept
m_childWidget.release();
}

ToolsField& IntValueFieldWidget::fieldImpl()
{
assert(m_wrapper);
return *m_wrapper;
}

void IntValueFieldWidget::refreshImpl()
{
assert((!m_wrapper) || (m_wrapper->canWrite()));
Expand Down
1 change: 1 addition & 0 deletions app/cc_view/src/widget/field/IntValueFieldWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class IntValueFieldWidget : public FieldWidget
~IntValueFieldWidget() noexcept;

protected:
virtual ToolsField& fieldImpl() override;
virtual void refreshImpl() override;
virtual void editEnabledUpdatedImpl() override;
virtual void updatePropertiesImpl(const QVariantMap& props) override;
Expand Down
6 changes: 6 additions & 0 deletions app/cc_view/src/widget/field/LongIntValueFieldWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ LongIntValueFieldWidget::LongIntValueFieldWidget(

LongIntValueFieldWidget::~LongIntValueFieldWidget() noexcept = default;

ToolsField& LongIntValueFieldWidget::fieldImpl()
{
assert(m_wrapper);
return *m_wrapper;
}

void LongIntValueFieldWidget::refreshImpl()
{
assert(m_wrapper->canWrite());
Expand Down
1 change: 1 addition & 0 deletions app/cc_view/src/widget/field/LongIntValueFieldWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class LongIntValueFieldWidget : public FieldWidget
~LongIntValueFieldWidget() noexcept;

protected:
virtual ToolsField& fieldImpl() override;
virtual void refreshImpl() override;
virtual void editEnabledUpdatedImpl() override;
virtual void updatePropertiesImpl(const QVariantMap& props) override;
Expand Down
6 changes: 6 additions & 0 deletions app/cc_view/src/widget/field/LongLongIntValueFieldWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ LongLongIntValueFieldWidget::LongLongIntValueFieldWidget(

LongLongIntValueFieldWidget::~LongLongIntValueFieldWidget() noexcept = default;

ToolsField& LongLongIntValueFieldWidget::fieldImpl()
{
assert(m_wrapper);
return *m_wrapper;
}

void LongLongIntValueFieldWidget::refreshImpl()
{
assert(m_wrapper->canWrite());
Expand Down
1 change: 1 addition & 0 deletions app/cc_view/src/widget/field/LongLongIntValueFieldWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class LongLongIntValueFieldWidget : public FieldWidget
~LongLongIntValueFieldWidget() noexcept;

protected:
virtual ToolsField& fieldImpl() override;
virtual void refreshImpl() override;
virtual void editEnabledUpdatedImpl() override;
virtual void updatePropertiesImpl(const QVariantMap& props) override;
Expand Down
6 changes: 6 additions & 0 deletions app/cc_view/src/widget/field/OptionalFieldWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ void OptionalFieldWidget::setField(FieldWidget* fieldWidget)
this, SLOT(fieldUpdated()));
}

ToolsField& OptionalFieldWidget::fieldImpl()
{
assert(m_wrapper);
return *m_wrapper;
}

void OptionalFieldWidget::refreshImpl()
{
refreshInternal();
Expand Down
1 change: 1 addition & 0 deletions app/cc_view/src/widget/field/OptionalFieldWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class OptionalFieldWidget : public FieldWidget
void setField(FieldWidget* fieldWidget);

protected:
virtual ToolsField& fieldImpl() override;
virtual void refreshImpl() override;
virtual void editEnabledUpdatedImpl() override;
virtual void updatePropertiesImpl(const QVariantMap& props) override;
Expand Down
6 changes: 6 additions & 0 deletions app/cc_view/src/widget/field/ScaledIntValueFieldWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ ScaledIntValueFieldWidget::ScaledIntValueFieldWidget(

ScaledIntValueFieldWidget::~ScaledIntValueFieldWidget() noexcept = default;

ToolsField& ScaledIntValueFieldWidget::fieldImpl()
{
assert(m_wrapper);
return *m_wrapper;
}

void ScaledIntValueFieldWidget::refreshImpl()
{
assert(m_wrapper->canWrite());
Expand Down
1 change: 1 addition & 0 deletions app/cc_view/src/widget/field/ScaledIntValueFieldWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class ScaledIntValueFieldWidget : public FieldWidget
~ScaledIntValueFieldWidget() noexcept;

protected:
virtual ToolsField& fieldImpl() override;
virtual void refreshImpl() override;
virtual void editEnabledUpdatedImpl() override;
virtual void updatePropertiesImpl(const QVariantMap& props) override;
Expand Down
6 changes: 6 additions & 0 deletions app/cc_view/src/widget/field/ShortIntValueFieldWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ ShortIntValueFieldWidget::ShortIntValueFieldWidget(

ShortIntValueFieldWidget::~ShortIntValueFieldWidget() noexcept = default;

ToolsField& ShortIntValueFieldWidget::fieldImpl()
{
assert(m_wrapper);
return *m_wrapper;
}

void ShortIntValueFieldWidget::refreshImpl()
{
assert(m_wrapper->canWrite());
Expand Down
1 change: 1 addition & 0 deletions app/cc_view/src/widget/field/ShortIntValueFieldWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class ShortIntValueFieldWidget : public FieldWidget
~ShortIntValueFieldWidget() noexcept;

protected:
virtual ToolsField& fieldImpl() override;
virtual void refreshImpl() override;
virtual void editEnabledUpdatedImpl() override;
virtual void updatePropertiesImpl(const QVariantMap& props) override;
Expand Down
6 changes: 6 additions & 0 deletions app/cc_view/src/widget/field/StringFieldWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ StringFieldWidget::StringFieldWidget(

StringFieldWidget::~StringFieldWidget() noexcept = default;

ToolsField& StringFieldWidget::fieldImpl()
{
assert(m_wrapper);
return *m_wrapper;
}

void StringFieldWidget::refreshImpl()
{
assert(m_ui.m_serValuePlainTextEdit != nullptr);
Expand Down
1 change: 1 addition & 0 deletions app/cc_view/src/widget/field/StringFieldWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class StringFieldWidget : public FieldWidget
~StringFieldWidget() noexcept;

protected:
virtual ToolsField& fieldImpl() override;
virtual void refreshImpl() override;
virtual void editEnabledUpdatedImpl() override;

Expand Down
6 changes: 6 additions & 0 deletions app/cc_view/src/widget/field/UnknownValueFieldWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ UnknownValueFieldWidget::UnknownValueFieldWidget(

UnknownValueFieldWidget::~UnknownValueFieldWidget() noexcept = default;

ToolsField& UnknownValueFieldWidget::fieldImpl()
{
assert(m_wrapper);
return *m_wrapper;
}

void UnknownValueFieldWidget::refreshImpl()
{
assert(m_wrapper->canWrite());
Expand Down
1 change: 1 addition & 0 deletions app/cc_view/src/widget/field/UnknownValueFieldWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class UnknownValueFieldWidget : public FieldWidget
~UnknownValueFieldWidget() noexcept;

protected:
virtual ToolsField& fieldImpl() override;
virtual void refreshImpl() override;
virtual void editEnabledUpdatedImpl() override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ UnsignedLongLongIntValueFieldWidget::UnsignedLongLongIntValueFieldWidget(

UnsignedLongLongIntValueFieldWidget::~UnsignedLongLongIntValueFieldWidget() noexcept = default;

ToolsField& UnsignedLongLongIntValueFieldWidget::fieldImpl()
{
assert(m_wrapper);
return *m_wrapper;
}

void UnsignedLongLongIntValueFieldWidget::refreshImpl()
{
assert(m_wrapper->canWrite());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class UnsignedLongLongIntValueFieldWidget : public FieldWidget
~UnsignedLongLongIntValueFieldWidget() noexcept;

protected:
virtual ToolsField& fieldImpl() override;
virtual void refreshImpl() override;
virtual void editEnabledUpdatedImpl() override;
virtual void updatePropertiesImpl(const QVariantMap& props) override;
Expand Down
Loading

0 comments on commit ee87ee5

Please sign in to comment.