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

12
mix/qml/WebPreview.qml

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

2
mix/qml/main.qml

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

Loading…
Cancel
Save