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
05c353ec
Commit
05c353ec
authored
Feb 21, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a basic <UNSTABLE> UI
parent
d7ecc92c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
216 additions
and
36 deletions
+216
-36
config.go
config.go
+2
-0
ethereum.go
ethereum.go
+50
-36
gui.go
ui/gui.go
+83
-0
wallet.qml
wallet.qml
+81
-0
No files found.
config.go
View file @
05c353ec
...
@@ -15,11 +15,13 @@ var GenAddr bool
...
@@ -15,11 +15,13 @@ var GenAddr bool
var
UseSeed
bool
var
UseSeed
bool
var
ImportKey
string
var
ImportKey
string
var
ExportKey
bool
var
ExportKey
bool
var
UseGui
bool
func
Init
()
{
func
Init
()
{
flag
.
BoolVar
(
&
StartConsole
,
"c"
,
false
,
"debug and testing console"
)
flag
.
BoolVar
(
&
StartConsole
,
"c"
,
false
,
"debug and testing console"
)
flag
.
BoolVar
(
&
StartMining
,
"m"
,
false
,
"start dagger mining"
)
flag
.
BoolVar
(
&
StartMining
,
"m"
,
false
,
"start dagger mining"
)
flag
.
BoolVar
(
&
ShowGenesis
,
"g"
,
false
,
"prints genesis header and exits"
)
flag
.
BoolVar
(
&
ShowGenesis
,
"g"
,
false
,
"prints genesis header and exits"
)
flag
.
BoolVar
(
&
UseGui
,
"gui"
,
false
,
"use the gui"
)
flag
.
BoolVar
(
&
UseUPnP
,
"upnp"
,
false
,
"enable UPnP support"
)
flag
.
BoolVar
(
&
UseUPnP
,
"upnp"
,
false
,
"enable UPnP support"
)
flag
.
BoolVar
(
&
UseSeed
,
"seed"
,
true
,
"seed peers"
)
flag
.
BoolVar
(
&
UseSeed
,
"seed"
,
true
,
"seed peers"
)
flag
.
BoolVar
(
&
GenAddr
,
"genaddr"
,
false
,
"create a new priv/pub key"
)
flag
.
BoolVar
(
&
GenAddr
,
"genaddr"
,
false
,
"create a new priv/pub key"
)
...
...
ethereum.go
View file @
05c353ec
...
@@ -5,6 +5,8 @@ import (
...
@@ -5,6 +5,8 @@ import (
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/go-ethereum/ui"
"github.com/niemeyer/qml"
"github.com/obscuren/secp256k1-go"
"github.com/obscuren/secp256k1-go"
"log"
"log"
"os"
"os"
...
@@ -76,9 +78,16 @@ pubk: %x
...
@@ -76,9 +78,16 @@ pubk: %x
}
}
func
main
()
{
func
main
()
{
runtime
.
GOMAXPROCS
(
runtime
.
NumCPU
())
Init
()
Init
()
// Qt has to be initialized in the main thread or it will throw errors
// It has to be called BEFORE setting the maximum procs.
if
UseGui
{
qml
.
Init
(
nil
)
}
runtime
.
GOMAXPROCS
(
runtime
.
NumCPU
())
ethchain
.
InitFees
()
ethchain
.
InitFees
()
ethutil
.
ReadConfig
(
".ethereum"
)
ethutil
.
ReadConfig
(
".ethereum"
)
ethutil
.
Config
.
Seed
=
UseSeed
ethutil
.
Config
.
Seed
=
UseSeed
...
@@ -156,8 +165,12 @@ func main() {
...
@@ -156,8 +165,12 @@ func main() {
go
console
.
Start
()
go
console
.
Start
()
}
}
if
UseGui
{
gui
:=
ethui
.
New
(
ethereum
)
gui
.
Start
()
//ethereum.Stop()
}
else
{
RegisterInterupts
(
ethereum
)
RegisterInterupts
(
ethereum
)
ethereum
.
Start
()
ethereum
.
Start
()
if
StartMining
{
if
StartMining
{
...
@@ -193,4 +206,5 @@ func main() {
...
@@ -193,4 +206,5 @@ func main() {
// Wait for shutdown
// Wait for shutdown
ethereum
.
WaitForShutdown
()
ethereum
.
WaitForShutdown
()
}
}
}
ui/gui.go
0 → 100644
View file @
05c353ec
package
ethui
import
(
"bufio"
"encoding/hex"
"fmt"
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethutil"
"github.com/niemeyer/qml"
"strings"
)
type
Gui
struct
{
win
*
qml
.
Window
engine
*
qml
.
Engine
component
*
qml
.
Common
eth
*
eth
.
Ethereum
}
func
New
(
ethereum
*
eth
.
Ethereum
)
*
Gui
{
return
&
Gui
{
eth
:
ethereum
}
}
type
Block
struct
{
Number
int
Hash
string
}
func
NewBlockFromBlock
(
block
*
ethchain
.
Block
)
*
Block
{
info
:=
block
.
BlockInfo
()
hash
:=
hex
.
EncodeToString
(
block
.
Hash
())
return
&
Block
{
Number
:
int
(
info
.
Number
),
Hash
:
hash
}
}
func
(
ui
*
Gui
)
Start
()
{
qml
.
RegisterTypes
(
"GoExtensions"
,
1
,
0
,
[]
qml
.
TypeSpec
{{
Init
:
func
(
p
*
Block
,
obj
qml
.
Object
)
{
p
.
Number
=
0
;
p
.
Hash
=
""
},
}})
ethutil
.
Config
.
Log
.
Infoln
(
"[GUI] Starting GUI"
)
ui
.
engine
=
qml
.
NewEngine
()
component
,
err
:=
ui
.
engine
.
LoadFile
(
"wallet.qml"
)
if
err
!=
nil
{
panic
(
err
)
}
ui
.
win
=
component
.
CreateWindow
(
nil
)
root
:=
ui
.
win
.
Root
()
context
:=
ui
.
engine
.
Context
()
context
.
SetVar
(
"tester"
,
&
Tester
{
root
:
root
})
ui
.
eth
.
BlockManager
.
SecondaryBlockProcessor
=
ui
ui
.
eth
.
Start
()
ui
.
win
.
Show
()
ui
.
win
.
Wait
()
}
func
(
ui
*
Gui
)
ProcessBlock
(
block
*
ethchain
.
Block
)
{
ui
.
win
.
Root
()
.
Call
(
"addBlock"
,
NewBlockFromBlock
(
block
))
}
type
Tester
struct
{
root
qml
.
Object
}
func
(
t
*
Tester
)
Compile
(
area
qml
.
Object
)
{
fmt
.
Println
(
area
)
ethutil
.
Config
.
Log
.
Infoln
(
"[TESTER] Compiling"
)
code
:=
area
.
String
(
"text"
)
scanner
:=
bufio
.
NewScanner
(
strings
.
NewReader
(
code
))
scanner
.
Split
(
bufio
.
ScanLines
)
var
lines
[]
string
for
scanner
.
Scan
()
{
lines
=
append
(
lines
,
scanner
.
Text
())
}
}
wallet.qml
0 → 100644
View file @
05c353ec
import
QtQuick
2.0
import
QtQuick
.
Controls
1.0
;
import
QtQuick
.
Layouts
1.0
;
import
GoExtensions
1.0
ApplicationWindow
{
id
:
root
width
:
800
height
:
600
minimumHeight
:
300
title
:
"Ethereal"
toolBar
:
ToolBar
{
id
:
mainToolbar
RowLayout
{
width
:
parent
.
width
Button
{
text
:
"Send"
onClicked
:
tester
.
compile
(
codeView
)
}
TextField
{
width
:
200
placeholderText
:
"Amount"
}
TextField
{
width
:
300
placeholderText
:
"Receiver Address (or empty for contract)"
Layout.fillWidth
:
true
}
}
}
SplitView
{
id
:
splitView
height
:
200
anchors.top
:
parent
.
top
anchors.right
:
parent
.
right
anchors.left
:
parent
.
left
TextArea
{
id
:
codeView
width
:
parent
.
width
/
2
}
TextArea
{
readOnly
:
true
}
}
property
var
blockModel
:
ListModel
{
id
:
blockModel
}
TableView
{
width
:
parent
.
width
height
:
100
anchors.bottom
:
parent
.
bottom
anchors.top
:
splitView
.
bottom
TableViewColumn
{
role
:
"number"
;
title
:
"#"
;
width
:
100
}
TableViewColumn
{
role
:
"hash"
;
title
:
"Hash"
;
width
:
560
}
model
:
blockModel
}
statusBar
:
StatusBar
{
RowLayout
{
Label
{
text
:
"0.0.1"
}
}
}
function
addBlock
(
block
)
{
blockModel
.
append
({
number
:
block
.
number
,
hash
:
block
.
hash
})
}
}
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