github.com/jonasnick/go-ethereum@v0.7.12-0.20150216215225-22176f05d387/cmd/mist/assets/qml/views/info.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  	property var title: "Debug Info"
    11  	property var menuItem
    12  
    13  	objectName: "infoView"
    14  	visible: false
    15  	anchors.fill: parent
    16  
    17  	color: "#00000000"
    18  
    19  	Column {
    20  		id: info
    21  		spacing: 3
    22  		anchors.fill: parent
    23  		anchors.topMargin: 5
    24  		anchors.leftMargin: 5
    25  
    26  		Label {
    27  			id: addressLabel
    28  			text: "Address"
    29  		}
    30  		TextField {
    31  			text: eth.coinbase()
    32  			width: 500
    33  		}
    34  
    35  		TextArea {
    36  			objectName: "statsPane"
    37  			width: parent.width
    38  			height: 200
    39  			selectByMouse: true
    40  			readOnly: true
    41  			font.family: "Courier"
    42  		}
    43  	}
    44  
    45  	RowLayout {
    46  		id: logLayout
    47  		width: parent.width
    48  		height: 200
    49  		anchors.bottom: parent.bottom
    50  
    51  		TableView {
    52  			id: addressView
    53  			width: parent.width
    54  			height: 200
    55  			anchors {
    56  				left: parent.left
    57  				right: logLevelSlider.left
    58  				bottom: parent.bottom
    59  				top: parent.top
    60  			}
    61  			TableViewColumn{ role: "name"; title: "name" }
    62  			TableViewColumn{ role: "address"; title: "address"; width: 300}
    63  
    64  			property var addressModel: ListModel {
    65  				id: addressModel
    66  			}
    67  
    68  			model: addressModel
    69  			itemDelegate: Item {
    70  				Text {
    71  					anchors {
    72  						left: parent.left
    73  						right: parent.right
    74  						leftMargin: 10
    75  						verticalCenter: parent.verticalCenter
    76  					}
    77  					color: styleData.textColor
    78  					elide: styleData.elideMode
    79  					text: styleData.value
    80  					font.pixelSize: 11
    81  					MouseArea {
    82  						acceptedButtons: Qt.LeftButton | Qt.RightButton
    83  						propagateComposedEvents: true
    84  						anchors.fill: parent
    85  						onClicked: {
    86  							addressView.selection.clear()
    87  							addressView.selection.select(styleData.row)
    88  
    89  							if(mouse.button == Qt.RightButton) {
    90  								contextMenu.row = styleData.row;
    91  								contextMenu.popup()
    92  							}
    93  						}
    94  					}
    95  				}
    96  			}
    97  
    98  			Menu {
    99  				id: contextMenu
   100  				property var row;
   101  
   102  				MenuItem {
   103  					text: "Copy"
   104  					onTriggered: {
   105  						copyToClipboard(addressModel.get(this.row).address)
   106  					}
   107  				}
   108  			}
   109  		}
   110  
   111  		/*
   112  		TableView {
   113  			id: logView
   114  			headerVisible: false
   115  			anchors {
   116  				right: logLevelSlider.left
   117  				left: parent.left
   118  				bottom: parent.bottom
   119  				top: parent.top
   120  			}
   121  
   122  			TableViewColumn{ role: "description" ; title: "log" }
   123  
   124  			model: logModel
   125  		}
   126  		*/
   127  
   128  		Slider {
   129  			id: logLevelSlider
   130  			value: gui.getLogLevelInt()
   131  			anchors {
   132  				right: parent.right
   133  				top: parent.top
   134  				bottom: parent.bottom
   135  
   136  				rightMargin: 5
   137  				leftMargin: 5
   138  				topMargin: 5
   139  				bottomMargin: 5
   140  			}
   141  
   142  			orientation: Qt.Vertical
   143  			maximumValue: 5
   144  			stepSize: 1
   145  
   146  			onValueChanged: {
   147  				gui.setLogLevel(value)
   148  			}
   149  		}
   150  	}
   151  
   152  	property var logModel: ListModel {
   153  		id: logModel
   154  	}
   155  
   156  	function addDebugMessage(message){
   157  		debuggerLog.append({value: message})
   158  	}
   159  
   160  	function addAddress(address) {
   161  		addressModel.append({name: address.name, address: address.address})
   162  	}
   163  
   164  	function clearAddress() {
   165  		addressModel.clear()
   166  	}
   167  
   168  	function addLog(str) {
   169  		// Remove first item once we've reached max log items
   170  		if(logModel.count > 250) {
   171  			logModel.remove(0)
   172  		}
   173  
   174  		if(str.len != 0) {
   175  			if(logView.flickableItem.atYEnd) {
   176  				logModel.append({description: str})
   177  				logView.positionViewAtRow(logView.rowCount - 1, ListView.Contain)
   178  			} else {
   179  				logModel.append({description: str})
   180  			}
   181  		}
   182  
   183  	}
   184  }