Round one HTML external applications using QML(Qt5) WebKit2 w/o native bindings

pull/34/head
obscuren 11 years ago
parent a0c97b663d
commit 6d5d539a85
  1. 7
      ethereal/assets/qml/wallet.qml
  2. 16
      ethereal/ui/ui_lib.go

@ -18,11 +18,13 @@ ApplicationWindow {
MenuBar { MenuBar {
Menu { Menu {
title: "File" title: "File"
/*
MenuItem { MenuItem {
text: "Import App" text: "Import App"
shortcut: "Ctrl+o" shortcut: "Ctrl+o"
onTriggered: openAppDialog.open() onTriggered: openAppDialog.open()
} }
*/
} }
Menu { Menu {
@ -240,7 +242,10 @@ ApplicationWindow {
id: openAppDialog id: openAppDialog
title: "Open QML Application" title: "Open QML Application"
onAccepted: { onAccepted: {
ui.open(openAppDialog.fileUrl.toString()) //ui.open(openAppDialog.fileUrl.toString())
//ui.openHtml(Qt.resolvedUrl(ui.assetPath("test.html")))
ui.openHtml(openAppDialog.fileUrl.toString())
} }
} }

@ -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) { func (ui *UiLib) Connect(button qml.Object) {
if !ui.connected { if !ui.connected {
ui.eth.Start() ui.eth.Start()

Loading…
Cancel
Save