diff --git a/importexport/musicxml/exportxml.cpp b/importexport/musicxml/exportxml.cpp index 5306acc5a0e4d..df7ff664def62 100644 --- a/importexport/musicxml/exportxml.cpp +++ b/importexport/musicxml/exportxml.cpp @@ -881,18 +881,25 @@ static void glissando(const Glissando* gli, int number, bool start, Notations& n { GlissandoType st = gli->glissandoType(); QString tagName; - switch (st) { - case GlissandoType::STRAIGHT: - tagName = "slide line-type=\"solid\""; - break; - case GlissandoType::WAVY: - tagName = "glissando line-type=\"wavy\""; - break; - default: - qDebug("unknown glissando subtype %d", int(st)); - return; - break; + if (st == GlissandoType::STRAIGHT) { + switch (gli->lineStyle()) { + case Qt::SolidLine: + tagName = "slide line-type=\"solid\""; + break; + case Qt::DashLine: + tagName = "slide line-type=\"dashed\""; + break; + case Qt::DotLine: + tagName = "slide line-type=\"dotted\""; + break; + default: + qDebug("Unknown glissando subtype %d", int(st)); + break; + } } + else + tagName = "glissando line-type=\"wavy\""; + tagName += QString(" number=\"%1\" type=\"%2\"").arg(number).arg(start ? "start" : "stop"); if (start) { tagName += color2xml(gli); diff --git a/importexport/musicxml/importmxmlpass2.cpp b/importexport/musicxml/importmxmlpass2.cpp index c71799c93235b..d354685b2299b 100644 --- a/importexport/musicxml/importmxmlpass2.cpp +++ b/importexport/musicxml/importmxmlpass2.cpp @@ -8013,10 +8013,11 @@ static void addGlissandoSlide(const Notation& notation, Note* note, MxmlLogger* logger, const QXmlStreamReader* const xmlreader) { int glissandoNumber = notation.attribute("number").toInt(); - if (glissandoNumber > 0) glissandoNumber--; + if (glissandoNumber > 0) + glissandoNumber--; const QString glissandoType = notation.attribute("type"); - int glissandoTag = notation.name() == "slide" ? 0 : 1; - // QString lineType = ee.attribute(QString("line-type"), "solid"); + const bool glissandoTag = notation.name() != "slide"; + const QString lineType = notation.attribute("line-type"); Glissando*& gliss = glissandi[glissandoNumber][glissandoTag]; const Fraction tick = note->tick(); @@ -8041,8 +8042,14 @@ static void addGlissandoSlide(const Notation& notation, Note* note, gliss->setParent(note); if (glissandoColor.isValid()/* && preferences.getBool(PREF_IMPORT_MUSICXML_IMPORTLAYOUT)*/) gliss->setLineColor(glissandoColor); + if (lineType == "dashed") + gliss->setLineStyle(Qt::DashLine); + else if (lineType == "dotted") + gliss->setLineStyle(Qt::DotLine); + else if (lineType == "solid" || lineType.isEmpty()) + gliss->setLineStyle(Qt::SolidLine); gliss->setText(glissandoText); - gliss->setGlissandoType(glissandoTag == 0 ? GlissandoType::STRAIGHT : GlissandoType::WAVY); + gliss->setGlissandoType(glissandoTag || (lineType == "wavy") ? GlissandoType::WAVY : GlissandoType::STRAIGHT); spanners[gliss] = QPair(tick.ticks(), -1); // qDebug("glissando/slide=%p inserted at first tick %d", gliss, tick); } diff --git a/mtest/musicxml/io/testGlissandoLines.xml b/mtest/musicxml/io/testGlissandoLines.xml new file mode 100644 index 0000000000000..21934de3ae4b4 --- /dev/null +++ b/mtest/musicxml/io/testGlissandoLines.xml @@ -0,0 +1,167 @@ + + + + + MuseScore testfile + Glissando line types + + + Klaus Rettinghaus + + MuseScore 0.7.0 + 2007-09-10 + + + + + + + + + + Piano + Pno. + + Piano + + + + 1 + 1 + 78.7402 + 0 + + + + + + + 1 + + 0 + + + + G + 2 + + + + + E + 4 + + 2 + 1 + half + up + + + + + + + C + 5 + + 2 + 1 + half + down + + + + + + + + + E + 4 + + 2 + 1 + half + up + + + + + + + C + 5 + + 2 + 1 + half + down + + + + + + + + + E + 4 + + 2 + 1 + half + up + + + + + + + C + 5 + + 2 + 1 + half + down + + + + + + + + + E + 4 + + 2 + 1 + half + up + + gliss. + + + + + C + 5 + + 2 + 1 + half + down + + + + + + light-heavy + + + + diff --git a/mtest/musicxml/io/tst_mxml_io.cpp b/mtest/musicxml/io/tst_mxml_io.cpp index fd48e111e881c..617db7bba734d 100644 --- a/mtest/musicxml/io/tst_mxml_io.cpp +++ b/mtest/musicxml/io/tst_mxml_io.cpp @@ -147,6 +147,7 @@ private slots: void fractionTicks() { mxmlIoTestRef("testFractionTicks"); } void fretboardDiagrams() { mxmlImportTestRef("testFretboardDiagrams"); } void fretDiagramLayoutOrder() { mxmlImportTestRef("testFretDiagramLayoutOrder"); } + void glissandoLines() { mxmlIoTest("testGlissandoLines"); } void grace1() { mxmlIoTest("testGrace1"); } void grace2() { mxmlIoTest("testGrace2"); } void grace3() { mxmlIoTest("testGrace3"); }