Browse Source

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

cl-refactor
Gav Wood 10 years ago
parent
commit
e0a4427685
  1. 12
      CodingStandards.txt
  2. 2
      alethzero/CMakeLists.txt
  3. 4
      alethzero/MainWin.cpp
  4. 4
      libethcore/EthashGPUMiner.cpp
  5. 11
      libethereum/Account.cpp
  6. 2
      libethereum/Client.h
  7. 1
      libethereum/ClientBase.h
  8. 2
      libethereum/Interface.h
  9. 38
      libweb3jsonrpc/WebThreeStubServerBase.cpp
  10. 1
      libweb3jsonrpc/WebThreeStubServerBase.h
  11. 7
      mix/CMakeLists.txt
  12. 39
      mix/ClientModel.cpp
  13. 8
      mix/FileIo.cpp
  14. 5
      mix/FileIo.h
  15. 1
      mix/MachineStates.h
  16. 3
      mix/MixApplication.cpp
  17. 34
      mix/MixClient.cpp
  18. 5
      mix/osx.qrc
  19. 1
      mix/qml.qrc
  20. 9
      mix/qml/Application.qml
  21. 298
      mix/qml/MacFileDialog.qml
  22. 2
      mix/qml/NewProjectDialog.qml
  23. 3
      mix/qml/PackagingStep.qml
  24. 5
      mix/qml/QFileDialog.qml
  25. 2
      mix/qml/StateDialog.qml
  26. 6
      mix/qml/WebPreview.qml
  27. 9
      mix/qml/html/cm/anyword-hint.js
  28. 2
      mix/qml/html/cm/inkpot.css
  29. 2
      mix/qml/html/cm/solidity.js
  30. 24
      mix/qml/html/cm/solidityToken.js
  31. 2
      mix/qml/js/TransactionHelper.js
  32. 13
      test/TestHelper.cpp
  33. 8
      test/libethereum/blockchain.cpp
  34. 13
      test/libethereum/state.cpp

12
CodingStandards.txt

@ -226,3 +226,15 @@ a. Includes should go in order of lower level (STL -> boost -> libdevcore -> lib
#include <libethereum/Defaults.h>
b. The only exception to the above rule is the top of a .cpp file where its corresponding header should be located.
13. Logging
Logging should be performed at appropriate verbosities depending on the logging message.
The more likely a message is to repeat (and thus cuase noise) the higher in verbosity it should be.
Some rules to keep in mind:
- Verbosity == 0 -> Reserved for important stuff that users must see and can understand.
- Verbosity == 1 -> Reserved for stuff that users don't need to see but can understand.
- Verbosity >= 2 -> Anything that is or might be displayed more than once every minute
- Verbosity >= 3 -> Anything that only a developer would understand
- Verbosity >= 4 -> Anything that is low-level (e.g. peer disconnects, timers being cancelled)

2
alethzero/CMakeLists.txt

@ -22,7 +22,7 @@ include_directories(${Boost_INCLUDE_DIRS})
find_package (Qt5WebEngine)
find_package (Qt5WebEngineWidgets)
if (APPLE)
if (APPLE AND (NOT "${Qt5Core_VERSION_STRING}" VERSION_LESS "5.5"))
# TODO: remove indirect dependencies once macdeployqt is fixed
find_package (Qt5WebEngineCore)
find_package (Qt5DBus)

4
alethzero/MainWin.cpp

@ -352,7 +352,7 @@ Addresses Main::allKnownAddresses() const
bool Main::confirm() const
{
return ui->natSpec->isChecked();
return true; //ui->natSpec->isChecked();
}
void Main::on_gasPrices_triggered()
@ -496,7 +496,7 @@ Address Main::getCurrencies() const
bool Main::doConfirm()
{
return ui->confirm->isChecked();
return true; //ui->confirm->isChecked();
}
void Main::installNameRegWatch()

4
libethcore/EthashGPUMiner.cpp

@ -213,9 +213,9 @@ bool EthashGPUMiner::configureGPU(
s_platformId = _platformId;
s_deviceId = _deviceId;
if (_localWorkSize != 32 && _localWorkSize != 64 && _localWorkSize != 128)
if (_localWorkSize != 32 && _localWorkSize != 64 && _localWorkSize != 128 && _localWorkSize != 256)
{
cout << "Given localWorkSize of " << toString(_localWorkSize) << "is invalid. Must be either 32,64, or 128" << endl;
cout << "Given localWorkSize of " << toString(_localWorkSize) << "is invalid. Must be either 32,64,128 or 256" << endl;
return false;
}

11
libethereum/Account.cpp

@ -20,6 +20,7 @@
*/
#include "Account.h"
#include <liblll/Compiler.h>
#include <test/JsonSpiritHeaders.h>
#include <libethcore/Common.h>
using namespace std;
@ -63,7 +64,15 @@ AccountMap dev::eth::jsonToAccountMap(std::string const& _json, AccountMaskMap*
if (haveCode)
{
ret[a] = Account(balance, Account::ContractConception);
ret[a].setCode(fromHex(o["code"].get_str()));
if (o["code"].type() == json_spirit::str_type)
{
if (o["code"].get_str().find("0x") != 0)
ret[a].setCode(compileLLL(o["code"].get_str(), false));
else
ret[a].setCode(fromHex(o["code"].get_str().substr(2)));
}
else
cerr << "Error importing code of account " << a << "! Code field needs to be a string";
}
else
ret[a] = Account(balance, Account::NormalCreation);

2
libethereum/Client.h

@ -98,6 +98,8 @@ public:
/// Get the remaining gas limit in this block.
virtual u256 gasLimitRemaining() const override { return m_postMine.gasLimitRemaining(); }
/// Get the gas bid price
virtual u256 gasBidPrice() const override { return m_gp->bid(); }
// [PRIVATE API - only relevant for base clients, not available in general]
/// Get the block.

1
libethereum/ClientBase.h

@ -148,6 +148,7 @@ public:
using Interface::addresses;
virtual Addresses addresses(BlockNumber _block) const override;
virtual u256 gasLimitRemaining() const override;
virtual u256 gasBidPrice() const override { return c_defaultGasPrice; }
/// Get the coinbase address
virtual Address address() const override;

2
libethereum/Interface.h

@ -190,6 +190,8 @@ public:
/// Get the remaining gas limit in this block.
virtual u256 gasLimitRemaining() const = 0;
// Get the gas bidding price
virtual u256 gasBidPrice() const = 0;
// [MINING API]:

38
libweb3jsonrpc/WebThreeStubServerBase.cpp

@ -239,19 +239,22 @@ string WebThreeStubServerBase::eth_getCode(string const& _address, string const&
}
}
void WebThreeStubServerBase::setTransactionDefaults(TransactionSkeleton & _t)
{
if (!_t.from)
_t.from = m_ethAccounts->defaultTransactAccount();
if (_t.gasPrice == UndefinedU256)
_t.gasPrice = client()->gasBidPrice();
if (_t.gas == UndefinedU256)
_t.gas = min<u256>(client()->gasLimitRemaining() / 5, client()->balanceAt(_t.from) / _t.gasPrice);
}
string WebThreeStubServerBase::eth_sendTransaction(Json::Value const& _json)
{
try
{
TransactionSkeleton t = toTransactionSkeleton(_json);
if (!t.from)
t.from = m_ethAccounts->defaultTransactAccount();
if (t.gasPrice == UndefinedU256)
t.gasPrice = 10 * dev::eth::szabo; // TODO: should be determined by user somehow.
if (t.gas == UndefinedU256)
t.gas = min<u256>(client()->gasLimitRemaining() / 5, client()->balanceAt(t.from) / t.gasPrice);
setTransactionDefaults(t);
return toJS(m_ethAccounts->authenticate(t));
}
catch (...)
@ -265,14 +268,7 @@ string WebThreeStubServerBase::eth_signTransaction(Json::Value const& _json)
try
{
TransactionSkeleton t = toTransactionSkeleton(_json);
if (!t.from)
t.from = m_ethAccounts->defaultTransactAccount();
if (t.gasPrice == UndefinedU256)
t.gasPrice = 10 * dev::eth::szabo; // TODO: should be determined by user somehow.
if (t.gas == UndefinedU256)
t.gas = min<u256>(client()->gasLimitRemaining() / 5, client()->balanceAt(t.from) / t.gasPrice);
setTransactionDefaults(t);
m_ethAccounts->authenticate(t);
return toJS((t.creation ? Transaction(t.value, t.gasPrice, t.gas, t.data) : Transaction(t.value, t.gasPrice, t.gas, t.to, t.data)).sha3(WithoutSignature));
@ -312,15 +308,7 @@ string WebThreeStubServerBase::eth_call(Json::Value const& _json, string const&
try
{
TransactionSkeleton t = toTransactionSkeleton(_json);
if (!t.from)
t.from = m_ethAccounts->defaultTransactAccount();
// if (!m_accounts->isRealAccount(t.from))
// return ret;
if (t.gasPrice == UndefinedU256)
t.gasPrice = 10 * dev::eth::szabo;
if (t.gas == UndefinedU256)
t.gas = client()->gasLimitRemaining();
setTransactionDefaults(t);
return toJS(client()->call(t.from, t.value, t.to, t.data, t.gas, t.gasPrice, jsToBlockNumber(_blockNumber), FudgeFactor::Lenient).output);
}
catch (...)

1
libweb3jsonrpc/WebThreeStubServerBase.h

@ -193,6 +193,7 @@ public:
protected:
void requires(std::string const& _session, Privilege _l) const { if (!hasPrivilegeLevel(_session, _l)) throw jsonrpc::JsonRpcException("Invalid privileges"); }
void setTransactionDefaults(eth::TransactionSkeleton & _t);
virtual bool hasPrivilegeLevel(std::string const& _session, Privilege _l) const { (void)_session; (void)_l; return false; }
virtual dev::eth::Interface* client() = 0;

7
mix/CMakeLists.txt

@ -20,6 +20,11 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") AND NOT (CMAKE_CXX_COMPILER_VER
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override")
endif ()
#TODO: remove once qt 5.5.1 is out
if (APPLE)
qt5_add_resources(UI_RESOURCES osx.qrc)
endif()
find_package (Qt5WebEngine)
if (APPLE AND (NOT "${Qt5Core_VERSION_STRING}" VERSION_LESS "5.5"))
# TODO: remove indirect dependencies once macdeployqt is fixed
@ -56,7 +61,7 @@ if (${ETH_HAVE_WEBENGINE})
add_definitions(-DETH_HAVE_WEBENGINE)
list(APPEND LIBRARIES "Qt5::WebEngine")
endif()
if (APPLE)
if (APPLE AND (NOT "${Qt5Core_VERSION_STRING}" VERSION_LESS "5.5"))
list(APPEND LIBRARIES "Qt5::WebEngineCore")
list(APPEND LIBRARIES "Qt5::DBus")
list(APPEND LIBRARIES "Qt5::PrintSupport")

39
mix/ClientModel.cpp

@ -449,6 +449,9 @@ void ClientModel::executeSequence(vector<TransactionSettings> const& _sequence)
}
m_gasCosts.append(m_client->lastExecution().gasUsed);
onNewTransaction();
TransactionException exception = m_client->lastExecution().excepted;
if (exception != TransactionException::None)
break;
}
emit runComplete();
}
@ -764,6 +767,42 @@ void ClientModel::onStateReset()
void ClientModel::onNewTransaction()
{
ExecutionResult const& tr = m_client->lastExecution();
switch (tr.excepted)
{
case TransactionException::None:
break;
case TransactionException::NotEnoughCash:
emit runFailed("Insufficient balance for contract deployment");
break;
case TransactionException::OutOfGasIntrinsic:
case TransactionException::OutOfGasBase:
case TransactionException::OutOfGas:
emit runFailed("Not enough gas");
break;
case TransactionException::BlockGasLimitReached:
emit runFailed("Block gas limit reached");
break;
case TransactionException::BadJumpDestination:
emit runFailed("Solidity exception (bad jump)");
break;
case TransactionException::OutOfStack:
emit runFailed("Out of stack");
break;
case TransactionException::StackUnderflow:
emit runFailed("Stack underflow");
//these should not happen in mix
case TransactionException::Unknown:
case TransactionException::BadInstruction:
case TransactionException::InvalidSignature:
case TransactionException::InvalidNonce:
case TransactionException::InvalidFormat:
case TransactionException::BadRLP:
emit runFailed("Internal execution error");
break;
}
unsigned block = m_client->number() + 1;
unsigned recordIndex = tr.executonIndex;
QString transactionIndex = tr.isCall() ? QObject::tr("Call") : QString("%1:%2").arg(block).arg(tr.transactionIndex);

8
mix/FileIo.cpp

@ -224,3 +224,11 @@ void FileIo::deleteFile(QString const& _path)
QFile file(pathFromUrl(_path));
file.remove();
}
QUrl FileIo::pathFolder(QString const& _path)
{
QFileInfo info(_path);
if (info.exists() && info.isDir())
return QUrl::fromLocalFile(_path);
return QUrl::fromLocalFile(QFileInfo(_path).absolutePath());
}

5
mix/FileIo.h

@ -71,6 +71,11 @@ public:
/// delete a directory
Q_INVOKABLE void deleteDir(QString const& _url);
//TODO: remove once qt 5.5.1 is out
Q_INVOKABLE QString urlToPath(QUrl const& _url) { return _url.toLocalFile(); }
Q_INVOKABLE QUrl pathToUrl(QString const& _path) { return QUrl::fromLocalFile(_path); }
Q_INVOKABLE QUrl pathFolder(QString const& _path);
private:
QString getHomePath() const;
QString pathFromUrl(QString const& _url);

1
mix/MachineStates.h

@ -85,6 +85,7 @@ struct ExecutionResult
unsigned executonIndex = 0;
bytes inputParameters;
eth::LocalisedLogEntries logs;
eth::TransactionException excepted = eth::TransactionException::Unknown;
bool isCall() const { return transactionIndex == std::numeric_limits<unsigned>::max(); }
bool isConstructor() const { return !isCall() && !address; }

3
mix/MixApplication.cpp

@ -41,6 +41,9 @@
extern int qInitResources_js();
using namespace dev::mix;
ApplicationService::ApplicationService()
{
#ifdef ETH_HAVE_WEBENGINE

34
mix/MixClient.cpp

@ -199,35 +199,8 @@ ExecutionResult MixClient::debugTransaction(Transaction const& _t, State const&
execution.go(onOp);
execution.finalize();
switch (er.excepted)
{
case TransactionException::None:
break;
case TransactionException::NotEnoughCash:
BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("Insufficient balance for contract deployment"));
case TransactionException::OutOfGasIntrinsic:
case TransactionException::OutOfGasBase:
case TransactionException::OutOfGas:
BOOST_THROW_EXCEPTION(OutOfGas() << errinfo_comment("Not enough gas"));
case TransactionException::BlockGasLimitReached:
BOOST_THROW_EXCEPTION(OutOfGas() << errinfo_comment("Block gas limit reached"));
case TransactionException::BadJumpDestination:
BOOST_THROW_EXCEPTION(OutOfGas() << errinfo_comment("Solidity exception (bad jump)"));
case TransactionException::OutOfStack:
BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("Out of stack"));
case TransactionException::StackUnderflow:
BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("Stack underflow"));
//these should not happen in mix
case TransactionException::Unknown:
case TransactionException::BadInstruction:
case TransactionException::InvalidSignature:
case TransactionException::InvalidNonce:
case TransactionException::InvalidFormat:
case TransactionException::BadRLP:
BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("Internal execution error"));
}
ExecutionResult d;
d.excepted = er.excepted;
d.inputParameters = _t.data();
d.result = er;
d.machineStates = machineStates;
@ -257,7 +230,8 @@ void MixClient::executeTransaction(Transaction const& _t, Block& _block, bool _c
// execute on a state
if (!_call)
{
t = _gasAuto ? replaceGas(_t, d.gasUsed, _secret) : _t;
u256 useGas = min(d.gasUsed, _block.gasLimitRemaining());
t = _gasAuto ? replaceGas(_t, useGas, _secret) : _t;
eth::ExecutionResult const& er = _block.execute(envInfo.lastHashes(), t);
if (t.isCreation() && _block.state().code(d.contractAddress).empty())
BOOST_THROW_EXCEPTION(OutOfGas() << errinfo_comment("Not enough gas for contract deployment"));
@ -284,7 +258,7 @@ void MixClient::mine()
RLPStream header;
h.streamRLP(header);
m_postMine.sealBlock(header.out());
bc().import(m_postMine.blockData(), m_stateDB, ImportRequirements::Everything & ~ImportRequirements::ValidSeal);
bc().import(m_postMine.blockData(), m_stateDB, (ImportRequirements::Everything & ~ImportRequirements::ValidSeal) != 0);
m_postMine.sync(bc());
m_preMine = m_postMine;
}

5
mix/osx.qrc

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file alias="qml/QFileDialog.qml">qml/MacFileDialog.qml</file>
</qresource>
</RCC>

1
mix/qml.qrc

@ -34,6 +34,7 @@
<file>qml/QStringTypeView.qml</file>
<file>qml/QVariableDeclaration.qml</file>
<file>qml/QVariableDefinition.qml</file>
<file>qml/QFileDialog.qml</file>
<file>qml/SourceSansProBold.qml</file>
<file>qml/SourceSansProLight.qml</file>
<file>qml/SourceSansProRegular.qml</file>

9
mix/qml/Application.qml

@ -217,6 +217,7 @@ ApplicationWindow {
shortcut: "Ctrl+Alt+V"
onTriggered: mainContent.debuggerPanel.assemblyMode = !mainContent.debuggerPanel.assemblyMode;
checked: mainContent.debuggerPanel.assemblyMode;
checkable: true
enabled: true
}
@ -281,11 +282,12 @@ ApplicationWindow {
onTriggered: openProjectFileDialog.open()
}
FileDialog {
QFileDialog {
id: openProjectFileDialog
visible: false
title: qsTr("Open a Project")
selectFolder: true
selectExisting: true
onAccepted: {
var path = openProjectFileDialog.fileUrl.toString();
path += "/";
@ -333,11 +335,12 @@ ApplicationWindow {
onTriggered: addExistingFileDialog.open()
}
FileDialog {
QFileDialog {
id: addExistingFileDialog
visible: false
title: qsTr("Add a File")
selectFolder: false
selectExisting: true
onAccepted: {
var paths = addExistingFileDialog.fileUrls;
projectModel.addExistingFiles(paths);
@ -427,7 +430,9 @@ ApplicationWindow {
}
Settings {
id: appSettings
property alias gasEstimation: gasEstimationAction.checked
property alias optimizeCode: optimizeCodeAction.checked
property string nodeAddress: "http://localhost:8545"
}
}

298
mix/qml/MacFileDialog.qml

@ -0,0 +1,298 @@
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Private 1.0 as ControlsPrivate
import QtQuick.Dialogs 1.2
import QtQuick.Dialogs.Private 1.1
import QtQuick.Layouts 1.1
import QtQuick.Window 2.1
import Qt.labs.folderlistmodel 2.1
import Qt.labs.settings 1.0
AbstractDialog {
id: root
property string folder: view.model.folder
property var nameFilters: []
property bool selectFolder: false
property bool selectExisting: true
property int selectedNameFilterIndex: -1
property var selectedNameFilterExtensions: []
property string selection: ""
property alias fileUrl: root.selection
function selectNameFilter(text) {
}
function clearSelection(text) {
selection = "";
}
function addSelection(text) {
selection = text;
}
onVisibleChanged: {
if (visible) {
view.needsWidthAdjustment = true
view.selection.clear()
view.focus = true
}
}
Component.onCompleted: {
folder = fileIo.pathToUrl(fileIo.homePath);
view.model.nameFilters = root.selectedNameFilterExtensions
filterField.currentIndex = root.selectedNameFilterIndex
root.favoriteFolders = settings.favoriteFolders
}
Component.onDestruction: {
settings.favoriteFolders = root.favoriteFolders
}
property Settings settings: Settings {
category: "QQControlsFileDialog"
property alias width: root.width
property alias height: root.height
property variant favoriteFolders: []
}
property bool showFocusHighlight: false
property SystemPalette palette: SystemPalette { }
property var favoriteFolders: []
function dirDown(path) {
view.selection.clear()
root.folder = "file://" + path
}
function dirUp() {
view.selection.clear()
if (view.model.parentFolder != "")
root.folder = view.model.parentFolder
}
function acceptSelection() {
// transfer the view's selections to QQuickFileDialog
clearSelection()
if (selectFolder && view.selection.count === 0)
addSelection(folder)
else {
view.selection.forEach(function(idx) {
if (view.model.isFolder(idx)) {
if (selectFolder)
addSelection(view.model.get(idx, "fileURL"))
} else {
if (!selectFolder)
addSelection(view.model.get(idx, "fileURL"))
}
})
}
accept()
}
property Action dirUpAction: Action {
text: "\ue810"
shortcut: "Ctrl+U"
onTriggered: dirUp()
tooltip: qsTr("Go up to the folder containing this one")
}
Rectangle {
id: window
implicitWidth: Math.min(root.__maximumDimension, Math.max(Screen.pixelDensity * 100, view.implicitWidth))
implicitHeight: Math.min(root.__maximumDimension, Screen.pixelDensity * 80)
color: root.palette.window
Binding {
target: view.model
property: "folder"
value: root.folder
}
Binding {
target: currentPathField
property: "text"
value: fileIo.urlToPath(root.folder)
}
Keys.onPressed: {
event.accepted = true
switch (event.key) {
case Qt.Key_Back:
case Qt.Key_Escape:
reject()
break
default:
event.accepted = false
break
}
}
Keys.forwardTo: [view.flickableItem]
TableView {
id: view
sortIndicatorVisible: true
width: parent.width
anchors.top: titleBar.bottom
anchors.bottom: bottomBar.top
property bool needsWidthAdjustment: true
selectionMode: root.selectMultiple ?
(ControlsPrivate.Settings.hasTouchScreen ? SelectionMode.MultiSelection : SelectionMode.ExtendedSelection) :
SelectionMode.SingleSelection
onRowCountChanged: if (needsWidthAdjustment && rowCount > 0) {
resizeColumnsToContents()
needsWidthAdjustment = false
}
model: FolderListModel {
showFiles: !root.selectFolder
nameFilters: root.selectedNameFilterExtensions
sortField: (view.sortIndicatorColumn === 0 ? FolderListModel.Name :
(view.sortIndicatorColumn === 1 ? FolderListModel.Type :
(view.sortIndicatorColumn === 2 ? FolderListModel.Size : FolderListModel.LastModified)))
sortReversed: view.sortIndicatorOrder === Qt.DescendingOrder
}
onActivated: if (view.focus) {
if (view.selection.count > 0 && view.model.isFolder(row)) {
dirDown(view.model.get(row, "filePath"))
} else {
root.acceptSelection()
}
}
onClicked: currentPathField.text = view.model.get(row, "filePath")
TableViewColumn {
id: fileNameColumn
role: "fileName"
title: qsTr("Filename")
delegate: Item {
implicitWidth: pathText.implicitWidth + pathText.anchors.leftMargin + pathText.anchors.rightMargin
Text {
id: fileIcon
width: height
verticalAlignment: Text.AlignVCenter
font.family: iconFont.name
property alias unicode: fileIcon.text
FontLoader { id: iconFont; source: "qrc:/QtQuick/Dialogs/qml/icons.ttf"; onNameChanged: console.log("custom font" + name) }
x: 4
height: parent.height - 2
unicode: view.model.isFolder(styleData.row) ? "\ue804" : "\ue802"
}
Text {
id: pathText
text: styleData.value
anchors {
left: parent.left
right: parent.right
leftMargin: 36 + 6
rightMargin: 4
verticalCenter: parent.verticalCenter
}
color: styleData.textColor
elide: Text.ElideRight
renderType: ControlsPrivate.Settings.isMobile ? Text.QtRendering : Text.NativeRendering
}
}
}
TableViewColumn {
role: "fileSuffix"
title: qsTr("Type", "file type (extension)")
// TODO should not need to create a whole new component just to customize the text value
// something like textFormat: function(text) { return view.model.get(styleData.row, "fileIsDir") ? "folder" : text }
delegate: Item {
implicitWidth: sizeText.implicitWidth + sizeText.anchors.leftMargin + sizeText.anchors.rightMargin
Text {
id: sizeText
text: view.model.get(styleData.row, "fileIsDir") ? "folder" : styleData.value
anchors {
left: parent.left
right: parent.right
leftMargin: 4
rightMargin: 4
verticalCenter: parent.verticalCenter
}
color: styleData.textColor
elide: Text.ElideRight
renderType: ControlsPrivate.Settings.isMobile ? Text.QtRendering : Text.NativeRendering
}
}
}
TableViewColumn {
role: "fileSize"
title: qsTr("Size", "file size")
horizontalAlignment: Text.AlignRight
}
TableViewColumn { id: modifiedColumn; role: "fileModified" ; title: qsTr("Modified", "last-modified time") }
TableViewColumn { id: accessedColumn; role: "fileAccessed" ; title: qsTr("Accessed", "last-accessed time") }
}
ToolBar {
id: titleBar
RowLayout {
anchors.fill: parent
ToolButton {
action: dirUpAction
//style: IconButtonStyle { }
Layout.maximumWidth: height * 1.5
}
TextField {
id: currentPathField
Layout.fillWidth: true
function doAccept() {
root.clearSelection()
if (root.addSelection(fileIo.pathToUrl(text)))
root.accept()
else
root.folder = fileIo.pathFolder(text)
}
onAccepted: doAccept()
}
}
}
Item {
id: bottomBar
width: parent.width
height: buttonRow.height + buttonRow.spacing * 2
anchors.bottom: parent.bottom
Row {
id: buttonRow
anchors.right: parent.right
anchors.rightMargin: spacing
anchors.verticalCenter: parent.verticalCenter
spacing: 4
ComboBox {
id: filterField
model: root.nameFilters
visible: !selectFolder
width: bottomBar.width - cancelButton.width - okButton.width - parent.spacing * 6
anchors.verticalCenter: parent.verticalCenter
onCurrentTextChanged: {
root.selectNameFilter(currentText)
view.model.nameFilters = root.selectedNameFilterExtensions
}
}
Button {
id: cancelButton
text: qsTr("Cancel")
onClicked: root.reject()
}
Button {
id: okButton
text: root.selectFolder ? qsTr("Choose") : (selectExisting ? qsTr("Open") : qsTr("Save"))
onClicked: {
if (view.model.isFolder(view.currentIndex) && !selectFolder)
dirDown(view.model.get(view.currentIndex, "filePath"))
else if (!(root.selectExisting))
currentPathField.doAccept()
else
root.acceptSelection()
}
}
}
}
}
}

2
mix/qml/NewProjectDialog.qml

@ -105,7 +105,7 @@ Item
}
FileDialog {
QFileDialog {
id: createProjectFileDialog
visible: false
title: qsTr("Please choose a path for the project")

3
mix/qml/PackagingStep.qml

@ -27,11 +27,12 @@ Rectangle {
visible = true
}
FileDialog {
QFileDialog {
id: ressourcesFolder
visible: false
title: qsTr("Please choose a path")
selectFolder: true
selectExisting: true
property variant target
onAccepted: {
var u = ressourcesFolder.fileUrl.toString();

5
mix/qml/QFileDialog.qml

@ -0,0 +1,5 @@
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Dialogs 1.2
FileDialog { }

2
mix/qml/StateDialog.qml

@ -124,7 +124,7 @@ Dialog {
importJsonFileDialog.open()
}
}
FileDialog {
QFileDialog {
id: importJsonFileDialog
visible: false
title: qsTr("Select State File")

6
mix/qml/WebPreview.qml

@ -94,6 +94,11 @@ Item {
onContractInterfaceChanged: reload();
}
Connections {
target: clientModel
onRunComplete: reload();
}
Connections {
target: projectModel
@ -313,7 +318,6 @@ Item {
width: parent.width
Layout.preferredWidth: parent.width
id: webView
experimental.settings.localContentCanAccessRemoteUrls: true
onJavaScriptConsoleMessage: {
console.log(sourceID + ":" + lineNumber + ": " + message);
webPreview.javaScriptMessage(level, sourceID, lineNumber - 1, message);

9
mix/qml/html/cm/anyword-hint.js

@ -24,6 +24,15 @@
list = addSolToken(curWord, list, seen, solMisc(), solMisc);
}
//TODO: tokenize properly
if (curLine.slice(start - 6, start) === "block.")
list = addSolToken(curWord, list, seen, solBlock(), solBlock);
else if (curLine.slice(start - 4, start) === "msg.")
list = addSolToken(curWord, list, seen, solMsg(), solMsg);
else if (curLine.slice(start - 3, start) === "tx.")
list = addSolToken(curWord, list, seen, solTx(), solTx);
var previousWord = "";
var re = new RegExp(word.source, "g");
for (var dir = -1; dir <= 1; dir += 2) {

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

@ -21,7 +21,7 @@ https://github.com/ciaranm/inkpot
.cm-s-inkpot span.cm-comment { color: #cd8b00; }
.cm-s-inkpot span.cm-def { color: #cfbfad; font-weight:bold; }
.cm-s-inkpot span.cm-keyword { color: #808bed; }
.cm-s-inkpot span.cm-builtin { color: #cfbfad; }
.cm-s-inkpot span.cm-builtin { color: #efac6d; }
.cm-s-inkpot span.cm-variable { color: #cfbfad; }
.cm-s-inkpot span.cm-string { color: #ffcd8b; }
.cm-s-inkpot span.cm-number { color: #f0ad6d; }

2
mix/qml/html/cm/solidity.js

@ -16,6 +16,7 @@ CodeMirror.defineMode("solidity", function(config) {
var stdContract = solStdContract();
var keywords = solKeywords();
var atoms = solMisc();
var builtins = solBuiltIn();
var isOperatorChar = /[+\-*&^%:=<>!|\/]/;
@ -64,6 +65,7 @@ CodeMirror.defineMode("solidity", function(config) {
if (atoms.propertyIsEnumerable(cur)) return "atom";
if (types.propertyIsEnumerable(cur)) return "variable-2";
if (stdContract.propertyIsEnumerable(cur)) return "variable-3";
if (builtins.propertyIsEnumerable(cur)) return "builtin";
return "variable";
}

24
mix/qml/html/cm/solidityToken.js

@ -28,6 +28,26 @@ function solMisc()
return { "true": true, "false": true, "null": true };
}
function solBuiltIn()
{
return { "msg": true, "tx": true, "block": true, "now": true };
}
function solBlock()
{
return { "coinbase": true, "difficulty": true, "gaslimit": true, "number": true, "blockhash": true, "timestamp":true };
}
function solMsg()
{
return { "data": true, "gas": true, "sender": true, "sig": true, "value": true };
}
function solTx()
{
return { "gasprice": true, "origin": true }
}
function keywordsName()
{
var keywords = {};
@ -37,5 +57,9 @@ function keywordsName()
keywords[solTime.name.toLowerCase()] = "Time";
keywords[solTypes.name.toLowerCase()] = "Type";
keywords[solMisc.name.toLowerCase()] = "Misc";
keywords[solBuiltIn.name.toLowerCase()] = "BuiltIn";
keywords[solBlock.name.toLowerCase()] = "Block";
keywords[solMsg.name.toLowerCase()] = "Message";
keywords[solTx.name.toLowerCase()] = "Transaction";
return keywords;
}

2
mix/qml/js/TransactionHelper.js

@ -19,7 +19,7 @@ function defaultTransaction()
function rpcCall(requests, callBack, error)
{
var jsonRpcUrl = "http://localhost:8545";
var jsonRpcUrl = appSettings.nodeAddress;
var rpcRequest = JSON.stringify(requests);
console.log(rpcRequest);
var httpRequest = new XMLHttpRequest();

13
test/TestHelper.cpp

@ -121,10 +121,21 @@ bytes ImportTest::executeTest()
{
ExecutionResult res;
eth::State tmpState = m_statePre;
try
{
std::pair<ExecutionResult, TransactionReceipt> execOut = m_statePre.execute(m_envInfo, m_transaction);
res = execOut.first;
m_logs = execOut.second.log();
}
catch (Exception const& _e)
{
cnote << "Exception: " << diagnostic_information(_e);
}
catch (std::exception const& _e)
{
cnote << "state execution exception: " << _e.what();
}
m_statePre.commit();
m_statePost = m_statePre;
m_statePre = tmpState;

8
test/libethereum/blockchain.cpp

@ -51,14 +51,6 @@ void overwriteBlockHeader(BlockHeader& _current_BlockHeader, mObject& _blObj, co
void updatePoW(BlockHeader& _bi);
mArray importUncles(mObject const& _blObj, vector<BlockHeader>& _vBiUncles, vector<BlockHeader> const& _vBiBlocks, std::vector<blockSet> _blockSet);
//void doBlockchainTests(json_spirit::mValue& _v, bool _fillin)
//{
// if (_fillin == false)
// _v.get_bool();
// cerr << "BlockChainTests not implemented!" << endl;
//}
void doBlockchainTests(json_spirit::mValue& _v, bool _fillin)
{
for (auto& i: _v.get_obj())

13
test/libethereum/state.cpp

@ -59,20 +59,9 @@ void doStateTests(json_spirit::mValue& v, bool _fillin)
const State importedStatePost = importer.m_statePost;
bytes output;
try
{
// execute transaction
Listener::ExecTimeGuard guard{i.first};
output = importer.executeTest();
}
catch (Exception const& _e)
{
cnote << "Exception: " << diagnostic_information(_e);
//theState.commit();
}
catch (std::exception const& _e)
{
cnote << "state execution exception: " << _e.what();
}
if (_fillin)
{

Loading…
Cancel
Save