Skip to content
Snippets Groups Projects
Commit b1974f03 authored by SeeLook's avatar SeeLook
Browse files

Implemented clef switching (simplest way so far, no staff implementation yet),...

Implemented clef switching (simplest way so far, no staff implementation yet), clef is separate QML file
parent 293a6fdb
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,7 @@
Tclef::EclefType Tclef::defaultType = Tclef::Treble_G;
QString Tclef::name() {
QString Tclef::name() const {
switch(m_type) {
case Treble_G:
return QApplication::translate("Tclef", "treble");
......@@ -47,7 +47,7 @@ QString Tclef::name() {
}
QString Tclef::desc() {
QString Tclef::desc() const {
switch(m_type) {
case Treble_G:
return QApplication::translate("Tclef", "clef G");
......
......@@ -33,6 +33,8 @@ class NOOTKACORE_EXPORT Tclef
{
Q_GADGET
Q_PROPERTY(EclefType type READ type WRITE setClef)
public:
enum EclefType {
NoClef = 0, /**< clef not defined */
......@@ -48,12 +50,14 @@ public:
Q_ENUM(EclefType)
Tclef(EclefType type = Treble_G) : m_type(type) {}
Tclef(const Tclef& other) { m_type = other.type(); }
~Tclef() {}
EclefType type() { return m_type; }
EclefType type() const { return m_type; }
void setClef(EclefType type) { m_type = type; }
QString name(); // short name of a clef
QString desc(); // a clef description
Q_INVOKABLE QString name() const; // short name of a clef
Q_INVOKABLE QString desc() const; // a clef description
/**
* Adds 'clef' key to XML stream compatible with MusicXML format with current clef
......@@ -74,5 +78,6 @@ private:
};
Q_DECLARE_METATYPE(Tclef)
#endif // TCLEF_H
......@@ -13,6 +13,7 @@
<file alias="Score.qml">qml/score/Score.qml</file>
<file alias="Staff.qml">qml/score/Staff.qml</file>
<file alias="Clef.qml">qml/score/Clef.qml</file>
<file alias="NoteSegment.qml">qml/score/NoteSegment.qml</file>
<file alias="TaboutNootka.qml">qml/about/TaboutNootka.qml</file>
......
......@@ -22,7 +22,6 @@ import QtQuick.Layouts 1.3
import QtQuick.Window 2.0
ApplicationWindow {
id: nootkaWindow
visible: true
......
......@@ -23,7 +23,6 @@ import QtGraphicalEffects 1.0
Item {
id: nootkaLabel
property alias version: versText.text
property color bgColor: "white"
property alias active: mouseArea.hoverEnabled
......@@ -48,11 +47,11 @@ Item {
}
Text {
id: versText
y: nootkaLabel.height * 0.72
anchors.horizontalCenter: logo.horizontalCenter
font.pixelSize: nootkaLabel.height * 0.2
color: bgColor
text: Noo.version()
}
MouseArea {
......
......@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
......@@ -68,7 +67,6 @@ ToolBar {
Item { Layout.fillWidth: true }
}
NootkaLabel {
version: "1.5.0-alpha"
anchors.right: parent.right
onClicked: toolBar.about()
}
......
/***************************************************************************
* Copyright (C) 2017 by Tomasz Bojczuk *
* seelook@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
import QtQuick 2.7
import QtQuick.Controls 2.0
import Score 1.0
Text {
id: clef
property int type: Tclef.Treble_G
property bool readOnly: false
x: 0.5
y: 5
text: "\ue050"
font { family: "Scorek"; pixelSize: 8 }
color: activPal.text
Drawer {
id: clefDrawer
width: nootkaWindow.width / 4
height: nootkaWindow.height
Column {
width: parent.width
spacing: 10
Button { text: Noo.clef(Tclef.Treble_G).name(); width: parent.width; onClicked: clefClicked(Tclef.Treble_G) }
Button { text: Noo.clef(Tclef.Treble_G_8down).name(); width: parent.width; onClicked: clefClicked(Tclef.Treble_G_8down) }
Button { text: Noo.clef(Tclef.Bass_F).name(); width: parent.width; onClicked: clefClicked(Tclef.Bass_F) }
Button { text: Noo.clef(Tclef.Bass_F_8down).name(); width: parent.width; onClicked: clefClicked(Tclef.Bass_F_8down) }
Button { text: Noo.clef(Tclef.Alto_C).name(); width: parent.width; onClicked: clefClicked(Tclef.Alto_C) }
Button { text: Noo.clef(Tclef.Tenor_C).name(); width: parent.width; onClicked: clefClicked(Tclef.Tenor_C) }
Button { text: Noo.clef(Tclef.PianoStaffClefs).name(); width: parent.width; onClicked: clefClicked(Tclef.PianoStaffClefs) }
}
}
MouseArea {
anchors.fill: parent
enabled: !readOnly
onClicked: {
clefDrawer.open()
}
}
onTypeChanged: {
if (clef.type === Tclef.PianoStaffClefs) {
console.log("Piano clef not supported yet")
return
}
switch (clef.type) {
case Tclef.Treble_G:
clef.y = 5; text = "\ue050"
break;
case Tclef.Treble_G_8down:
clef.y = 5; text = "\ue052"
break;
case Tclef.Bass_F:
clef.y = 1; text = "\ue062"
break;
case Tclef.Bass_F_8down:
clef.y = 1; text = "\ue064"
break;
case Tclef.Alto_C:
clef.y = 3; text = "\ue05c"
break;
case Tclef.Tenor_C:
clef.y = 1; text = "\ue05c"
break;
}
}
function clefClicked(c) {
clef.type = c
clefDrawer.close()
}
}
......@@ -19,10 +19,13 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import Score 1.0
Flickable {
id: score
property int clef: Tclef.Treble_G_8down
property alias bgColor: bgRect.color
width: parent.width
......@@ -38,7 +41,13 @@ Flickable {
Column {
Staff {
id: staff0
number: 0
clef.type: score.clef
clef.onTypeChanged: {
// TODO: approve clef for all staves
}
}
}
}
......@@ -19,10 +19,14 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import Score 1.0
Item {
id: staff
property alias clef: clef
property real linesCount: 40
property int number: -1
property real upperLine: 16.0
......@@ -43,13 +47,11 @@ Item {
}
}
Text {
id: clef
x: 0.5
y: 5
text: "\ue050"
font { family: "Scorek"; pixelSize: 8 }
color: activPal.text
Clef {
id: clef
onTypeChanged: {
// TODO: approve clef change to the notes
}
}
Text { // staff number
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment