Browse Source

Merge branch 'develop' of https://github.com/ethereum/cpp-ethereum into

mix_editor

Conflicts:
	mix/qml/WebPreview.qml
cl-refactor
arkpar 10 years ago
parent
commit
5f6f05042f
  1. 11
      README.md
  2. 10
      alethzero/Main.ui
  3. 45
      alethzero/MainWin.cpp
  4. 2
      libethereum/Client.cpp
  5. 2
      libethereum/Executive.cpp
  6. 2
      libethereum/State.cpp
  7. 10
      libethereum/Transaction.cpp
  8. 11
      libethereum/Transaction.h
  9. 6
      libethereum/TransactionQueue.cpp
  10. 1
      liblll/CodeFragment.cpp
  11. 1
      liblll/CodeFragment.h
  12. 43
      libsolidity/CompilerStack.cpp
  13. 4
      libsolidity/CompilerStack.h
  14. 2
      mix/AssemblyDebuggerControl.cpp
  15. 5
      mix/ClientModel.cpp
  16. 8
      mix/CodeModel.cpp
  17. 8
      mix/CodeModel.h
  18. 5
      mix/DebuggingStateWrapper.cpp
  19. 6
      mix/main.cpp
  20. 1
      mix/qml.qrc
  21. 4
      mix/qml/DebugBasicInfo.qml
  22. 42
      mix/qml/DebugInfoList.qml
  23. 210
      mix/qml/Debugger.qml
  24. 36
      mix/qml/ItemDelegateDataDump.qml
  25. 60
      mix/qml/MainContent.qml
  26. 2
      mix/qml/NewProjectDialog.qml
  27. 4
      mix/qml/ProjectModel.qml
  28. 47
      mix/qml/Splitter.qml
  29. 2
      mix/qml/StateDialog.qml
  30. 15
      mix/qml/StatusPane.qml
  31. 3
      mix/qml/StepActionImage.qml
  32. 4
      mix/qml/TransactionDialog.qml
  33. 10
      mix/qml/WebPreview.qml
  34. 2
      mix/qml/html/codeeditor.html
  35. 26
      mix/qml/js/Debugger.js
  36. 21
      mix/qml/main.qml
  37. 2
      neth/main.cpp

11
README.md

@ -1,14 +1,11 @@
## Ethereum C++ Client. ## Ethereum C++ Client.
[![Build
Status](http://build.ethdev.com/buildstatusimage?builder=Linux%20C%2B%2B%20master%20branch)](http://build.ethdev.com/builders/Linux%20C%2B%2B%20master%20branch/builds/-1) master [![Build
Status](http://build.ethdev.com/buildstatusimage?builder=Linux%20C%2B%2B%20develop%20branch)](http://build.ethdev.com/builders/Linux%20C%2B%2B%20develop%20branch/builds/-1) develop
By Gav Wood, 2014. By Gav Wood, 2014.
[![Build | Linux | OSX | Windows
+Status](http://build.ethdev.com/buildstatusimage?builder=Linux%20C%2B%2B%20master%20branch)](http://build.ethdev.com/builders/Linux%20C%2B%2B%20master%20branch/builds/-1) master [![Build ----------|---------|-----|--------
+Status](http://build.ethdev.com/buildstatusimage?builder=Linux%20C%2B%2B%20develop%20branch)](http://build.ethdev.com/builders/Linux%20C%2B%2B%20develop%20branch/builds/-1) develop develop | [![Build+Status](http://build.ethdev.com/buildstatusimage?builder=Linux%20C%2B%2B%20develop%20branch)](http://build.ethdev.com/builders/Linux%20C%2B%2B%20develop%20branch/builds/-1) | [![Build+Status](http://build.ethdev.com/buildstatusimage?builder=OSX%20C%2B%2B%20develop%20branch)](http://build.ethdev.com/builders/OSX%20C%2B%2B%20develop%20branch/builds/-1) | [![Build+Status](http://build.ethdev.com/buildstatusimage?builder=Windows%20C%2B%2B%20develop%20branch)](http://build.ethdev.com/builders/Windows%20C%2B%2B%20develop%20branch/builds/-1)
master | [![Build+Status](http://build.ethdev.com/buildstatusimage?builder=Linux%20C%2B%2B%20master%20branch)](http://build.ethdev.com/builders/Linux%20C%2B%2B%20master%20branch/builds/-1) | [![Build+Status](http://build.ethdev.com/buildstatusimage?builder=OSX%20C%2B%2B%20master%20branch)](http://build.ethdev.com/builders/OSX%20C%2B%2B%20master%20branch/builds/-1) | [![Build+Status](http://build.ethdev.com/buildstatusimage?builder=Windows%20C%2B%2B%20master%20branch)](http://build.ethdev.com/builders/Windows%20C%2B%2B%20master%20branch/builds/-1)
[![Stories in Ready](https://badge.waffle.io/ethereum/cpp-ethereum.png?label=ready&title=Ready)](http://waffle.io/ethereum/cpp-ethereum) [![Stories in Ready](https://badge.waffle.io/ethereum/cpp-ethereum.png?label=ready&title=Ready)](http://waffle.io/ethereum/cpp-ethereum)

10
alethzero/Main.ui

@ -95,8 +95,8 @@
<widget class="QLineEdit" name="urlEdit"/> <widget class="QLineEdit" name="urlEdit"/>
</item> </item>
<item> <item>
<widget class="QWebView" name="webView" native="true"> <widget class="QWebView" name="webView">
<property name="url" stdset="0"> <property name="url">
<url> <url>
<string>about:blank</string> <string>about:blank</string>
</url> </url>
@ -1212,8 +1212,8 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QWebView" name="jsConsole" native="true"> <widget class="QWebView" name="jsConsole">
<property name="url" stdset="0"> <property name="url">
<url> <url>
<string>about:blank</string> <string>about:blank</string>
</url> </url>
@ -2035,7 +2035,7 @@ font-size: 14pt</string>
</action> </action>
<action name="importKeyFile"> <action name="importKeyFile">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Claim Ether Presale &amp;Wallet...</string> <string>Claim Ether Presale &amp;Wallet...</string>

45
alethzero/MainWin.cpp

@ -755,7 +755,7 @@ void Main::on_importKey_triggered()
void Main::on_importKeyFile_triggered() void Main::on_importKeyFile_triggered()
{ {
QString s = QFileDialog::getOpenFileName(this, "Import Account", QDir::homePath(), "JSON Files (*.json);;All Files (*)"); QString s = QFileDialog::getOpenFileName(this, "Claim Account Contents", QDir::homePath(), "JSON Files (*.json);;All Files (*)");
try try
{ {
js::mValue val; js::mValue val;
@ -785,9 +785,13 @@ void Main::on_importKeyFile_triggered()
if (std::find(m_myKeys.begin(), m_myKeys.end(), k) == m_myKeys.end()) if (std::find(m_myKeys.begin(), m_myKeys.end(), k) == m_myKeys.end())
{ {
m_myKeys.append(k); if (m_myKeys.empty())
{
m_myKeys.push_back(KeyPair::create());
keysChanged(); keysChanged();
} }
ethereum()->transact(k.sec(), ethereum()->balanceAt(k.address()) - gasPrice() * c_txGas, m_myKeys.back().address(), {}, c_txGas, gasPrice());
}
else else
QMessageBox::warning(this, "Already Have Key", "Could not import the secret key: we already own this account."); QMessageBox::warning(this, "Already Have Key", "Could not import the secret key: we already own this account.");
} }
@ -1093,7 +1097,7 @@ void Main::refreshBlockChain()
auto b = bc.block(h); auto b = bc.block(h);
for (auto const& i: RLP(b)[1]) for (auto const& i: RLP(b)[1])
{ {
Transaction t(i.data()); Transaction t(i.data(), CheckSignature::Sender);
if (bm || transactionMatch(filter, t)) if (bm || transactionMatch(filter, t))
{ {
QString s = t.receiveAddress() ? QString s = t.receiveAddress() ?
@ -1381,7 +1385,7 @@ void Main::on_blocks_currentItemChanged()
else else
{ {
unsigned txi = item->data(Qt::UserRole + 1).toInt(); unsigned txi = item->data(Qt::UserRole + 1).toInt();
Transaction tx(block[1][txi].data()); Transaction tx(block[1][txi].data(), CheckSignature::Sender);
auto ss = tx.safeSender(); auto ss = tx.safeSender();
h256 th = sha3(rlpList(ss, tx.nonce())); h256 th = sha3(rlpList(ss, tx.nonce()));
TransactionReceipt receipt = ethereum()->blockChain().receipts(h).receipts[txi]; TransactionReceipt receipt = ethereum()->blockChain().receipts(h).receipts[txi];
@ -1644,13 +1648,18 @@ static shh::Topic topicFromText(QString _s)
return ret; return ret;
} }
bool Main::sourceIsSolidity(string const& _source) bool Main::sourceIsSolidity(string const& _source)
{ {
// TODO: Improve this heuristic // TODO: Improve this heuristic
return (_source.substr(0, 8) == "contract" || _source.substr(0, 5) == "//sol"); return (_source.substr(0, 8) == "contract" || _source.substr(0, 5) == "//sol");
} }
static bool sourceIsSerpent(string const& _source)
{
// TODO: Improve this heuristic
return (_source.substr(0, 5) == "//ser");
}
string const Main::getFunctionHashes(dev::solidity::CompilerStack const &_compiler, string const Main::getFunctionHashes(dev::solidity::CompilerStack const &_compiler,
string const& _contractName) string const& _contractName)
{ {
@ -1685,6 +1694,7 @@ void Main::on_data_textChanged()
dev::solidity::CompilerStack compiler; dev::solidity::CompilerStack compiler;
try try
{ {
// compiler.addSources(dev::solidity::StandardSources);
m_data = compiler.compile(src, m_enableOptimizer); m_data = compiler.compile(src, m_enableOptimizer);
solidity = "<h4>Solidity</h4>"; solidity = "<h4>Solidity</h4>";
solidity += "<pre>" + QString::fromStdString(compiler.getInterface()).replace(QRegExp("\\s"), "").toHtmlEscaped() + "</pre>"; solidity += "<pre>" + QString::fromStdString(compiler.getInterface()).replace(QRegExp("\\s"), "").toHtmlEscaped() + "</pre>";
@ -1702,10 +1712,7 @@ void Main::on_data_textChanged()
solidity = "<h4>Solidity</h4><pre>Uncaught exception.</pre>"; solidity = "<h4>Solidity</h4><pre>Uncaught exception.</pre>";
} }
} }
else else if (sourceIsSerpent(src))
{
m_data = compileLLL(src, m_enableOptimizer, &errors);
if (errors.size())
{ {
try try
{ {
@ -1719,6 +1726,9 @@ void Main::on_data_textChanged()
} }
} }
else else
{
m_data = compileLLL(src, m_enableOptimizer, &errors);
if (errors.empty())
{ {
auto asmcode = compileLLLToAsm(src, false); auto asmcode = compileLLLToAsm(src, false);
lll = "<h4>Pre</h4><pre>" + QString::fromStdString(asmcode).toHtmlEscaped() + "</pre>"; lll = "<h4>Pre</h4><pre>" + QString::fromStdString(asmcode).toHtmlEscaped() + "</pre>";
@ -1969,9 +1979,24 @@ void Main::on_debug_clicked()
} }
} }
bool beginsWith(Address _a, bytes const& _b)
{
for (unsigned i = 0; i < min<unsigned>(20, _b.size()); ++i)
if (_a[i] != _b[i])
return false;
return true;
}
void Main::on_create_triggered() void Main::on_create_triggered()
{ {
m_myKeys.append(KeyPair::create()); bool ok = true;
QString s = QInputDialog::getText(this, "Special Beginning?", "If you want a special key, enter some hex digits that it should begin with.\nNOTE: The more you enter, the longer generation will take.", QLineEdit::Normal, QString(), &ok);
if (!ok)
return;
KeyPair p;
while (!beginsWith(p.address(), asBytes(s.toStdString())))
p = KeyPair::create();
m_myKeys.append(p);
keysChanged(); keysChanged();
} }

2
libethereum/Client.cpp

@ -642,7 +642,7 @@ Transaction Client::transaction(h256 _blockHash, unsigned _i) const
{ {
auto bl = m_bc.block(_blockHash); auto bl = m_bc.block(_blockHash);
RLP b(bl); RLP b(bl);
return Transaction(b[1][_i].data()); return Transaction(b[1][_i].data(), CheckSignature::Range);
} }
BlockInfo Client::uncle(h256 _blockHash, unsigned _i) const BlockInfo Client::uncle(h256 _blockHash, unsigned _i) const

2
libethereum/Executive.cpp

@ -53,7 +53,7 @@ void Executive::accrueSubState(SubState& _parentContext)
bool Executive::setup(bytesConstRef _rlp) bool Executive::setup(bytesConstRef _rlp)
{ {
// Entry point for a user-executed transaction. // Entry point for a user-executed transaction.
m_t = Transaction(_rlp); m_t = Transaction(_rlp, CheckSignature::Sender);
// Avoid invalid transactions. // Avoid invalid transactions.
auto nonceReq = m_s.transactionsFrom(m_t.sender()); auto nonceReq = m_s.transactionsFrom(m_t.sender());

2
libethereum/State.cpp

@ -395,7 +395,7 @@ bool State::cull(TransactionQueue& _tq) const
{ {
try try
{ {
Transaction t(i.second); Transaction t(i.second, CheckSignature::Sender);
if (t.nonce() <= transactionsFrom(t.sender())) if (t.nonce() <= transactionsFrom(t.sender()))
{ {
_tq.drop(i.first); _tq.drop(i.first);

10
libethereum/Transaction.cpp

@ -30,7 +30,7 @@ using namespace dev::eth;
#define ETH_ADDRESS_DEBUG 0 #define ETH_ADDRESS_DEBUG 0
Transaction::Transaction(bytesConstRef _rlpData, bool _checkSender) Transaction::Transaction(bytesConstRef _rlpData, CheckSignature _checkSig)
{ {
int field = 0; int field = 0;
RLP rlp(_rlpData); RLP rlp(_rlpData);
@ -46,8 +46,14 @@ Transaction::Transaction(bytesConstRef _rlpData, bool _checkSender)
byte v = rlp[field = 6].toInt<byte>() - 27; byte v = rlp[field = 6].toInt<byte>() - 27;
h256 r = rlp[field = 7].toInt<u256>(); h256 r = rlp[field = 7].toInt<u256>();
h256 s = rlp[field = 8].toInt<u256>(); h256 s = rlp[field = 8].toInt<u256>();
if (rlp.itemCount() > 9)
BOOST_THROW_EXCEPTION(BadRLP() << errinfo_comment("to many fields in the transaction RLP"));
m_vrs = SignatureStruct{ r, s, v }; m_vrs = SignatureStruct{ r, s, v };
if (_checkSender) if (_checkSig >= CheckSignature::Range && !m_vrs.isValid())
BOOST_THROW_EXCEPTION(InvalidSignature());
if (_checkSig == CheckSignature::Sender)
m_sender = sender(); m_sender = sender();
} }
catch (Exception& _e) catch (Exception& _e)

11
libethereum/Transaction.h

@ -37,6 +37,13 @@ enum IncludeSignature
WithSignature = 1, ///< Do include a signature. WithSignature = 1, ///< Do include a signature.
}; };
enum class CheckSignature
{
None,
Range,
Sender
};
/// Encodes a transaction, ready to be exported to or freshly imported from RLP. /// Encodes a transaction, ready to be exported to or freshly imported from RLP.
class Transaction class Transaction
{ {
@ -57,10 +64,10 @@ public:
Transaction(u256 _value, u256 _gasPrice, u256 _gas, bytes const& _data): m_type(ContractCreation), m_value(_value), m_gasPrice(_gasPrice), m_gas(_gas), m_data(_data) {} Transaction(u256 _value, u256 _gasPrice, u256 _gas, bytes const& _data): m_type(ContractCreation), m_value(_value), m_gasPrice(_gasPrice), m_gas(_gas), m_data(_data) {}
/// Constructs a transaction from the given RLP. /// Constructs a transaction from the given RLP.
explicit Transaction(bytesConstRef _rlp, bool _checkSender = false); explicit Transaction(bytesConstRef _rlp, CheckSignature _checkSig);
/// Constructs a transaction from the given RLP. /// Constructs a transaction from the given RLP.
explicit Transaction(bytes const& _rlp, bool _checkSender = false): Transaction(&_rlp, _checkSender) {} explicit Transaction(bytes const& _rlp, CheckSignature _checkSig): Transaction(&_rlp, _checkSig) {}
/// Checks equality of transactions. /// Checks equality of transactions.

6
libethereum/TransactionQueue.cpp

@ -42,7 +42,7 @@ bool TransactionQueue::import(bytesConstRef _transactionRLP)
// Check validity of _transactionRLP as a transaction. To do this we just deserialise and attempt to determine the sender. // Check validity of _transactionRLP as a transaction. To do this we just deserialise and attempt to determine the sender.
// If it doesn't work, the signature is bad. // If it doesn't work, the signature is bad.
// The transaction's nonce may yet be invalid (or, it could be "valid" but we may be missing a marginally older transaction). // The transaction's nonce may yet be invalid (or, it could be "valid" but we may be missing a marginally older transaction).
Transaction t(_transactionRLP, true); Transaction t(_transactionRLP, CheckSignature::Sender);
UpgradeGuard ul(l); UpgradeGuard ul(l);
// If valid, append to blocks. // If valid, append to blocks.
@ -69,14 +69,14 @@ void TransactionQueue::setFuture(std::pair<h256, bytes> const& _t)
if (m_current.count(_t.first)) if (m_current.count(_t.first))
{ {
m_current.erase(_t.first); m_current.erase(_t.first);
m_unknown.insert(make_pair(Transaction(_t.second).sender(), _t)); m_unknown.insert(make_pair(Transaction(_t.second, CheckSignature::Sender).sender(), _t));
} }
} }
void TransactionQueue::noteGood(std::pair<h256, bytes> const& _t) void TransactionQueue::noteGood(std::pair<h256, bytes> const& _t)
{ {
WriteGuard l(m_lock); WriteGuard l(m_lock);
auto r = m_unknown.equal_range(Transaction(_t.second).sender()); auto r = m_unknown.equal_range(Transaction(_t.second, CheckSignature::Sender).sender());
for (auto it = r.first; it != r.second; ++it) for (auto it = r.first; it != r.second; ++it)
m_current.insert(it->second); m_current.insert(it->second);
m_unknown.erase(r.first, r.second); m_unknown.erase(r.first, r.second);

1
liblll/CodeFragment.cpp

@ -266,7 +266,6 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
} }
++ii; ++ii;
} }
} }
else if (us == "LIT") else if (us == "LIT")
{ {

1
liblll/CodeFragment.h

@ -61,3 +61,4 @@ static const CodeFragment NullCodeFragment;
} }
} }

43
libsolidity/CompilerStack.cpp

@ -21,6 +21,7 @@
* Full-stack compiler that converts a source code string to bytecode. * Full-stack compiler that converts a source code string to bytecode.
*/ */
#include <boost/algorithm/string.hpp>
#include <libsolidity/AST.h> #include <libsolidity/AST.h>
#include <libsolidity/Scanner.h> #include <libsolidity/Scanner.h>
#include <libsolidity/Parser.h> #include <libsolidity/Parser.h>
@ -123,9 +124,49 @@ void CompilerStack::compile(bool _optimize)
} }
} }
string CompilerStack::expanded(string const& _sourceCode)
{
// TODO: populate some nicer way.
static const map<string, string> c_requires = {
{ "Config", "contract Config{function lookup(uint256 service)constant returns(address a){}function kill(){}function unregister(uint256 id){}function register(uint256 id,address service){}}" },
{ "owned", "contract owned{function owned(){owner = msg.sender;}address owner;}" },
{ "mortal", "#require owned\ncontract mortal is owned {function kill() { if (msg.sender == owner) suicide(owner); }}" },
{ "NameReg", "contract NameReg{function register(string32 name){}function addressOf(string32 name)constant returns(address addr){}function unregister(){}function nameOf(address addr)constant returns(string32 name){}}" },
{ "named", "#require Config NameReg\ncontract named is mortal, owned {function named(string32 name) {NameReg(Config().lookup(1)).register(name);}" },
{ "std", "#require owned mortal Config NameReg named" },
};
string sub;
set<string> got;
function<string(string const&)> localExpanded;
localExpanded = [&](string const& s) -> string
{
string ret = s;
for (size_t p = 0; p != string::npos;)
if ((p = ret.find("#require ")) != string::npos)
{
string n = ret.substr(p + 9, ret.find_first_of('\n', p + 9) - p - 9);
ret.replace(p, n.size() + 9, "");
vector<string> rs;
boost::split(rs, n, boost::is_any_of(" \t,"), boost::token_compress_on);
for (auto const& r: rs)
if (!got.count(r))
{
if (c_requires.count(r))
sub.append("\n" + localExpanded(c_requires.at(r)) + "\n");
got.insert(r);
}
}
// TODO: remove once we have genesis contracts.
else if ((p = ret.find("Config()")) != string::npos)
ret.replace(p, 8, "Config(0x661005d2720d855f1d9976f88bb10c1a3398c77f)");
return ret;
};
return sub + localExpanded(_sourceCode);
}
bytes const& CompilerStack::compile(string const& _sourceCode, bool _optimize) bytes const& CompilerStack::compile(string const& _sourceCode, bool _optimize)
{ {
parse(_sourceCode); parse(expanded(_sourceCode));
compile(_optimize); compile(_optimize);
return getBytecode(); return getBytecode();
} }

4
libsolidity/CompilerStack.h

@ -138,6 +138,10 @@ private:
Contract(); Contract();
}; };
/// Expand source code with preprocessor-like includes.
/// @todo Replace with better framework.
std::string expanded(std::string const& _sourceCode);
void reset(bool _keepSources = false); void reset(bool _keepSources = false);
void resolveImports(); void resolveImports();

2
mix/AssemblyDebuggerControl.cpp

@ -49,5 +49,5 @@ void AssemblyDebuggerControl::start() const
void AssemblyDebuggerControl::showDebugger() void AssemblyDebuggerControl::showDebugger()
{ {
QObject* debugPanel = m_view->findChild<QObject*>("debugPanel", Qt::FindChildrenRecursively); QObject* debugPanel = m_view->findChild<QObject*>("debugPanel", Qt::FindChildrenRecursively);
QMetaObject::invokeMethod(debugPanel, "update"); QMetaObject::invokeMethod(debugPanel, "update", Q_ARG(QVariant, true));
} }

5
mix/ClientModel.cpp

@ -103,7 +103,10 @@ void ClientModel::debugState(QVariantMap _state)
TransactionSettings transactionSettings(functionId, value, gas, gasPrice); TransactionSettings transactionSettings(functionId, value, gas, gasPrice);
for (auto p = params.cbegin(); p != params.cend(); ++p) for (auto p = params.cbegin(); p != params.cend(); ++p)
transactionSettings.parameterValues.insert(std::make_pair(p.key(), (qvariant_cast<QEther*>(p.value()))->toU256Wei())); {
QBigInt* param = qvariant_cast<QBigInt*>(p.value());
transactionSettings.parameterValues.insert(std::make_pair(p.key(), boost::get<dev::u256>(param->internalValue())));
}
transactionSequence.push_back(transactionSettings); transactionSequence.push_back(transactionSettings);
} }

8
mix/CodeModel.cpp

@ -61,7 +61,7 @@ CompilationResult::CompilationResult(const dev::solidity::CompilerStack& _compil
m_bytes = _compiler.getBytecode(); m_bytes = _compiler.getBytecode();
m_assemblyCode = QString::fromStdString(dev::eth::disassemble(m_bytes)); m_assemblyCode = QString::fromStdString(dev::eth::disassemble(m_bytes));
dev::solidity::InterfaceHandler interfaceHandler; dev::solidity::InterfaceHandler interfaceHandler;
m_contractDefinition = QString::fromStdString(*interfaceHandler.getABIInterface(contractDefinition)); m_contractInterface = QString::fromStdString(*interfaceHandler.getABIInterface(contractDefinition));
} }
else else
m_contract.reset(new QContractDefinition()); m_contract.reset(new QContractDefinition());
@ -75,7 +75,7 @@ CompilationResult::CompilationResult(CompilationResult const& _prev, QString con
m_compilerMessage(_compilerMessage), m_compilerMessage(_compilerMessage),
m_bytes(_prev.m_bytes), m_bytes(_prev.m_bytes),
m_assemblyCode(_prev.m_assemblyCode), m_assemblyCode(_prev.m_assemblyCode),
m_contractDefinition(_prev.m_contractDefinition), m_contractInterface(_prev.m_contractInterface),
m_codeHighlighter(_prev.m_codeHighlighter) m_codeHighlighter(_prev.m_codeHighlighter)
{} {}
@ -164,7 +164,7 @@ void CodeModel::runCompilationJob(int _jobId, QString const& _code)
void CodeModel::onCompilationComplete(CompilationResult* _newResult) void CodeModel::onCompilationComplete(CompilationResult* _newResult)
{ {
m_compiling = false; m_compiling = false;
bool contractChanged = m_result->contractDefinition() != _newResult->contractDefinition(); bool contractChanged = m_result->contractInterface() != _newResult->contractInterface();
m_result.reset(_newResult); m_result.reset(_newResult);
emit compilationComplete(); emit compilationComplete();
emit stateChanged(); emit stateChanged();
@ -172,7 +172,7 @@ void CodeModel::onCompilationComplete(CompilationResult* _newResult)
{ {
emit codeChanged(); emit codeChanged();
if (contractChanged) if (contractChanged)
emit contractDefinitionChanged(); emit contractInterfaceChanged();
} }
} }

8
mix/CodeModel.h

@ -67,7 +67,7 @@ class CompilationResult: public QObject
Q_PROPERTY(QContractDefinition* contract READ contract) Q_PROPERTY(QContractDefinition* contract READ contract)
Q_PROPERTY(QString compilerMessage READ compilerMessage CONSTANT) Q_PROPERTY(QString compilerMessage READ compilerMessage CONSTANT)
Q_PROPERTY(bool successful READ successful CONSTANT) Q_PROPERTY(bool successful READ successful CONSTANT)
Q_PROPERTY(QString contractDefinition READ contractDefinition CONSTANT) Q_PROPERTY(QString contractInterface READ contractInterface CONSTANT)
public: public:
/// Empty compilation result constructor /// Empty compilation result constructor
@ -90,7 +90,7 @@ public:
/// @returns contract bytecode in human-readable form /// @returns contract bytecode in human-readable form
QString assemblyCode() const { return m_assemblyCode; } QString assemblyCode() const { return m_assemblyCode; }
/// @returns contract definition in JSON format /// @returns contract definition in JSON format
QString contractDefinition() const { return m_contractDefinition; } QString contractInterface() const { return m_contractInterface; }
/// Get code highlighter /// Get code highlighter
std::shared_ptr<CodeHighlighter> codeHighlighter() { return m_codeHighlighter; } std::shared_ptr<CodeHighlighter> codeHighlighter() { return m_codeHighlighter; }
@ -101,7 +101,7 @@ private:
QString m_compilerMessage; ///< @todo: use some structure here QString m_compilerMessage; ///< @todo: use some structure here
dev::bytes m_bytes; dev::bytes m_bytes;
QString m_assemblyCode; QString m_assemblyCode;
QString m_contractDefinition; QString m_contractInterface;
std::shared_ptr<CodeHighlighter> m_codeHighlighter; std::shared_ptr<CodeHighlighter> m_codeHighlighter;
friend class CodeModel; friend class CodeModel;
@ -142,7 +142,7 @@ signals:
/// Emitted if there are any changes in the code model /// Emitted if there are any changes in the code model
void codeChanged(); void codeChanged();
/// Emitted if there are any changes in the contract interface /// Emitted if there are any changes in the contract interface
void contractDefinitionChanged(); void contractInterfaceChanged();
/// Emitted on compilation complete. Internal /// Emitted on compilation complete. Internal
void compilationCompleteInternal(CompilationResult* _newResult); void compilationCompleteInternal(CompilationResult* _newResult);

5
mix/DebuggingStateWrapper.cpp

@ -86,9 +86,8 @@ QBigInt* DebuggingStateWrapper::newMemSize()
QStringList DebuggingStateWrapper::debugStack() QStringList DebuggingStateWrapper::debugStack()
{ {
QStringList stack; QStringList stack;
for (auto i: m_state.stack) for (std::vector<u256>::reverse_iterator i = m_state.stack.rbegin(); i != m_state.stack.rend(); ++i)
stack.append(QString::fromStdString(prettyU256(i))); stack.append(QString::fromStdString(prettyU256(*i)));
return fillList(stack, ""); return fillList(stack, "");
} }

6
mix/main.cpp

@ -21,6 +21,7 @@
*/ */
#include <iostream> #include <iostream>
#include <stdlib.h>
#include "MixApplication.h" #include "MixApplication.h"
#include "Exceptions.h" #include "Exceptions.h"
using namespace dev::mix; using namespace dev::mix;
@ -29,6 +30,11 @@ int main(int _argc, char* _argv[])
{ {
#ifdef ETH_HAVE_WEBENGINE #ifdef ETH_HAVE_WEBENGINE
Q_INIT_RESOURCE(js); Q_INIT_RESOURCE(js);
#endif
#if __linux
//work around ubuntu appmenu-qt5 bug
//https://bugs.launchpad.net/ubuntu/+source/appmenu-qt5/+bug/1323853
putenv((char*)"QT_QPA_PLATFORMTHEME=");
#endif #endif
try try
{ {

1
mix/qml.qrc

@ -41,5 +41,6 @@
<file>qml/Ether.qml</file> <file>qml/Ether.qml</file>
<file>qml/EtherValue.qml</file> <file>qml/EtherValue.qml</file>
<file>qml/BigIntValue.qml</file> <file>qml/BigIntValue.qml</file>
<file>qml/Splitter.qml</file>
</qresource> </qresource>
</RCC> </RCC>

4
mix/qml/DebugBasicInfo.qml

@ -5,8 +5,6 @@ import QtQuick.Controls.Styles 1.1
RowLayout { RowLayout {
property string titleStr property string titleStr
width: parent.width
height: parent.height / 4
function update(_value) function update(_value)
{ {
@ -14,7 +12,7 @@ RowLayout {
} }
Rectangle { Rectangle {
width: parent.width / 2 width: 120
height: parent.height height: parent.height
color: "#e5e5e5" color: "#e5e5e5"
Text Text

42
mix/qml/DebugInfoList.qml

@ -9,6 +9,23 @@ ColumnLayout {
property bool collapsible; property bool collapsible;
property Component itemDelegate property Component itemDelegate
spacing: 0 spacing: 0
function collapse()
{
storageContainer.state = "collapsed";
}
function show()
{
storageContainer.state = "";
}
Component.onCompleted:
{
if (storageContainer.parent.parent.height === 25)
storageContainer.state = "collapsed";
}
RowLayout { RowLayout {
height: 25 height: 25
id: header id: header
@ -17,7 +34,6 @@ ColumnLayout {
width: 15 width: 15
sourceSize.width: 15 sourceSize.width: 15
id: storageImgArrow id: storageImgArrow
visible: collapsible
} }
Text { Text {
@ -32,40 +48,39 @@ ColumnLayout {
enabled: collapsible enabled: collapsible
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
if (collapsible)
{
if (storageContainer.state == "collapsed") if (storageContainer.state == "collapsed")
{
storageContainer.state = ""; storageContainer.state = "";
storageContainer.parent.parent.height = storageContainer.parent.parent.Layout.maximumHeight;
}
else else
storageContainer.state = "collapsed"; storageContainer.state = "collapsed";
} }
} }
} }
}
RowLayout
{
height: parent.height - header.height
clip: true
Rectangle Rectangle
{ {
height: parent.height
border.width: 3 border.width: 3
border.color: "#deddd9" border.color: "#deddd9"
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true
states: [ states: [
State { State {
name: "collapsed" name: "collapsed"
PropertyChanges {
target: storageContainer.parent
height: 0
visible: false
}
PropertyChanges { PropertyChanges {
target: storageImgArrow target: storageImgArrow
source: "qrc:/qml/img/closedtriangleindicator.png" source: "qrc:/qml/img/closedtriangleindicator.png"
} }
PropertyChanges {
target: storageContainer.parent.parent
height: 25
}
} }
] ]
id: storageContainer id: storageContainer
width: parent.width
ListView { ListView {
clip: true; clip: true;
anchors.top: parent.top anchors.top: parent.top
@ -80,4 +95,3 @@ ColumnLayout {
} }
} }
} }
}

210
mix/qml/Debugger.qml

@ -3,6 +3,7 @@ import QtQuick.Controls.Styles 1.1
import QtQuick.Controls 1.1 import QtQuick.Controls 1.1
import QtQuick.Dialogs 1.1 import QtQuick.Dialogs 1.1
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import Qt.labs.settings 1.0
import "js/Debugger.js" as Debugger import "js/Debugger.js" as Debugger
import "js/ErrorLocationFormater.js" as ErrorLocationFormater import "js/ErrorLocationFormater.js" as ErrorLocationFormater
@ -20,7 +21,13 @@ Rectangle {
Debugger.moveSelection(-1); Debugger.moveSelection(-1);
} }
function update() onVisibleChanged:
{
if (visible)
forceActiveFocus();
}
function update(giveFocus)
{ {
if (statusPane.result.successful) if (statusPane.result.successful)
{ {
@ -39,11 +46,13 @@ Rectangle {
errorDetail.text = errorInfo.errorDetail; errorDetail.text = errorInfo.errorDetail;
errorLine.text = errorInfo.errorLine; errorLine.text = errorInfo.errorLine;
} }
if (giveFocus)
forceActiveFocus();
} }
Connections { Connections {
target: codeModel target: codeModel
onCompilationComplete: update() onCompilationComplete: update(false)
} }
Rectangle Rectangle
@ -95,17 +104,18 @@ Rectangle {
} }
} }
Flickable { Flickable {
property int firstColumnWidth: 170 property int firstColumnWidth: 180
property int secondColumnWidth: 250 property int secondColumnWidth: 250
id: debugScrollArea id: debugScrollArea
flickableDirection: Flickable.VerticalFlick flickableDirection: Flickable.VerticalFlick
anchors.fill: parent anchors.fill: parent
contentHeight: machineStates.height + 300 contentHeight: 4000
contentWidth: machineStates.width contentWidth: parent.width
Rectangle
GridLayout {
anchors.fill: parent
ColumnLayout
{ {
property int sideMargin: 10 property int sideMargin: 10
id: machineStates id: machineStates
@ -115,13 +125,16 @@ Rectangle {
anchors.leftMargin: machineStates.sideMargin anchors.leftMargin: machineStates.sideMargin
anchors.right: parent.right; anchors.right: parent.right;
anchors.rightMargin: machineStates.sideMargin anchors.rightMargin: machineStates.sideMargin
flow: GridLayout.TopToBottom anchors.fill: parent
rowSpacing: 15 Layout.fillWidth: true
Layout.fillHeight: true
RowLayout { RowLayout {
// step button + slider // step button + slider
id: buttonRow
spacing: machineStates.sideMargin spacing: machineStates.sideMargin
height: 27 height: 27
width: debugPanel.width Layout.fillWidth: true
Rectangle Rectangle
{ {
height: parent.height height: parent.height
@ -137,8 +150,9 @@ Rectangle {
enabledStateImg: "qrc:/qml/img/jumpoutback.png" enabledStateImg: "qrc:/qml/img/jumpoutback.png"
disableStateImg: "qrc:/qml/img/jumpoutbackdisabled.png" disableStateImg: "qrc:/qml/img/jumpoutbackdisabled.png"
onClicked: Debugger.stepOutBack() onClicked: Debugger.stepOutBack()
width: 25 width: 28
height: 27 height: 30
buttonTooltip: qsTr("Step Out Back")
} }
StepActionImage StepActionImage
@ -147,8 +161,9 @@ Rectangle {
enabledStateImg: "qrc:/qml/img/jumpintoback.png" enabledStateImg: "qrc:/qml/img/jumpintoback.png"
disableStateImg: "qrc:/qml/img/jumpintobackdisabled.png" disableStateImg: "qrc:/qml/img/jumpintobackdisabled.png"
onClicked: Debugger.stepIntoBack() onClicked: Debugger.stepIntoBack()
width: 25 width: 28
height: 27 height: 30
buttonTooltip: qsTr("Step Into Back")
} }
StepActionImage StepActionImage
@ -157,8 +172,9 @@ Rectangle {
enabledStateImg: "qrc:/qml/img/jumpoverback.png" enabledStateImg: "qrc:/qml/img/jumpoverback.png"
disableStateImg: "qrc:/qml/img/jumpoverbackdisabled.png" disableStateImg: "qrc:/qml/img/jumpoverbackdisabled.png"
onClicked: Debugger.stepOverBack() onClicked: Debugger.stepOverBack()
width: 25 width: 28
height: 27 height: 30
buttonTooltip: qsTr("Step Over Back")
} }
StepActionImage StepActionImage
@ -167,8 +183,9 @@ Rectangle {
enabledStateImg: "qrc:/qml/img/jumpoverforward.png" enabledStateImg: "qrc:/qml/img/jumpoverforward.png"
disableStateImg: "qrc:/qml/img/jumpoverforwarddisabled.png" disableStateImg: "qrc:/qml/img/jumpoverforwarddisabled.png"
onClicked: Debugger.stepOverForward() onClicked: Debugger.stepOverForward()
width: 25 width: 28
height: 27 height: 30
buttonTooltip: qsTr("Step Over Forward")
} }
StepActionImage StepActionImage
@ -177,8 +194,9 @@ Rectangle {
enabledStateImg: "qrc:/qml/img/jumpintoforward.png" enabledStateImg: "qrc:/qml/img/jumpintoforward.png"
disableStateImg: "qrc:/qml/img/jumpintoforwarddisabled.png" disableStateImg: "qrc:/qml/img/jumpintoforwarddisabled.png"
onClicked: Debugger.stepIntoForward() onClicked: Debugger.stepIntoForward()
width: 25 width: 28
height: 27 height: 30
buttonTooltip: qsTr("Step Into Forward")
} }
StepActionImage StepActionImage
@ -187,14 +205,16 @@ Rectangle {
enabledStateImg: "qrc:/qml/img/jumpoutforward.png" enabledStateImg: "qrc:/qml/img/jumpoutforward.png"
disableStateImg: "qrc:/qml/img/jumpoutforwarddisabled.png" disableStateImg: "qrc:/qml/img/jumpoutforwarddisabled.png"
onClicked: Debugger.stepOutForward() onClicked: Debugger.stepOutForward()
width: 25 width: 28
height: 27 height: 30
buttonTooltip: qsTr("Step Out Forward")
} }
} }
} }
Rectangle { Rectangle {
color: "transparent" color: "transparent"
width: debugScrollArea.secondColumnWidth Layout.fillWidth: true
height: parent.height height: parent.height
Slider { Slider {
id: statesSlider id: statesSlider
@ -224,12 +244,15 @@ Rectangle {
RowLayout { RowLayout {
// Assembly code // Assembly code
width: debugPanel.width id: assemblyCodeRow
Layout.fillWidth: true
height: 405 height: 405
implicitHeight: 405
spacing: machineStates.sideMargin spacing: machineStates.sideMargin
Rectangle Rectangle
{ {
id: stateListContainer
width: debugScrollArea.firstColumnWidth width: debugScrollArea.firstColumnWidth
height: parent.height height: parent.height
border.width: 3 border.width: 3
@ -246,7 +269,7 @@ Rectangle {
id: statesList id: statesList
delegate: renderDelegate delegate: renderDelegate
highlight: highlightBar highlight: highlightBar
highlightFollowsCurrentItem: true highlightFollowsCurrentItem: false
} }
Component { Component {
@ -255,8 +278,11 @@ Rectangle {
radius: 4 radius: 4
height: statesList.currentItem.height height: statesList.currentItem.height
width: statesList.currentItem.width; width: statesList.currentItem.width;
y: statesList.currentItem.y
color: "#4A90E2" color: "#4A90E2"
Behavior on y { SpringAnimation { spring: 2; damping: 0.1 } } Behavior on y {
PropertyAnimation { properties: "y"; easing.type: Easing.InOutQuad; duration: 50}
}
} }
} }
@ -288,54 +314,49 @@ Rectangle {
} }
} }
ColumnLayout {
width: debugScrollArea.secondColumnWidth
height: parent.height
Rectangle { Rectangle {
// Info Layout.fillWidth: true
height: parent.height //- 2 * stateListContainer.border.width
ColumnLayout
{
width: parent.width width: parent.width
id: basicInfoColumn anchors.fill: parent
height: 125
color: "transparent"
ColumnLayout {
spacing: 0 spacing: 0
width: parent.width
height: parent.height
DebugBasicInfo { DebugBasicInfo {
id: currentStep id: currentStep
titleStr: qsTr("Current step") titleStr: qsTr("Current Step")
Layout.fillWidth: true
height: 30
} }
DebugBasicInfo { DebugBasicInfo {
id: mem id: mem
titleStr: qsTr("Adding memory") titleStr: qsTr("Adding Memory")
Layout.fillWidth: true
height: 30
} }
DebugBasicInfo { DebugBasicInfo {
id: stepCost id: stepCost
titleStr: qsTr("Step cost") titleStr: qsTr("Step Cost")
Layout.fillWidth: true
height: 30
} }
DebugBasicInfo { DebugBasicInfo {
id: gasSpent id: gasSpent
titleStr: qsTr("Total gas spent") titleStr: qsTr("Total Gas Spent")
} Layout.fillWidth: true
} height: 30
} }
Rectangle {
// Stack
height: 275
width: parent.width
color: "transparent"
DebugInfoList DebugInfoList
{ {
Layout.fillHeight: true
Layout.fillWidth: true
id: stack id: stack
width: parent.width
height: parent.height
collapsible: false collapsible: false
title : qsTr("Stack") title : qsTr("Stack")
itemDelegate: Item { itemDelegate: Item {
id: renderedItem id: renderedItem
height: 27 height: 25
width: parent.width width: parent.width
RowLayout RowLayout
{ {
@ -352,7 +373,8 @@ Rectangle {
Text { Text {
anchors.centerIn: parent anchors.centerIn: parent
anchors.leftMargin: 5 anchors.leftMargin: 5
color: "#8b8b8b" font.family: "monospace"
color: "#4a4a4a"
text: model.index; text: model.index;
font.pointSize: 9 font.pointSize: 9
} }
@ -369,8 +391,9 @@ Rectangle {
Text { Text {
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 5 anchors.leftMargin: 5
font.family: "monospace"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
color: "#8b8b8b" color: "#4a4a4a"
text: modelData text: modelData
font.pointSize: 9 font.pointSize: 9
} }
@ -390,18 +413,32 @@ Rectangle {
} }
} }
Rectangle { SplitView
width: debugPanel.width - 2 * machineStates.sideMargin {
height: 2; id: splitInfoList
color: "#e3e3e3" Layout.fillHeight: true
radius: 3 Layout.fillWidth: true
Settings {
id: splitSettings
property alias storageHeightSettings: storageRect.height
property alias memoryDumpHeightSettings: memoryRect.height
property alias callDataHeightSettings: callDataRect.height
} }
orientation: Qt.Vertical
width: debugPanel.width - 2 * machineStates.sideMargin
Rectangle
{
id: storageRect
width: parent.width
Layout.minimumHeight: 25
Layout.maximumHeight: 223
height: 25
DebugInfoList DebugInfoList
{ {
id: storage id: storage
width: debugPanel.width - 2 * machineStates.sideMargin anchors.fill: parent
height: 223
collapsible: true collapsible: true
title : qsTr("Storage") title : qsTr("Storage")
itemDelegate: itemDelegate:
@ -425,8 +462,9 @@ Rectangle {
Text { Text {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
font.family: "monospace"
anchors.leftMargin: 5 anchors.leftMargin: 5
color: "#8b8b8b" color: "#4a4a4a"
text: modelData.split(' ')[0].substring(0, 10); text: modelData.split(' ')[0].substring(0, 10);
font.pointSize: 9 font.pointSize: 9
} }
@ -445,8 +483,9 @@ Rectangle {
width: parent.width - 5 width: parent.width - 5
wrapMode: Text.Wrap wrapMode: Text.Wrap
anchors.left: parent.left anchors.left: parent.left
font.family: "monospace"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
color: "#8b8b8b" color: "#4a4a4a"
text: modelData.split(' ')[1].substring(0, 10); text: modelData.split(' ')[1].substring(0, 10);
font.pointSize: 9 font.pointSize: 9
} }
@ -462,18 +501,18 @@ Rectangle {
} }
} }
} }
Rectangle {
width: debugPanel.width - 2 * machineStates.sideMargin
height: 2;
color: "#e3e3e3"
radius: 3
} }
Rectangle
{
id: memoryRect;
height: 25
width: parent.width
Layout.minimumHeight: 25
Layout.maximumHeight: 223
DebugInfoList { DebugInfoList {
id: memoryDump id: memoryDump
width: debugPanel.width - 2 * machineStates.sideMargin anchors.fill: parent
height: 223
collapsible: true collapsible: true
title: qsTr("Memory Dump") title: qsTr("Memory Dump")
itemDelegate: itemDelegate:
@ -483,20 +522,20 @@ Rectangle {
ItemDelegateDataDump {} ItemDelegateDataDump {}
} }
} }
Rectangle {
width: debugPanel.width - 2 * machineStates.sideMargin
height: 2;
color: "#e3e3e3"
radius: 3
} }
Rectangle
{
id: callDataRect
height: 25
width: parent.width
Layout.minimumHeight: 25
Layout.maximumHeight: 223
DebugInfoList { DebugInfoList {
id: callDataDump id: callDataDump
width: debugPanel.width - 2 * machineStates.sideMargin anchors.fill: parent
height: 223
collapsible: true collapsible: true
title: qsTr("Call data") title: qsTr("Call Data")
itemDelegate: itemDelegate:
Item { Item {
height: 29 height: 29
@ -505,5 +544,14 @@ Rectangle {
} }
} }
} }
Rectangle
{
width: parent.width
Layout.minimumHeight: 25
color: "transparent"
}
}
}
}
} }
} }

36
mix/qml/ItemDelegateDataDump.qml

@ -20,29 +20,33 @@ Rectangle {
Layout.maximumWidth: 35 Layout.maximumWidth: 35
Layout.minimumHeight: parent.height Layout.minimumHeight: parent.height
Text { Text {
anchors.centerIn: parent anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: 5 anchors.left: parent.left
color: "#8b8b8b" anchors.leftMargin: 3
font.family: "monospace"
font.bold: true
color: "#4a4a4a"
text: modelData[0] text: modelData[0]
font.pointSize: 9; font.pointSize: 8;
} }
} }
Rectangle Rectangle
{ {
anchors.left: firstCol.right
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: 90 Layout.minimumWidth: 110
Layout.preferredWidth: 90 Layout.preferredWidth: 110
Layout.maximumWidth: 90 Layout.maximumWidth: 110
Layout.minimumHeight: parent.height Layout.minimumHeight: parent.height
Text { Text {
anchors.left: parent.left font.family: "monospace"
anchors.leftMargin: 7 font.bold: true
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
color: "#8b8b8b" anchors.left: parent.left
anchors.leftMargin: 4
color: "#4a4a4a"
text: modelData[1] text: modelData[1]
font.pointSize: 9 font.pointSize: 8
} }
} }
@ -52,12 +56,12 @@ Rectangle {
Layout.minimumWidth: 50 Layout.minimumWidth: 50
Layout.minimumHeight: parent.height Layout.minimumHeight: parent.height
Text { Text {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
color: "#ededed" anchors.horizontalCenter: parent.horizontalCenter
font.bold: true font.family: "monospace"
color: "#4a4a4a"
text: modelData[2] text: modelData[2]
font.pointSize: 10 font.pointSize: 8
} }
} }
} }

60
mix/qml/MainContent.qml

@ -3,6 +3,7 @@ import QtQuick.Controls 1.1
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
import CodeEditorExtensionManager 1.0 import CodeEditorExtensionManager 1.0
import Qt.labs.settings 1.0
Rectangle { Rectangle {
@ -20,6 +21,14 @@ Rectangle {
property alias rightViewVisible : rightView.visible property alias rightViewVisible : rightView.visible
property alias webViewVisible : webPreview.visible property alias webViewVisible : webPreview.visible
onWidthChanged:
{
if (rightView.visible)
contentView.width = parent.width - projectList.width - rightView.width;
else
contentView.width = parent.width - projectList.width;
}
function toggleRightView() { function toggleRightView() {
if (!rightView.visible) if (!rightView.visible)
rightView.show(); rightView.show();
@ -41,6 +50,10 @@ Rectangle {
webPreview.visible = !webPreview.visible; webPreview.visible = !webPreview.visible;
} }
function rightViewVisible() {
return rightView.visible;
}
CodeEditorExtensionManager { CodeEditorExtensionManager {
headerView: headerPaneTabs; headerView: headerPaneTabs;
rightView: rightPaneTabs; rightView: rightPaneTabs;
@ -82,21 +95,37 @@ Rectangle {
} }
} }
SplitView { Rectangle {
resizing: false
Layout.row: 1
orientation: Qt.Horizontal;
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: root.height - headerView.height; Layout.preferredHeight: root.height - headerView.height;
Settings {
id: splitSettings
property alias projectWidth: projectList.width
property alias contentViewWidth: contentView.width
property alias rightViewWidth: rightView.width
}
ProjectList { ProjectList {
anchors.left: parent.left
id: projectList id: projectList
width: 200 width: 200
height: parent.height height: parent.height
Layout.minimumWidth: 200 Layout.minimumWidth: 200
} }
Splitter
{
id: resizeLeft
itemToStick: projectList
itemMinimumWidth: projectList.Layout.minimumWidth
direction: "right"
brother: contentView
color: "#a2a2a2"
}
Rectangle { Rectangle {
anchors.left: projectList.right
id: contentView id: contentView
width: parent.width - projectList.width width: parent.width - projectList.width
height: parent.height height: parent.height
@ -117,28 +146,39 @@ Rectangle {
} }
} }
Splitter
{
id: resizeRight
visible: false;
itemToStick: rightView
itemMinimumWidth: rightView.Layout.minimumWidth
direction: "left"
brother: contentView
color: "#a2a2a2"
}
Rectangle { Rectangle {
visible: false; visible: false;
id: rightView; id: rightView;
Keys.onEscapePressed: Keys.onEscapePressed: hide()
{
hide();
}
function show() { function show() {
visible = true; visible = true;
resizeRight.visible = true;
contentView.width = parent.width - projectList.width - rightView.width; contentView.width = parent.width - projectList.width - rightView.width;
} }
function hide() { function hide() {
resizeRight.visible = false;
visible = false; visible = false;
contentView.width = parent.width - projectList.width; contentView.width = parent.width - projectList.width;
} }
height: parent.height; height: parent.height;
width: 450 width: 515
Layout.minimumWidth: 450 Layout.minimumWidth: 515
anchors.right: parent.right
Rectangle { Rectangle {
anchors.fill: parent; anchors.fill: parent;
id: rightPaneView id: rightPaneView

2
mix/qml/NewProjectDialog.qml

@ -64,7 +64,7 @@ Window {
Button { Button {
enabled: titleField.text != "" && pathField.text != "" enabled: titleField.text != "" && pathField.text != ""
text: qsTr("Ok"); text: qsTr("OK");
onClicked: { onClicked: {
close(); close();
accepted(); accepted();

4
mix/qml/ProjectModel.qml

@ -89,7 +89,7 @@ Item {
FileDialog { FileDialog {
id: openProjectFileDialog id: openProjectFileDialog
visible: false visible: false
title: qsTr("Open a project") title: qsTr("Open a Project")
selectFolder: true selectFolder: true
onAccepted: { onAccepted: {
var path = openProjectFileDialog.fileUrl.toString(); var path = openProjectFileDialog.fileUrl.toString();
@ -101,7 +101,7 @@ Item {
FileDialog { FileDialog {
id: addExistingFileDialog id: addExistingFileDialog
visible: false visible: false
title: qsTr("Add a file") title: qsTr("Add a File")
selectFolder: false selectFolder: false
onAccepted: { onAccepted: {
var paths = addExistingFileDialog.fileUrls; var paths = addExistingFileDialog.fileUrls;

47
mix/qml/Splitter.qml

@ -0,0 +1,47 @@
import QtQuick 2.2
Rectangle {
property variant itemToStick;
property int itemMinimumWidth;
property string direction;
property variant brother;
Component.onCompleted:
{
if (direction === "left")
anchors.right = itemToStick.left;
else if (direction === "right")
anchors.left = itemToStick.right;
}
width: 5
height: parent.height
anchors.top: parent.top;
MouseArea
{
property int startX: 0;
anchors.fill: parent
onPressed: startX = mouseX;
onPositionChanged:
{
parent.x += mouseX;
var diff = 0;
if (direction == "left")
diff = mouseX - startX;
else if (direction == "right")
diff = -(mouseX - startX);
if (itemMinimumWidth > itemToStick.width - diff)
{
brother.width = brother.width + diff;
itemToStick.width = itemMinimumWidth;
}
else
{
brother.width = brother.width + diff;
itemToStick.width = itemToStick.width - diff;
}
}
cursorShape: Qt.SizeHorCursor
}
}

2
mix/qml/StateDialog.qml

@ -99,7 +99,7 @@ Window {
anchors.right: parent.right; anchors.right: parent.right;
Button { Button {
text: qsTr("Ok"); text: qsTr("OK");
onClicked: { onClicked: {
close(); close();
accepted(); accepted();

15
mix/qml/StatusPane.qml

@ -14,6 +14,7 @@ Rectangle {
status.state = ""; status.state = "";
status.text = qsTr("Compile without errors."); status.text = qsTr("Compile without errors.");
logslink.visible = false; logslink.visible = false;
debugImg.state = "active";
} }
else else
{ {
@ -21,6 +22,7 @@ Rectangle {
var errorInfo = ErrorLocationFormater.extractErrorInfo(statusPane.result.compilerMessage, true); var errorInfo = ErrorLocationFormater.extractErrorInfo(statusPane.result.compilerMessage, true);
status.text = errorInfo.errorLocation + " " + errorInfo.errorDetail; status.text = errorInfo.errorLocation + " " + errorInfo.errorDetail;
logslink.visible = true; logslink.visible = true;
debugImg.state = "";
} }
debugRunActionIcon.enabled = statusPane.result.successful; debugRunActionIcon.enabled = statusPane.result.successful;
} }
@ -65,7 +67,7 @@ Rectangle {
visible: false visible: false
font.pointSize: 9 font.pointSize: 9
height: 9 height: 9
text: qsTr("See log.") text: qsTr("See Log.")
font.family: "Monospace" font.family: "Monospace"
objectName: "status" objectName: "status"
id: logslink id: logslink
@ -96,16 +98,23 @@ Rectangle {
Button Button
{ {
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 7 anchors.rightMargin: 9
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
id: debugImg id: debugImg
iconSource: "qrc:/qml/img/bugiconinactive.png" iconSource: "qrc:/qml/img/bugiconinactive.png"
action: debugRunActionIcon action: debugRunActionIcon
states: [
State{
name: "active"
PropertyChanges { target: debugImg; iconSource: "qrc:/qml/img/bugiconactive.png"}
}
]
} }
Action { Action {
id: debugRunActionIcon id: debugRunActionIcon
onTriggered: { onTriggered: {
mainContent.ensureRightView(); mainContent.toggleRightView();
if (mainContent.rightViewVisible())
clientModel.debugDeployment(); clientModel.debugDeployment();
} }
enabled: false enabled: false

3
mix/qml/StepActionImage.qml

@ -8,6 +8,7 @@ Rectangle {
id: buttonActionContainer id: buttonActionContainer
property string disableStateImg property string disableStateImg
property string enabledStateImg property string enabledStateImg
property string buttonTooltip
signal clicked signal clicked
function enabled(state) function enabled(state)
@ -19,7 +20,6 @@ Rectangle {
debugImg.iconSource = disableStateImg; debugImg.iconSource = disableStateImg;
} }
color: "transparent"
Button Button
{ {
anchors.fill: parent anchors.fill: parent
@ -31,6 +31,7 @@ Rectangle {
} }
Action { Action {
tooltip: buttonTooltip
id: buttonAction id: buttonAction
onTriggered: { onTriggered: {
buttonActionContainer.clicked(); buttonActionContainer.clicked();

4
mix/qml/TransactionDialog.qml

@ -136,7 +136,7 @@ Window {
} }
Label { Label {
text: qsTr("Gas price") text: qsTr("Gas Price")
} }
Rectangle Rectangle
{ {
@ -183,7 +183,7 @@ Window {
anchors.right: parent.right; anchors.right: parent.right;
Button { Button {
text: qsTr("Ok"); text: qsTr("OK");
onClicked: { onClicked: {
close(); close();
accepted(); accepted();

10
mix/qml/WebPreview.qml

@ -27,10 +27,10 @@ Item {
} }
function updateContract() { function updateContract() {
var contractDefinition = codeModel.code.contractDefinition; var contractInterface = codeModel.code.contractInterface;
if (contractDefinition === "") if (contractInterface === "")
contractDefinition = "[]" contractInterface = "[]"
webView.runJavaScript("updateContract(\"" + clientModel.contractAddress + "\", " + contractDefinition + ")"); webView.runJavaScript("updateContract(\"" + clientModel.contractAddress + "\", " + contractInterface + ")");
} }
function reloadOnSave() { function reloadOnSave() {
@ -68,7 +68,7 @@ Item {
Connections { Connections {
target: codeModel target: codeModel
onContractDefinitionChanged: reload(); onContractInterfaceChanged: reload();
} }
Connections { Connections {

2
mix/qml/html/codeeditor.html

@ -12,5 +12,5 @@
<script src="cm/fullscreen.js"></script> <script src="cm/fullscreen.js"></script>
<script src="cm/active-line.js"></script> <script src="cm/active-line.js"></script>
<script src="cm/matchbrackets.js"></script> <script src="cm/matchbrackets.js"></script>
<body></body> <body oncontextmenu="return false;"></body>
<script src="codeeditor.js"></script> <script src="codeeditor.js"></script>

26
mix/qml/js/Debugger.js

@ -7,7 +7,7 @@ var currentSelectedState = null;
var jumpStartingPoint = null; var jumpStartingPoint = null;
function init() function init()
{ {
if (debugStates === undefined) if (typeof(debugStates) === "undefined")
return; return;
statesSlider.maximumValue = debugStates.length - 1; statesSlider.maximumValue = debugStates.length - 1;
@ -24,6 +24,9 @@ function init()
function moveSelection(incr) function moveSelection(incr)
{ {
if (typeof(debugStates) === "undefined")
return;
if (currentSelectedState + incr >= 0) if (currentSelectedState + incr >= 0)
{ {
if (currentSelectedState + incr < debugStates.length) if (currentSelectedState + incr < debugStates.length)
@ -34,6 +37,9 @@ function moveSelection(incr)
function select(stateIndex) function select(stateIndex)
{ {
if (typeof(debugStates) === "undefined")
return;
var codeLine = codeStr(stateIndex); var codeLine = codeStr(stateIndex);
var state = debugStates[stateIndex]; var state = debugStates[stateIndex];
highlightSelection(codeLine); highlightSelection(codeLine);
@ -53,6 +59,9 @@ function select(stateIndex)
function codeStr(stateIndex) function codeStr(stateIndex)
{ {
if (typeof(debugStates) === "undefined")
return;
var state = debugStates[stateIndex]; var state = debugStates[stateIndex];
return bytesCodeMapping.getValue(state.curPC); return bytesCodeMapping.getValue(state.curPC);
} }
@ -64,6 +73,9 @@ function highlightSelection(index)
function completeCtxInformation(state) function completeCtxInformation(state)
{ {
if (typeof(debugStates) === "undefined")
return;
currentStep.update(state.step); currentStep.update(state.step);
mem.update(state.newMemSize.value() + " " + qsTr("words")); mem.update(state.newMemSize.value() + " " + qsTr("words"));
stepCost.update(state.gasCost.value()); stepCost.update(state.gasCost.value());
@ -83,6 +95,9 @@ function displayReturnValue()
function stepOutBack() function stepOutBack()
{ {
if (typeof(debugStates) === "undefined")
return;
if (jumpStartingPoint != null) if (jumpStartingPoint != null)
{ {
select(jumpStartingPoint); select(jumpStartingPoint);
@ -99,6 +114,9 @@ function stepIntoBack()
function stepOverBack() function stepOverBack()
{ {
if (typeof(debugStates) === "undefined")
return;
var state = debugStates[currentSelectedState]; var state = debugStates[currentSelectedState];
if (state.instruction === "JUMPDEST") if (state.instruction === "JUMPDEST")
{ {
@ -118,6 +136,9 @@ function stepOverBack()
function stepOverForward() function stepOverForward()
{ {
if (typeof(debugStates) === "undefined")
return;
var state = debugStates[currentSelectedState]; var state = debugStates[currentSelectedState];
if (state.instruction === "JUMP") if (state.instruction === "JUMP")
{ {
@ -137,6 +158,9 @@ function stepOverForward()
function stepIntoForward() function stepIntoForward()
{ {
if (typeof(debugStates) === "undefined")
return;
var state = debugStates[currentSelectedState]; var state = debugStates[currentSelectedState];
if (state.instruction === "JUMP") if (state.instruction === "JUMP")
{ {

21
mix/qml/main.qml

@ -40,6 +40,7 @@ ApplicationWindow {
Menu { Menu {
title: qsTr("Windows") title: qsTr("Windows")
MenuItem { action: showHideRightPanel } MenuItem { action: showHideRightPanel }
MenuItem { action: toggleWebPreview }
} }
} }
@ -90,7 +91,7 @@ ApplicationWindow {
Action { Action {
id: toggleWebPreview id: toggleWebPreview
text: "Show/Hide web view" text: "Show Web View"
shortcut: "F2" shortcut: "F2"
checkable: true checkable: true
checked: mainContent.webViewVisible checked: mainContent.webViewVisible
@ -99,7 +100,7 @@ ApplicationWindow {
Action { Action {
id: showHideRightPanel id: showHideRightPanel
text: "Show right view" text: "Show Right View"
shortcut: "F7" shortcut: "F7"
checkable: true checkable: true
checked: mainContent.rightViewVisible checked: mainContent.rightViewVisible
@ -108,7 +109,7 @@ ApplicationWindow {
Action { Action {
id: createProjectAction id: createProjectAction
text: qsTr("&New project") text: qsTr("&New Project")
shortcut: "Ctrl+N" shortcut: "Ctrl+N"
enabled: true; enabled: true;
onTriggered: projectModel.createProject(); onTriggered: projectModel.createProject();
@ -116,7 +117,7 @@ ApplicationWindow {
Action { Action {
id: openProjectAction id: openProjectAction
text: qsTr("&Open project") text: qsTr("&Open Project")
shortcut: "Ctrl+O" shortcut: "Ctrl+O"
enabled: true; enabled: true;
onTriggered: projectModel.browseProject(); onTriggered: projectModel.browseProject();
@ -124,7 +125,7 @@ ApplicationWindow {
Action { Action {
id: addNewJsFileAction id: addNewJsFileAction
text: qsTr("New JavaScript file") text: qsTr("New JavaScript File")
shortcut: "Ctrl+Alt+J" shortcut: "Ctrl+Alt+J"
enabled: !projectModel.isEmpty enabled: !projectModel.isEmpty
onTriggered: projectModel.newJsFile(); onTriggered: projectModel.newJsFile();
@ -132,7 +133,7 @@ ApplicationWindow {
Action { Action {
id: addNewHtmlFileAction id: addNewHtmlFileAction
text: qsTr("New HTML file") text: qsTr("New HTML File")
shortcut: "Ctrl+Alt+H" shortcut: "Ctrl+Alt+H"
enabled: !projectModel.isEmpty enabled: !projectModel.isEmpty
onTriggered: projectModel.newHtmlFile(); onTriggered: projectModel.newHtmlFile();
@ -140,7 +141,7 @@ ApplicationWindow {
Action { Action {
id: addNewContractAction id: addNewContractAction
text: qsTr("New contract") text: qsTr("New Contract")
shortcut: "Ctrl+Alt+C" shortcut: "Ctrl+Alt+C"
enabled: !projectModel.isEmpty enabled: !projectModel.isEmpty
onTriggered: projectModel.newContract(); onTriggered: projectModel.newContract();
@ -148,7 +149,7 @@ ApplicationWindow {
Action { Action {
id: addExistingFileAction id: addExistingFileAction
text: qsTr("Add existing file") text: qsTr("Add Existing File")
shortcut: "Ctrl+Alt+A" shortcut: "Ctrl+Alt+A"
enabled: !projectModel.isEmpty enabled: !projectModel.isEmpty
onTriggered: projectModel.addExistingFile(); onTriggered: projectModel.addExistingFile();
@ -156,7 +157,7 @@ ApplicationWindow {
Action { Action {
id: saveAllFilesAction id: saveAllFilesAction
text: qsTr("Save all") text: qsTr("Save All")
shortcut: "Ctrl+S" shortcut: "Ctrl+S"
enabled: !projectModel.isEmpty enabled: !projectModel.isEmpty
onTriggered: projectModel.saveAll(); onTriggered: projectModel.saveAll();
@ -164,7 +165,7 @@ ApplicationWindow {
Action { Action {
id: closeProjectAction id: closeProjectAction
text: qsTr("Close project") text: qsTr("Close Project")
shortcut: "Ctrl+W" shortcut: "Ctrl+W"
enabled: !projectModel.isEmpty enabled: !projectModel.isEmpty
onTriggered: projectModel.closeProject(); onTriggered: projectModel.closeProject();

2
neth/main.cpp

@ -886,7 +886,7 @@ int main(int argc, char** argv)
auto b = bc.block(h); auto b = bc.block(h);
for (auto const& i: RLP(b)[1]) for (auto const& i: RLP(b)[1])
{ {
Transaction t(i.data()); Transaction t(i.data(), CheckSignature::Sender);
auto s = t.receiveAddress() ? auto s = t.receiveAddress() ?
boost::format(" %1% %2%> %3%: %4% [%5%]") % boost::format(" %1% %2%> %3%: %4% [%5%]") %
toString(t.safeSender()) % toString(t.safeSender()) %

Loading…
Cancel
Save