plugeth/ui/qt/filter.go
obscuren e3da85faed Implemented filter for ws + fixes
* proper 0xhex
* filters fixed
* start of filter manager
* accounts for ws. Closes #246
2015-01-10 00:51:56 +01:00

34 lines
646 B
Go

package qt
import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/ui"
"gopkg.in/qml.v1"
)
func NewFilterFromMap(object map[string]interface{}, eth core.EthManager) *core.Filter {
filter := ui.NewFilterFromMap(object, eth)
if object["altered"] != nil {
filter.Altered = makeAltered(object["altered"])
}
return filter
}
func makeAltered(v interface{}) (d []core.AccountChange) {
if qList, ok := v.(*qml.List); ok {
var s []interface{}
qList.Convert(&s)
d = makeAltered(s)
} else if qMap, ok := v.(*qml.Map); ok {
var m map[string]interface{}
qMap.Convert(&m)
d = makeAltered(m)
}
return
}