Skip to content

Commit c4b8c11

Browse files
author
Alexandre Van de Sande
committed
side icons
1 parent 666ef48 commit c4b8c11

File tree

4 files changed

+103
-19
lines changed

4 files changed

+103
-19
lines changed

cmd/mist/assets/browser.png

-4.47 KB
Loading

cmd/mist/assets/[email protected]

1.57 KB
Loading

cmd/mist/assets/qml/main.qml

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,14 @@ ApplicationWindow {
4040
// Takes care of loading all default plugins
4141
Component.onCompleted: {
4242

43-
catalog = addPlugin("./views/catalog.qml", {noAdd: true, close: false, section: "begin"});
44-
var wallet = addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "ethereum", active: true});
43+
catalog = addPlugin("./views/catalog.qml", {noAdd: true, close: false, section: "begin", active: true});
44+
var wallet = addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "ethereum"});
4545

46-
addPlugin("./views/miner.qml", {noAdd: true, close: false, section: "ethereum", active: true});
46+
var walletWeb = addPlugin("./views/browser.qml", {noAdd: true, close: false, section: "ethereum", active: false});
47+
walletWeb.view.url = "http://ethereum-dapp-wallet.meteor.com/";
48+
walletWeb.menuItem.title = "Wallet";
49+
50+
addPlugin("./views/miner.qml", {noAdd: true, close: false, section: "ethereum", active: false});
4751
addPlugin("./views/transaction.qml", {noAdd: true, close: false, section: "legacy"});
4852
addPlugin("./views/whisper.qml", {noAdd: true, close: false, section: "legacy"});
4953
addPlugin("./views/chain.qml", {noAdd: true, close: false, section: "legacy"});
@@ -443,10 +447,14 @@ ApplicationWindow {
443447
property var view;
444448
property var path;
445449
property var closable;
450+
property var badgeContent;
446451

447452
property alias title: label.text
448453
property alias icon: icon.source
449454
property alias secondaryTitle: secondary.text
455+
property alias badgeNumber: badgeNumberLabel.text
456+
property alias badgeIcon: badgeIconLabel.text
457+
450458
function setSelection(on) {
451459
sel.visible = on
452460

@@ -539,9 +547,6 @@ ApplicationWindow {
539547
if (parent.closable == true) {
540548
closeIcon.visible = sel.visible
541549
}
542-
/*if(view.hasOwnProperty("iconSource")) {
543-
icon.source = view.iconSource;
544-
}*/
545550
}
546551
onExited: {
547552
closeIcon.visible = false
@@ -550,8 +555,8 @@ ApplicationWindow {
550555

551556
Image {
552557
id: icon
553-
height: 24
554-
width: 24
558+
height: 28
559+
width: 28
555560
anchors {
556561
left: parent.left
557562
verticalCenter: parent.verticalCenter
@@ -581,7 +586,7 @@ ApplicationWindow {
581586
verticalCenter: parent.verticalCenter
582587
leftMargin: 6
583588
rightMargin: 8
584-
// verticalCenterOffset: -10
589+
verticalCenterOffset: (secondaryTitle == "") ? 0 : -10;
585590
}
586591
x:250
587592
color: "#665F5F"
@@ -607,7 +612,7 @@ ApplicationWindow {
607612
visible: false
608613
width: 10
609614
height: 10
610-
color: "#FFFFFF"
615+
color: "#FAFAFA"
611616
anchors {
612617
fill: icon
613618
}
@@ -626,9 +631,49 @@ ApplicationWindow {
626631
centerIn: parent
627632
}
628633
color: "#665F5F"
629-
font.pixelSize: 18
634+
font.pixelSize: 20
630635
text: "\ue082"
631636
}
637+
}
638+
639+
Rectangle {
640+
id: badge
641+
visible: (badgeContent == "icon" || badgeContent == "number" )? true : false
642+
width: 32
643+
color: "#05000000"
644+
anchors {
645+
right: parent.right;
646+
top: parent.top;
647+
bottom: parent.bottom;
648+
rightMargin: 4;
649+
}
650+
651+
Text {
652+
id: badgeIconLabel
653+
visible: (badgeContent == "icon") ? true : false;
654+
font.family: simpleLineIcons.name
655+
anchors {
656+
centerIn: parent
657+
}
658+
horizontalAlignment: Text.AlignCenter
659+
color: "#AAA0A0"
660+
font.pixelSize: 20
661+
text: badgeIcon
662+
}
663+
664+
Text {
665+
id: badgeNumberLabel
666+
visible: (badgeContent == "number") ? true : false;
667+
anchors {
668+
centerIn: parent
669+
}
670+
horizontalAlignment: Text.AlignCenter
671+
font.family: sourceSansPro.name
672+
font.weight: Font.Light
673+
color: "#AAA0A0"
674+
font.pixelSize: 18
675+
text: badgeNumber
676+
}
632677
}
633678

634679

cmd/mist/assets/qml/views/browser.qml

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,50 @@ Rectangle {
351351
z: 10
352352

353353
Timer {
354-
interval: 500; running: true; repeat: true
354+
interval: 2000; running: true; repeat: true
355355
onTriggered: {
356-
webview.runJavaScript("try{document.querySelector('meta[name=badge]').getAttribute('content')}catch(e){}", function(badge) {
357-
if (badge) {
358-
menuItem.secondaryTitle = badge;
359-
}
360-
});
356+
webview.runJavaScript("try{document.querySelector('meta[name=ethereum-dapp-info]').getAttribute('content')}catch(e){}", function(extraInfo) {
357+
if (extraInfo) {
358+
menuItem.secondaryTitle = extraInfo;
359+
}
360+
});
361+
webview.runJavaScript("try{document.querySelector('meta[name=ethereum-dapp-badge]').getAttribute('content')}catch(e){}", function(badge) {
362+
if (badge) {
363+
if (Number(badge)>0 && Number(badge)<999) {
364+
menuItem.badgeNumber = Number(badge);
365+
menuItem.badgeContent = "number"
366+
} else if (badge == "warning") {
367+
menuItem.badgeIcon = "\ue00e"
368+
menuItem.badgeContent = "icon"
369+
370+
} else if (badge == "ghost") {
371+
menuItem.badgeIcon = "\ue01a"
372+
menuItem.badgeContent = "icon"
373+
374+
} else if (badge == "question") {
375+
menuItem.badgeIcon = "\ue05d"
376+
menuItem.badgeContent = "icon"
377+
378+
} else if (badge == "info") {
379+
menuItem.badgeIcon = "\ue08b"
380+
menuItem.badgeContent = "icon"
381+
382+
} else if (badge == "check") {
383+
menuItem.badgeIcon = "\ue080"
384+
menuItem.badgeContent = "icon"
385+
386+
} else if (badge == "gear") {
387+
menuItem.badgeIcon = "\ue09a"
388+
menuItem.badgeContent = "icon"
389+
390+
}
391+
392+
393+
console.log(menuItem.badgeContent);
394+
} else {
395+
menuItem.badgeContent = ""
396+
}
397+
});
361398
}
362399
}
363400

@@ -367,10 +404,12 @@ Rectangle {
367404
menuItem.title = pageTitle;
368405
});
369406

370-
webView.runJavaScript("document.querySelector(\"link[rel='icon']\").getAttribute(\"href\")", function(sideIcon){
407+
webView.runJavaScript("try{document.querySelector(\"link[rel='icon']\").getAttribute(\"href\")}catch(e){}", function(sideIcon){
371408
if(sideIcon){
372-
menuItem.icon = "http://localhost:3000/[email protected]"
409+
menuItem.icon = webview.url + sideIcon;
410+
console.log("icon: " + webview.url + sideIcon );
373411
};
412+
console.log("no icon!" );
374413
});
375414

376415
webView.runJavaScript("try{document.querySelector(\"meta[name='ethereum-dapp-url-bar-style']\").getAttribute(\"content\")}catch(e){}", function(topBarStyle){

0 commit comments

Comments
 (0)