From 19deb2fc36965266c3dab843923487548562477b Mon Sep 17 00:00:00 2001 From: Louis-Joseph Fournier Date: Sat, 9 Jan 2016 00:01:37 +0100 Subject: [PATCH] Configure page code in progress --- qml/ConfigurePageSailfish.qml | 45 ++++++++++++++++++++++++++++++++--- qml/Sailfish.qml | 5 ++-- qml/sailfish.qrc | 4 +++- src/sailfish.cpp | 1 + 4 files changed, 49 insertions(+), 6 deletions(-) diff --git a/qml/ConfigurePageSailfish.qml b/qml/ConfigurePageSailfish.qml index 42356f1..4a05fb4 100644 --- a/qml/ConfigurePageSailfish.qml +++ b/qml/ConfigurePageSailfish.qml @@ -18,12 +18,15 @@ import QtQuick 2.0 import Sailfish.Silica 1.0 -import ".." // Config singleton +import "." // Config singleton Dialog { id: configurePage allowedOrientations: Orientation.All + signal configChanged() + + property QtObject tuner; property variant la_tab: [392, 400, 415, 430, 440, 442] Column { @@ -52,17 +55,53 @@ Dialog { model: la_tab.length Rectangle { - width: pre_la_parent.width / tab_la.length + width: pre_la_parent.width / la_tab.length border.color: Theme.primaryColor border.width: 1 + color: la.text == la_tab[parent.index] ? Theme.highlightColor : "transparent" Text { + id: la_freq font.pixelSize: Theme.fontSizeSmall text: tab_la[parent.index] - onClick: la.text = text + } + MouseArea { + anchors.fill: parent + onClicked: la.text = la_freq.text } } } } + + /// temperaments + ComboBox { + id: combo + width: parent.width + label: qsTr("Temperament") + currentIndex: Config.temperament_idx + property variant temp_list: tuner.temperament_list + + menu: ContextMenu { + Repeater { + model: combo.temp_list.length + + MenuItem { + text: combo.temp_list[index] + } + } + } + } + + TextSwitch { + id: notes_style + text: qsTr("French notes") + down: Config.note_style == 1 + } + } + onAccepted: { + Config.la = la.text + Config.temperament_idx = combo.currentIndex + Config.notes_style = notes_style.checked ? 1 : 0 + configChanged() } } diff --git a/qml/Sailfish.qml b/qml/Sailfish.qml index 9cd2f26..5b947c8 100644 --- a/qml/Sailfish.qml +++ b/qml/Sailfish.qml @@ -54,8 +54,8 @@ ApplicationWindow { MenuItem { text: qsTr("Configuration") onClicked: { - var confpage = pageStack.push(Qt.resolvedUrl("ConfigurePage.qml")) - confpage.accepted.connect(saver.save) + var confpage = pageStack.push(Qt.resolvedUrl("ConfigurePageSailfish.qml"), { tuner: app.tuner }) + confpage.configChanged.connect(saver.save) } } } @@ -70,6 +70,7 @@ ApplicationWindow { onClicked: togglePause() } } + } Tuner { diff --git a/qml/sailfish.qrc b/qml/sailfish.qrc index 3e0008b..9e64aff 100644 --- a/qml/sailfish.qrc +++ b/qml/sailfish.qrc @@ -7,6 +7,8 @@ ScaleToise.qml Toise.qml Led.qml -ConfigurePage.qml +ConfigurePageSailfish.qml +Config.qml +qmldir diff --git a/src/sailfish.cpp b/src/sailfish.cpp index f0239dd..9182442 100644 --- a/src/sailfish.cpp +++ b/src/sailfish.cpp @@ -19,6 +19,7 @@ #include #include #include +#include "ObjectSaver.hpp" #include "Tuner.hpp" class Main {