aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-10-18 19:20:06 +0800
committerobscuren <geffobscura@gmail.com>2014-10-18 19:20:06 +0800
commitd2bb83833ffadc91d128a1833853ec3240b8c824 (patch)
treed73b32a16971da3a3a413f8acd6e01bff0fa25fa /ui/qt
parent70a00d602e38e4a2dc1658d483192165c3e479b8 (diff)
downloadgo-tangerine-d2bb83833ffadc91d128a1833853ec3240b8c824.tar
go-tangerine-d2bb83833ffadc91d128a1833853ec3240b8c824.tar.gz
go-tangerine-d2bb83833ffadc91d128a1833853ec3240b8c824.tar.bz2
go-tangerine-d2bb83833ffadc91d128a1833853ec3240b8c824.tar.lz
go-tangerine-d2bb83833ffadc91d128a1833853ec3240b8c824.tar.xz
go-tangerine-d2bb83833ffadc91d128a1833853ec3240b8c824.tar.zst
go-tangerine-d2bb83833ffadc91d128a1833853ec3240b8c824.zip
Moved Filter's wrapping functions to their own util package. Fixes #61
* CLI ethereum should no longer require the Qt/QML package
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/filter.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/ui/qt/filter.go b/ui/qt/filter.go
new file mode 100644
index 000000000..86a34f37b
--- /dev/null
+++ b/ui/qt/filter.go
@@ -0,0 +1,38 @@
+package qt
+
+import (
+ "fmt"
+
+ "github.com/ethereum/eth-go/ethchain"
+ "github.com/ethereum/eth-go/ui"
+ "gopkg.in/qml.v1"
+)
+
+func NewFilterFromMap(object map[string]interface{}, eth ethchain.EthManager) *ethchain.Filter {
+ filter := ui.NewFilterFromMap(object, eth)
+
+ if object["altered"] != nil {
+ filter.Altered = makeAltered(object["altered"])
+ }
+
+ return filter
+}
+
+func makeAltered(v interface{}) (d []ethchain.AccountChange) {
+ if qList, ok := v.(*qml.List); ok {
+ var s []interface{}
+ qList.Convert(&s)
+
+ fmt.Println(s)
+
+ d = makeAltered(s)
+ } else if qMap, ok := v.(*qml.Map); ok {
+ var m map[string]interface{}
+ qMap.Convert(&m)
+ fmt.Println(m)
+
+ d = makeAltered(m)
+ }
+
+ return
+}