remove jsre from mist
This commit is contained in:
parent
da44097800
commit
31ffca6d8a
@ -12,7 +12,7 @@ import "../ext/http.js" as Http
|
||||
|
||||
ApplicationWindow {
|
||||
id: root
|
||||
|
||||
|
||||
//flags: Qt.FramelessWindowHint
|
||||
// Use this to make the window frameless. But then you'll need to do move and resize by hand
|
||||
|
||||
@ -53,7 +53,7 @@ ApplicationWindow {
|
||||
whisperTab.view.url = "http://ethereum-dapp-whisper-client.meteor.com/";
|
||||
whisperTab.menuItem.title = "Whisper Chat";
|
||||
*/
|
||||
addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "legacy"});
|
||||
addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "legacy"});
|
||||
addPlugin("./views/transaction.qml", {noAdd: true, close: false, section: "legacy"});
|
||||
addPlugin("./views/whisper.qml", {noAdd: true, close: false, section: "legacy"});
|
||||
addPlugin("./views/chain.qml", {noAdd: true, close: false, section: "legacy"});
|
||||
@ -126,7 +126,7 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
function newBrowserTab(url) {
|
||||
|
||||
|
||||
var urlMatches = url.toString().match(/^[a-z]*\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);
|
||||
var requestedDomain = urlMatches && urlMatches[1];
|
||||
|
||||
@ -138,17 +138,17 @@ ApplicationWindow {
|
||||
var existingDomain = matches && matches[1];
|
||||
if (requestedDomain == existingDomain) {
|
||||
domainAlreadyOpen = true;
|
||||
|
||||
|
||||
if (mainSplit.views[i].view.url != url){
|
||||
mainSplit.views[i].view.url = url;
|
||||
}
|
||||
|
||||
|
||||
activeView(mainSplit.views[i].view, mainSplit.views[i].menuItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!domainAlreadyOpen) {
|
||||
if (!domainAlreadyOpen) {
|
||||
var window = addPlugin("./views/browser.qml", {noAdd: true, close: true, section: "apps", active: true});
|
||||
window.view.url = url;
|
||||
window.menuItem.title = "Mist";
|
||||
@ -158,105 +158,6 @@ ApplicationWindow {
|
||||
|
||||
|
||||
|
||||
menuBar: MenuBar {
|
||||
Menu {
|
||||
title: "File"
|
||||
MenuItem {
|
||||
text: "New tab"
|
||||
shortcut: "Ctrl+t"
|
||||
onTriggered: {
|
||||
activeView(catalog.view, catalog.menuItem);
|
||||
}
|
||||
}
|
||||
|
||||
MenuSeparator {}
|
||||
|
||||
MenuItem {
|
||||
text: "Import key"
|
||||
shortcut: "Ctrl+i"
|
||||
onTriggered: {
|
||||
generalFileDialog.show(true, function(path) {
|
||||
gui.importKey(path)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Export keys"
|
||||
shortcut: "Ctrl+e"
|
||||
onTriggered: {
|
||||
generalFileDialog.show(false, function(path) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Generate key"
|
||||
shortcut: "Ctrl+k"
|
||||
onTriggered: gui.generateKey()
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
title: "Developer"
|
||||
MenuItem {
|
||||
text: "Import Tx"
|
||||
onTriggered: {
|
||||
txImportDialog.visible = true
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Run JS file"
|
||||
onTriggered: {
|
||||
generalFileDialog.show(true, function(path) {
|
||||
eth.evalJavascriptFile(path)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Dump state"
|
||||
onTriggered: {
|
||||
generalFileDialog.show(false, function(path) {
|
||||
// Empty hash for latest
|
||||
gui.dumpState("", path)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
MenuSeparator {}
|
||||
}
|
||||
|
||||
Menu {
|
||||
title: "Network"
|
||||
MenuItem {
|
||||
text: "Add Peer"
|
||||
shortcut: "Ctrl+p"
|
||||
onTriggered: {
|
||||
addPeerWin.visible = true
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: "Show Peers"
|
||||
shortcut: "Ctrl+e"
|
||||
onTriggered: {
|
||||
peerWindow.visible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
title: "Help"
|
||||
MenuItem {
|
||||
text: "About"
|
||||
onTriggered: {
|
||||
aboutWin.visible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
property var blockModel: ListModel {
|
||||
id: blockModel
|
||||
@ -313,28 +214,28 @@ ApplicationWindow {
|
||||
Layout.minimumWidth: 192
|
||||
Layout.maximumWidth: 192
|
||||
|
||||
FontLoader {
|
||||
FontLoader {
|
||||
id: sourceSansPro
|
||||
source: "fonts/SourceSansPro-Regular.ttf"
|
||||
source: "fonts/SourceSansPro-Regular.ttf"
|
||||
}
|
||||
FontLoader {
|
||||
source: "fonts/SourceSansPro-Semibold.ttf"
|
||||
}
|
||||
FontLoader {
|
||||
source: "fonts/SourceSansPro-Bold.ttf"
|
||||
}
|
||||
FontLoader {
|
||||
source: "fonts/SourceSansPro-Black.ttf"
|
||||
}
|
||||
FontLoader {
|
||||
source: "fonts/SourceSansPro-Light.ttf"
|
||||
}
|
||||
FontLoader {
|
||||
source: "fonts/SourceSansPro-ExtraLight.ttf"
|
||||
}
|
||||
FontLoader {
|
||||
FontLoader {
|
||||
source: "fonts/SourceSansPro-Semibold.ttf"
|
||||
}
|
||||
FontLoader {
|
||||
source: "fonts/SourceSansPro-Bold.ttf"
|
||||
}
|
||||
FontLoader {
|
||||
source: "fonts/SourceSansPro-Black.ttf"
|
||||
}
|
||||
FontLoader {
|
||||
source: "fonts/SourceSansPro-Light.ttf"
|
||||
}
|
||||
FontLoader {
|
||||
source: "fonts/SourceSansPro-ExtraLight.ttf"
|
||||
}
|
||||
FontLoader {
|
||||
id: simpleLineIcons
|
||||
source: "fonts/Simple-Line-Icons.ttf"
|
||||
source: "fonts/Simple-Line-Icons.ttf"
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
@ -393,7 +294,7 @@ ApplicationWindow {
|
||||
|
||||
function setSelection(on) {
|
||||
sel.visible = on
|
||||
|
||||
|
||||
if (this.closable == true) {
|
||||
closeIcon.visible = on
|
||||
}
|
||||
@ -404,7 +305,7 @@ ApplicationWindow {
|
||||
label.visible = !on
|
||||
buttonLabel.visible = on
|
||||
}
|
||||
|
||||
|
||||
width: 192
|
||||
height: 55
|
||||
color: "#00000000"
|
||||
@ -417,7 +318,7 @@ ApplicationWindow {
|
||||
Rectangle {
|
||||
// New App Button
|
||||
id: newAppButton
|
||||
visible: false
|
||||
visible: false
|
||||
anchors.fill: parent
|
||||
anchors.rightMargin: 8
|
||||
border.width: 0
|
||||
@ -504,16 +405,16 @@ ApplicationWindow {
|
||||
id: buttonLabel
|
||||
visible: false
|
||||
text: "GO TO NEW APP"
|
||||
font.family: sourceSansPro.name
|
||||
font.family: sourceSansPro.name
|
||||
font.weight: Font.DemiBold
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: "#AAA0A0"
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: label
|
||||
font.family: sourceSansPro.name
|
||||
font.family: sourceSansPro.name
|
||||
font.weight: Font.DemiBold
|
||||
elide: Text.ElideRight
|
||||
x:250
|
||||
@ -529,15 +430,15 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Text {
|
||||
id: secondary
|
||||
//only shows secondary title if there's no badge
|
||||
visible: (badgeContent == "icon" || badgeContent == "number" )? false : true
|
||||
font.family: sourceSansPro.name
|
||||
font.family: sourceSansPro.name
|
||||
font.weight: Font.Light
|
||||
anchors {
|
||||
left: icon.right
|
||||
@ -566,8 +467,8 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
Text {
|
||||
|
||||
font.family: simpleLineIcons.name
|
||||
|
||||
font.family: simpleLineIcons.name
|
||||
anchors {
|
||||
centerIn: parent
|
||||
}
|
||||
@ -575,11 +476,11 @@ ApplicationWindow {
|
||||
font.pixelSize: 20
|
||||
text: "\ue082"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: badge
|
||||
visible: (badgeContent == "icon" || badgeContent == "number" )? true : false
|
||||
visible: (badgeContent == "icon" || badgeContent == "number" )? true : false
|
||||
width: 32
|
||||
color: "#05000000"
|
||||
anchors {
|
||||
@ -588,11 +489,11 @@ ApplicationWindow {
|
||||
bottom: parent.bottom;
|
||||
rightMargin: 4;
|
||||
}
|
||||
|
||||
|
||||
Text {
|
||||
id: badgeIconLabel
|
||||
visible: (badgeContent == "icon") ? true : false;
|
||||
font.family: simpleLineIcons.name
|
||||
font.family: simpleLineIcons.name
|
||||
anchors {
|
||||
centerIn: parent
|
||||
}
|
||||
@ -600,7 +501,7 @@ ApplicationWindow {
|
||||
color: "#AAA0A0"
|
||||
font.pixelSize: 20
|
||||
text: badgeIcon
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: badgeNumberLabel
|
||||
@ -609,14 +510,14 @@ ApplicationWindow {
|
||||
centerIn: parent
|
||||
}
|
||||
horizontalAlignment: Text.AlignCenter
|
||||
font.family: sourceSansPro.name
|
||||
font.family: sourceSansPro.name
|
||||
font.weight: Font.Light
|
||||
color: "#AAA0A0"
|
||||
font.pixelSize: 18
|
||||
text: badgeNumber
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function closeApp() {
|
||||
@ -685,7 +586,7 @@ ApplicationWindow {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
spacing: 3
|
||||
|
||||
|
||||
|
||||
|
||||
ColumnLayout {
|
||||
@ -702,7 +603,7 @@ ApplicationWindow {
|
||||
color: "transparent"
|
||||
Text {
|
||||
text: "ETHEREUM"
|
||||
font.family: sourceSansPro.name
|
||||
font.family: sourceSansPro.name
|
||||
font.weight: Font.Regular
|
||||
// anchors.top: 20
|
||||
// anchors.left: 16
|
||||
@ -711,10 +612,10 @@ ApplicationWindow {
|
||||
topMargin: 4
|
||||
fill: parent
|
||||
}
|
||||
// anchors.leftMargin: 16
|
||||
// anchors.topMargin: 16
|
||||
// anchors.leftMargin: 16
|
||||
// anchors.topMargin: 16
|
||||
// anchors.verticalCenterOffset: 50
|
||||
color: "#AAA0A0"
|
||||
color: "#AAA0A0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -735,7 +636,7 @@ ApplicationWindow {
|
||||
|
||||
Text {
|
||||
text: "APPS"
|
||||
font.family: sourceSansPro.name
|
||||
font.family: sourceSansPro.name
|
||||
font.weight: Font.Regular
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 16
|
||||
@ -775,7 +676,7 @@ ApplicationWindow {
|
||||
anchors.left: menu.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.top: parent.top
|
||||
color: "#00000000"
|
||||
color: "#00000000"
|
||||
|
||||
/*Rectangle {
|
||||
id: urlPane
|
||||
|
@ -25,9 +25,7 @@ import "C"
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math/big"
|
||||
"os"
|
||||
"path"
|
||||
"runtime"
|
||||
"sort"
|
||||
@ -99,7 +97,7 @@ func NewWindow(ethereum *eth.Ethereum) *Gui {
|
||||
return gui
|
||||
}
|
||||
|
||||
func (gui *Gui) Start(assetPath string) {
|
||||
func (gui *Gui) Start(assetPath, libPath string) {
|
||||
defer gui.txDb.Close()
|
||||
|
||||
guilogger.Infoln("Starting GUI")
|
||||
@ -117,7 +115,7 @@ func (gui *Gui) Start(assetPath string) {
|
||||
// Create a new QML engine
|
||||
gui.engine = qml.NewEngine()
|
||||
context := gui.engine.Context()
|
||||
gui.uiLib = NewUiLib(gui.engine, gui.eth, assetPath)
|
||||
gui.uiLib = NewUiLib(gui.engine, gui.eth, assetPath, libPath)
|
||||
gui.whisper = qwhisper.New(gui.eth.Whisper())
|
||||
|
||||
// Expose the eth library and the ui library to QML
|
||||
@ -292,25 +290,6 @@ func (self *Gui) getObjectByName(objectName string) qml.Object {
|
||||
return self.win.Root().ObjectByName(objectName)
|
||||
}
|
||||
|
||||
func loadJavascriptAssets(gui *Gui) (jsfiles string) {
|
||||
for _, fn := range []string{"ext/q.js", "ext/eth.js/main.js", "ext/eth.js/qt.js", "ext/setup.js"} {
|
||||
f, err := os.Open(gui.uiLib.AssetPath(fn))
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
continue
|
||||
}
|
||||
|
||||
content, err := ioutil.ReadAll(f)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
continue
|
||||
}
|
||||
jsfiles += string(content)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (gui *Gui) SendCommand(cmd ServEv) {
|
||||
gui.serviceEvents <- cmd
|
||||
}
|
||||
|
@ -65,6 +65,7 @@ func init() {
|
||||
utils.NodeKeyFileFlag,
|
||||
utils.RPCListenAddrFlag,
|
||||
utils.RPCPortFlag,
|
||||
utils.JSpathFlag,
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,7 +112,7 @@ func run(ctx *cli.Context) {
|
||||
gui := NewWindow(ethereum)
|
||||
utils.RegisterInterrupt(func(os.Signal) { gui.Stop() })
|
||||
// gui blocks the main thread
|
||||
gui.Start(ctx.GlobalString(assetPathFlag.Name))
|
||||
gui.Start(ctx.GlobalString(assetPathFlag.Name), ctx.GlobalString(utils.JSpathFlag.Name))
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
@ -21,7 +21,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"path"
|
||||
|
||||
@ -29,7 +28,6 @@ import (
|
||||
"github.com/ethereum/go-ethereum/eth"
|
||||
"github.com/ethereum/go-ethereum/ethutil"
|
||||
"github.com/ethereum/go-ethereum/event/filter"
|
||||
"github.com/ethereum/go-ethereum/javascript"
|
||||
"github.com/ethereum/go-ethereum/xeth"
|
||||
"github.com/obscuren/qml"
|
||||
)
|
||||
@ -49,15 +47,19 @@ type UiLib struct {
|
||||
// The main application window
|
||||
win *qml.Window
|
||||
|
||||
jsEngine *javascript.JSRE
|
||||
|
||||
filterCallbacks map[int][]int
|
||||
filterManager *filter.FilterManager
|
||||
}
|
||||
|
||||
func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib {
|
||||
func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath, libPath string) *UiLib {
|
||||
x := xeth.New(eth, nil)
|
||||
lib := &UiLib{XEth: x, engine: engine, eth: eth, assetPath: assetPath, jsEngine: javascript.NewJSRE(x), filterCallbacks: make(map[int][]int)} //, filters: make(map[int]*xeth.JSFilter)}
|
||||
lib := &UiLib{
|
||||
XEth: x,
|
||||
engine: engine,
|
||||
eth: eth,
|
||||
assetPath: assetPath,
|
||||
filterCallbacks: make(map[int][]int),
|
||||
}
|
||||
lib.filterManager = filter.NewFilterManager(eth.EventMux())
|
||||
go lib.filterManager.Start()
|
||||
|
||||
@ -76,19 +78,6 @@ func (self *UiLib) ImportTx(rlpTx string) {
|
||||
}
|
||||
}
|
||||
|
||||
func (self *UiLib) EvalJavascriptFile(path string) {
|
||||
self.jsEngine.LoadExtFile(path[7:])
|
||||
}
|
||||
|
||||
func (self *UiLib) EvalJavascriptString(str string) string {
|
||||
value, err := self.jsEngine.Run(str)
|
||||
if err != nil {
|
||||
return err.Error()
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%v", value)
|
||||
}
|
||||
|
||||
func (ui *UiLib) Muted(content string) {
|
||||
component, err := ui.engine.LoadFile(ui.AssetPath("qml/muted.qml"))
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user