Browse Source

minor fixes

cl-refactor
arkpar 10 years ago
parent
commit
9e87abc136
  1. 9
      mix/qml/StateListModel.qml
  2. 12
      mix/qml/WebPreview.qml
  3. 2
      mix/qml/main.qml

9
mix/qml/StateListModel.qml

@ -47,6 +47,10 @@ Item {
varComponent = Qt.createComponent("qrc:/qml/QHashType.qml"); varComponent = Qt.createComponent("qrc:/qml/QHashType.qml");
else if (type.indexOf("bool") !== -1) else if (type.indexOf("bool") !== -1)
varComponent = Qt.createComponent("qrc:/qml/QBoolType.qml"); varComponent = Qt.createComponent("qrc:/qml/QBoolType.qml");
else {
console.log("Unknown parameter type: " + type);
continue;
}
var param = varComponent.createObject(stateListModel); var param = varComponent.createObject(stateListModel);
var dec = Qt.createComponent("qrc:/qml/QVariableDeclaration.qml"); var dec = Qt.createComponent("qrc:/qml/QVariableDeclaration.qml");
@ -203,7 +207,7 @@ Item {
} }
function debugDefaultState() { function debugDefaultState() {
if (defaultStateIndex >= 0) if (defaultStateIndex >= 0 && defaultStateIndex < stateList.length)
runState(defaultStateIndex); runState(defaultStateIndex);
} }
@ -221,6 +225,9 @@ Item {
defaultStateIndex = 0; defaultStateIndex = 0;
defaultStateChanged(); defaultStateChanged();
} }
else if (defaultStateIndex > index)
defaultStateIndex--;
save(); save();
} }

12
mix/qml/WebPreview.qml

@ -24,8 +24,10 @@ Item {
} }
function reload() { function reload() {
updateContract(); if (initialized) {
webView.runJavaScript("reloadPage()"); updateContract();
webView.runJavaScript("reloadPage()");
}
} }
function updateContract() { function updateContract() {
@ -33,9 +35,9 @@ Item {
for (var c in codeModel.contracts) { for (var c in codeModel.contracts) {
var contract = codeModel.contracts[c]; var contract = codeModel.contracts[c];
contracts[c] = { contracts[c] = {
name: contract.contract.name, name: contract.contract.name,
address: clientModel.contractAddresses[contract.contract.name], address: clientModel.contractAddresses[contract.contract.name],
interface: JSON.parse(contract.contractInterface), interface: JSON.parse(contract.contractInterface),
}; };
} }
webView.runJavaScript("updateContracts(" + JSON.stringify(contracts) + ")"); webView.runJavaScript("updateContracts(" + JSON.stringify(contracts) + ")");

2
mix/qml/main.qml

@ -95,7 +95,7 @@ ApplicationWindow {
text: qsTr("Mine") text: qsTr("Mine")
shortcut: "Ctrl+M" shortcut: "Ctrl+M"
onTriggered: clientModel.mine(); onTriggered: clientModel.mine();
enabled: codeModel.hasContract && !clientModel.running &&!clientModel.mining enabled: codeModel.hasContract && !clientModel.running && !clientModel.mining
} }
StateList { StateList {

Loading…
Cancel
Save