Browse Source

Merge pull request #1206 from yann300/registrar

mix - DeploymentDialog Redesign
cl-refactor
Arkadiy Paronyan 10 years ago
parent
commit
239cde887a
  1. 435
      mix/qml/DeploymentDialog.qml
  2. 2
      mix/qml/StatusPane.qml
  3. BIN
      mix/qml/img/b64.png
  4. BIN
      mix/qml/img/exit.png
  5. BIN
      mix/qml/img/help.png
  6. BIN
      mix/qml/img/note.png
  7. BIN
      mix/qml/img/openedfolder.png
  8. BIN
      mix/qml/img/run.png
  9. 2
      mix/qml/js/ProjectModel.js
  10. 6
      mix/res.qrc

435
mix/qml/DeploymentDialog.qml

@ -15,15 +15,19 @@ Window {
id: modalDeploymentDialog id: modalDeploymentDialog
modality: Qt.ApplicationModal modality: Qt.ApplicationModal
width: 930 width: 735
height: 350 height: 320
maximumWidth: width
minimumWidth: width
maximumHeight: height
minimumHeight: height
visible: false visible: false
property alias applicationUrlEth: applicationUrlEth.text property alias applicationUrlEth: applicationUrlEth.text
property alias applicationUrlHttp: applicationUrlHttp.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 string packageHash
property alias packageBase64: base64Value.text property string packageBase64
property string eth: "4c3f7330690ed3657d3fa20fe5717b84010528ae"; /* TODO: replace with the good address */ property string eth: registrarAddr.text
property string currentAccount property string currentAccount
property alias gasToUse: gasToUseInput.text 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 anchors.margins: 10
color: Style.generic.layout.backgroundColor ColumnLayout
GridLayout
{ {
columns: 2 id: containerDeploy
anchors.top: parent.top Layout.fillWidth: true
anchors.left: parent.left Layout.preferredHeight: 500
width: parent.width RowLayout
DefaultLabel
{ {
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 Button
{ {
width: 300 action: displayHelpAction
height: 25 iconSource: "qrc:/qml/img/help.png"
color: "transparent" }
ComboBox {
id: comboAccounts Action {
property var balances: [] id: displayHelpAction
onCurrentIndexChanged : { tooltip: qsTr("Help")
if (modelAccounts.count > 0) onTriggered: {
{ Qt.openUrlExternally("https://github.com/ethereum/wiki/wiki/Mix:-The-DApp-IDE#deployment-to-network")
currentAccount = modelAccounts.get(currentIndex).id;
balance.text = balances[currentIndex];
}
} }
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 action: b64Action
anchors.left: comboAccounts.right iconSource: "qrc:/qml/img/b64.png"
anchors.leftMargin: 20 }
id: balance;
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 Action {
{ id: exitAction
text: qsTr("Ethereum Application URL: ") tooltip: qsTr("Exit")
onTriggered: {
close()
}
}
} }
Rectangle GridLayout
{ {
Layout.fillWidth: true columns: 2
height: 25 width: parent.width
color: "transparent"
DefaultLabel
{
text: qsTr("Root Registrar address:")
}
DefaultTextField DefaultTextField
{ {
width: 350 Layout.preferredWidth: 350
id: applicationUrlEth id: registrarAddr
} }
DefaultLabel DefaultLabel
{ {
anchors.verticalCenter: parent.verticalCenter; text: qsTr("Account used to deploy:")
anchors.left: applicationUrlEth.right
text: "/" + projectModel.projectTitle
} }
}
DefaultLabel Rectangle
{ {
text: qsTr("Web Application Ressources URL: ") 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 DefaultLabel
{ {
Layout.fillWidth: true anchors.verticalCenter: parent.verticalCenter
id: applicationUrlHttp anchors.left: comboAccounts.right
} anchors.leftMargin: 20
id: balance;
}
}
DefaultLabel DefaultLabel
{ {
text: qsTr("Amount of gas to use for each contract deployment: ") text: qsTr("Amount of gas to use for each contract deployment: ")
} }
DefaultTextField DefaultTextField
{ {
text: "20000" text: "20000"
Layout.fillWidth: true Layout.preferredWidth: 350
id: gasToUseInput id: gasToUseInput
} }
DefaultLabel DefaultLabel
{ {
text: qsTr("Package (Base64): ") 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 Layout.fillWidth: true
readOnly: true Rectangle
id: base64Value {
height: 60 Layout.preferredWidth: 357
enabled: base64Value.text != "" color: "transparent"
} }
}
Button
{
id: deployButton
action: runAction
iconSource: "qrc:/qml/img/run.png"
}
MessageDialog { Action {
id: deployDialog id: runAction
standardButtons: StandardButton.Ok tooltip: qsTr("Deploy contract(s) and Package resources files.")
icon: StandardIcon.Warning 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 { Rectangle
id: errorDialog {
standardButtons: StandardButton.Ok width: parent.width
icon: StandardIcon.Critical height: 1
color: "#5891d3"
} }
RowLayout ColumnLayout
{ {
anchors.bottom: parent.bottom id: containerRegister
anchors.right: parent.right; Layout.fillWidth: true
anchors.bottomMargin: 10 Layout.preferredHeight: 500
Button { RowLayout
text: qsTr("Deploy contract / Package resources"); {
tooltip: qsTr("Deploy contract and package resources files.") Layout.preferredHeight: 25
onClicked: { Rectangle
var inError = []; {
var ethUrl = ProjectModelCode.formatAppUrl(applicationUrlEth.text); Layout.preferredWidth: 356
for (var k in ethUrl) DefaultLabel
{ {
if (ethUrl[k].length > 32) text: qsTr("Registration")
inError.push(qsTr("Member too long: " + ethUrl[k]) + "\n"); font.family: lightFont.name
font.underline: true
anchors.centerIn: parent
} }
if (!stopForInputError(inError))
deployWarningDialog.open();
} }
} }
Button { GridLayout
text: qsTr("Package resources only"); {
tooltip: qsTr("Package resources files.") columns: 2
enabled: Object.keys(projectModel.deploymentAddresses).length > 0 Layout.fillWidth: true
onClicked: {
ProjectModelCode.startDeployProject(false); DefaultLabel
{
Layout.preferredWidth: 355
text: qsTr("URL Hint contract address:")
} }
}
Button { DefaultTextField
text: qsTr("Open Package Directory"); {
enabled: projectModel.deploymentDir !== "" Layout.preferredWidth: 350
onClicked: { id: urlHintAddr
fileIo.openFileBrowser(projectModel.deploymentDir); enabled: rowRegister.isOkToRegister()
} }
}
Button { DefaultLabel
text: qsTr("Register Web Application"); {
tooltip: qsTr("Register hosted Web Application.") Layout.preferredWidth: 355
onClicked: { text: qsTr("Web Application Resources URL: ")
if (applicationUrlHttp.text === "" || deploymentDialog.packageHash === "") }
{
deployDialog.title = text; DefaultTextField
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(); Layout.preferredWidth: 350
return; id: applicationUrlHttp
} enabled: rowRegister.isOkToRegister()
var inError = [];
if (applicationUrlHttp.text.length > 32)
inError.push(qsTr(applicationUrlHttp.text));
if (!stopForInputError(inError))
ProjectModelCode.registerToUrlHint();
} }
} }
Button { RowLayout
text: qsTr("Close"); {
onClicked: close(); 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
}
} }

2
mix/qml/StatusPane.qml

@ -46,7 +46,7 @@ Rectangle {
Connections { Connections {
target:clientModel target:clientModel
onRunStarted: infoMessage(qsTr("Running transactions...")); onRunStarted: infoMessage(qsTr("Running transactions..."));
onRunFailed: errorMessage(qsTr("Error running transactions")); onRunFailed: errorMessage(qsTr("Error running transactions: " + _message));
onRunComplete: infoMessage(qsTr("Run complete")); onRunComplete: infoMessage(qsTr("Run complete"));
onNewBlock: infoMessage(qsTr("New block created")); onNewBlock: infoMessage(qsTr("New block created"));
} }

BIN
mix/qml/img/b64.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
mix/qml/img/exit.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

BIN
mix/qml/img/help.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

BIN
mix/qml/img/note.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

BIN
mix/qml/img/openedfolder.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

BIN
mix/qml/img/run.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 B

2
mix/qml/js/ProjectModel.js

@ -609,6 +609,8 @@ function formatAppUrl(url)
{ {
if (url.toLowerCase().indexOf("eth://") === 0) if (url.toLowerCase().indexOf("eth://") === 0)
url = url.substring(6); url = url.substring(6);
if (url.toLowerCase().indexOf(projectModel.projectTitle + ".") === 0)
url = url.substring(projectModel.projectTitle.length + 1);
if (url === "") if (url === "")
return [projectModel.projectTitle]; return [projectModel.projectTitle];

6
mix/res.qrc

@ -103,5 +103,11 @@
<file>qml/img/available_updates.png</file> <file>qml/img/available_updates.png</file>
<file>qml/DeploymentDialog.qml</file> <file>qml/DeploymentDialog.qml</file>
<file>qml/img/search_filled.png</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> </qresource>
</RCC> </RCC>

Loading…
Cancel
Save