Skip to content

Commit

Permalink
Fix #235516: support .musicxml file extension
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacWeiss committed Aug 1, 2017
1 parent a8efa6d commit d6d69fb
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 14 deletions.
18 changes: 18 additions & 0 deletions build/Linux+BSD/musescore.xml.in
Expand Up @@ -37,4 +37,22 @@
</magic>
<glob pattern="*.xml" weight="40"/>
</mime-type>
<mime-type type="application/vnd.recordare.musicxml@MSCORE_INSTALL_SUFFIX@+xml">
<!-- http://www.musicxml.com/for-developers/musicxml-dtd/ -->
<_comment>uncompressed MusicXML 3.1+ file</_comment>
<sub-class-of type="application/xml"/>
<!-- <icon name="application-x-musescore"/> Uncomment to use MuseScore file icon -->
<!-- <generic-icon name="audio-x-generic"/> Uncomment to use generic audio file icon -->
<magic>
<match type="string" value="&lt;?xml" offset="0">
<match type="string" value="score-partwise" offset="0:128"/>
<match type="string" value="score-timewise" offset="0:128"/>
</match>
<match type="string" value="&lt;!--" offset="0">
<match type="string" value="score-partwise" offset="0:128"/>
<match type="string" value="score-timewise" offset="0:128"/>
</match>
</magic>
<glob pattern="*.musicxml" weight="40"/>
</mime-type>
</mime-info>
18 changes: 18 additions & 0 deletions build/MacOSXBundleInfo.plist.in
Expand Up @@ -119,6 +119,24 @@
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>MusicXML 3.1+ File</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>musicxml</string>
</array>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/vnd.recordare.musicxml+xml</string>
</array>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Compressed MusicXML File</string>
Expand Down
3 changes: 2 additions & 1 deletion build/packaging/WIX.template.in
Expand Up @@ -89,8 +89,9 @@
<!-- Extend to the "open with" list + Win7 jump menu pinning -->
<RegistryValue Root="$(var.RegistryRoot)" Key="SOFTWARE\Classes\Applications\$(var.ExeKey)\SupportedTypes" Name=".mscz" Value="" Type="string" />
<RegistryValue Root="$(var.RegistryRoot)" Key="SOFTWARE\Classes\Applications\$(var.ExeKey)\SupportedTypes" Name=".mscx" Value="" Type="string" />
<RegistryValue Root="$(var.RegistryRoot)" Key="SOFTWARE\Classes\Applications\$(var.ExeKey)\SupportedTypes" Name=".mxl" Value="" Type="string" />
<RegistryValue Root="$(var.RegistryRoot)" Key="SOFTWARE\Classes\Applications\$(var.ExeKey)\SupportedTypes" Name=".xml" Value="" Type="string" />
<RegistryValue Root="$(var.RegistryRoot)" Key="SOFTWARE\Classes\Applications\$(var.ExeKey)\SupportedTypes" Name=".musicxml" Value="" Type="string" />
<RegistryValue Root="$(var.RegistryRoot)" Key="SOFTWARE\Classes\Applications\$(var.ExeKey)\SupportedTypes" Name=".mxl" Value="" Type="string" />
<RegistryValue Root="$(var.RegistryRoot)" Key="SOFTWARE\Classes\Applications\$(var.ExeKey)\SupportedTypes" Name=".cap" Value="" Type="string" />
<RegistryValue Root="$(var.RegistryRoot)" Key="SOFTWARE\Classes\Applications\$(var.ExeKey)\SupportedTypes" Name=".capx" Value="" Type="string" />
<RegistryValue Root="$(var.RegistryRoot)" Key="SOFTWARE\Classes\Applications\$(var.ExeKey)\SupportedTypes" Name=".bww" Value="" Type="string" />
Expand Down
19 changes: 10 additions & 9 deletions mscore/file.cpp
Expand Up @@ -269,22 +269,22 @@ void MuseScore::loadFiles()
{
QStringList files = getOpenScoreNames(
#ifdef OMR
tr("All Supported Files") + " (*.mscz *.mscx *.xml *.mxl *.mid *.midi *.kar *.md *.mgu *.MGU *.sgu *.SGU *.cap *.capx *.pdf *.ove *.scw *.bww *.GTP *.GP3 *.GP4 *.GP5 *.GPX);;" +
tr("All Supported Files") + " (*.mscz *.mscx *.mxl *.musicxml *.xml *.mid *.midi *.kar *.md *.mgu *.sgu *.cap *.capx *.pdf *.ove *.scw *.bww *.gtp *.gp3 *.gp4 *.gp5 *.gpx);;" +
#else
tr("All Supported Files") + " (*.mscz *.mscx *.xml *.mxl *.mid *.midi *.kar *.md *.mgu *.MGU *.sgu *.SGU *.cap *.capx *.ove *.scw *.bww *.GTP *.GP3 *.GP4 *.GP5 *.GPX);;" +
tr("All Supported Files") + " (*.mscz *.mscx *.mxl *.musicxml *.xml *.mid *.midi *.kar *.md *.mgu *.sgu *.cap *.capx *.ove *.scw *.bww *.gtp *.gp3 *.gp4 *.gp5 *.gpx);;" +
#endif
tr("MuseScore Files") + " (*.mscz *.mscx);;" +
tr("MusicXML Files") + " (*.xml *.mxl);;" +
tr("MusicXML Files") + " (*.mxl *.musicxml *.xml);;" +
tr("MIDI Files") + " (*.mid *.midi *.kar);;" +
tr("Muse Data Files") + " (*.md);;" +
tr("Capella Files") + " (*.cap *.capx);;" +
tr("BB Files <experimental>") + " (*.mgu *.MGU *.sgu *.SGU);;" +
tr("BB Files <experimental>") + " (*.mgu *.sgu);;" +
#ifdef OMR
tr("PDF Files <experimental OMR>") + " (*.pdf);;" +
#endif
tr("Overture / Score Writer Files <experimental>") + " (*.ove *.scw);;" +
tr("Bagpipe Music Writer Files <experimental>") + " (*.bww);;" +
tr("Guitar Pro") + " (*.GTP *.GP3 *.GP4 *.GP5 *.GPX)",
tr("Guitar Pro") + " (*.gtp *.gp3 *.gp4 *.gp5 *.gpx)",
tr("Load Score")
);
for (const QString& s : files)
Expand Down Expand Up @@ -1601,8 +1601,8 @@ void MuseScore::exportFile()
fl.append(tr("MP3 Audio") + " (*.mp3)");
#endif
fl.append(tr("Standard MIDI File") + " (*.mid)");
fl.append(tr("MusicXML File") + " (*.xml)");
fl.append(tr("Compressed MusicXML File") + " (*.mxl)");
fl.append(tr("Uncompressed MusicXML File") + " (*.musicxml)");
fl.append(tr("Uncompressed MuseScore File") + " (*.mscx)");

QString saveDialogTitle = tr("Export");
Expand Down Expand Up @@ -1677,8 +1677,8 @@ bool MuseScore::exportParts()
fl.append(tr("MP3 Audio") + " (*.mp3)");
#endif
fl.append(tr("Standard MIDI File") + " (*.mid)");
fl.append(tr("MusicXML File") + " (*.xml)");
fl.append(tr("Compressed MusicXML File") + " (*.mxl)");
fl.append(tr("Uncompressed MusicXML File") + " (*.musicxml)");
fl.append(tr("MuseScore File") + " (*.mscz)");
fl.append(tr("Uncompressed MuseScore File") + " (*.mscx)");

Expand Down Expand Up @@ -1846,8 +1846,8 @@ bool MuseScore::saveAs(Score* cs, bool saveCopy, const QString& path, const QStr
writeSessionFile(false);
}
}
else if (ext == "xml") {
// save as MusicXML *.xml file
else if (ext == "musicxml") {
// save as MusicXML *.musicxml file
rv = saveXml(cs, fn);
}
else if (ext == "mxl") {
Expand Down Expand Up @@ -2120,6 +2120,7 @@ Score::FileError readScore(MasterScore* score, QString name, bool ignoreVersionE
};
static const ImportDef imports[] = {
{ "xml", &importMusicXml },
{ "musicxml", &importMusicXml },
{ "mxl", &importCompressedMusicXml },
{ "mid", &importMidi },
{ "midi", &importMidi },
Expand Down
2 changes: 1 addition & 1 deletion mscore/musescore.cpp
Expand Up @@ -2602,7 +2602,7 @@ static bool doConvert(Score* cs, QString fn, QString plugin = "")
return false;
return true;
}
else if (fn.endsWith(".xml")) {
else if (fn.endsWith(".xml") || fn.endsWith(".musicxml")) {
rv = saveXml(cs, fn);
}
else if (fn.endsWith(".mxl")) {
Expand Down
3 changes: 2 additions & 1 deletion mscore/startcenter.cpp
Expand Up @@ -249,7 +249,8 @@ void MyWebView::link(const QUrl& url)
{
QString path(url.path());
QFileInfo fi(path);
if (fi.suffix() == "mscz" || fi.suffix() == "xml" || fi.suffix() == "mxl") {
if (fi.suffix() == "mscz" || fi.suffix() == "xml"
|| fi.suffix() == "musicxml" || fi.suffix() == "mxl") {
mscore->loadFile(url);
QAction* a = getAction("startcenter");
a->setChecked(false);
Expand Down
3 changes: 2 additions & 1 deletion mscore/webpage.cpp
Expand Up @@ -197,7 +197,8 @@ void MyWebView::link(const QUrl& url)
{
QString path(url.path());
QFileInfo fi(path);
if (fi.suffix() == "mscz" || fi.suffix() == "xml" || fi.suffix() == "mxl")
if (fi.suffix() == "mscz" || fi.suffix() == "xml"
|| fi.suffix() == "musicxml" || fi.suffix() == "mxl")
mscore->loadFile(url);
else if(url.host().startsWith("connect."))
load(QNetworkRequest(url));
Expand Down
2 changes: 1 addition & 1 deletion mtest/testutils.cpp
Expand Up @@ -160,7 +160,7 @@ MasterScore* MTest::readCreatedScore(const QString& name)
else if (csl == "pdf")
rv = importPdf(score, name);
#endif
else if (csl == "xml")
else if (csl == "xml" || csl == "musicxml")
rv = importMusicXml(score, name);
else if (csl == "gp3" || csl == "gp4" || csl == "gp5" || csl == "gpx")
rv = importGTP(score, name);
Expand Down

0 comments on commit d6d69fb

Please sign in to comment.