more code for inspector+barlines
This commit is contained in:
parent
e430b8d85c
commit
6ea46108d9
5 changed files with 233 additions and 85 deletions
|
@ -38,10 +38,25 @@ int BarLine::_origSpan, BarLine::_origSpanFrom, BarLine::_origSpanTo;
|
|||
//---------------------------------------------------------
|
||||
|
||||
static const char* barLineNames[] = {
|
||||
"normal", "double", "start-repeat", "end-repeat", "dashed", "end",
|
||||
"end-start-repeat", "dotted"
|
||||
QT_TRANSLATE_NOOP("barline", "normal"),
|
||||
QT_TRANSLATE_NOOP("barline", "double"),
|
||||
QT_TRANSLATE_NOOP("barline", "start-repeat"),
|
||||
QT_TRANSLATE_NOOP("barline", "end-repeat"),
|
||||
QT_TRANSLATE_NOOP("barline", "dashed"),
|
||||
QT_TRANSLATE_NOOP("barline", "end"),
|
||||
QT_TRANSLATE_NOOP("barline", "end-start-repeat"),
|
||||
QT_TRANSLATE_NOOP("barline", "dotted")
|
||||
};
|
||||
|
||||
//---------------------------------------------------------
|
||||
// userTypeName
|
||||
//---------------------------------------------------------
|
||||
|
||||
QString BarLine::userTypeName(BarLineType t)
|
||||
{
|
||||
return qApp->translate("barline", barLineNames[int(t)]);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// BarLine
|
||||
//---------------------------------------------------------
|
||||
|
@ -442,11 +457,7 @@ void BarLine::read(XmlReader& e)
|
|||
}
|
||||
setBarLineType(ct);
|
||||
}
|
||||
if (parent() && parent()->type() == SEGMENT) {
|
||||
Measure* m = static_cast<Segment*>(parent())->measure();
|
||||
if (barLineType() != m->endBarLineType())
|
||||
_customSubtype = true;
|
||||
}
|
||||
_customSubtype = BarLineType(propertyDefault(P_SUBTYPE).toInt()) != barLineType();
|
||||
}
|
||||
else if (tag == "customSubtype")
|
||||
_customSubtype = e.readInt();
|
||||
|
@ -1046,7 +1057,7 @@ bool BarLine::setProperty(P_ID id, const QVariant& v)
|
|||
switch(id) {
|
||||
case P_SUBTYPE:
|
||||
_barLineType = BarLineType(v.toInt());
|
||||
_customSubtype = parent() && (static_cast<Segment*>(parent())->measure())->endBarLineType() != v.toInt();
|
||||
_customSubtype = parent() && (static_cast<Segment*>(parent())->measure())->endBarLineType() != _barLineType;
|
||||
break;
|
||||
case P_BARLINE_SPAN:
|
||||
setSpan(v.toInt());
|
||||
|
|
|
@ -101,14 +101,15 @@ class BarLine : public Element {
|
|||
ElementList* el() { return &_el; }
|
||||
const ElementList* el() const { return &_el; }
|
||||
|
||||
static QString userTypeName(BarLineType);
|
||||
QString barLineTypeName() const;
|
||||
void setBarLineType(const QString& s);
|
||||
void setBarLineType(BarLineType i) { _barLineType = i; }
|
||||
BarLineType barLineType() const { return _barLineType; }
|
||||
|
||||
virtual QVariant getProperty(P_ID propertyId) const;
|
||||
virtual bool setProperty(P_ID propertyId, const QVariant&);
|
||||
virtual QVariant propertyDefault(P_ID propertyId) const;
|
||||
virtual QVariant getProperty(P_ID propertyId) const override;
|
||||
virtual bool setProperty(P_ID propertyId, const QVariant&) override;
|
||||
virtual QVariant propertyDefault(P_ID propertyId) const override;
|
||||
|
||||
virtual qreal mag() const;
|
||||
|
||||
|
|
|
@ -610,26 +610,6 @@ void InspectorDynamic::setElement()
|
|||
InspectorBase::setElement();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// InspectorBarLine
|
||||
//---------------------------------------------------------
|
||||
|
||||
InspectorBarLine::InspectorBarLine(QWidget* parent)
|
||||
: InspectorBase(parent)
|
||||
{
|
||||
e.setupUi(addWidget());
|
||||
b.setupUi(addWidget());
|
||||
|
||||
iList = {
|
||||
{ P_COLOR, 0, 0, e.color, e.resetColor },
|
||||
{ P_VISIBLE, 0, 0, e.visible, e.resetVisible },
|
||||
{ P_USER_OFF, 0, 0, e.offsetX, e.resetX },
|
||||
{ P_USER_OFF, 1, 0, e.offsetY, e.resetY },
|
||||
{ P_SUBTYPE, 0, 0, b.type, b.resetType }
|
||||
};
|
||||
mapSignals();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// InspectorSlur
|
||||
//---------------------------------------------------------
|
||||
|
@ -660,14 +640,86 @@ InspectorEmpty::InspectorEmpty(QWidget* parent)
|
|||
setToolTip(tr("Select an element to display its properties"));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// InspectorBarLine
|
||||
//---------------------------------------------------------
|
||||
|
||||
InspectorBarLine::InspectorBarLine(QWidget* parent)
|
||||
: InspectorBase(parent)
|
||||
{
|
||||
static const char* buildinSpanNames[BARLINE_BUILTIN_SPANS] = {
|
||||
QT_TRANSLATE_NOOP("inspector", "Staff default"),
|
||||
QT_TRANSLATE_NOOP("inspector", "Tick"),
|
||||
QT_TRANSLATE_NOOP("inspector", "Tick alt."),
|
||||
QT_TRANSLATE_NOOP("inspector", "Short"),
|
||||
QT_TRANSLATE_NOOP("inspector", "Short alt.")
|
||||
};
|
||||
|
||||
BarLineType types[8] = {
|
||||
NORMAL_BAR,
|
||||
DOUBLE_BAR,
|
||||
START_REPEAT,
|
||||
END_REPEAT,
|
||||
BROKEN_BAR,
|
||||
END_BAR,
|
||||
END_START_REPEAT,
|
||||
DOTTED_BAR
|
||||
};
|
||||
|
||||
e.setupUi(addWidget());
|
||||
b.setupUi(addWidget());
|
||||
|
||||
for (const char* name : buildinSpanNames)
|
||||
b.spanType->addItem(tr(name));
|
||||
for (BarLineType t : types)
|
||||
b.type->addItem(BarLine::userTypeName(t), int(t));
|
||||
|
||||
iList = {
|
||||
{ P_COLOR, 0, 0, e.color, e.resetColor },
|
||||
{ P_VISIBLE, 0, 0, e.visible, e.resetVisible },
|
||||
{ P_USER_OFF, 0, 0, e.offsetX, e.resetX },
|
||||
{ P_USER_OFF, 1, 0, e.offsetY, e.resetY },
|
||||
{ P_SUBTYPE, 0, 0, b.type, b.resetType },
|
||||
{ P_BARLINE_SPAN, 0, 0, b.span, b.resetSpan },
|
||||
{ P_BARLINE_SPAN_FROM, 0, 0, b.spanFrom, b.resetSpanFrom },
|
||||
{ P_BARLINE_SPAN_TO, 0, 0, b.spanTo, b.resetSpanTo },
|
||||
};
|
||||
mapSignals();
|
||||
connect(b.spanType, SIGNAL(activated(int)), SLOT(spanTypeActivated(int)));
|
||||
connect(b.resetSpanType, SIGNAL(clicked()), SLOT(resetSpanType()));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// setElement
|
||||
//---------------------------------------------------------
|
||||
|
||||
void InspectorBarLine::setElement()
|
||||
{
|
||||
InspectorBase::setElement();
|
||||
// BarLine* bl = static_cast<BarLine*>(inspector->element());
|
||||
// Measure* m = static_cast<Segment*>(bl->parent())->measure();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// spanTypeActivated
|
||||
//---------------------------------------------------------
|
||||
|
||||
void InspectorBarLine::spanTypeActivated(int idx)
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// resetSpanType
|
||||
//---------------------------------------------------------
|
||||
|
||||
void InspectorBarLine::resetSpanType()
|
||||
{
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
#define BARLINE_TYPE_DEFAULT -1
|
||||
|
||||
QString InspectorBarLine::builtinSpanNames[BARLINE_BUILTIN_SPANS] =
|
||||
{
|
||||
tr("Staff default"), tr("Tick"), tr("Tick alt."), tr("Short"), tr("Short alt.")
|
||||
};
|
||||
|
||||
int InspectorBarLine::builtinSpans[BARLINE_BUILTIN_SPANS][3] =
|
||||
{// span From To
|
||||
|
|
|
@ -45,15 +45,15 @@ class Segment;
|
|||
class Chord;
|
||||
|
||||
|
||||
//---------------------------------------------------------
|
||||
// InspectorElement
|
||||
//---------------------------------------------------------
|
||||
|
||||
class UiInspectorElement: public Ui::InspectorElement {
|
||||
public:
|
||||
void setupUi(QWidget *InspectorElement);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------
|
||||
// InspectorElement
|
||||
//---------------------------------------------------------
|
||||
|
||||
class InspectorElement : public InspectorBase {
|
||||
Q_OBJECT
|
||||
UiInspectorElement b;
|
||||
|
@ -145,7 +145,7 @@ class InspectorClef : public InspectorBase {
|
|||
|
||||
public:
|
||||
InspectorClef(QWidget* parent);
|
||||
virtual void setElement();
|
||||
virtual void setElement() override;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -234,7 +234,7 @@ class InspectorDynamic : public InspectorBase {
|
|||
|
||||
public:
|
||||
InspectorDynamic(QWidget* parent);
|
||||
virtual void setElement();
|
||||
virtual void setElement() override;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -252,8 +252,13 @@ class InspectorBarLine : public InspectorBase {
|
|||
static QString builtinSpanNames[BARLINE_BUILTIN_SPANS];
|
||||
static int builtinSpans[BARLINE_BUILTIN_SPANS][3];
|
||||
|
||||
private slots:
|
||||
void spanTypeActivated(int);
|
||||
void resetSpanType();
|
||||
|
||||
public:
|
||||
InspectorBarLine(QWidget* parent);
|
||||
virtual void setElement() override;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>274</width>
|
||||
<height>120</height>
|
||||
<width>283</width>
|
||||
<height>169</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -64,48 +64,7 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="type">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Normal</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Double</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Start Repeat</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>End Repeat</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Dashed</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>End</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>End-Start Repeat</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Dotted</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="type"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
|
@ -140,6 +99,126 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Span from</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Span</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="spanFrom"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="span"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Span to</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="spanTo"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QToolButton" name="resetSpan">
|
||||
<property name="toolTip">
|
||||
<string>reset value</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../musescore.qrc">
|
||||
<normaloff>:/data/icons/resetproperty.png</normaloff>:/data/icons/resetproperty.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>14</width>
|
||||
<height>14</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QToolButton" name="resetSpanFrom">
|
||||
<property name="toolTip">
|
||||
<string>reset value</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../musescore.qrc">
|
||||
<normaloff>:/data/icons/resetproperty.png</normaloff>:/data/icons/resetproperty.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>14</width>
|
||||
<height>14</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QToolButton" name="resetSpanTo">
|
||||
<property name="toolTip">
|
||||
<string>reset value</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../musescore.qrc">
|
||||
<normaloff>:/data/icons/resetproperty.png</normaloff>:/data/icons/resetproperty.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>14</width>
|
||||
<height>14</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Spantype</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="spanType"/>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QToolButton" name="resetSpanType">
|
||||
<property name="toolTip">
|
||||
<string>reset value</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../musescore.qrc">
|
||||
<normaloff>:/data/icons/resetproperty.png</normaloff>:/data/icons/resetproperty.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>14</width>
|
||||
<height>14</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
Loading…
Reference in a new issue