diff --git a/mix/qml/DeploymentDialog.qml b/mix/qml/DeploymentDialog.qml index 5e55e9800..046dd1689 100644 --- a/mix/qml/DeploymentDialog.qml +++ b/mix/qml/DeploymentDialog.qml @@ -15,15 +15,19 @@ Window { id: modalDeploymentDialog modality: Qt.ApplicationModal - width: 930 - height: 350 + width: 735 + height: 320 + maximumWidth: width + minimumWidth: width + maximumHeight: height + minimumHeight: height visible: false property alias applicationUrlEth: applicationUrlEth.text property alias applicationUrlHttp: applicationUrlHttp.text - property string urlHintContract: "c83d3e22645fb015d02043a744921cc2f828c64d" /* TODO: replace with the good address */ + property string urlHintContract: urlHintAddr.text property string packageHash - property alias packageBase64: base64Value.text - property string eth: "4c3f7330690ed3657d3fa20fe5717b84010528ae"; /* TODO: replace with the good address */ + property string packageBase64 + property string eth: registrarAddr.text property string currentAccount property alias gasToUse: gasToUseInput.text @@ -150,187 +154,348 @@ Window { } } - Rectangle + SourceSansProRegular { - anchors.fill : parent + id: lightFont + } + + Column + { + spacing: 5 + anchors.fill: parent anchors.margins: 10 - color: Style.generic.layout.backgroundColor - GridLayout + ColumnLayout { - columns: 2 - anchors.top: parent.top - anchors.left: parent.left - width: parent.width - DefaultLabel + id: containerDeploy + Layout.fillWidth: true + Layout.preferredHeight: 500 + RowLayout { - text: qsTr("Account used to deploy:") - } + Rectangle + { + Layout.preferredWidth: 357 + DefaultLabel + { + text: qsTr("Deployment") + font.family: lightFont.name + font.underline: true + anchors.centerIn: parent + } + } - Rectangle - { - width: 300 - height: 25 - color: "transparent" - ComboBox { - id: comboAccounts - property var balances: [] - onCurrentIndexChanged : { - if (modelAccounts.count > 0) - { - currentAccount = modelAccounts.get(currentIndex).id; - balance.text = balances[currentIndex]; - } + Button + { + action: displayHelpAction + iconSource: "qrc:/qml/img/help.png" + } + + Action { + id: displayHelpAction + tooltip: qsTr("Help") + onTriggered: { + Qt.openUrlExternally("https://github.com/ethereum/wiki/wiki/Mix:-The-DApp-IDE#deployment-to-network") } - model: ListModel { - id: modelAccounts + } + + Button + { + action: openFolderAction + iconSource: "qrc:/qml/img/openedfolder.png" + } + + Action { + id: openFolderAction + enabled: deploymentDialog.packageBase64 !== "" + tooltip: qsTr("Open Package Folder") + onTriggered: { + fileIo.openFileBrowser(projectModel.deploymentDir); } } - DefaultLabel + Button { - anchors.verticalCenter: parent.verticalCenter - anchors.left: comboAccounts.right - anchors.leftMargin: 20 - id: balance; + action: b64Action + iconSource: "qrc:/qml/img/b64.png" + } + + Action { + id: b64Action + enabled: deploymentDialog.packageBase64 !== "" + tooltip: qsTr("Copy Base64 conversion to ClipBoard") + onTriggered: { + appContext.toClipboard(deploymentDialog.packageBase64); + } } - } + Button + { + action: exitAction + iconSource: "qrc:/qml/img/exit.png" + } - DefaultLabel - { - text: qsTr("Ethereum Application URL: ") + Action { + id: exitAction + tooltip: qsTr("Exit") + onTriggered: { + close() + } + } } - Rectangle + GridLayout { - Layout.fillWidth: true - height: 25 - color: "transparent" + columns: 2 + width: parent.width + + DefaultLabel + { + text: qsTr("Root Registrar address:") + } + DefaultTextField { - width: 350 - id: applicationUrlEth + Layout.preferredWidth: 350 + id: registrarAddr } DefaultLabel { - anchors.verticalCenter: parent.verticalCenter; - anchors.left: applicationUrlEth.right - text: "/" + projectModel.projectTitle + text: qsTr("Account used to deploy:") } - } - DefaultLabel - { - text: qsTr("Web Application Ressources URL: ") - } + Rectangle + { + width: 300 + height: 25 + color: "transparent" + ComboBox { + id: comboAccounts + property var balances: [] + onCurrentIndexChanged : { + if (modelAccounts.count > 0) + { + currentAccount = modelAccounts.get(currentIndex).id; + balance.text = balances[currentIndex]; + } + } + model: ListModel { + id: modelAccounts + } + } - DefaultTextField - { - Layout.fillWidth: true - id: applicationUrlHttp - } + DefaultLabel + { + anchors.verticalCenter: parent.verticalCenter + anchors.left: comboAccounts.right + anchors.leftMargin: 20 + id: balance; + } + } - DefaultLabel - { - text: qsTr("Amount of gas to use for each contract deployment: ") - } + DefaultLabel + { + text: qsTr("Amount of gas to use for each contract deployment: ") + } - DefaultTextField - { - text: "20000" - Layout.fillWidth: true - id: gasToUseInput - } + DefaultTextField + { + text: "20000" + Layout.preferredWidth: 350 + id: gasToUseInput + } - DefaultLabel - { - text: qsTr("Package (Base64): ") + DefaultLabel + { + text: qsTr("Ethereum Application URL: ") + } + + Rectangle + { + Layout.fillWidth: true + height: 25 + color: "transparent" + DefaultTextField + { + width: 200 + id: applicationUrlEth + onTextChanged: { + appUrlFormatted.text = ProjectModelCode.formatAppUrl(text).join('/'); + } + } + + DefaultLabel + { + id: appUrlFormatted + anchors.verticalCenter: parent.verticalCenter; + anchors.left: applicationUrlEth.right + font.italic: true + font.pointSize: Style.absoluteSize(-1) + } + } } - TextArea + RowLayout { Layout.fillWidth: true - readOnly: true - id: base64Value - height: 60 - enabled: base64Value.text != "" - } - } + Rectangle + { + Layout.preferredWidth: 357 + color: "transparent" + } + + Button + { + id: deployButton + action: runAction + iconSource: "qrc:/qml/img/run.png" + } - MessageDialog { - id: deployDialog - standardButtons: StandardButton.Ok - icon: StandardIcon.Warning + Action { + id: runAction + tooltip: qsTr("Deploy contract(s) and Package resources files.") + onTriggered: { + var inError = []; + var ethUrl = ProjectModelCode.formatAppUrl(applicationUrlEth.text); + for (var k in ethUrl) + { + if (ethUrl[k].length > 32) + inError.push(qsTr("Member too long: " + ethUrl[k]) + "\n"); + } + if (!stopForInputError(inError)) + { + if (contractRedeploy.checked) + deployWarningDialog.open(); + else + ProjectModelCode.startDeployProject(false); + } + } + } + + CheckBox + { + anchors.left: deployButton.right + id: contractRedeploy + enabled: Object.keys(projectModel.deploymentAddresses).length > 0 + checked: Object.keys(projectModel.deploymentAddresses).length == 0 + text: qsTr("Deploy Contract(s)") + anchors.verticalCenter: parent.verticalCenter + } + } } - MessageDialog { - id: errorDialog - standardButtons: StandardButton.Ok - icon: StandardIcon.Critical + Rectangle + { + width: parent.width + height: 1 + color: "#5891d3" } - RowLayout + ColumnLayout { - anchors.bottom: parent.bottom - anchors.right: parent.right; - anchors.bottomMargin: 10 - Button { - text: qsTr("Deploy contract / Package resources"); - tooltip: qsTr("Deploy contract and package resources files.") - onClicked: { - var inError = []; - var ethUrl = ProjectModelCode.formatAppUrl(applicationUrlEth.text); - for (var k in ethUrl) + id: containerRegister + Layout.fillWidth: true + Layout.preferredHeight: 500 + RowLayout + { + Layout.preferredHeight: 25 + Rectangle + { + Layout.preferredWidth: 356 + DefaultLabel { - if (ethUrl[k].length > 32) - inError.push(qsTr("Member too long: " + ethUrl[k]) + "\n"); + text: qsTr("Registration") + font.family: lightFont.name + font.underline: true + anchors.centerIn: parent } - if (!stopForInputError(inError)) - deployWarningDialog.open(); } } - Button { - text: qsTr("Package resources only"); - tooltip: qsTr("Package resources files.") - enabled: Object.keys(projectModel.deploymentAddresses).length > 0 - onClicked: { - ProjectModelCode.startDeployProject(false); + GridLayout + { + columns: 2 + Layout.fillWidth: true + + DefaultLabel + { + Layout.preferredWidth: 355 + text: qsTr("URL Hint contract address:") } - } - Button { - text: qsTr("Open Package Directory"); - enabled: projectModel.deploymentDir !== "" - onClicked: { - fileIo.openFileBrowser(projectModel.deploymentDir); + DefaultTextField + { + Layout.preferredWidth: 350 + id: urlHintAddr + enabled: rowRegister.isOkToRegister() } - } - Button { - text: qsTr("Register Web Application"); - tooltip: qsTr("Register hosted Web Application.") - onClicked: { - if (applicationUrlHttp.text === "" || deploymentDialog.packageHash === "") - { - deployDialog.title = text; - deployDialog.text = qsTr("Please provide the link where the resources are stored and ensure the package is aleary built using the deployment step.") - deployDialog.open(); - return; - } - var inError = []; - if (applicationUrlHttp.text.length > 32) - inError.push(qsTr(applicationUrlHttp.text)); - if (!stopForInputError(inError)) - ProjectModelCode.registerToUrlHint(); + DefaultLabel + { + Layout.preferredWidth: 355 + text: qsTr("Web Application Resources URL: ") + } + + DefaultTextField + { + Layout.preferredWidth: 350 + id: applicationUrlHttp + enabled: rowRegister.isOkToRegister() } } - Button { - text: qsTr("Close"); - onClicked: close(); + RowLayout + { + id: rowRegister + Layout.fillWidth: true + + Rectangle + { + Layout.preferredWidth: 357 + color: "transparent" + } + + function isOkToRegister() + { + return Object.keys(projectModel.deploymentAddresses).length > 0 && deploymentDialog.packageHash !== ""; + } + + Button { + action: registerAction + iconSource: "qrc:/qml/img/note.png" + } + + Action { + id: registerAction + enabled: rowRegister.isOkToRegister() + tooltip: qsTr("Register hosted Web Application.") + onTriggered: { + if (applicationUrlHttp.text === "" || deploymentDialog.packageHash === "") + { + deployDialog.title = text; + deployDialog.text = qsTr("Please provide the link where the resources are stored and ensure the package is aleary built using the deployment step.") + deployDialog.open(); + return; + } + var inError = []; + if (applicationUrlHttp.text.length > 32) + inError.push(qsTr(applicationUrlHttp.text)); + if (!stopForInputError(inError)) + ProjectModelCode.registerToUrlHint(); + } + } } } } + + MessageDialog { + id: deployDialog + standardButtons: StandardButton.Ok + icon: StandardIcon.Warning + } + + MessageDialog { + id: errorDialog + standardButtons: StandardButton.Ok + icon: StandardIcon.Critical + } } diff --git a/mix/qml/StatusPane.qml b/mix/qml/StatusPane.qml index 15db4d688..e526d65bd 100644 --- a/mix/qml/StatusPane.qml +++ b/mix/qml/StatusPane.qml @@ -46,7 +46,7 @@ Rectangle { Connections { target:clientModel onRunStarted: infoMessage(qsTr("Running transactions...")); - onRunFailed: errorMessage(qsTr("Error running transactions")); + onRunFailed: errorMessage(qsTr("Error running transactions: " + _message)); onRunComplete: infoMessage(qsTr("Run complete")); onNewBlock: infoMessage(qsTr("New block created")); } diff --git a/mix/qml/img/b64.png b/mix/qml/img/b64.png new file mode 100644 index 000000000..2089c948e Binary files /dev/null and b/mix/qml/img/b64.png differ diff --git a/mix/qml/img/exit.png b/mix/qml/img/exit.png new file mode 100644 index 000000000..1233765ae Binary files /dev/null and b/mix/qml/img/exit.png differ diff --git a/mix/qml/img/help.png b/mix/qml/img/help.png new file mode 100644 index 000000000..06fffe9f8 Binary files /dev/null and b/mix/qml/img/help.png differ diff --git a/mix/qml/img/note.png b/mix/qml/img/note.png new file mode 100644 index 000000000..e44e94744 Binary files /dev/null and b/mix/qml/img/note.png differ diff --git a/mix/qml/img/openedfolder.png b/mix/qml/img/openedfolder.png new file mode 100644 index 000000000..728839de4 Binary files /dev/null and b/mix/qml/img/openedfolder.png differ diff --git a/mix/qml/img/run.png b/mix/qml/img/run.png new file mode 100644 index 000000000..37ac04689 Binary files /dev/null and b/mix/qml/img/run.png differ diff --git a/mix/qml/js/ProjectModel.js b/mix/qml/js/ProjectModel.js index 1ebbf6ef6..d308119ae 100644 --- a/mix/qml/js/ProjectModel.js +++ b/mix/qml/js/ProjectModel.js @@ -609,6 +609,8 @@ function formatAppUrl(url) { if (url.toLowerCase().indexOf("eth://") === 0) url = url.substring(6); + if (url.toLowerCase().indexOf(projectModel.projectTitle + ".") === 0) + url = url.substring(projectModel.projectTitle.length + 1); if (url === "") return [projectModel.projectTitle]; diff --git a/mix/res.qrc b/mix/res.qrc index 852983eae..fc1b2fb23 100644 --- a/mix/res.qrc +++ b/mix/res.qrc @@ -103,5 +103,11 @@ <file>qml/img/available_updates.png</file> <file>qml/DeploymentDialog.qml</file> <file>qml/img/search_filled.png</file> + <file>qml/img/help.png</file> + <file>qml/img/openedfolder.png</file> + <file>qml/img/b64.png</file> + <file>qml/img/exit.png</file> + <file>qml/img/run.png</file> + <file>qml/img/note.png</file> </qresource> </RCC>