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" color: "#CCCCCC"
} }
WebView { ScrollView {
objectName: "webView"
id: webview
anchors { anchors {
left: parent.left left: parent.left
right: parent.right right: parent.right
bottom: parent.bottom bottom: parent.bottom
top: divider.bottom top: divider.bottom
} }
WebView {
objectName: "webView"
id: webview
anchors.fill: parent
function injectJs(js) { function injectJs(js) {
webview.experimental.navigatorQtObjectEnabled = true; webview.experimental.navigatorQtObjectEnabled = true;
@ -172,9 +174,22 @@ Rectangle {
webview.experimental.postMessage(JSON.stringify(data)) webview.experimental.postMessage(JSON.stringify(data))
} }
Component.onCompleted: {
for (var i in experimental.preferences) {
console.log(i)
}
}
experimental.preferences.javascriptEnabled: true 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.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 { experimental.itemSelector: MouseArea {
// To avoid conflicting with ListView.model when inside Initiator context. // To avoid conflicting with ListView.model when inside Initiator context.
property QtObject selectorModel: model property QtObject selectorModel: model
@ -202,9 +217,6 @@ Rectangle {
itemSelector.popup() 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.userScripts: ["../ext/q.js", "../ext/ethereum.js/lib/web3.js", "../ext/ethereum.js/lib/qt.js", "../ext/setup.js"]
experimental.onMessageReceived: { experimental.onMessageReceived: {
console.log("[onMessageReceived]: ", message.data) console.log("[onMessageReceived]: ", message.data)
@ -446,6 +458,7 @@ Rectangle {
postEvent(ev, [storageObject.address, storageObject.value]) postEvent(ev, [storageObject.address, storageObject.value])
} }
} }
}
Rectangle { Rectangle {

View File

@ -312,10 +312,11 @@ func (self *UiLib) ToAscii(data string) string {
} }
/// Ethereum filter methods /// 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 := qt.NewFilterFromMap(object, self.eth)
filter.MessageCallback = func(messages state.Messages) { 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) id = self.filterManager.InstallFilter(filter)
return id return id