summaryrefslogtreecommitdiff
path: root/sowatchui
diff options
context:
space:
mode:
Diffstat (limited to 'sowatchui')
-rw-r--r--sowatchui/main.cpp4
-rw-r--r--sowatchui/qml/GroupHeader.qml26
-rw-r--r--sowatchui/qml/MainPage.qml7
-rw-r--r--sowatchui/qml/WatchPage.qml69
-rw-r--r--sowatchui/sowatch_src_inkscape.svgzbin0 -> 8771 bytes
-rw-r--r--sowatchui/watchesmodel.cpp13
-rw-r--r--sowatchui/watchesmodel.h4
7 files changed, 107 insertions, 16 deletions
diff --git a/sowatchui/main.cpp b/sowatchui/main.cpp
index f8c58af..af2a0c0 100644
--- a/sowatchui/main.cpp
+++ b/sowatchui/main.cpp
@@ -1,4 +1,5 @@
#include <QtGui/QApplication>
+#include <QtDeclarative/QtDeclarative>
#include "qmlapplicationviewer.h"
#include <sowatch.h>
@@ -21,6 +22,9 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
qDebug() << "Starting" << watches << endl;
+ qmlRegisterType<sowatch::ConfigKey>();
+ qmlRegisterType<sowatch::GConfKey>("com.javispedro.sowatch", 1, 0, "GConfKey");
+
viewer->rootContext()->setContextProperty("watches", watches);
viewer->rootContext()->setContextProperty("watchScanner", watchScanner);
diff --git a/sowatchui/qml/GroupHeader.qml b/sowatchui/qml/GroupHeader.qml
new file mode 100644
index 0000000..0350ee0
--- /dev/null
+++ b/sowatchui/qml/GroupHeader.qml
@@ -0,0 +1,26 @@
+import QtQuick 1.1
+import com.nokia.meego 1.1
+
+Item {
+ id: header
+ height: 40
+
+ property alias text: headerLabel.text
+
+ Text {
+ id: headerLabel
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ anchors.rightMargin: 8
+ anchors.bottomMargin: 2
+ font: UiConstants.GroupHeaderFont
+ color: theme.inverted ? "#4D4D4D" : "#3C3C3C";
+ }
+ Image {
+ anchors.right: headerLabel.left
+ anchors.left: parent.left
+ anchors.verticalCenter: headerLabel.verticalCenter
+ anchors.rightMargin: 24
+ source: "image://theme/meegotouch-groupheader" + (theme.inverted ? "-inverted" : "") + "-background"
+ }
+}
diff --git a/sowatchui/qml/MainPage.qml b/sowatchui/qml/MainPage.qml
index d722b3d..339b1a6 100644
--- a/sowatchui/qml/MainPage.qml
+++ b/sowatchui/qml/MainPage.qml
@@ -32,10 +32,9 @@ Page {
anchors.verticalCenter: parent.verticalCenter
}
- onClicked: {
- var page = Qt.createComponent("WatchPage.qml");
- pageStack.push(page);
- }
+ onClicked: pageStack.push(Qt.resolvedUrl("WatchPage.qml"),
+ {configKey: model.configKey,
+ configQmlUrl: model.configQmlUrl});
}
}
ScrollDecorator {
diff --git a/sowatchui/qml/WatchPage.qml b/sowatchui/qml/WatchPage.qml
index 8159834..83932eb 100644
--- a/sowatchui/qml/WatchPage.qml
+++ b/sowatchui/qml/WatchPage.qml
@@ -1,6 +1,7 @@
import QtQuick 1.1
import com.nokia.meego 1.1
import com.nokia.extras 1.1
+import com.javispedro.sowatch 1.0
Page {
id: watchPage
@@ -8,6 +9,9 @@ Page {
anchors.rightMargin: UiConstants.DefaultMargin
orientationLock: PageOrientation.LockPortrait
+ property string configKey;
+ property url configQmlUrl;
+
tools: ToolBarLayout {
ToolIcon {
platformIconId: "toolbar-back"
@@ -16,22 +20,65 @@ Page {
}
}
- ListView {
- id: emptyListView
+ GConfKey {
+ id: nameKey
+ key: configKey + "/name"
+ }
+
+ Flickable {
+ id: mainFlickable
anchors.fill: parent
- model: ListModel {
+ contentHeight: mainColumn.height
- }
+ Column {
+ id: mainColumn
+ width: parent.width
+
+ Item {
+ id: enableItem
+ width: parent.width
+ height: UiConstants.ListItemHeightDefault
+
+ Label {
+ text: qsTr("Enabled")
+ font: UiConstants.TitleFont
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ }
+ Switch {
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ checked: true
+ }
+ }
+
+ GroupHeader {
+ width: parent.width
+ text: "Watch settings"
+ visible: configQmlLoader.status === Loader.Ready
+ }
+
+ Loader {
+ id: configQmlLoader
+ source: configQmlUrl
+ width: parent.width
+ onLoaded: item.configKey = configKey;
+ }
+
+ GroupHeader {
+ width: parent.width
+ text: "Watchlets"
+ visible: configQmlLoader.status === Loader.Ready
+ }
- delegate: ListDelegate {
- Image {
- source: "image://theme/icon-m-common-drilldown-arrow" + (theme.inverted ? "-inverse" : "")
- anchors.right: parent.right;
- anchors.verticalCenter: parent.verticalCenter
- }
+ GroupHeader {
+ width: parent.width
+ text: "Notification sources"
+ visible: configQmlLoader.status === Loader.Ready
+ }
}
}
ScrollDecorator {
- flickableItem: watchesListView
+ flickableItem: mainFlickable
}
}
diff --git a/sowatchui/sowatch_src_inkscape.svgz b/sowatchui/sowatch_src_inkscape.svgz
new file mode 100644
index 0000000..ea0ee94
--- /dev/null
+++ b/sowatchui/sowatch_src_inkscape.svgz
Binary files differ
diff --git a/sowatchui/watchesmodel.cpp b/sowatchui/watchesmodel.cpp
index 5644466..c45a229 100644
--- a/sowatchui/watchesmodel.cpp
+++ b/sowatchui/watchesmodel.cpp
@@ -14,6 +14,8 @@ WatchesModel::WatchesModel(QObject *parent) :
roles[Qt::DisplayRole] = QByteArray("title");
roles[Qt::StatusTipRole] = QByteArray("subtitle");
roles[ObjectRole] = QByteArray("object");
+ roles[ConfigKeyRole] = QByteArray("configKey");
+ roles[ConfigQmlUrlRole] = QByteArray("configQmlUrl");
setRoleNames(roles);
connect(_config, SIGNAL(changed()),
@@ -57,6 +59,17 @@ QVariant WatchesModel::data(const QModelIndex &index, int role) const
} else {
return QVariant(tr("Disabled"));
}
+ case ConfigKeyRole:
+ return QVariant::fromValue(key);
+ case ConfigQmlUrlRole:
+ if (config->isSet("driver")) {
+ QString driver = config->value("driver").toString();
+ WatchPluginInterface *plugin = Registry::registry()->getWatchPlugin(driver);
+ if (plugin) {
+ return QVariant::fromValue(plugin->getConfigQmlUrl(driver));
+ }
+ }
+ return QVariant::fromValue(QUrl());
}
return QVariant();
}
diff --git a/sowatchui/watchesmodel.h b/sowatchui/watchesmodel.h
index 4962725..396fc8d 100644
--- a/sowatchui/watchesmodel.h
+++ b/sowatchui/watchesmodel.h
@@ -15,7 +15,9 @@ public:
~WatchesModel();
enum DataRoles {
- ObjectRole = Qt::UserRole
+ ObjectRole = Qt::UserRole,
+ ConfigKeyRole,
+ ConfigQmlUrlRole
};
int rowCount(const QModelIndex &parent) const;