Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
3d2c3b01
Commit
3d2c3b01
authored
Mar 02, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using asset path helper (includes a debug path atm)
parent
a482b0cc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
147 additions
and
87 deletions
+147
-87
gui.go
ui/gui.go
+2
-7
ui_lib.go
ui/ui_lib.go
+27
-0
wallet.qml
wallet.qml
+118
-80
No files found.
ui/gui.go
View file @
3d2c3b01
...
@@ -9,8 +9,6 @@ import (
...
@@ -9,8 +9,6 @@ import (
"github.com/ethereum/eth-go/ethdb"
"github.com/ethereum/eth-go/ethdb"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethutil"
"github.com/niemeyer/qml"
"github.com/niemeyer/qml"
"bitbucket.org/kardianos/osext"
"path/filepath"
"math/big"
"math/big"
"strings"
"strings"
)
)
...
@@ -87,15 +85,12 @@ func (ui *Gui) Start() {
...
@@ -87,15 +85,12 @@ func (ui *Gui) Start() {
// Create a new QML engine
// Create a new QML engine
ui
.
engine
=
qml
.
NewEngine
()
ui
.
engine
=
qml
.
NewEngine
()
// Get Binary Directory
exedir
,
_
:=
osext
.
ExecutableFolder
()
// Load the main QML interface
// Load the main QML interface
component
,
err
:=
ui
.
engine
.
LoadFile
(
filepath
.
Join
(
exedir
,
"wallet.qml"
))
component
,
err
:=
ui
.
engine
.
LoadFile
(
AssetPath
(
"wallet.qml"
))
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
}
}
ui
.
engine
.
LoadFile
(
filepath
.
Join
(
exedir
,
"transactions.qml"
))
ui
.
engine
.
LoadFile
(
AssetPath
(
"transactions.qml"
))
ui
.
win
=
component
.
CreateWindow
(
nil
)
ui
.
win
=
component
.
CreateWindow
(
nil
)
...
...
ui/ui_lib.go
View file @
3d2c3b01
package
ethui
package
ethui
import
(
import
(
"bitbucket.org/kardianos/osext"
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethutil"
"github.com/niemeyer/qml"
"github.com/niemeyer/qml"
"path"
"path/filepath"
"runtime"
)
)
// UI Library that has some basic functionality exposed
// UI Library that has some basic functionality exposed
...
@@ -38,3 +42,26 @@ func (ui *UiLib) Connect(button qml.Object) {
...
@@ -38,3 +42,26 @@ func (ui *UiLib) Connect(button qml.Object) {
func
(
ui
*
UiLib
)
ConnectToPeer
(
addr
string
)
{
func
(
ui
*
UiLib
)
ConnectToPeer
(
addr
string
)
{
ui
.
eth
.
ConnectToPeer
(
addr
)
ui
.
eth
.
ConnectToPeer
(
addr
)
}
}
func
(
ui
*
UiLib
)
AssetPath
(
p
string
)
string
{
return
AssetPath
(
p
)
}
func
AssetPath
(
p
string
)
string
{
var
base
string
switch
runtime
.
GOOS
{
case
"darwin"
:
// Get Binary Directory
exedir
,
_
:=
osext
.
ExecutableFolder
()
base
=
filepath
.
Join
(
exedir
,
"../Resources"
)
base
=
"/Users/jeffrey/go/src/github.com/ethereum/go-ethereum"
case
"linux"
:
base
=
"/usr/share/ethereal"
case
"window"
:
fallthrough
default
:
base
=
"."
}
return
path
.
Join
(
base
,
p
)
}
wallet.qml
View file @
3d2c3b01
...
@@ -115,116 +115,141 @@ ApplicationWindow {
...
@@ -115,116 +115,141 @@ ApplicationWindow {
}
}
}
}
}
}
}
property
var
txModel
:
ListModel
{
id
:
txModel
}
}
Rectangle
{
Rectangle
{
id
:
history
View
id
:
main
View
property
var
title
:
"Transactions
"
color
:
"#00000000
"
anchors.right
:
parent
.
right
anchors.right
:
parent
.
right
anchors.left
:
menu
.
right
anchors.left
:
menu
.
right
anchors.bottom
:
parent
.
bottom
anchors.bottom
:
parent
.
bottom
anchors.top
:
parent
.
top
anchors.top
:
parent
.
top
TableView
{
id
:
txTableView
anchors.fill
:
parent
TableViewColumn
{
role
:
"value"
;
title
:
"Value"
;
width
:
100
}
TableViewColumn
{
role
:
"address"
;
title
:
"Address"
;
width
:
430
}
model
:
txModel
property
var
txModel
:
ListModel
{
id
:
txModel
}
}
}
Rectangle
{
Rectangle
{
id
:
newTxView
id
:
historyView
property
var
title
:
"New transaction"
anchors.fill
:
parent
visible
:
false
anchors.right
:
parent
.
right
anchors.left
:
menu
.
right
anchors.bottom
:
parent
.
bottom
anchors.top
:
parent
.
top
color
:
"#00000000"
ColumnLayout
{
property
var
title
:
"Transactions"
width
:
400
TableView
{
anchors.left
:
parent
.
left
id
:
txTableView
anchors.top
:
parent
.
top
anchors.fill
:
parent
anchors.leftMargin
:
5
TableViewColumn
{
role
:
"value"
;
title
:
"Value"
;
width
:
100
}
anchors.topMargin
:
5
TableViewColumn
{
role
:
"address"
;
title
:
"Address"
;
width
:
430
}
TextField
{
id
:
txAmount
width
:
200
placeholderText
:
"Amount"
}
TextField
{
model
:
txModel
id
:
txReceiver
placeholderText
:
"Receiver Address (or empty for contract)"
Layout.fillWidth
:
true
}
}
}
Label
{
Rectangle
{
text
:
"Transaction data"
id
:
newTxView
}
property
var
title
:
"New transaction"
TextArea
{
visible
:
false
id
:
codeView
anchors.fill
:
parent
color
:
"#00000000"
ColumnLayout
{
width
:
400
anchors.left
:
parent
.
left
anchors.top
:
parent
.
top
anchors.leftMargin
:
5
anchors.topMargin
:
5
anchors.topMargin
:
5
Layout.fillWidth
:
true
TextField
{
width
:
parent
.
width
/
2
id
:
txAmount
}
width
:
200
placeholderText
:
"Amount"
}
TextField
{
id
:
txReceiver
placeholderText
:
"Receiver Address (or empty for contract)"
Layout.fillWidth
:
true
}
Button
{
Label
{
text
:
"Send"
text
:
"Transaction data"
onClicked
:
{
}
console
.
log
(
eth
.
createTx
(
txReceiver
.
text
,
txAmount
.
text
,
codeView
.
text
))
TextArea
{
id
:
codeView
anchors.topMargin
:
5
Layout.fillWidth
:
true
width
:
parent
.
width
/
2
}
Button
{
text
:
"Send"
onClicked
:
{
console
.
log
(
eth
.
createTx
(
txReceiver
.
text
,
txAmount
.
text
,
codeView
.
text
))
}
}
}
}
}
}
}
}
Rectangle
{
Rectangle
{
id
:
networkView
id
:
networkView
property
var
title
:
"Network"
property
var
title
:
"Network"
visible
:
false
visible
:
false
anchors.right
:
parent
.
right
anchors.fill
:
parent
anchors.bottom
:
parent
.
bottom
anchors.top
:
parent
.
top
TableView
{
id
:
blockTable
width
:
parent
.
width
anchors.top
:
parent
.
top
anchors.bottom
:
logView
.
top
TableViewColumn
{
role
:
"number"
;
title
:
"#"
;
width
:
100
}
TableViewColumn
{
role
:
"hash"
;
title
:
"Hash"
;
width
:
560
}
model
:
blockModel
/*
onDoubleClicked: {
popup.visible = true
popup.block = eth.getBlock(blockModel.get(row).hash)
popup.hashLabel.text = popup.block.hash
}
*/
}
TableView
{
property
var
logModel
:
ListModel
{
id
:
blockTable
id
:
logModel
width
:
parent
.
width
}
anchors.top
:
parent
.
top
anchors.bottom
:
logView
.
top
TableViewColumn
{
role
:
"number"
;
title
:
"#"
;
width
:
100
}
TableViewColumn
{
role
:
"hash"
;
title
:
"Hash"
;
width
:
560
}
model
:
blockModel
TableView
{
id
:
logView
width
:
parent
.
width
height
:
150
anchors.bottom
:
parent
.
bottom
TableViewColumn
{
role
:
"description"
;
title
:
"log"
}
onDoubleClicked
:
{
model
:
logModel
popup
.
visible
=
true
popup
.
block
=
eth
.
getBlock
(
blockModel
.
get
(
row
).
hash
)
popup
.
hashLabel
.
text
=
popup
.
block
.
hash
}
}
}
}
property
var
logModel
:
ListModel
{
/*
id
:
logModel
signal addPlugin(string name)
Component {
id: pluginWindow
Rectangle {
anchors.fill: parent
Label {
id: pluginTitle
anchors.centerIn: parent
text: "Hello world"
}
Component.onCompleted: setView(this)
}
}
}
TableView
{
onAddPlugin: {
id
:
logView
var pluginWin = pluginWindow.createObject(mainView)
width
:
parent
.
width
console.log(pluginWin)
height
:
150
pluginWin.pluginTitle.text = "Test"
anchors.bottom
:
parent
.
bottom
TableViewColumn
{
role
:
"description"
;
title
:
"log"
}
model
:
logModel
}
}
*/
}
}
}
}
...
@@ -249,6 +274,7 @@ ApplicationWindow {
...
@@ -249,6 +274,7 @@ ApplicationWindow {
}
}
text
:
"Connect"
text
:
"Connect"
}
}
Button
{
Button
{
id
:
importAppButton
id
:
importAppButton
anchors.left
:
connectButton
.
right
anchors.left
:
connectButton
.
right
...
@@ -304,6 +330,10 @@ ApplicationWindow {
...
@@ -304,6 +330,10 @@ ApplicationWindow {
anchors.left
:
parent
.
left
anchors.left
:
parent
.
left
anchors.leftMargin
:
10
anchors.leftMargin
:
10
placeholderText
:
"address:port"
placeholderText
:
"address:port"
onAccepted
:
{
ui
.
connectToPeer
(
addrField
.
text
)
addPeerWin
.
visible
=
false
}
}
}
Button
{
Button
{
anchors.left
:
addrField
.
right
anchors.left
:
addrField
.
right
...
@@ -315,6 +345,9 @@ ApplicationWindow {
...
@@ -315,6 +345,9 @@ ApplicationWindow {
addPeerWin
.
visible
=
false
addPeerWin
.
visible
=
false
}
}
}
}
Component.onCompleted
:
{
addrField
.
focus
=
true
}
}
}
Window
{
Window
{
...
@@ -346,6 +379,11 @@ ApplicationWindow {
...
@@ -346,6 +379,11 @@ ApplicationWindow {
}
}
function
loadPlugin
(
name
)
{
console
.
log
(
"Loading plugin"
+
name
)
mainView
.
addPlugin
(
name
)
}
function
setWalletValue
(
value
)
{
function
setWalletValue
(
value
)
{
walletValueLabel
.
text
=
value
walletValueLabel
.
text
=
value
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment