2014-10-18 06:20:06 -05:00
|
|
|
package qt
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2014-10-31 04:59:17 -05:00
|
|
|
"github.com/ethereum/go-ethereum/chain"
|
2014-10-23 08:01:27 -05:00
|
|
|
"github.com/ethereum/go-ethereum/ui"
|
2014-10-18 06:20:06 -05:00
|
|
|
"gopkg.in/qml.v1"
|
|
|
|
)
|
|
|
|
|
2014-10-31 04:59:17 -05:00
|
|
|
func NewFilterFromMap(object map[string]interface{}, eth chain.EthManager) *chain.Filter {
|
2014-10-18 06:20:06 -05:00
|
|
|
filter := ui.NewFilterFromMap(object, eth)
|
|
|
|
|
|
|
|
if object["altered"] != nil {
|
|
|
|
filter.Altered = makeAltered(object["altered"])
|
|
|
|
}
|
|
|
|
|
|
|
|
return filter
|
|
|
|
}
|
|
|
|
|
2014-10-31 04:59:17 -05:00
|
|
|
func makeAltered(v interface{}) (d []chain.AccountChange) {
|
2014-10-18 06:20:06 -05:00
|
|
|
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
|
|
|
|
}
|