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
a6f4eef1
Commit
a6f4eef1
authored
Jun 02, 2014
by
Maran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Peer Window
parent
98811f11
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
2 deletions
+64
-2
wallet.qml
ethereal/assets/qml/wallet.qml
+49
-1
gui.go
ethereal/ui/gui.go
+11
-1
repl.go
ethereum/repl.go
+4
-0
No files found.
ethereal/assets/qml/wallet.qml
View file @
a6f4eef1
...
...
@@ -45,6 +45,13 @@ ApplicationWindow {
addPeerWin
.
visible
=
true
}
}
MenuItem
{
text
:
"Show Peers"
shortcut
:
"Ctrl+e"
onTriggered
:
{
peerWindow
.
visible
=
true
}
}
}
Menu
{
...
...
@@ -359,6 +366,10 @@ ApplicationWindow {
id
:
peerImage
anchors.right
:
parent
.
right
width
:
10
;
height
:
10
MouseArea
{
onDoubleClicked
:
peerWindow
.
visible
=
true
anchors.fill
:
parent
}
source
:
ui
.
assetPath
(
"network.png"
)
}
}
...
...
@@ -623,6 +634,20 @@ ApplicationWindow {
function
setPeers
(
text
)
{
peerLabel
.
text
=
text
}
function
addPeer
(
peer
)
{
// We could just append the whole peer object but it cries if you try to alter them
peerModel
.
append
({
ip
:
peer
.
ip
,
port
:
peer
.
port
,
lastResponse
:
timeAgo
(
peer
.
lastSend
),
version
:
peer
.
version
})
}
function
resetPeers
(){
peerModel
.
clear
()
}
function
timeAgo
(
unixTs
){
var
lapsed
=
(
Date
.
now
()
-
new
Date
(
unixTs
*
1000
))
/
1000
return
(
lapsed
+
" seconds ago"
)
}
function
convertToPretty
(
unixTs
){
var
a
=
new
Date
(
unixTs
*
1000
);
var
months
=
[
'Jan'
,
'Feb'
,
'Mar'
,
'Apr'
,
'May'
,
'Jun'
,
'Jul'
,
'Aug'
,
'Sep'
,
'Oct'
,
'Nov'
,
'Dec'
];
...
...
@@ -635,6 +660,30 @@ ApplicationWindow {
var
time
=
date
+
' '
+
month
+
' '
+
year
+
' '
+
hour
+
':'
+
min
+
':'
+
sec
;
return
time
;
}
// ******************************************
// Windows
// ******************************************
Window
{
id
:
peerWindow
height
:
200
width
:
500
Rectangle
{
anchors.fill
:
parent
property
var
peerModel
:
ListModel
{
id
:
peerModel
}
TableView
{
anchors.fill
:
parent
id
:
peerTable
model
:
peerModel
TableViewColumn
{
width
:
120
;
role
:
"ip"
;
title
:
"IP"
}
TableViewColumn
{
width
:
60
;
role
:
"port"
;
title
:
"Port"
}
TableViewColumn
{
width
:
120
;
role
:
"lastResponse"
;
title
:
"Last event"
}
TableViewColumn
{
width
:
180
;
role
:
"version"
;
title
:
"Version"
}
}
}
}
// *******************************************
// Components
// *******************************************
...
...
@@ -810,7 +859,6 @@ ApplicationWindow {
}
}
}
// New Transaction component
Component
{
id
:
newTransaction
...
...
ethereal/ui/gui.go
View file @
a6f4eef1
...
...
@@ -12,6 +12,7 @@ import (
"github.com/go-qml/qml"
"math/big"
"strings"
"time"
)
type
Gui
struct
{
...
...
@@ -91,7 +92,7 @@ func (gui *Gui) Start(assetPath string) {
ethutil
.
Config
.
Log
.
AddLogSystem
(
gui
)
}
if
err
!=
nil
{
ethutil
.
Config
.
Log
.
Infoln
(
"FATAL: asset not found: you can set an alternative asset path on on the command line using option 'asset_path'"
)
ethutil
.
Config
.
Log
.
Infoln
(
"FATAL: asset not found: you can set an alternative asset path on on the command line using option 'asset_path'"
,
err
)
panic
(
err
)
}
...
...
@@ -235,6 +236,8 @@ func (gui *Gui) update() {
reactor
.
Subscribe
(
"object:"
+
string
(
namereg
),
objectChan
)
reactor
.
Subscribe
(
"peerList"
,
peerChan
)
ticker
:=
time
.
NewTicker
(
5
*
time
.
Second
)
state
:=
gui
.
eth
.
StateManager
()
.
TransState
()
unconfirmedFunds
:=
new
(
big
.
Int
)
...
...
@@ -284,12 +287,19 @@ func (gui *Gui) update() {
gui
.
loadAddressBook
()
case
<-
peerChan
:
gui
.
setPeerInfo
()
case
<-
ticker
.
C
:
gui
.
setPeerInfo
()
}
}
}
func
(
gui
*
Gui
)
setPeerInfo
()
{
gui
.
win
.
Root
()
.
Call
(
"setPeers"
,
fmt
.
Sprintf
(
"%d / %d"
,
gui
.
eth
.
PeerCount
(),
gui
.
eth
.
MaxPeers
))
gui
.
win
.
Root
()
.
Call
(
"resetPeers"
)
for
_
,
peer
:=
range
gui
.
pub
.
GetPeers
()
{
gui
.
win
.
Root
()
.
Call
(
"addPeer"
,
peer
)
}
}
// Logging functions that log directly to the GUI interface
...
...
ethereum/repl.go
View file @
a6f4eef1
...
...
@@ -66,6 +66,10 @@ func (self *JSEthereum) GetBlock(hash string) otto.Value {
return
self
.
toVal
(
&
JSBlock
{
self
.
PEthereum
.
GetBlock
(
hash
),
self
})
}
func
(
self
*
JSEthereum
)
GetPeers
()
otto
.
Value
{
return
self
.
toVal
(
self
.
PEthereum
.
GetPeers
())
}
func
(
self
*
JSEthereum
)
GetKey
()
otto
.
Value
{
return
self
.
toVal
(
self
.
PEthereum
.
GetKey
())
}
...
...
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