Skip to content

Commit

Permalink
fix title generation if scorename contains '&'
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Feb 18, 2014
1 parent 0e5c2d3 commit 1b1f704
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
15 changes: 11 additions & 4 deletions libmscore/text.cpp
Expand Up @@ -1383,7 +1383,6 @@ void Text::genText()
}
while (!xmlNesting.isEmpty())
xmlNesting.popToken();
printf("gen text <%s>\n", qPrintable(_text));
}

//---------------------------------------------------------
Expand Down Expand Up @@ -1907,9 +1906,9 @@ bool Text::readProperties(XmlReader& e)
else if (tag == "data") // obsolete
e.readElementText();
else if (tag == "html")
setText(Xml::xmlString(QTextDocumentFragment::fromHtml(e.readXml()).toPlainText()));
setPlainText(QTextDocumentFragment::fromHtml(e.readXml()).toPlainText());
else if (tag == "text")
setText(e.readXml());
_text = e.readXml();
else if (tag == "html-data") {
QString s = e.readXml();
if (score()->mscVersion() <= 114) {
Expand All @@ -1929,7 +1928,7 @@ bool Text::readProperties(XmlReader& e)
s.replace(QChar(0xe168), QString("%1%2").arg(QChar(0xd834)).arg(QChar(0xdd0c))); // varcoda
s.replace(QChar(0xe169), QString("%1%2").arg(QChar(0xd834)).arg(QChar(0xdd0c))); // segno
}
setText(Xml::xmlString(QTextDocumentFragment::fromHtml(s).toPlainText()));
setPlainText(QTextDocumentFragment::fromHtml(s).toPlainText());
}
else if (tag == "subtype") // obsolete
e.skipCurrentElement();
Expand Down Expand Up @@ -2176,6 +2175,14 @@ Element* Text::drop(const DropData& data)
return 0;
}

//---------------------------------------------------------
// setPlainText
//---------------------------------------------------------

void Text::setPlainText(const QString& s)
{
_text = s.toHtmlEscaped();
}

}

5 changes: 3 additions & 2 deletions libmscore/text.h
Expand Up @@ -215,8 +215,9 @@ class Text : public Element {
const TextStyle& textStyle() const { return _textStyle; }
TextStyle& textStyle() { return _textStyle; }

void setText(const QString& s) { _text = s; }
QString text() const { return _text; }
void setPlainText(const QString& s);
void setText(const QString& s) { _text = s; }
QString text() const { return _text; }
void insertText(const QString&);

virtual void layout();
Expand Down
14 changes: 5 additions & 9 deletions mscore/file.cpp
Expand Up @@ -693,27 +693,27 @@ void MuseScore::newFile()
if (!title.isEmpty()) {
Text* s = new Text(score);
s->setTextStyleType(TEXT_STYLE_TITLE);
s->setText(title);
s->setPlainText(title);
measure->add(s);
score->setMetaTag("workTitle", title);
}
if (!subtitle.isEmpty()) {
Text* s = new Text(score);
s->setTextStyleType(TEXT_STYLE_SUBTITLE);
s->setText(subtitle);
s->setPlainText(subtitle);
measure->add(s);
}
if (!composer.isEmpty()) {
Text* s = new Text(score);
s->setTextStyleType(TEXT_STYLE_COMPOSER);
s->setText(composer);
s->setPlainText(composer);
measure->add(s);
score->setMetaTag("composer", composer);
}
if (!poet.isEmpty()) {
Text* s = new Text(score);
s->setTextStyleType(TEXT_STYLE_POET);
s->setText(poet);
s->setPlainText(poet);
measure->add(s);
// the poet() functions returns data called lyricist in the dialog
score->setMetaTag("lyricist", poet);
Expand All @@ -722,11 +722,7 @@ void MuseScore::newFile()
if (newWizard->createTempo()) {
double tempo = newWizard->tempo();
TempoText* tt = new TempoText(score);

int uc = 0x1d15f;
QChar h(QChar::highSurrogate(uc));
QChar l(QChar::lowSurrogate(uc));
tt->setText(QString("%1%2 = %3").arg(h).arg(l).arg(tempo));
tt->setText(QString("#noteQuarterUp# = %1").arg(tempo));
tempo /= 60; // bpm -> bps

tt->setTempo(tempo);
Expand Down

0 comments on commit 1b1f704

Please sign in to comment.