From 594003891a205d9727ab6c827e94eb35a8148dab Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 24 Jun 2015 23:52:51 +0200 Subject: [PATCH] tr dialog ui changes --- mix/qml/Ether.qml | 1 + mix/qml/QHashTypeView.qml | 23 ++---- mix/qml/QIntTypeView.qml | 33 +++----- mix/qml/QStringTypeView.qml | 28 +++---- mix/qml/StructView.qml | 8 +- mix/qml/TransactionDialog.qml | 151 ++++++++++++++++++---------------- 6 files changed, 112 insertions(+), 132 deletions(-) diff --git a/mix/qml/Ether.qml b/mix/qml/Ether.qml index 7a059e04d..29323642a 100644 --- a/mix/qml/Ether.qml +++ b/mix/qml/Ether.qml @@ -54,6 +54,7 @@ RowLayout { { id: units visible: displayUnitSelection; + implicitWidth: 145 onCurrentTextChanged: { if (value) diff --git a/mix/qml/QHashTypeView.qml b/mix/qml/QHashTypeView.qml index ee5848b3a..6811dd43f 100644 --- a/mix/qml/QHashTypeView.qml +++ b/mix/qml/QHashTypeView.qml @@ -13,22 +13,15 @@ Item id: boldFont } - Rectangle { - anchors.fill: parent - radius: 4 - TextInput { - id: textinput - text: value + TextInput { + id: textinput + text: value + wrapMode: Text.WrapAnywhere + MouseArea { + id: mouseArea anchors.fill: parent - wrapMode: Text.WrapAnywhere - clip: true - font.family: boldFont.name - MouseArea { - id: mouseArea - anchors.fill: parent - hoverEnabled: true - onClicked: textinput.forceActiveFocus() - } + hoverEnabled: true + onClicked: textinput.forceActiveFocus() } } } diff --git a/mix/qml/QIntTypeView.qml b/mix/qml/QIntTypeView.qml index ec54d6409..6bee54a1f 100644 --- a/mix/qml/QIntTypeView.qml +++ b/mix/qml/QIntTypeView.qml @@ -1,35 +1,26 @@ import QtQuick 2.0 - +import QtQuick.Controls 1.1 Item { property alias value: textinput.text property alias readOnly: textinput.readOnly id: editRoot - width: readOnly ? textinput.implicitWidth : 150 - + width: 200 DebuggerPaneStyle { id: dbgStyle } - Rectangle { - anchors.fill: parent - radius: 4 - TextInput { - anchors.verticalCenter: parent.verticalCenter - id: textinput - font.family: dbgStyle.general.basicFont - clip: true - selectByMouse: true - text: value + TextField { + anchors.verticalCenter: parent.verticalCenter + id: textinput + selectByMouse: true + text: value + implicitWidth: 200 + MouseArea { + id: mouseArea anchors.fill: parent - font.pointSize: dbgStyle.general.basicFontSize - color: dbgStyle.general.basicColor - MouseArea { - id: mouseArea - anchors.fill: parent - hoverEnabled: true - onClicked: textinput.forceActiveFocus() - } + hoverEnabled: true + onClicked: textinput.forceActiveFocus() } } } diff --git a/mix/qml/QStringTypeView.qml b/mix/qml/QStringTypeView.qml index c42e65654..25831cb00 100644 --- a/mix/qml/QStringTypeView.qml +++ b/mix/qml/QStringTypeView.qml @@ -1,4 +1,5 @@ import QtQuick 2.0 +import QtQuick.Controls 1.1 Item { @@ -11,25 +12,16 @@ Item id: dbgStyle } - Rectangle { - anchors.fill: parent - radius: 4 - TextInput { - anchors.verticalCenter: parent.verticalCenter - id: textinput - font.family: dbgStyle.general.basicFont - clip: true - selectByMouse: true - text: value + TextField { + anchors.verticalCenter: parent.verticalCenter + id: textinput + selectByMouse: true + text: value + MouseArea { + id: mouseArea anchors.fill: parent - font.pointSize: dbgStyle.general.basicFontSize - color: dbgStyle.general.basicColor - MouseArea { - id: mouseArea - anchors.fill: parent - hoverEnabled: true - onClicked: textinput.forceActiveFocus() - } + hoverEnabled: true + onClicked: textinput.forceActiveFocus() } } } diff --git a/mix/qml/StructView.qml b/mix/qml/StructView.qml index e486ec6fd..bd2cbf598 100644 --- a/mix/qml/StructView.qml +++ b/mix/qml/StructView.qml @@ -13,7 +13,7 @@ Column property int transactionIndex property string context Layout.fillWidth: true - spacing: 15 + spacing: 5 Repeater { id: repeater @@ -21,7 +21,7 @@ Column RowLayout { 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 Rectangle { @@ -31,13 +31,11 @@ Column anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter Label { - height: 20 id: nameLabel text: modelData.name } Label { - height: 20 id: typeLabel text: " (" + modelData.type.name + ")" font.italic: true @@ -49,8 +47,6 @@ Column Loader { id: typeLoader - height: 20 - anchors.verticalCenter: parent.verticalCenter sourceComponent: { var t = modelData.type.category; diff --git a/mix/qml/TransactionDialog.qml b/mix/qml/TransactionDialog.qml index edd19906d..f4aa9a5f0 100644 --- a/mix/qml/TransactionDialog.qml +++ b/mix/qml/TransactionDialog.qml @@ -13,7 +13,7 @@ import "." Dialog { id: modalTransactionDialog modality: Qt.ApplicationModal - width: 630 + width: 580 height: 500 visible: false title: qsTr("Edit Transaction") @@ -31,7 +31,7 @@ Dialog { property alias stateAccounts: senderComboBox.model property bool saveStatus signal accepted; - + property int rowWidth: 500 StateDialogStyle { id: transactionDialogStyle } @@ -39,8 +39,8 @@ Dialog { function open(index, blockIdx, item) { transactionIndex = index blockIndex = blockIdx - typeLoader.transactionIndex = index - typeLoader.blockIndex = blockIdx + paramScroll.transactionIndex = index + paramScroll.blockIndex = blockIdx saveStatus = item.saveStatus gasValueEdit.gasValue = item.gas; gasAutoCheck.checked = item.gasAuto ? true : false; @@ -139,10 +139,10 @@ Dialog { function initTypeLoader() { - typeLoader.value = {} - typeLoader.members = [] - typeLoader.value = paramValues; - typeLoader.members = paramsModel; + paramScroll.value = {} + paramScroll.members = [] + paramScroll.value = paramValues; + paramScroll.members = paramsModel; paramScroll.updateView() } @@ -273,6 +273,7 @@ Dialog { } contentItem: Rectangle { + id: containerRect color: transactionDialogStyle.generic.backgroundColor anchors.fill: parent ScrollView @@ -280,14 +281,18 @@ Dialog { anchors.top: parent.top anchors.fill: parent ColumnLayout { - width: modalTransactionDialog.width - 30 - anchors.horizontalCenter: parent.horizontalCenter + Layout.preferredWidth: rowWidth anchors.top: parent.top anchors.topMargin: 10 - spacing: 10 + anchors.left: parent.left + width: 500 + anchors.leftMargin: + { + return (containerRect.width - 530) /2 + } + RowLayout { - Layout.fillWidth: true Rectangle { Layout.preferredWidth: 150 @@ -318,7 +323,6 @@ Dialog { RowLayout { - Layout.fillWidth: true Rectangle { Layout.preferredWidth: 150 @@ -335,7 +339,7 @@ Dialog { Column { - Layout.preferredWidth: 150 + Layout.preferredWidth: 350 Layout.preferredHeight: 90 ExclusiveGroup { id: rbbuttonList @@ -393,7 +397,6 @@ Dialog { RowLayout { - Layout.fillWidth: true Rectangle { Layout.preferredWidth: 150 @@ -436,7 +439,6 @@ Dialog { RowLayout { - Layout.fillWidth: true Rectangle { Layout.preferredWidth: 150 @@ -444,12 +446,14 @@ Dialog { function hide() { + parent.visible = false functionRect.visible = false functionComboBox.visible = false } function show() { + parent.visible = true functionRect.visible = true functionComboBox.visible = true } @@ -476,37 +480,26 @@ Dialog { } } - RowLayout + StructView { id: paramScroll + members: paramsModel; + accounts: senderComboBox.model + context: "parameter" Layout.fillWidth: true - function updateView() { paramScroll.visible = paramsModel.length > 0 - typeLoader.visible = paramsModel.length > 0 - paramScroll.height = paramsModel.length < 6 ? paramsModel.length * 30 : 190 - typeLoader.height = paramsModel.length < 6 ? paramsModel.length * 30 : 190 + paramScroll.Layout.preferredHeight = paramsModel.length < 6 ? paramsModel.length * 30 : 205 if (paramsModel.length === 0) { paramScroll.height = 0 - typeLoader.height = 0 } } - - StructView - { - id: typeLoader - Layout.preferredWidth: 500 - members: paramsModel; - accounts: senderComboBox.model - context: "parameter" - } } RowLayout { - Layout.fillWidth: true Rectangle { Layout.preferredWidth: 150 @@ -519,6 +512,7 @@ Dialog { } Ether { + Layout.preferredWidth: 350 id: valueField edit: true displayFormattedValue: false @@ -542,20 +536,24 @@ Dialog { Rectangle { - width: parent.width height: 20 color: "transparent" - Label { - text: qsTr("Transaction fees") + Layout.preferredWidth: 500 + Rectangle + { + anchors.horizontalCenter: parent.horizontalCenter + Label { + text: qsTr("Transaction fees") + anchors.horizontalCenter: parent.horizontalCenter + } } + } RowLayout { - Layout.fillWidth: true - Layout.preferredHeight: 40 - + Layout.preferredHeight: 45 Rectangle { Layout.preferredWidth: 150 @@ -568,6 +566,7 @@ Dialog { Row { + Layout.preferredWidth: 350 DefaultTextField { property variant gasValue @@ -595,7 +594,10 @@ Dialog { { var gasCost = codeModel.gasCostBy(contractName, functionName); if (gasCost && gasCost.length > 0) + { + var gas = codeModel.txGas + codeModel.callStipend + parseInt(gasCost[0].gas) estimatedGas.text = qsTr("Estimated cost: ") + gasCost[0].gas + " gas" + } } function updateView() @@ -635,8 +637,8 @@ Dialog { RowLayout { - Layout.fillWidth: true - Layout.preferredHeight: 40 + Layout.preferredWidth: 500 + Layout.preferredHeight: 45 Rectangle { Layout.preferredWidth: 150 @@ -645,22 +647,23 @@ Dialog { anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right text: qsTr("Gas Price") - } - Label { - id: gasPriceMarket - anchors.top: gasPriceLabel.bottom - Component.onCompleted: - { - NetworkDeployment.gasPrice(function(result) + Label { + id: gasPriceMarket + anchors.top: gasPriceLabel.bottom + Component.onCompleted: { - gasPriceMarket.text = qsTr("Current market: ") + " " + result + " Wei"; - }, function (){}); + NetworkDeployment.gasPrice(function(result) + { + gasPriceMarket.text = qsTr("Current market: ") + " " + result + " Wei"; + }, function (){}); + } } } } Ether { + Layout.preferredWidth: 350 id: gasPriceField edit: true displayFormattedValue: false @@ -671,33 +674,38 @@ Dialog { RowLayout { - anchors.right: parent.right - Button { - text: qsTr("Cancel"); - onClicked: close(); - } + Layout.preferredWidth: 500 + Row + { + width: parent.width + anchors.right: parent.right + Button { + id: updateBtn + text: qsTr("Cancel"); + onClicked: close(); + } - Button { - text: qsTr("Update"); - onClicked: { - var invalid = InputValidator.validate(paramsModel, paramValues); - if (invalid.length === 0) - { - close(); - accepted(); - } - else - { - errorDialog.text = qsTr("Some parameters are invalid:\n"); - for (var k in invalid) - errorDialog.text += invalid[k].message + "\n"; - errorDialog.open(); + Button { + text: qsTr("Update"); + onClicked: { + var invalid = InputValidator.validate(paramsModel, paramValues); + if (invalid.length === 0) + { + close(); + accepted(); + } + else + { + errorDialog.text = qsTr("Some parameters are invalid:\n"); + for (var k in invalid) + errorDialog.text += invalid[k].message + "\n"; + errorDialog.open(); + } } } } - MessageDialog { id: errorDialog standardButtons: StandardButton.Ok @@ -707,11 +715,10 @@ Dialog { RowLayout { + Layout.preferredHeight: 30 anchors.bottom: parent.bottom - Layout.preferredHeight: 20 } } } } } -