From bc5b70046e84c6e5a33a19bd2e64e626fdf0579e Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Thu, 9 Aug 2012 18:50:23 +0200 Subject: first UI editable settings! --- metawatch/metawatch.pro | 2 +- metawatch/metawatchplugin.cpp | 9 +++++ metawatch/metawatchplugin.h | 7 ++-- metawatch/qml/metawatch-digital-config.qml | 55 ++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 metawatch/qml/metawatch-digital-config.qml (limited to 'metawatch') diff --git a/metawatch/metawatch.pro b/metawatch/metawatch.pro index 9331665..721380d 100644 --- a/metawatch/metawatch.pro +++ b/metawatch/metawatch.pro @@ -33,7 +33,7 @@ FORMS += \ metawatchsimulatorform.ui res_files.files += res/graphics res/fonts -qml_files.files += qml/com +qml_files.files += qml/com qml/metawatch-digital-config.qml LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch diff --git a/metawatch/metawatchplugin.cpp b/metawatch/metawatchplugin.cpp index 72713ec..f73c127 100644 --- a/metawatch/metawatchplugin.cpp +++ b/metawatch/metawatchplugin.cpp @@ -39,6 +39,15 @@ WatchScanner* MetaWatchPlugin::getScanner(QObject *parent) return new MetaWatchScanner(parent); } +QUrl MetaWatchPlugin::getConfigQmlUrl(const QString &driver) +{ + if (driver == "metawatch-digital") { + return QUrl::fromLocalFile(SOWATCH_QML_DIR "/metawatch-digital-config.qml"); + } else { + return QUrl(); + } +} + Watch* MetaWatchPlugin::getWatch(const QString& driver, ConfigKey* settings, QObject *parent) { if (driver == "metawatch-digital") { diff --git a/metawatch/metawatchplugin.h b/metawatch/metawatchplugin.h index 964aa04..5b729f2 100644 --- a/metawatch/metawatchplugin.h +++ b/metawatch/metawatchplugin.h @@ -14,9 +14,10 @@ public: MetaWatchPlugin(); ~MetaWatchPlugin(); - virtual QStringList drivers(); - virtual WatchScanner* getScanner(QObject *parent); - virtual Watch* getWatch(const QString& driver, ConfigKey *settings, QObject *parent); + QStringList drivers(); + WatchScanner* getScanner(QObject *parent); + QUrl getConfigQmlUrl(const QString &driver); + Watch* getWatch(const QString& driver, ConfigKey *settings, QObject *parent); private: static bool fontsLoaded; diff --git a/metawatch/qml/metawatch-digital-config.qml b/metawatch/qml/metawatch-digital-config.qml new file mode 100644 index 0000000..f0f2e91 --- /dev/null +++ b/metawatch/qml/metawatch-digital-config.qml @@ -0,0 +1,55 @@ +import QtQuick 1.1 +import com.nokia.meego 1.1 +import com.javispedro.sowatch 1.0 + +Column { + property string configKey; + + Item { + id: hourModeItem + width: parent.width + height: UiConstants.ListItemHeightDefault + + GConfKey { + id: hourModeKey + key: configKey + "/24h-mode" + value: hourModeSwitch.checked + } + Label { + text: qsTr("24-hour clock mode") + font: UiConstants.TitleFont + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + } + Switch { + id: hourModeSwitch + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + checked: hourModeKey.value + } + } + + Item { + id: dayMonthOrderItem + width: parent.width + height: UiConstants.ListItemHeightDefault + + GConfKey { + id: dayMonthOrderKey + key: configKey + "/day-month-order" + value: dayMonthOrderSwitch.checked + } + Label { + text: qsTr("Use DD/MM instead of MM/DD") + font: UiConstants.TitleFont + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + } + Switch { + id: dayMonthOrderSwitch + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + checked: dayMonthOrderKey.value + } + } +} -- cgit v1.2.3