Browse Source

bug fix

cl-refactor
yann300 10 years ago
parent
commit
4fefa1f266
  1. 10
      mix/ClientModel.cpp
  2. 4
      mix/CodeModel.cpp
  3. 2
      mix/CodeModel.h
  4. 29
      mix/qml/QBoolTypeView.qml
  5. 15
      mix/qml/StateDialog.qml
  6. 1
      mix/qml/StateListModel.qml
  7. 3
      mix/qml/StructView.qml
  8. 3
      mix/qml/TransactionDialog.qml
  9. 22
      mix/qml/TransactionLog.qml
  10. 7
      mix/qml/html/cm/inkpot.css
  11. 1
      mix/qml/html/cm/solarized.css

10
mix/ClientModel.cpp

@ -389,7 +389,7 @@ std::pair<QString, int> ClientModel::resolvePair(QString const& _contractId)
{
std::pair<QString, int> ret;
ret.first = _contractId;
ret.second = -1;
ret.second = 0;
if (_contractId.startsWith("<") && _contractId.endsWith(">"))
{
QStringList values = ret.first.remove("<").remove(">").split(" - ");
@ -401,10 +401,10 @@ std::pair<QString, int> ClientModel::resolvePair(QString const& _contractId)
QString ClientModel::resolveToken(std::pair<QString, int> const& _value, vector<Address> const& _contracts)
{
if (_value.second != -1)
return QString::fromStdString("0x" + dev::toHex(_contracts.at(_value.second).ref()));
else
return _value.first;
if (_contracts.size() > 0)
return QString::fromStdString("0x" + dev::toHex(_contracts.at(_value.second).ref()));
else
return _value.first;
}
std::pair<QString, int> ClientModel::retrieveToken(QString const& _value, vector<Address> const& _contracts)

4
mix/CodeModel.cpp

@ -197,6 +197,8 @@ CodeModel::~CodeModel()
stop();
disconnect(this);
releaseContracts();
if (m_gasCostsMaps)
m_gasCostsMaps->deleteLater();
}
void CodeModel::stop()
@ -358,7 +360,7 @@ void CodeModel::gasEstimation(solidity::CompilerStack const& _cs)
{
if (m_gasCostsMaps)
m_gasCostsMaps->deleteLater();
m_gasCostsMaps = new GasMapWrapper(this);
m_gasCostsMaps = new GasMapWrapper();
for (std::string n: _cs.getContractNames())
{
ContractDefinition const& contractDefinition = _cs.getContractDefinition(n);

2
mix/CodeModel.h

@ -137,7 +137,7 @@ class GasMapWrapper: public QObject
Q_PROPERTY(GasCostsMaps gasMaps MEMBER m_gasMaps CONSTANT)
public:
GasMapWrapper(QObject* _parent): QObject(_parent){}
GasMapWrapper(QObject* _parent = 0): QObject(_parent){}
void push(QString _source, int _start, int _end, QString _value, bool _isInfinite);
bool contains(QString _key);
void insert(QString _source, QVariantList _variantList);

29
mix/qml/QBoolTypeView.qml

@ -6,22 +6,37 @@ Item
id: editRoot
property string value
property string defaultValue
property alias readOnly: !boolCombo.enabled
property bool readOnly: !boolCombo.enabled
height: 20
width: 150
onReadOnlyChanged: {
boolCombo.enabled = !readOnly;
}
function init()
{
value = value === true ? "1" : value
value = value === false ? "0" : value;
value = value === "true" ? "1" : value
value = value === "false" ? "0" : value;
if (value === "")
boolCombo.currentIndex = parseInt(defaultValue);
else
boolCombo.currentIndex = parseInt(value);
boolCombo.enabled = !readOnly;
}
Rectangle {
anchors.fill: parent
ComboBox
{
property bool inited: false
property bool inited;
Component.onCompleted:
{
if (value === "")
currentIndex = parseInt(defaultValue);
else
currentIndex = parseInt(value);
inited = true
init();
inited = true;
}
id: boolCombo

15
mix/qml/StateDialog.qml

@ -507,8 +507,13 @@ Dialog {
Button {
text: qsTr("OK")
onClicked: {
close()
accepted()
if (titleField.text === "")
alertDialog.open()
else
{
close()
accepted()
}
}
}
Button {
@ -517,6 +522,12 @@ Dialog {
}
}
MessageDialog
{
id: alertDialog
text: qsTr("Please provide a name.")
}
ListModel {
id: accountsModel

1
mix/qml/StateListModel.qml

@ -266,6 +266,7 @@ Item {
var ctorTr = defaultTransactionItem();
ctorTr.functionId = c;
ctorTr.contractId = c;
ctorTr.label = qsTr("Deploy") + " " + ctorTr.contractId;
ctorTr.sender = state.accounts[0].secret;
state.transactions.push(ctorTr);
changed = true;

3
mix/qml/StructView.qml

@ -93,6 +93,9 @@ Column
else
item.value = getValue();
if (ptype.category === QSolidityType.Bool)
item.init();
item.onValueChanged.connect(function() {
vals[pname] = item.value;
valueChanged();

3
mix/qml/TransactionDialog.qml

@ -94,7 +94,6 @@ Dialog {
function loadCtorParameters(contractId)
{
paramsModel = [];
console.log(contractId);
var contract = codeModel.contracts[contractId];
if (contract) {
var params = contract.contract.constructor.parameters;
@ -154,7 +153,7 @@ Dialog {
if (functionComboBox.currentIndex >= 0 && functionComboBox.currentIndex < functionsModel.count) {
var contract = codeModel.contracts[contractFromToken(recipients.currentValue())];
if (contract) {
var func = contract.contract.functions[functionComboBox.currentIndex];
var func = contract.contract.functions[functionComboBox.currentIndex - 1];
if (func) {
var parameters = func.parameters;
for (var p = 0; p < parameters.length; p++)

22
mix/qml/TransactionLog.qml

@ -73,8 +73,30 @@ Item {
}
}
CheckBox
{
text: qsTr("Mine")
onCheckedChanged: {
mineAction.enabled = !checked;
mineTimer.running = checked;
}
}
Timer
{
id: mineTimer
repeat: true;
interval: 12000
running: false
onTriggered:
{
clientModel.mine();
}
}
Button
{
id: mineBtn
anchors.rightMargin: 9
anchors.verticalCenter: parent.verticalCenter
action: mineAction

7
mix/qml/html/cm/inkpot.css

@ -52,7 +52,7 @@ span.CodeMirror-selectedtext { color: #ffffff !important; }
.CodeMirror-errorannotation {
border-bottom: 1px solid #DD3330;
margin-bottom: 4px;
}
}
.CodeMirror-errorannotation-context {
font-family: monospace;
@ -63,3 +63,8 @@ span.CodeMirror-selectedtext { color: #ffffff !important; }
border-top: solid 2px #063742;
}
.CodeMirror-search-field
{
font-size: 12px;
}

1
mix/qml/html/cm/solarized.css

@ -194,4 +194,3 @@ span.CodeMirror-selectedtext { color: #586e75 !important; }
.CodeMirror-gasCosts {
border-bottom: double 1px #2aa198;
}

Loading…
Cancel
Save