Skip to content

Commit

Permalink
Darkmode
Browse files Browse the repository at this point in the history
  • Loading branch information
laurent committed Dec 13, 2022
1 parent 2ca4014 commit 801fc73
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 33 deletions.
16 changes: 16 additions & 0 deletions soloanalyser/NiceLabel.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import QtQuick 2.9
import QtQuick.Controls 2.2

/**
* 1.0: Only setting the right color in the darkmode
*/
Label {
id: control
color: sysActivePalette.text

SystemPalette {
id: sysActivePalette;
colorGroup: SystemPalette.Active
}

}
23 changes: 22 additions & 1 deletion soloanalyser/NiceRadioButton.qml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import QtQuick 2.9
import QtQuick.Controls 2.2

/**
* 1.0: initial
* 1.1: tweak colours in dark mode
*/
RadioButton {
id: control
id: control

width: 200

indicator: Rectangle {
implicitWidth: 20
implicitHeight: 20
Expand All @@ -21,4 +28,18 @@ RadioButton {
visible: control.checked
}
}

contentItem: Text {
text: control.text
font: control.font
opacity: enabled ? 1.0 : 0.3
color: sysActivePalette.text
verticalAlignment: Text.AlignVCenter
leftPadding: control.indicator.width + control.spacing
}

SystemPalette {
id: sysActivePalette;
colorGroup: SystemPalette.Active
}
}
35 changes: 27 additions & 8 deletions soloanalyser/SmallCheckBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,25 @@ import QtQuick 2.9
import QtQuick.Controls 2.2

/**
* 1.1: set default leftPadding to 0 and stop adding 2 at the left of the indicator
*/
* 1.1: set default leftPadding to 0 and stop adding 2 at the left of the indicator
* 1.2: tweak colours in dark mode
*/
CheckBox {
id: schk
id: control
property alias boxWidth: box.implicitWidth
leftPadding : 0


indicator: Rectangle {
id: box
implicitWidth: 20
implicitWidth: 18
implicitHeight: implicitWidth
x: schk.leftPadding
x: control.leftPadding
y: parent.height / 2 - height / 2
border.color: "grey"



Item {
id: mainContainer
property var _mw: Math.max(3,box.implicitWidth * 0.2)
Expand All @@ -28,13 +33,12 @@ CheckBox {
Canvas {
id: drawingCanvas
anchors.fill: parent
visible: schk.checked
visible: control.checked
onPaint: {
var ctx = getContext("2d");


ctx.lineWidth = Math.max(1.5,box.implicitWidth * 0.05);
ctx.strokeStyle = "black";
ctx.strokeStyle = control.color; //"black";
ctx.beginPath();
ctx.moveTo(0, 0);
ctx.lineTo(drawingCanvas.width, drawingCanvas.height);
Expand All @@ -48,4 +52,19 @@ CheckBox {
}
}
}

contentItem: Text {
text: control.text
font: control.font
opacity: enabled ? 1.0 : 0.3
color: sysActivePalette.text
verticalAlignment: Text.AlignVCenter
leftPadding: control.indicator.width + control.spacing
}

SystemPalette {
id: sysActivePalette;
colorGroup: SystemPalette.Active
}

}
45 changes: 21 additions & 24 deletions soloanalyser/soloanalyser-interactive.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,18 @@ import "core.js" as Core
/* - 1.4.3: IgnoreBrackettedChords option
/* - 1.4.4: Don't analyse drum staves
/* - 1.4.5: Port to MuseScore 4.0
/* - 1.4.5: New plugin folder strucutre
/* - 1.4.5: New plugin folder structure
/* - 1.4.6: Darkmode
/**********************************************/

MuseScore {
menuPath: "Plugins.Solo Analyser." + pluginName
description: "Colors and names the notes based on their role if chords/harmonies."
version: "1.4.5"
version: "1.4.6"

readonly property var pluginName: "Interactive"

pluginType: "dialog"
/* //implicitWidth: controls.implictWidth * 1.5
//implicitHeight: controls.implicitHeight
implicitWidth: 900
implicitHeight: 500*/
width: mainRow.childrenRect.width + mainRow.anchors.leftMargin + mainRow.anchors.rightMargin
height: mainRow.childrenRect.height + mainRow.anchors.topMargin + mainRow.anchors.bottomMargin

Expand Down Expand Up @@ -140,8 +137,8 @@ MuseScore {
Layout.fillHeight: true
Layout.fillWidth: true

Label {
text: "Note coloring"
NiceLabel {
text: "Note coloring : "
//Tooltip.text : "Color all notes or only the ones defined by the chord";
Layout.alignment: Qt.AlignLeft
Layout.fillHeight: false
Expand All @@ -164,8 +161,8 @@ MuseScore {

}

Label {
text: "Note name"
NiceLabel {
text: "Note name : "
//Tooltip.text : "Name all notes or only the ones defined by the chord";
Layout.alignment: Qt.AlignLeft
Layout.fillHeight: false
Expand All @@ -188,8 +185,8 @@ MuseScore {

}

Label {
text: "Root:"
NiceLabel {
text: "Root : "
}
Rectangle {
id: rootColorChosser
Expand All @@ -206,8 +203,8 @@ MuseScore {
}
}

Label {
text: "Bass:"
NiceLabel {
text: "Bass : "
}
Rectangle {
id: bassColorChosser
Expand All @@ -224,8 +221,8 @@ MuseScore {
}
}

Label {
text: "Chord:"
NiceLabel {
text: "Chord : "
}
Rectangle {
id: chordColorChosser
Expand All @@ -242,8 +239,8 @@ MuseScore {
}
}

Label {
text: "Altered:"
NiceLabel {
text: "Altered : "
}
Rectangle {
id: alteredColorChosser
Expand All @@ -260,8 +257,8 @@ MuseScore {
}
}

Label {
text: "Scale:"
NiceLabel {
text: "Scale : "
}
Rectangle {
id: scaleColorChosser
Expand All @@ -278,8 +275,8 @@ MuseScore {
}
}

/*Label {
text: "Invalid:"
/*NiceLabel {
text: "Invalid : "
}
Rectangle {
id: errorColorChosser
Expand All @@ -296,8 +293,8 @@ MuseScore {
}
}*/

Label {
text: "Text form"
NiceLabel {
text: "Text form : "
}

NiceComboBox {
Expand Down

0 comments on commit 801fc73

Please sign in to comment.