Updated browser & pass view to callback function

This commit is contained in:
obscuren 2015-01-22 00:24:20 +01:00
parent 87f50659db
commit 465b0a79d8
2 changed files with 303 additions and 289 deletions

View File

@ -152,15 +152,17 @@ Rectangle {
color: "#CCCCCC"
}
WebView {
objectName: "webView"
id: webview
ScrollView {
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
top: divider.bottom
}
WebView {
objectName: "webView"
id: webview
anchors.fill: parent
function injectJs(js) {
webview.experimental.navigatorQtObjectEnabled = true;
@ -172,9 +174,22 @@ Rectangle {
webview.experimental.postMessage(JSON.stringify(data))
}
Component.onCompleted: {
for (var i in experimental.preferences) {
console.log(i)
}
}
experimental.preferences.javascriptEnabled: true
experimental.preferences.webAudioEnabled: true
experimental.preferences.pluginsEnabled: true
experimental.preferences.navigatorQtObjectEnabled: true
experimental.preferences.developerExtrasEnabled: true
experimental.preferences.webGLEnabled: true
experimental.preferences.notificationsEnabled: true
experimental.preferences.localStorageEnabled: true
experimental.userAgent:"Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Mist/0.1 Safari/537.36"
experimental.itemSelector: MouseArea {
// To avoid conflicting with ListView.model when inside Initiator context.
property QtObject selectorModel: model
@ -202,9 +217,6 @@ Rectangle {
itemSelector.popup()
}
}
experimental.preferences.webAudioEnabled: true
experimental.preferences.navigatorQtObjectEnabled: true
experimental.preferences.developerExtrasEnabled: true
experimental.userScripts: ["../ext/q.js", "../ext/ethereum.js/lib/web3.js", "../ext/ethereum.js/lib/qt.js", "../ext/setup.js"]
experimental.onMessageReceived: {
console.log("[onMessageReceived]: ", message.data)
@ -446,6 +458,7 @@ Rectangle {
postEvent(ev, [storageObject.address, storageObject.value])
}
}
}
Rectangle {

View File

@ -312,10 +312,11 @@ func (self *UiLib) ToAscii(data string) string {
}
/// Ethereum filter methods
func (self *UiLib) NewFilter(object map[string]interface{}) (id int) {
func (self *UiLib) NewFilter(object map[string]interface{}, view *qml.Common) (id int) {
filter := qt.NewFilterFromMap(object, self.eth)
filter.MessageCallback = func(messages state.Messages) {
self.win.Root().Call("invokeFilterCallback", xeth.ToJSMessages(messages), id)
view.Call("messages", xeth.ToJSMessages(messages), id)
//self.win.Root().Call("invokeFilterCallback", xeth.ToJSMessages(messages), id)
}
id = self.filterManager.InstallFilter(filter)
return id