Added "Repeat style" property for barlines sections

This commit is contained in:
pereverzev_v 2020-05-06 14:04:14 +02:00
parent e1f5157f81
commit 7aa8f92a17
9 changed files with 93 additions and 3 deletions

Binary file not shown.

View file

@ -15,6 +15,7 @@ void BarlineSettingsModel::createProperties()
m_isSpanToNextStaff = buildPropertyItem(Ms::Pid::BARLINE_SPAN);
m_spanFrom = buildPropertyItem(Ms::Pid::BARLINE_SPAN_FROM);
m_spanTo = buildPropertyItem(Ms::Pid::BARLINE_SPAN_TO);
m_hasToShowTips = buildPropertyItem(Ms::Pid::BARLINE_SHOW_TIPS);
}
void BarlineSettingsModel::requestElements()
@ -39,13 +40,17 @@ void BarlineSettingsModel::loadProperties()
loadPropertyItem(m_spanTo, [] (const QVariant& elementPropertyValue) -> QVariant {
return elementPropertyValue.toInt();
});
loadPropertyItem(m_hasToShowTips);
}
void BarlineSettingsModel::resetProperties()
{
m_type->resetToDefault();
m_isSpanToNextStaff->resetToDefault();
m_spanFrom->resetToDefault();
m_spanTo->resetToDefault();
m_hasToShowTips->resetToDefault();
}
void BarlineSettingsModel::applyToAllStaffs()
@ -107,3 +112,8 @@ PropertyItem* BarlineSettingsModel::spanTo() const
{
return m_spanTo;
}
PropertyItem* BarlineSettingsModel::hasToShowTips() const
{
return m_hasToShowTips;
}

View file

@ -11,6 +11,7 @@ class BarlineSettingsModel : public AbstractInspectorModel
Q_PROPERTY(PropertyItem* isSpanToNextStaff READ isSpanToNextStaff CONSTANT)
Q_PROPERTY(PropertyItem* spanFrom READ spanFrom CONSTANT)
Q_PROPERTY(PropertyItem* spanTo READ spanTo CONSTANT)
Q_PROPERTY(PropertyItem* hasToShowTips READ hasToShowTips CONSTANT)
public:
explicit BarlineSettingsModel(QObject* parent, IElementRepositoryService* repository);
@ -27,12 +28,14 @@ public:
PropertyItem* isSpanToNextStaff() const;
PropertyItem* spanFrom() const;
PropertyItem* spanTo() const;
PropertyItem* hasToShowTips() const;
private:
PropertyItem* m_type = nullptr;
PropertyItem* m_isSpanToNextStaff = nullptr;
PropertyItem* m_spanFrom = nullptr;
PropertyItem* m_spanTo = nullptr;
PropertyItem* m_hasToShowTips = nullptr;
};
#endif // BARLINESETTINGSMODEL_H

View file

@ -123,8 +123,12 @@ public:
LINE_WITH_HOOK = 0xEF85,
LINE_WITH_ANGLED_HOOK = 0xEF86,
LINE_PEDAL_STAR_ENDING = 0xEF87,
AUTO = 0xEF88,
NONE = 0xEF89
BARLINE_WINGED = 0xF34C,
BARLINE_UNWINGED = 0xF34D,
AUTO,
NONE,
CUSTOM
};
};

View file

@ -54,6 +54,44 @@ StyledPopup {
}
}
Column {
spacing: 8
width: parent.width
StyledTextLabel {
text: qsTr("Repeat style")
}
RadioButtonGroup {
id: repeatStyle
height: 30
width: parent.width
model: [
{ iconRole: IconNameTypes.BARLINE_UNWINGED, valueRole: false },
{ iconRole: IconNameTypes.BARLINE_WINGED, valueRole: true }
]
delegate: FlatRadioButton {
ButtonGroup.group: repeatStyle.radioButtonGroup
checked: barlineSettingsModel && !barlineSettingsModel.isUndefined ? barlineSettingsModel.hasToShowTips.value === modelData["valueRole"]
: false
onToggled: {
barlineSettingsModel.hasToShowTips.value = modelData["valueRole"]
}
StyledIconLabel {
iconCode: modelData["iconRole"]
}
}
}
}
CheckBox {
id: spanToNextStaffCheckBox

View file

@ -900,6 +900,30 @@ Element* BarLine::drop(EditData& data)
return 0;
}
//---------------------------------------------------------
// setShowTips
//---------------------------------------------------------
void BarLine::setShowTips(bool val)
{
if (!score())
return;
score()->undoChangeStyleVal(Sid::repeatBarTips, val);
}
//---------------------------------------------------------
// showTips
//---------------------------------------------------------
bool BarLine::showTips() const
{
if (!score())
return false;
return score()->styleB(Sid::repeatBarTips);
}
//---------------------------------------------------------
// gripsPositions
//---------------------------------------------------------
@ -1536,6 +1560,8 @@ QVariant BarLine::getProperty(Pid id) const
return int(spanFrom());
case Pid::BARLINE_SPAN_TO:
return int(spanTo());
case Pid::BARLINE_SHOW_TIPS:
return showTips();
default:
break;
}
@ -1561,6 +1587,9 @@ bool BarLine::setProperty(Pid id, const QVariant& v)
case Pid::BARLINE_SPAN_TO:
setSpanTo(v.toInt());
break;
case Pid::BARLINE_SHOW_TIPS:
setShowTips(v.toBool());
break;
default:
return Element::setProperty(id, v);
}
@ -1616,6 +1645,8 @@ QVariant BarLine::propertyDefault(Pid propertyId) const
case Pid::BARLINE_SPAN_TO:
return staff() ? staff()->barLineTo() : 0;
case Pid::BARLINE_SHOW_TIPS:
return false;
default:
break;
}

View file

@ -101,9 +101,11 @@ public:
void setSpanStaff(int val) { _spanStaff = val; }
void setSpanFrom(int val) { _spanFrom = val; }
void setSpanTo(int val) { _spanTo = val; }
void setShowTips(bool val);
int spanStaff() const { return _spanStaff; }
int spanFrom() const { return _spanFrom; }
int spanTo() const { return _spanTo; }
bool showTips() const;
void startEdit(EditData& ed) override;
void endEdit(EditData&) override;

View file

@ -124,6 +124,8 @@ static constexpr PropertyMetaData propertyList[] = {
DUMMY_QT_TRANSLATE_NOOP("propertyName", "span from") },
{ Pid::BARLINE_SPAN_TO, false, "spanToOffset", P_TYPE::INT,
DUMMY_QT_TRANSLATE_NOOP("propertyName", "span to") },
{ Pid::BARLINE_SHOW_TIPS, false, "showTips", P_TYPE::BOOL,
DUMMY_QT_TRANSLATE_NOOP("propertyName", "show tips") },
{ Pid::OFFSET, false, "offset", P_TYPE::POINT_SP_MM,
DUMMY_QT_TRANSLATE_NOOP("propertyName", "offset") },
{ Pid::FRET, true, "fret", P_TYPE::INT,
@ -136,7 +138,6 @@ static constexpr PropertyMetaData propertyList[] = {
DUMMY_QT_TRANSLATE_NOOP("propertyName", "played") },
{ Pid::TIMESIG_NOMINAL, false, 0, P_TYPE::FRACTION,
DUMMY_QT_TRANSLATE_NOOP("propertyName", "nominal time signature") },
{ Pid::TIMESIG_ACTUAL, true, 0, P_TYPE::FRACTION,
DUMMY_QT_TRANSLATE_NOOP("propertyName", "actual time signature") },
{ Pid::NUMBER_TYPE, false, "numberType", P_TYPE::INT,

View file

@ -96,6 +96,7 @@ enum class Pid {
BARLINE_SPAN,
BARLINE_SPAN_FROM,
BARLINE_SPAN_TO,
BARLINE_SHOW_TIPS,
OFFSET,
FRET,
STRING,