plugeth/ui/qt/filter.go

39 lines
689 B
Go
Raw Normal View History

package qt
import (
"fmt"
2014-12-04 09:28:02 +00:00
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/ui"
"gopkg.in/qml.v1"
)
2014-12-04 09:28:02 +00:00
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
}
2014-12-04 09:28:02 +00:00
func makeAltered(v interface{}) (d []core.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
}