|
@ -15,15 +15,19 @@ Window { |
|
|
|
|
|
|
|
|
id: modalDeploymentDialog |
|
|
id: modalDeploymentDialog |
|
|
modality: Qt.ApplicationModal |
|
|
modality: Qt.ApplicationModal |
|
|
width: 930 |
|
|
width: 735 |
|
|
height: 350 |
|
|
height: 480 |
|
|
|
|
|
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 alias packageBase64: base64Value.text |
|
|
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,300 @@ Window { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Rectangle |
|
|
Column |
|
|
{ |
|
|
{ |
|
|
anchors.fill : parent |
|
|
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:") |
|
|
DefaultLabel |
|
|
|
|
|
{ |
|
|
|
|
|
text: qsTr("DEPLOYING") |
|
|
|
|
|
font.italic: true |
|
|
|
|
|
font.underline: true |
|
|
|
|
|
Layout.preferredWidth: 356 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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") |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Rectangle |
|
|
GridLayout |
|
|
{ |
|
|
{ |
|
|
width: 300 |
|
|
columns: 2 |
|
|
height: 25 |
|
|
width: parent.width |
|
|
color: "transparent" |
|
|
|
|
|
ComboBox { |
|
|
DefaultLabel |
|
|
id: comboAccounts |
|
|
{ |
|
|
property var balances: [] |
|
|
text: qsTr("Registrar address:") |
|
|
onCurrentIndexChanged : { |
|
|
} |
|
|
if (modelAccounts.count > 0) |
|
|
|
|
|
{ |
|
|
DefaultTextField |
|
|
currentAccount = modelAccounts.get(currentIndex).id; |
|
|
{ |
|
|
balance.text = balances[currentIndex]; |
|
|
Layout.preferredWidth: 350 |
|
|
|
|
|
id: registrarAddr |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DefaultLabel |
|
|
|
|
|
{ |
|
|
|
|
|
text: qsTr("Account used to deploy:") |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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 |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
model: ListModel { |
|
|
|
|
|
id: modelAccounts |
|
|
DefaultLabel |
|
|
|
|
|
{ |
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter |
|
|
|
|
|
anchors.left: comboAccounts.right |
|
|
|
|
|
anchors.leftMargin: 20 |
|
|
|
|
|
id: balance; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
DefaultLabel |
|
|
DefaultLabel |
|
|
{ |
|
|
{ |
|
|
anchors.verticalCenter: parent.verticalCenter |
|
|
text: qsTr("Amount of gas to use for each contract deployment: ") |
|
|
anchors.left: comboAccounts.right |
|
|
|
|
|
anchors.leftMargin: 20 |
|
|
|
|
|
id: balance; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DefaultTextField |
|
|
|
|
|
{ |
|
|
|
|
|
text: "20000" |
|
|
|
|
|
Layout.preferredWidth: 350 |
|
|
|
|
|
id: gasToUseInput |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
DefaultLabel |
|
|
DefaultLabel |
|
|
{ |
|
|
{ |
|
|
text: qsTr("Ethereum Application URL: ") |
|
|
text: qsTr("Ethereum Application URL: ") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Rectangle |
|
|
Rectangle |
|
|
{ |
|
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
|
height: 25 |
|
|
|
|
|
color: "transparent" |
|
|
|
|
|
DefaultTextField |
|
|
|
|
|
{ |
|
|
{ |
|
|
width: 350 |
|
|
Layout.fillWidth: true |
|
|
id: applicationUrlEth |
|
|
height: 25 |
|
|
|
|
|
color: "transparent" |
|
|
|
|
|
DefaultTextField |
|
|
|
|
|
{ |
|
|
|
|
|
width: 300 |
|
|
|
|
|
id: applicationUrlEth |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DefaultLabel |
|
|
|
|
|
{ |
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter; |
|
|
|
|
|
anchors.left: applicationUrlEth.right |
|
|
|
|
|
text: "/" + projectModel.projectTitle |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
DefaultLabel |
|
|
DefaultLabel |
|
|
{ |
|
|
{ |
|
|
anchors.verticalCenter: parent.verticalCenter; |
|
|
text: qsTr("Package (Base64): ") |
|
|
anchors.left: applicationUrlEth.right |
|
|
|
|
|
text: "/" + projectModel.projectTitle |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DefaultLabel |
|
|
TextArea |
|
|
{ |
|
|
{ |
|
|
text: qsTr("Web Application Ressources URL: ") |
|
|
Layout.preferredWidth: 350 |
|
|
|
|
|
readOnly: true |
|
|
|
|
|
id: base64Value |
|
|
|
|
|
height: 60 |
|
|
|
|
|
enabled: base64Value.text != "" |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
DefaultTextField |
|
|
Row |
|
|
{ |
|
|
{ |
|
|
Layout.fillWidth: true |
|
|
Button { |
|
|
id: applicationUrlHttp |
|
|
text: qsTr("Deploy"); |
|
|
} |
|
|
tooltip: qsTr("Deploy contract and package resources files.") |
|
|
|
|
|
onClicked: { |
|
|
|
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
DefaultLabel |
|
|
CheckBox |
|
|
{ |
|
|
{ |
|
|
text: qsTr("Amount of gas to use for each contract deployment: ") |
|
|
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 |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
DefaultTextField |
|
|
Rectangle |
|
|
{ |
|
|
{ |
|
|
text: "20000" |
|
|
width: parent.width |
|
|
Layout.fillWidth: true |
|
|
height: 1 |
|
|
id: gasToUseInput |
|
|
color: "#5891d3" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
DefaultLabel |
|
|
ColumnLayout |
|
|
|
|
|
{ |
|
|
|
|
|
id: containerRegister |
|
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
|
Layout.preferredHeight: 500 |
|
|
|
|
|
RowLayout |
|
|
{ |
|
|
{ |
|
|
text: qsTr("Package (Base64): ") |
|
|
DefaultLabel |
|
|
|
|
|
{ |
|
|
|
|
|
text: qsTr("REGISTERING") |
|
|
|
|
|
font.italic: true |
|
|
|
|
|
font.underline: true |
|
|
|
|
|
Layout.preferredWidth: 356 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Button |
|
|
|
|
|
{ |
|
|
|
|
|
action: displayHelpAction |
|
|
|
|
|
iconSource: "qrc:/qml/img/help.png" |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
TextArea |
|
|
GridLayout |
|
|
{ |
|
|
{ |
|
|
|
|
|
columns: 2 |
|
|
Layout.fillWidth: true |
|
|
Layout.fillWidth: true |
|
|
readOnly: true |
|
|
|
|
|
id: base64Value |
|
|
|
|
|
height: 60 |
|
|
|
|
|
enabled: base64Value.text != "" |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
MessageDialog { |
|
|
DefaultLabel |
|
|
id: deployDialog |
|
|
{ |
|
|
standardButtons: StandardButton.Ok |
|
|
Layout.preferredWidth: 355 |
|
|
icon: StandardIcon.Warning |
|
|
text: qsTr("Url hint address:") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
MessageDialog { |
|
|
DefaultTextField |
|
|
id: errorDialog |
|
|
{ |
|
|
standardButtons: StandardButton.Ok |
|
|
Layout.preferredWidth: 350 |
|
|
icon: StandardIcon.Critical |
|
|
id: urlHintAddr |
|
|
} |
|
|
enabled: rowRegister.isOkToRegister() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
RowLayout |
|
|
DefaultLabel |
|
|
{ |
|
|
{ |
|
|
anchors.bottom: parent.bottom |
|
|
Layout.preferredWidth: 355 |
|
|
anchors.right: parent.right; |
|
|
text: qsTr("Web Application Ressources URL: ") |
|
|
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) |
|
|
|
|
|
{ |
|
|
|
|
|
if (ethUrl[k].length > 32) |
|
|
|
|
|
inError.push(qsTr("Member too long: " + ethUrl[k]) + "\n"); |
|
|
|
|
|
} |
|
|
|
|
|
if (!stopForInputError(inError)) |
|
|
|
|
|
deployWarningDialog.open(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Button { |
|
|
DefaultTextField |
|
|
text: qsTr("Package resources only"); |
|
|
{ |
|
|
tooltip: qsTr("Package resources files.") |
|
|
Layout.preferredWidth: 350 |
|
|
enabled: Object.keys(projectModel.deploymentAddresses).length > 0 |
|
|
id: applicationUrlHttp |
|
|
onClicked: { |
|
|
enabled: rowRegister.isOkToRegister() |
|
|
ProjectModelCode.startDeployProject(false); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Button { |
|
|
Rectangle |
|
|
text: qsTr("Open Package Directory"); |
|
|
{ |
|
|
enabled: projectModel.deploymentDir !== "" |
|
|
id: rowRegister |
|
|
onClicked: { |
|
|
Layout.fillWidth: true |
|
|
fileIo.openFileBrowser(projectModel.deploymentDir); |
|
|
|
|
|
|
|
|
function isOkToRegister() |
|
|
|
|
|
{ |
|
|
|
|
|
return Object.keys(projectModel.deploymentAddresses).length > 0 && deploymentDialog.packageHash !== ""; |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Button { |
|
|
Button { |
|
|
text: qsTr("Register Web Application"); |
|
|
text: qsTr("Register"); |
|
|
tooltip: qsTr("Register hosted Web Application.") |
|
|
tooltip: qsTr("Register hosted Web Application.") |
|
|
onClicked: { |
|
|
enabled: rowRegister.isOkToRegister() |
|
|
if (applicationUrlHttp.text === "" || deploymentDialog.packageHash === "") |
|
|
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.title = text; |
|
|
deployDialog.open(); |
|
|
deployDialog.text = qsTr("Please provide the link where the resources are stored and ensure the package is aleary built using the deployment step.") |
|
|
return; |
|
|
deployDialog.open(); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
var inError = []; |
|
|
|
|
|
if (applicationUrlHttp.text.length > 32) |
|
|
|
|
|
inError.push(qsTr(applicationUrlHttp.text)); |
|
|
|
|
|
if (!stopForInputError(inError)) |
|
|
|
|
|
ProjectModelCode.registerToUrlHint(); |
|
|
} |
|
|
} |
|
|
var inError = []; |
|
|
|
|
|
if (applicationUrlHttp.text.length > 32) |
|
|
|
|
|
inError.push(qsTr(applicationUrlHttp.text)); |
|
|
|
|
|
if (!stopForInputError(inError)) |
|
|
|
|
|
ProjectModelCode.registerToUrlHint(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Button { |
|
|
Button { |
|
|
text: qsTr("Close"); |
|
|
anchors.right: parent.right |
|
|
onClicked: close(); |
|
|
text: qsTr("Cancel"); |
|
|
|
|
|
onClicked: close(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
MessageDialog { |
|
|
|
|
|
id: deployDialog |
|
|
|
|
|
standardButtons: StandardButton.Ok |
|
|
|
|
|
icon: StandardIcon.Warning |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
MessageDialog { |
|
|
|
|
|
id: errorDialog |
|
|
|
|
|
standardButtons: StandardButton.Ok |
|
|
|
|
|
icon: StandardIcon.Critical |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|