From 6d5d539a859cae43a1e97acd6fc5675d45b09063 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 21 Apr 2014 00:57:57 +0200 Subject: [PATCH] Round one HTML external applications using QML(Qt5) WebKit2 w/o native bindings --- ethereal/assets/qml/wallet.qml | 7 ++++++- ethereal/ui/ui_lib.go | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 37224c7b4..ed06f3518 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -18,11 +18,13 @@ ApplicationWindow { MenuBar { Menu { title: "File" + /* MenuItem { text: "Import App" shortcut: "Ctrl+o" onTriggered: openAppDialog.open() } + */ } Menu { @@ -240,7 +242,10 @@ ApplicationWindow { id: openAppDialog title: "Open QML Application" onAccepted: { - ui.open(openAppDialog.fileUrl.toString()) + //ui.open(openAppDialog.fileUrl.toString()) + //ui.openHtml(Qt.resolvedUrl(ui.assetPath("test.html"))) + ui.openHtml(openAppDialog.fileUrl.toString()) + } } diff --git a/ethereal/ui/ui_lib.go b/ethereal/ui/ui_lib.go index 95743fa5d..096af16db 100644 --- a/ethereal/ui/ui_lib.go +++ b/ethereal/ui/ui_lib.go @@ -51,6 +51,22 @@ func (ui *UiLib) Open(path string) { }() } +func (ui *UiLib) OpenHtml(path string) { + component, err := ui.engine.LoadFile(ui.AssetPath("qml/webapp.qml")) + if err != nil { + ethutil.Config.Log.Debugln(err) + + return + } + win := component.CreateWindow(nil) + win.Set("url", path) + + go func() { + win.Show() + win.Wait() + }() +} + func (ui *UiLib) Connect(button qml.Object) { if !ui.connected { ui.eth.Start()