Skip to content

Commit

Permalink
Add rest of v2.0 Part properties to v3.2.1
Browse files Browse the repository at this point in the history
The v3.0 release lost many properties for the Part
object when it released. This commit restores them.
  • Loading branch information
DLLarson committed Jun 25, 2019
1 parent 2e78246 commit fc305ed
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 13 deletions.
10 changes: 5 additions & 5 deletions libmscore/part.cpp
Expand Up @@ -504,7 +504,7 @@ void Part::insertTime(const Fraction& tick, const Fraction& len)
// lyricCount
//---------------------------------------------------------

int Part::lyricCount()
int Part::lyricCount() const
{
if (!score())
return 0;
Expand All @@ -524,7 +524,7 @@ int Part::lyricCount()
// harmonyCount
//---------------------------------------------------------

int Part::harmonyCount()
int Part::harmonyCount() const
{
if (!score())
return 0;
Expand All @@ -543,7 +543,7 @@ int Part::harmonyCount()
// hasPitchedStaff
//---------------------------------------------------------

bool Part::hasPitchedStaff()
bool Part::hasPitchedStaff() const
{
if (!staves())
return false;
Expand All @@ -558,7 +558,7 @@ bool Part::hasPitchedStaff()
// hasTabStaff
//---------------------------------------------------------

bool Part::hasTabStaff()
bool Part::hasTabStaff() const
{
if (!staves())
return false;
Expand All @@ -573,7 +573,7 @@ bool Part::hasTabStaff()
// hasDrumStaff
//---------------------------------------------------------

bool Part::hasDrumStaff()
bool Part::hasDrumStaff() const
{
if (!staves())
return false;
Expand Down
10 changes: 5 additions & 5 deletions libmscore/part.h
Expand Up @@ -122,11 +122,11 @@ class Part final : public ScoreElement {
QVariant getProperty(Pid) const override;
bool setProperty(Pid, const QVariant&) override;

int lyricCount();
int harmonyCount();
bool hasPitchedStaff();
bool hasTabStaff();
bool hasDrumStaff();
int lyricCount() const;
int harmonyCount() const;
bool hasPitchedStaff() const;
bool hasTabStaff() const;
bool hasDrumStaff() const;

const Part* masterPart() const;
Part* masterPart();
Expand Down
49 changes: 46 additions & 3 deletions mscore/plugin/api/part.h
Expand Up @@ -25,10 +25,42 @@ namespace PluginAPI {

class Part : public Ms::PluginAPI::ScoreElement {
Q_OBJECT
Q_PROPERTY(int startTrack READ startTrack)
Q_PROPERTY(int endTrack READ endTrack)
Q_PROPERTY(int startTrack READ startTrack)
Q_PROPERTY(int endTrack READ endTrack)
/// The string identifier for the current instrument. \since MuseScore 3.2
Q_PROPERTY(QString instrumentId READ instrumentId)
Q_PROPERTY(QString instrumentId READ instrumentId)
/// The number of Chord Symbols. \since MuseScore 3.2.1
Q_PROPERTY(int harmonyCount READ harmonyCount)
/// Whether it is a percussion staff. \since MuseScore 3.2.1
Q_PROPERTY(bool hasDrumStaff READ hasDrumStaff)
/// Whether it is a 'normal' staff with notes. \since MuseScore 3.2.1
Q_PROPERTY(bool hasPitchedStaff READ hasPitchedStaff)
/// Whether it is a tablature staff. \since MuseScore 3.2.1
Q_PROPERTY(bool hasTabStaff READ hasTabStaff)
/// The number of lyrics syllables. \since MuseScore 3.2.1
Q_PROPERTY(int lyricCount READ lyricCount)
/// One of 16 music channels that can be assigned an instrument. \since MuseScore 3.2.1
Q_PROPERTY(int midiChannel READ midiChannel)
/// One of the 128 different instruments in General MIDI. \since MuseScore 3.2.1
Q_PROPERTY(int midiProgram READ midiProgram)
/// The long name for the current instrument.
/// Note that this property was writeable in MuseScore v2.x
/// \since MuseScore 3.2.1
Q_PROPERTY(QString longName READ longName)
/// The short name for the current instrument.
/// Note that this property was writeable in MuseScore v2.x
/// \since MuseScore 3.2.1
Q_PROPERTY(QString shortName READ shortName)
/// The name of the current part of music.
/// It is shown in Mixer.
///
/// Note that this property was writeable in MuseScore v2.x
/// \since MuseScore 3.2.1
Q_PROPERTY(QString partName READ partName)
/// Whether part is shown or hidden.
/// Note that this property was writeable in MuseScore v2.x
/// \since MuseScore 3.2.1
Q_PROPERTY(bool show READ show)

public:
/// \cond MS_INTERNAL
Expand All @@ -41,6 +73,17 @@ class Part : public Ms::PluginAPI::ScoreElement {
int startTrack() const { return part()->startTrack(); }
int endTrack() const { return part()->endTrack(); }
QString instrumentId() const { return part()->instrument()->instrumentId(); }
int harmonyCount() const { return part()->harmonyCount(); }
bool hasPitchedStaff() const { return part()->hasPitchedStaff(); }
bool hasTabStaff() const { return part()->hasTabStaff(); }
bool hasDrumStaff() const { return part()->hasDrumStaff(); }
int lyricCount() const { return part()->lyricCount(); }
int midiChannel() const { return part()->midiChannel(); }
int midiProgram() const { return part()->midiProgram(); }
QString longName() const { return part()->longName(); }
QString shortName() const { return part()->shortName(); }
QString partName() const { return part()->partName(); }
bool show() const { return part()->show(); }
/// \endcond
};
} // namespace PluginAPI
Expand Down

0 comments on commit fc305ed

Please sign in to comment.