Repository navigation
Make Revision in Score properties and About box a clickable URL to the corresponding commit #33712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
cde9090
cce74b3
332abfa
28ebef2
36d1b8d
0bbdb91
1cd5962
bf442dd
c4c03cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,10 @@ using namespace muse::modularity; | |
| using namespace mu::notation; | ||
| using namespace mu::project; | ||
|
|
||
| //! NOTE: Should match value in aboutmodel.cpp | ||
| static const QString GITHUB_REVISION_URL("https://github.com/musescore/MuseScore/commit/"); | ||
| static const QString SOURCEFORGE_REVISION_URL("https://sourceforge.net/p/mscore/code/"); | ||
|
|
||
| ProjectPropertiesModel::ProjectPropertiesModel(QObject* parent) | ||
| : QAbstractListModel(parent), muse::Contextable(muse::iocCtxForQmlObject(this)) | ||
| { | ||
|
|
@@ -159,15 +163,23 @@ QString ProjectPropertiesModel::version() const | |
|
|
||
| QString ProjectPropertiesModel::revision() const | ||
| { | ||
| int rev = m_projectMetaInfo.musescoreRevision; | ||
| QString revision; | ||
| if (rev > 99999) { // MuseScore 1.3 is decimal 5702, 2.0 and later uses a 7-digit hex SHA | ||
| revision = QString::number(rev, 16); | ||
| } else { | ||
| revision = QString::number(rev, 10); | ||
| const int rev = m_projectMetaInfo.musescoreRevision; | ||
| if (rev > 0 && rev <= 5709) { | ||
| // MuseScore 1.x and earlier used decimal numbers, referring to a commit on SourceForge.net, the largest being 5709 | ||
| const QString revText = QString::number(rev, 10); | ||
| const QString revUrl = SOURCEFORGE_REVISION_URL + revText; | ||
| return QString("<a href=\"%1\">%2</a>").arg(revUrl, revText); | ||
| } | ||
|
|
||
| if (rev > 0xffffff) { | ||
| // MuseScore 2.0 and later use a >= 7-digit hex SHA, referring to a commit on GitHub.com | ||
| const QString revText = QString::number(rev, 16); | ||
| const QString revUrl = GITHUB_REVISION_URL + revText; | ||
| return QString("<a href=\"%1\">%2</a>").arg(revUrl, revText); | ||
| } | ||
|
|
||
| return revision; | ||
| // unknown, like in a self-built development version, or in a very old version of MuseScore before the revision number was tracked | ||
| return muse::qtrc("global", "Unknown"); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure we'd want a translated text getting placed in the score's metadata? And is inconsistent vs. how it is dealt with for header/footer
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm - if I understand you correctly this doesn't actually modify the score's metadata though? It's purely used for UI purposes in the project properties dialog when we encounter a revision we don't recognise.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't the revision also written into the score?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is, but not using this method (it uses
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I see, you're right. Remaining question is whether to convert an unknown revision number for header/footer, it might be better to not even try (and print "0" in almost all cases, or some arbitrary and meaningless number between 5710 and 0xfffffe) and just print nothing instead? |
||
| } | ||
|
|
||
| QString ProjectPropertiesModel::apiLevel() const | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.