github.com/jonasnick/go-ethereum@v0.7.12-0.20150216215225-22176f05d387/cmd/mist/assets/qml/views/wallet.qml (about) 1 import QtQuick 2.0 2 import QtQuick.Controls 1.0; 3 import QtQuick.Layouts 1.0; 4 import QtQuick.Dialogs 1.0; 5 import QtQuick.Window 2.1; 6 import QtQuick.Controls.Styles 1.1 7 import Ethereum 1.0 8 9 Rectangle { 10 id: root 11 property var title: "Wallet" 12 property var iconSource: "../facet.png" 13 property var menuItem 14 15 objectName: "walletView" 16 anchors.fill: parent 17 18 Label { 19 objectName: "balanceLabel" 20 visible: false 21 onTextChanged: { 22 balance.text = text 23 menuItem.secondaryTitle = text 24 } 25 } 26 27 function onReady() { 28 setBalance() 29 } 30 31 function setBalance() { 32 balance.text = "<b>Balance</b>: " + eth.numberToHuman(eth.balanceAt(eth.coinbase())) 33 if(menuItem) 34 menuItem.secondaryTitle = eth.numberToHuman(eth.balanceAt(eth.coinbase())) 35 } 36 37 ListModel { 38 id: denomModel 39 ListElement { text: "Wei" ; zeros: "" } 40 ListElement { text: "Ada" ; zeros: "000" } 41 ListElement { text: "Babbage" ; zeros: "000000" } 42 ListElement { text: "Shannon" ; zeros: "000000000" } 43 ListElement { text: "Szabo" ; zeros: "000000000000" } 44 ListElement { text: "Finney" ; zeros: "000000000000000" } 45 ListElement { text: "Ether" ; zeros: "000000000000000000" } 46 ListElement { text: "Einstein" ;zeros: "000000000000000000000" } 47 ListElement { text: "Douglas" ; zeros: "000000000000000000000000000000000000000000" } 48 } 49 50 ColumnLayout { 51 spacing: 10 52 y: 40 53 anchors.fill: parent 54 55 Text { 56 id: balance 57 font.pixelSize: 24 58 anchors { 59 horizontalCenter: parent.horizontalCenter 60 top: parent.top 61 topMargin: 20 62 } 63 } 64 65 Rectangle { 66 id: newTxPane 67 color: "#ececec" 68 border.color: "#cccccc" 69 border.width: 1 70 anchors { 71 top: balance.bottom 72 topMargin: 10 73 left: parent.left 74 leftMargin: 5 75 right: parent.right 76 rightMargin: 5 77 } 78 height: 100 79 80 RowLayout { 81 id: amountFields 82 spacing: 10 83 anchors { 84 top: parent.top 85 topMargin: 20 86 left: parent.left 87 leftMargin: 20 88 } 89 90 Text { 91 text: "Ξ " 92 } 93 94 // There's something off with the row layout where textfields won't listen to the width setting 95 Rectangle { 96 width: 50 97 height: 20 98 TextField { 99 id: txValue 100 width: parent.width 101 placeholderText: "0.00" 102 } 103 } 104 105 ComboBox { 106 id: valueDenom 107 currentIndex: 5 108 model: denomModel 109 } 110 111 } 112 113 RowLayout { 114 id: toFields 115 spacing: 10 116 anchors { 117 top: amountFields.bottom 118 topMargin: 5 119 left: parent.left 120 leftMargin: 20 121 } 122 123 Text { 124 text: "To" 125 } 126 127 Rectangle { 128 width: 200 129 height: 20 130 TextField { 131 id: txTo 132 width: parent.width 133 placeholderText: "Address or name" 134 } 135 } 136 137 Button { 138 text: "Send" 139 onClicked: { 140 var value = txValue.text + denomModel.get(valueDenom.currentIndex).zeros; 141 var gasPrice = "10000000000000" 142 var res = eth.transact({from: eth.coinbase(), to: txTo.text, value: value, gas: "500", gasPrice: gasPrice}) 143 } 144 } 145 } 146 } 147 148 Rectangle { 149 anchors { 150 left: parent.left 151 right: parent.right 152 top: newTxPane.bottom 153 topMargin: 10 154 bottom: parent.bottom 155 } 156 TableView { 157 id: txTableView 158 anchors.fill : parent 159 TableViewColumn{ role: "num" ; title: "#" ; width: 30 } 160 TableViewColumn{ role: "from" ; title: "From" ; width: 340 } 161 TableViewColumn{ role: "to" ; title: "To" ; width: 340 } 162 TableViewColumn{ role: "value" ; title: "Amount" ; width: 100 } 163 164 model: ListModel { 165 id: txModel 166 Component.onCompleted: { 167 } 168 169 function addTxs(messages) { 170 /* 171 setBalance() 172 173 for(var i = 0; i < messages.length; i++) { 174 var message = messages.get(i); 175 var to = eth.lookupName(message.to); 176 var from; 177 if(message.from.length == 0) { 178 from = "- MINED -"; 179 } else { 180 from = eth.lookupName(message.from); 181 } 182 txModel.insert(0, {num: txModel.count, from: from, to: to, value: eth.numberToHuman(message.value)}) 183 } 184 */ 185 } 186 } 187 } 188 } 189 190 } 191 }