Skip to content

Commit 5ae3dee

Browse files
committed
New menu
1 parent 8865543 commit 5ae3dee

File tree

7 files changed

+161
-72
lines changed

7 files changed

+161
-72
lines changed

ethereal/assets/qml/views/chain.qml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ import QtQuick.Controls.Styles 1.1
77
import Ethereum 1.0
88

99
Rectangle {
10+
id: root
1011
property var title: "Network"
1112
property var iconFile: "../net.png"
13+
property var secondary: "Hi"
14+
property var menuItem
1215

1316
objectName: "chainView"
1417
visible: false
@@ -93,6 +96,8 @@ Rectangle {
9396
}
9497
}
9598

99+
100+
96101
function addBlock(block, initial) {
97102
var txs = JSON.parse(block.transactions);
98103
var amount = 0
@@ -109,6 +114,8 @@ Rectangle {
109114
} else {
110115
blockModel.insert(0, {number: block.number, name: block.name, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)})
111116
}
117+
118+
//root.secondary.text = "#" + block.number;
112119
}
113120

114121
Window {

ethereal/assets/qml/views/history.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Ethereum 1.0
99
Rectangle {
1010
property var iconFile: "../tx.png"
1111
property var title: "Transactions"
12+
property var menuItem
1213

1314
property var txModel: ListModel {
1415
id: txModel

ethereal/assets/qml/views/info.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Ethereum 1.0
99
Rectangle {
1010
property var title: "Information"
1111
property var iconFile: "../heart.png"
12+
property var menuItem
1213

1314
objectName: "infoView"
1415
visible: false

ethereal/assets/qml/views/javascript.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Ethereum 1.0
99
Rectangle {
1010
property var title: "JavaScript"
1111
property var iconFile: "../tx.png"
12+
property var menuItem
1213

1314
objectName: "javascriptView"
1415
visible: false
@@ -33,7 +34,6 @@ Rectangle {
3334

3435
TextArea {
3536
id: output
36-
verticalAlignment: TextEdit.AlignBottom
3737
text: "> JSRE Ready..."
3838
anchors {
3939
top: parent.top

ethereal/assets/qml/views/pending_tx.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Ethereum 1.0
99
Rectangle {
1010
property var title: "Pending Transactions"
1111
property var iconFile: "../tx.png"
12+
property var menuItem
1213

1314
objectName: "pendingTxView"
1415
anchors.fill: parent

ethereal/assets/qml/views/transaction.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Ethereum 1.0
99
Rectangle {
1010
property var iconFile: "../new.png"
1111
property var title: "New transaction"
12+
property var menuItem
1213

1314
objectName: "newTxView"
1415
visible: false

ethereal/assets/qml/wallet.qml

Lines changed: 149 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ ApplicationWindow {
3030

3131
// Takes care of loading all default plugins
3232
Component.onCompleted: {
33-
var historyView = addPlugin("./views/history.qml", {title: "History"})
34-
var newTxView = addPlugin("./views/transaction.qml", {title: "New Transaction"})
35-
var chainView = addPlugin("./views/chain.qml", {title: "Block chain"})
36-
var infoView = addPlugin("./views/info.qml", {title: "Info"})
37-
var pendingTxView = addPlugin("./views/pending_tx.qml", {title: "Pending", canClose: true})
38-
var pendingTxView = addPlugin("./views/javascript.qml", {title: "JavaScript", canClose: true})
33+
var historyView = addPlugin("./views/history.qml", {default: true})
34+
var newTxView = addPlugin("./views/transaction.qml", {default: true})
35+
var chainView = addPlugin("./views/chain.qml", {default: true})
36+
var infoView = addPlugin("./views/info.qml", {default: true})
37+
var pendingTxView = addPlugin("./views/pending_tx.qml", {default: true})
38+
var pendingTxView = addPlugin("./views/javascript.qml", {default: true})
3939

4040
// Call the ready handler
4141
gui.done()
@@ -250,12 +250,17 @@ ApplicationWindow {
250250
anchors.fill: parent
251251
resizing: false
252252

253-
function setView(view) {
253+
function setView(view, menu) {
254254
for(var i = 0; i < views.length; i++) {
255-
views[i].visible = false
256-
}
255+
views[i][0].visible = false
257256

257+
views[i][1].border.color = "#00000000"
258+
views[i][1].color = "#00000000"
259+
}
258260
view.visible = true
261+
262+
menu.border.color = "#CCCCCC"
263+
menu.color = "#FFFFFFFF"
259264
}
260265

261266
function addComponent(component, options) {
@@ -265,8 +270,9 @@ ApplicationWindow {
265270
return;
266271
}
267272

268-
menu.createMenuItem(view.iconFile, view, options);
269-
mainSplit.views.push(view);
273+
var menuItem = menu.createMenuItem(view.iconFile, view, options);
274+
275+
mainSplit.views.push([view, menuItem]);
270276

271277
return view
272278
}
@@ -276,96 +282,91 @@ ApplicationWindow {
276282
********************/
277283
Rectangle {
278284
id: menu
279-
Layout.minimumWidth: 80
280-
Layout.maximumWidth: 80
285+
Layout.minimumWidth: 180
286+
Layout.maximumWidth: 180
281287
anchors.top: parent.top
282-
color: "#252525"
288+
color: "#ececec"
283289

284290
Component {
285291
id: menuItemTemplate
286-
Image {
292+
Rectangle {
293+
id: menuItem
287294
property var view;
288-
anchors.horizontalCenter: parent.horizontalCenter
289-
MouseArea {
290-
anchors.fill: parent
291-
onClicked: {
292-
mainSplit.setView(view)
293-
}
294-
}
295-
}
296-
}
297295

298-
/*
299-
Component {
300-
id: menuItemTemplate
296+
property alias title: label.text
297+
property alias secondary: secondary.text
301298

302-
RowLayout {
303-
property var view;
304-
property alias source: icon.source;
305-
property alias title: title.text
306-
height: 25
307-
308-
id: tab
299+
width: 180
300+
height: 28
301+
border.color: "#00000000"
302+
border.width: 1
303+
radius: 5
304+
color: "#00000000"
309305

310306
anchors {
311307
left: parent.left
312-
right: parent.right
308+
leftMargin: 4
313309
}
314310

315311
Image {
316312
id: icon
317-
//anchors.horizontalCenter: parent.horizontalCenter
318-
}
319-
320-
MouseArea {
321-
anchors.fill: parent
322-
onClicked: {
323-
mainSplit.setView(view)
313+
anchors {
314+
left: parent.left
315+
verticalCenter: parent.verticalCenter
324316
}
317+
source: "../pick.png"
325318
}
326319

327-
Rectangle {
328-
color: "#bbbbbb"
329-
Label {
330-
id: title
331-
y: parent.height / 2 - this.height / 2
332-
//x: 5
333-
font.pixelSize: 10
320+
Text {
321+
id: label
322+
anchors {
323+
left: icon.right
324+
verticalCenter: parent.verticalCenter
334325
}
335326

327+
text: "Chain"
328+
font.bold: true
329+
color: "#0D0A01"
330+
font.pixelSize: 12
331+
}
336332

337-
Image {
338-
id: closeButton
339-
y: parent.height / 2 - this.height / 2
340-
visible: false
341-
342-
source: "../close.png"
343-
anchors {
344-
right: parent.right
345-
rightMargin: 5
346-
}
333+
Text {
334+
id: secondary
335+
anchors {
336+
right: parent.right
337+
rightMargin: 8
338+
verticalCenter: parent.verticalCenter
339+
}
340+
color: "#AEADBE"
341+
font.pixelSize: 12
342+
}
347343

348-
MouseArea {
349-
anchors.fill: parent
350-
onClicked: {
351-
console.log("should close")
352-
}
353-
}
344+
MouseArea {
345+
anchors.fill: parent
346+
onClicked: {
347+
mainSplit.setView(view, menuItem)
354348
}
355349
}
356350
}
357351
}
358-
*/
359352

360353
function createMenuItem(icon, view, options) {
361354
if(options === undefined) {
362355
options = {};
363356
}
364357

365-
var comp = menuItemTemplate.createObject(menuColumn)
358+
if(options.default) {
359+
var comp = menuItemTemplate.createObject(menuDefault)
360+
}
361+
366362
comp.view = view
367-
comp.source = icon
368-
//comp.title = options.title
363+
comp.title = view.title
364+
if(view.secondary !== undefined) {
365+
comp.secondary = view.secondary
366+
}
367+
368+
return comp
369+
369370
/*
370371
if(options.canClose) {
371372
//comp.closeButton.visible = options.canClose
@@ -375,10 +376,87 @@ ApplicationWindow {
375376

376377
ColumnLayout {
377378
id: menuColumn
378-
y: 50
379+
y: 30
380+
width: parent.width
379381
anchors.left: parent.left
380382
anchors.right: parent.right
381-
spacing: 10
383+
spacing: 3
384+
385+
Text {
386+
text: "ETHEREUM"
387+
font.bold: true
388+
anchors {
389+
left: parent.left
390+
leftMargin: 5
391+
}
392+
color: "#888888"
393+
}
394+
395+
ColumnLayout {
396+
id: menuDefault
397+
spacing: 3
398+
anchors {
399+
left: parent.left
400+
right: parent.right
401+
}
402+
}
403+
404+
Text {
405+
text: "APPS"
406+
font.bold: true
407+
anchors {
408+
left: parent.left
409+
leftMargin: 5
410+
}
411+
color: "#888888"
412+
}
413+
414+
/*
415+
Rectangle {
416+
width: 180
417+
height: 28
418+
border.color: "#CCCCCC"
419+
border.width: 1
420+
radius: 5
421+
color: "#FFFFFF"
422+
423+
anchors {
424+
left: parent.left
425+
leftMargin: 4
426+
}
427+
428+
Image {
429+
id: icon
430+
anchors {
431+
left: parent.left
432+
verticalCenter: parent.verticalCenter
433+
}
434+
source: "../pick.png"
435+
}
436+
437+
Text {
438+
anchors {
439+
left: icon.right
440+
verticalCenter: parent.verticalCenter
441+
}
442+
443+
text: "Wallet"
444+
font.bold: true
445+
color: "#0D0A01"
446+
}
447+
448+
Text {
449+
anchors {
450+
right: parent.right
451+
rightMargin: 8
452+
verticalCenter: parent.verticalCenter
453+
}
454+
color: "#AEADBE"
455+
text: "12e15 Ξ"
456+
font.pixelSize: 12
457+
}
458+
}
459+
*/
382460
}
383461
}
384462

0 commit comments

Comments
 (0)