Skip to content

Commit 6305669

Browse files
committed
Fix Instrument change text should show full instrument name
1 parent 41b7bde commit 6305669

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

src/engraving/dom/instrchange.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ void InstrumentChange::setupInstrument(const Instrument* instrument)
152152
}
153153

154154
//: The text of an "instrument change" marking. It is an instruction to the player to switch to another instrument.
155-
const String newInstrChangeText = muse::mtrc("engraving", "To %1").arg(instrument->trackName());
155+
const String newInstrChangeText = muse::mtrc("engraving", "To %1").arg(instrument->trackNameWithTrait());
156156
undoChangeProperty(Pid::TEXT, TextBase::plainToXmlText(newInstrChangeText));
157157
}
158158

src/engraving/dom/instrument.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
#include "instrument.h"
2424

25+
#include "translation.h"
26+
2527
#include "drumset.h"
2628
#include "instrtemplate.h"
2729
#include "masterscore.h"
@@ -1066,6 +1068,14 @@ String Instrument::trackName() const
10661068
return m_trackName;
10671069
}
10681070

1071+
String Instrument::trackNameWithTrait() const
1072+
{
1073+
if (m_trait.type == TraitType::Transposition && !m_trait.isHiddenOnScore) {
1074+
return muse::mtrc("engraving", "%1 in %2").arg(m_trackName, m_trait.name);
1075+
}
1076+
return m_trackName;
1077+
}
1078+
10691079
void Instrument::setTrackName(const String& s)
10701080
{
10711081
m_trackName = s;

src/engraving/dom/instrument.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ class Instrument
348348
String musicXmlId() const;
349349

350350
String trackName() const;
351+
String trackNameWithTrait() const;
351352
void setTrackName(const String& s);
352353
String nameAsXmlText() const;
353354
String nameAsPlainText() const;

src/notation/internal/notationparts.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,6 @@ using namespace mu::engraving;
4848

4949
static const mu::engraving::Fraction DEFAULT_TICK = mu::engraving::Fraction(0, 1);
5050

51-
static String formatInstrumentTitleOnScore(const String& instrumentName, const Trait& trait)
52-
{
53-
// Comments for translators start with //:
54-
55-
if (trait.type == TraitType::Transposition && !trait.isHiddenOnScore) {
56-
//: %1=name ("Horn"), %2=transposition ("C alto"). Example: "Horn in C alto"
57-
return muse::qtrc("notation", "%1 in %2", "Transposing instrument displayed in the score")
58-
.arg(instrumentName, trait.name);
59-
}
60-
61-
return instrumentName; // Example: "Flute"
62-
}
63-
6451
NotationParts::NotationParts(IGetScore* getScore, INotationInteractionPtr interaction, INotationUndoStackPtr undoStack)
6552
: m_getScore(getScore), m_undoStack(undoStack), m_interaction(interaction)
6653
{

0 commit comments

Comments
 (0)