Skip to content

Commit 8e39cf0

Browse files
committed
Fixed version change when saving to file
1 parent d0fc8e9 commit 8e39cf0

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

libmscore/read302.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ Score::FileError MasterScore::read302(XmlReader& e)
412412
else {
413413
score = new MasterScore();
414414
score->setMscVersion(mscVersion());
415+
score->setMscoreVersionName(mscVersionName());
415416
addMovement(score);
416417
}
417418
if (!score->read(e)) {

libmscore/score.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ class Score : public QObject, public ScoreElement {
476476
ScoreOrder* _scoreOrder { nullptr }; ///< used for score ordering
477477

478478
int _mscVersion { MSCVERSION }; ///< version of current loading *.msc file
479+
QString _mscVersionName { MSC_VERSION };
479480

480481
QMap<QString, QString> _metaTags;
481482

@@ -945,6 +946,9 @@ class Score : public QObject, public ScoreElement {
945946
int mscVersion() const { return _mscVersion; }
946947
void setMscVersion(int v) { _mscVersion = v; }
947948

949+
QString mscVersionName() const { return _mscVersionName; }
950+
void setMscoreVersionName(const QString& v) { _mscVersionName = v; }
951+
948952
void addLyrics(const Fraction& tick, int staffIdx, const QString&);
949953

950954
void updateSwing();

libmscore/scorefile.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -763,11 +763,11 @@ bool Score::saveFile(QIODevice* f, bool msczFormat, bool onlySelection)
763763
xml.setWriteOmr(msczFormat);
764764
xml.header();
765765

766-
xml.stag("museScore version=\"" MSC_VERSION "\"");
766+
xml.stag("museScore version=\"" + mscVersionName() + "\"");
767767

768768
if (!MScore::testMode) {
769-
xml.tag("programVersion", VERSION);
770-
xml.tag("programRevision", revision);
769+
xml.tag("programVersion", mscVersion());
770+
xml.tag("programRevision", mscoreRevision());
771771
}
772772
write(xml, onlySelection);
773773
xml.etag();
@@ -1023,6 +1023,7 @@ Score::FileError MasterScore::read1(XmlReader& e, bool ignoreVersionError)
10231023
const QString& version = e.attribute("version");
10241024
QStringList sl = version.split('.');
10251025
setMscVersion(sl[0].toInt() * 100 + sl[1].toInt());
1026+
setMscoreVersionName(version);
10261027

10271028
if (!ignoreVersionError) {
10281029
if (mscVersion() > MSCVERSION)

0 commit comments

Comments
 (0)