Browse Source

tr dialog ui changes

cl-refactor
yann300 10 years ago
parent
commit
594003891a
  1. 1
      mix/qml/Ether.qml
  2. 23
      mix/qml/QHashTypeView.qml
  3. 33
      mix/qml/QIntTypeView.qml
  4. 28
      mix/qml/QStringTypeView.qml
  5. 8
      mix/qml/StructView.qml
  6. 151
      mix/qml/TransactionDialog.qml

1
mix/qml/Ether.qml

@ -54,6 +54,7 @@ RowLayout {
{ {
id: units id: units
visible: displayUnitSelection; visible: displayUnitSelection;
implicitWidth: 145
onCurrentTextChanged: onCurrentTextChanged:
{ {
if (value) if (value)

23
mix/qml/QHashTypeView.qml

@ -13,22 +13,15 @@ Item
id: boldFont id: boldFont
} }
Rectangle { TextInput {
anchors.fill: parent id: textinput
radius: 4 text: value
TextInput { wrapMode: Text.WrapAnywhere
id: textinput MouseArea {
text: value id: mouseArea
anchors.fill: parent anchors.fill: parent
wrapMode: Text.WrapAnywhere hoverEnabled: true
clip: true onClicked: textinput.forceActiveFocus()
font.family: boldFont.name
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: textinput.forceActiveFocus()
}
} }
} }
} }

33
mix/qml/QIntTypeView.qml

@ -1,35 +1,26 @@
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Controls 1.1
Item Item
{ {
property alias value: textinput.text property alias value: textinput.text
property alias readOnly: textinput.readOnly property alias readOnly: textinput.readOnly
id: editRoot id: editRoot
width: readOnly ? textinput.implicitWidth : 150 width: 200
DebuggerPaneStyle { DebuggerPaneStyle {
id: dbgStyle id: dbgStyle
} }
Rectangle { TextField {
anchors.fill: parent anchors.verticalCenter: parent.verticalCenter
radius: 4 id: textinput
TextInput { selectByMouse: true
anchors.verticalCenter: parent.verticalCenter text: value
id: textinput implicitWidth: 200
font.family: dbgStyle.general.basicFont MouseArea {
clip: true id: mouseArea
selectByMouse: true
text: value
anchors.fill: parent anchors.fill: parent
font.pointSize: dbgStyle.general.basicFontSize hoverEnabled: true
color: dbgStyle.general.basicColor onClicked: textinput.forceActiveFocus()
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: textinput.forceActiveFocus()
}
} }
} }
} }

28
mix/qml/QStringTypeView.qml

@ -1,4 +1,5 @@
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Controls 1.1
Item Item
{ {
@ -11,25 +12,16 @@ Item
id: dbgStyle id: dbgStyle
} }
Rectangle { TextField {
anchors.fill: parent anchors.verticalCenter: parent.verticalCenter
radius: 4 id: textinput
TextInput { selectByMouse: true
anchors.verticalCenter: parent.verticalCenter text: value
id: textinput MouseArea {
font.family: dbgStyle.general.basicFont id: mouseArea
clip: true
selectByMouse: true
text: value
anchors.fill: parent anchors.fill: parent
font.pointSize: dbgStyle.general.basicFontSize hoverEnabled: true
color: dbgStyle.general.basicColor onClicked: textinput.forceActiveFocus()
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: textinput.forceActiveFocus()
}
} }
} }
} }

8
mix/qml/StructView.qml

@ -13,7 +13,7 @@ Column
property int transactionIndex property int transactionIndex
property string context property string context
Layout.fillWidth: true Layout.fillWidth: true
spacing: 15 spacing: 5
Repeater Repeater
{ {
id: repeater id: repeater
@ -21,7 +21,7 @@ Column
RowLayout RowLayout
{ {
id: row id: row
height: 20 + (members[index].type.category === QSolidityType.Struct ? (20 * members[index].type.members.length) : 0) height: 30 + (members[index].type.category === QSolidityType.Struct ? (30 * members[index].type.members.length) : 0)
Layout.fillWidth: true Layout.fillWidth: true
Rectangle Rectangle
{ {
@ -31,13 +31,11 @@ Column
anchors.right: parent.right anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Label { Label {
height: 20
id: nameLabel id: nameLabel
text: modelData.name text: modelData.name
} }
Label { Label {
height: 20
id: typeLabel id: typeLabel
text: " (" + modelData.type.name + ")" text: " (" + modelData.type.name + ")"
font.italic: true font.italic: true
@ -49,8 +47,6 @@ Column
Loader Loader
{ {
id: typeLoader id: typeLoader
height: 20
anchors.verticalCenter: parent.verticalCenter
sourceComponent: sourceComponent:
{ {
var t = modelData.type.category; var t = modelData.type.category;

151
mix/qml/TransactionDialog.qml

@ -13,7 +13,7 @@ import "."
Dialog { Dialog {
id: modalTransactionDialog id: modalTransactionDialog
modality: Qt.ApplicationModal modality: Qt.ApplicationModal
width: 630 width: 580
height: 500 height: 500
visible: false visible: false
title: qsTr("Edit Transaction") title: qsTr("Edit Transaction")
@ -31,7 +31,7 @@ Dialog {
property alias stateAccounts: senderComboBox.model property alias stateAccounts: senderComboBox.model
property bool saveStatus property bool saveStatus
signal accepted; signal accepted;
property int rowWidth: 500
StateDialogStyle { StateDialogStyle {
id: transactionDialogStyle id: transactionDialogStyle
} }
@ -39,8 +39,8 @@ Dialog {
function open(index, blockIdx, item) { function open(index, blockIdx, item) {
transactionIndex = index transactionIndex = index
blockIndex = blockIdx blockIndex = blockIdx
typeLoader.transactionIndex = index paramScroll.transactionIndex = index
typeLoader.blockIndex = blockIdx paramScroll.blockIndex = blockIdx
saveStatus = item.saveStatus saveStatus = item.saveStatus
gasValueEdit.gasValue = item.gas; gasValueEdit.gasValue = item.gas;
gasAutoCheck.checked = item.gasAuto ? true : false; gasAutoCheck.checked = item.gasAuto ? true : false;
@ -139,10 +139,10 @@ Dialog {
function initTypeLoader() function initTypeLoader()
{ {
typeLoader.value = {} paramScroll.value = {}
typeLoader.members = [] paramScroll.members = []
typeLoader.value = paramValues; paramScroll.value = paramValues;
typeLoader.members = paramsModel; paramScroll.members = paramsModel;
paramScroll.updateView() paramScroll.updateView()
} }
@ -273,6 +273,7 @@ Dialog {
} }
contentItem: Rectangle { contentItem: Rectangle {
id: containerRect
color: transactionDialogStyle.generic.backgroundColor color: transactionDialogStyle.generic.backgroundColor
anchors.fill: parent anchors.fill: parent
ScrollView ScrollView
@ -280,14 +281,18 @@ Dialog {
anchors.top: parent.top anchors.top: parent.top
anchors.fill: parent anchors.fill: parent
ColumnLayout { ColumnLayout {
width: modalTransactionDialog.width - 30 Layout.preferredWidth: rowWidth
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 10 anchors.topMargin: 10
spacing: 10 anchors.left: parent.left
width: 500
anchors.leftMargin:
{
return (containerRect.width - 530) /2
}
RowLayout RowLayout
{ {
Layout.fillWidth: true
Rectangle Rectangle
{ {
Layout.preferredWidth: 150 Layout.preferredWidth: 150
@ -318,7 +323,6 @@ Dialog {
RowLayout RowLayout
{ {
Layout.fillWidth: true
Rectangle Rectangle
{ {
Layout.preferredWidth: 150 Layout.preferredWidth: 150
@ -335,7 +339,7 @@ Dialog {
Column Column
{ {
Layout.preferredWidth: 150 Layout.preferredWidth: 350
Layout.preferredHeight: 90 Layout.preferredHeight: 90
ExclusiveGroup { ExclusiveGroup {
id: rbbuttonList id: rbbuttonList
@ -393,7 +397,6 @@ Dialog {
RowLayout RowLayout
{ {
Layout.fillWidth: true
Rectangle Rectangle
{ {
Layout.preferredWidth: 150 Layout.preferredWidth: 150
@ -436,7 +439,6 @@ Dialog {
RowLayout RowLayout
{ {
Layout.fillWidth: true
Rectangle Rectangle
{ {
Layout.preferredWidth: 150 Layout.preferredWidth: 150
@ -444,12 +446,14 @@ Dialog {
function hide() function hide()
{ {
parent.visible = false
functionRect.visible = false functionRect.visible = false
functionComboBox.visible = false functionComboBox.visible = false
} }
function show() function show()
{ {
parent.visible = true
functionRect.visible = true functionRect.visible = true
functionComboBox.visible = true functionComboBox.visible = true
} }
@ -476,37 +480,26 @@ Dialog {
} }
} }
RowLayout StructView
{ {
id: paramScroll id: paramScroll
members: paramsModel;
accounts: senderComboBox.model
context: "parameter"
Layout.fillWidth: true Layout.fillWidth: true
function updateView() function updateView()
{ {
paramScroll.visible = paramsModel.length > 0 paramScroll.visible = paramsModel.length > 0
typeLoader.visible = paramsModel.length > 0 paramScroll.Layout.preferredHeight = paramsModel.length < 6 ? paramsModel.length * 30 : 205
paramScroll.height = paramsModel.length < 6 ? paramsModel.length * 30 : 190
typeLoader.height = paramsModel.length < 6 ? paramsModel.length * 30 : 190
if (paramsModel.length === 0) if (paramsModel.length === 0)
{ {
paramScroll.height = 0 paramScroll.height = 0
typeLoader.height = 0
} }
} }
StructView
{
id: typeLoader
Layout.preferredWidth: 500
members: paramsModel;
accounts: senderComboBox.model
context: "parameter"
}
} }
RowLayout RowLayout
{ {
Layout.fillWidth: true
Rectangle Rectangle
{ {
Layout.preferredWidth: 150 Layout.preferredWidth: 150
@ -519,6 +512,7 @@ Dialog {
} }
Ether { Ether {
Layout.preferredWidth: 350
id: valueField id: valueField
edit: true edit: true
displayFormattedValue: false displayFormattedValue: false
@ -542,20 +536,24 @@ Dialog {
Rectangle Rectangle
{ {
width: parent.width
height: 20 height: 20
color: "transparent" color: "transparent"
Label { Layout.preferredWidth: 500
text: qsTr("Transaction fees") Rectangle
{
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
Label {
text: qsTr("Transaction fees")
anchors.horizontalCenter: parent.horizontalCenter
}
} }
} }
RowLayout RowLayout
{ {
Layout.fillWidth: true Layout.preferredHeight: 45
Layout.preferredHeight: 40
Rectangle Rectangle
{ {
Layout.preferredWidth: 150 Layout.preferredWidth: 150
@ -568,6 +566,7 @@ Dialog {
Row Row
{ {
Layout.preferredWidth: 350
DefaultTextField DefaultTextField
{ {
property variant gasValue property variant gasValue
@ -595,7 +594,10 @@ Dialog {
{ {
var gasCost = codeModel.gasCostBy(contractName, functionName); var gasCost = codeModel.gasCostBy(contractName, functionName);
if (gasCost && gasCost.length > 0) if (gasCost && gasCost.length > 0)
{
var gas = codeModel.txGas + codeModel.callStipend + parseInt(gasCost[0].gas)
estimatedGas.text = qsTr("Estimated cost: ") + gasCost[0].gas + " gas" estimatedGas.text = qsTr("Estimated cost: ") + gasCost[0].gas + " gas"
}
} }
function updateView() function updateView()
@ -635,8 +637,8 @@ Dialog {
RowLayout RowLayout
{ {
Layout.fillWidth: true Layout.preferredWidth: 500
Layout.preferredHeight: 40 Layout.preferredHeight: 45
Rectangle Rectangle
{ {
Layout.preferredWidth: 150 Layout.preferredWidth: 150
@ -645,22 +647,23 @@ Dialog {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
text: qsTr("Gas Price") text: qsTr("Gas Price")
}
Label { Label {
id: gasPriceMarket id: gasPriceMarket
anchors.top: gasPriceLabel.bottom anchors.top: gasPriceLabel.bottom
Component.onCompleted: Component.onCompleted:
{
NetworkDeployment.gasPrice(function(result)
{ {
gasPriceMarket.text = qsTr("Current market: ") + " " + result + " Wei"; NetworkDeployment.gasPrice(function(result)
}, function (){}); {
gasPriceMarket.text = qsTr("Current market: ") + " " + result + " Wei";
}, function (){});
}
} }
} }
} }
Ether { Ether {
Layout.preferredWidth: 350
id: gasPriceField id: gasPriceField
edit: true edit: true
displayFormattedValue: false displayFormattedValue: false
@ -671,33 +674,38 @@ Dialog {
RowLayout RowLayout
{ {
anchors.right: parent.right
Button { Layout.preferredWidth: 500
text: qsTr("Cancel"); Row
onClicked: close(); {
} width: parent.width
anchors.right: parent.right
Button {
id: updateBtn
text: qsTr("Cancel");
onClicked: close();
}
Button { Button {
text: qsTr("Update"); text: qsTr("Update");
onClicked: { onClicked: {
var invalid = InputValidator.validate(paramsModel, paramValues); var invalid = InputValidator.validate(paramsModel, paramValues);
if (invalid.length === 0) if (invalid.length === 0)
{ {
close(); close();
accepted(); accepted();
} }
else else
{ {
errorDialog.text = qsTr("Some parameters are invalid:\n"); errorDialog.text = qsTr("Some parameters are invalid:\n");
for (var k in invalid) for (var k in invalid)
errorDialog.text += invalid[k].message + "\n"; errorDialog.text += invalid[k].message + "\n";
errorDialog.open(); errorDialog.open();
}
} }
} }
} }
MessageDialog { MessageDialog {
id: errorDialog id: errorDialog
standardButtons: StandardButton.Ok standardButtons: StandardButton.Ok
@ -707,11 +715,10 @@ Dialog {
RowLayout RowLayout
{ {
Layout.preferredHeight: 30
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
Layout.preferredHeight: 20
} }
} }
} }
} }
} }

Loading…
Cancel
Save