Skip to content

Commit bba7f01

Browse files
Jojo-Schmitzlasconic
authored andcommitted
Port to MuseScore 3.x
1 parent 3182e2d commit bba7f01

File tree

2 files changed

+23
-73
lines changed

2 files changed

+23
-73
lines changed

blacknotes.js

Lines changed: 0 additions & 67 deletions
This file was deleted.

blacknotes.qml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//
55
// Copyright (C)2010 Nicolas Froment (lasconic)
66
// Copyright (C)2014 Jörn Eichler (heuchi)
7-
// Copyright (C)2012-2015 Joachim Schmitz (Jojo-Schmitz)
7+
// Copyright (C)2012-2019 Joachim Schmitz (Jojo-Schmitz)
88
//
99
// This program is free software; you can redistribute it and/or modify
1010
// it under the terms of the GNU General Public License version 2.
@@ -19,14 +19,25 @@
1919
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2020
//=============================================================================
2121

22-
import QtQuick 2.2
23-
import MuseScore 1.0
22+
import QtQuick 2.9
23+
import QtQuick.Dialogs 1.2
24+
import MuseScore 3.0
2425

2526
MuseScore {
26-
version: "1.0"
27+
version: "3.0"
2728
description: "This plugin paints all chords and rests in black"
2829
menuPath: "Plugins.Notes.Color Notes in Black"
2930

31+
MessageDialog {
32+
id: versionError
33+
visible: false
34+
title: qsTr("Unsupported MuseScore Version")
35+
text: qsTr("This plugin needs MuseScore 3.0.2 or later")
36+
onAccepted: {
37+
Qt.quit()
38+
}
39+
}
40+
3041
function blackenElement(element) {
3142
if (element.type == Element.REST)
3243
element.color = "black"
@@ -40,7 +51,7 @@ MuseScore {
4051
if (element.stemSlash)
4152
element.stemSlash.color = "black"
4253
}
43-
else if (element.type == Element.NOTE) {
54+
else if (element.type == Element.NOTE) {
4455
element.color = "black"
4556
if (element.accidental)
4657
element.accidental.color = "black"
@@ -49,6 +60,8 @@ MuseScore {
4960
element.dots[i].color = "black"
5061
}
5162
}
63+
else
64+
console.log("Unknown element type: " + element.type)
5265
}
5366

5467
// Apply the given function to all chords and rests in selection
@@ -116,7 +129,11 @@ MuseScore {
116129
}
117130

118131
onRun: {
119-
if (typeof curScore !== 'undefined')
132+
console.log("Hello, Black Notes")
133+
// check MuseScore version
134+
if (mscoreMajorVersion == 3 && mscoreMinorVersion == 0 && mscoreUpdateVersion <= 1)
135+
versionError.open()
136+
else
120137
applyToChordsAndRestsInSelection(blackenElement)
121138
Qt.quit();
122139
}

0 commit comments

Comments
 (0)