diff --git a/alethzero/CMakeLists.txt b/alethzero/CMakeLists.txt index b58446935..8f355def7 100644 --- a/alethzero/CMakeLists.txt +++ b/alethzero/CMakeLists.txt @@ -40,9 +40,6 @@ target_link_libraries(${EXECUTABLE} evm) target_link_libraries(${EXECUTABLE} ethcore) target_link_libraries(${EXECUTABLE} devcrypto) target_link_libraries(${EXECUTABLE} secp256k1) -if (NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")) -target_link_libraries(${EXECUTABLE} serpent) -endif() target_link_libraries(${EXECUTABLE} lll) target_link_libraries(${EXECUTABLE} solidity) target_link_libraries(${EXECUTABLE} evmcore) @@ -51,6 +48,10 @@ target_link_libraries(${EXECUTABLE} web3jsonrpc) target_link_libraries(${EXECUTABLE} jsqrc) target_link_libraries(${EXECUTABLE} natspec) +if (NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")) + target_link_libraries(${EXECUTABLE} serpent) +endif() + # eth_install_executable is defined in cmake/EthExecutableHelper.cmake eth_install_executable(${EXECUTABLE}) diff --git a/eth/CMakeLists.txt b/eth/CMakeLists.txt index c98f3cbec..31aa8df96 100644 --- a/eth/CMakeLists.txt +++ b/eth/CMakeLists.txt @@ -16,7 +16,6 @@ add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) add_dependencies(${EXECUTABLE} BuildInfo.h) target_link_libraries(${EXECUTABLE} ${Boost_REGEX_LIBRARIES}) -target_link_libraries(${EXECUTABLE} ${Boost_DATE_TIME_LIBRARIES}) if (READLINE_FOUND) target_link_libraries(${EXECUTABLE} ${READLINE_LIBRARIES}) diff --git a/libdevcore/CMakeLists.txt b/libdevcore/CMakeLists.txt index 51caee3d3..40aa7ce24 100644 --- a/libdevcore/CMakeLists.txt +++ b/libdevcore/CMakeLists.txt @@ -26,9 +26,14 @@ else() endif() target_link_libraries(${EXECUTABLE} ${Boost_THREAD_LIBRARIES}) -#target_link_libraries(${EXECUTABLE} ${Boost_DATE_TIME_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${Boost_SYSTEM_LIBRARIES}) +# transitive dependencies for windows executables +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + target_link_libraries(${EXECUTABLE} ${Boost_CHRONO_LIBRARIES}) + target_link_libraries(${EXECUTABLE} ${Boost_DATE_TIME_LIBRARIES}) +endif() + if (APPLE) find_package(Threads REQUIRED) target_link_libraries(${EXECUTABLE} ${CMAKE_THREAD_LIBS_INIT}) diff --git a/libdevcore/CommonIO.h b/libdevcore/CommonIO.h index d2a67921b..23092b702 100644 --- a/libdevcore/CommonIO.h +++ b/libdevcore/CommonIO.h @@ -57,7 +57,7 @@ template struct StreamOut { static S& bypass(S& _out, T const template struct StreamOut { static S& bypass(S& _out, uint8_t const& _t) { _out << (int)_t; return _out; } }; template inline std::ostream& operator<<(std::ostream& _out, std::vector const& _e); -template inline std::ostream& operator<<(std::ostream& _out, std::array const& _e); +template inline std::ostream& operator<<(std::ostream& _out, std::array const& _e); template inline std::ostream& operator<<(std::ostream& _out, std::pair const& _e); template inline std::ostream& operator<<(std::ostream& _out, std::list const& _e); template inline std::ostream& operator<<(std::ostream& _out, std::tuple const& _e); @@ -84,7 +84,7 @@ inline S& streamout(S& _out, std::vector const& _e) template inline std::ostream& operator<<(std::ostream& _out, std::vector const& _e) { streamout(_out, _e); return _out; } -template +template inline S& streamout(S& _out, std::array const& _e) { _out << "["; @@ -98,23 +98,7 @@ inline S& streamout(S& _out, std::array const& _e) _out << "]"; return _out; } -template inline std::ostream& operator<<(std::ostream& _out, std::array const& _e) { streamout(_out, _e); return _out; } - -template -inline S& streamout(S& _out, std::array const& _e) -{ - _out << "["; - if (!_e.empty()) - { - StreamOut::bypass(_out, _e.front()); - auto i = _e.begin(); - for (++i; i != _e.end(); ++i) - StreamOut::bypass(_out << ",", *i); - } - _out << "]"; - return _out; -} -template inline std::ostream& operator<<(std::ostream& _out, std::array const& _e) { streamout(_out, _e); return _out; } +template inline std::ostream& operator<<(std::ostream& _out, std::array const& _e) { streamout(_out, _e); return _out; } template inline S& streamout(S& _out, std::list const& _e) diff --git a/libethereum/State.cpp b/libethereum/State.cpp index e44b81c83..beab32abb 100644 --- a/libethereum/State.cpp +++ b/libethereum/State.cpp @@ -370,7 +370,7 @@ void State::resetCurrent() m_cache.clear(); m_currentBlock = BlockInfo(); m_currentBlock.coinbaseAddress = m_ourAddress; - m_currentBlock.timestamp = time(0); + m_currentBlock.timestamp = max(m_previousBlock.timestamp + 1, (u256)time(0)); m_currentBlock.transactionsRoot = h256(); m_currentBlock.sha3Uncles = h256(); m_currentBlock.populateFromParent(m_previousBlock); diff --git a/libsolidity/CompilerContext.cpp b/libsolidity/CompilerContext.cpp index 52910a556..01a71d7c9 100644 --- a/libsolidity/CompilerContext.cpp +++ b/libsolidity/CompilerContext.cpp @@ -76,7 +76,7 @@ bytes const& CompilerContext::getCompiledContract(const ContractDefinition& _con bool CompilerContext::isLocalVariable(Declaration const* _declaration) const { - return m_localVariables.count(_declaration); + return !!m_localVariables.count(_declaration); } eth::AssemblyItem CompilerContext::getFunctionEntryLabel(Declaration const& _declaration) diff --git a/libweb3jsonrpc/CMakeLists.txt b/libweb3jsonrpc/CMakeLists.txt index c9b2aa39d..98bbaa339 100644 --- a/libweb3jsonrpc/CMakeLists.txt +++ b/libweb3jsonrpc/CMakeLists.txt @@ -30,7 +30,10 @@ target_link_libraries(${EXECUTABLE} ${JSON_RPC_CPP_SERVER_LIBRARIES}) target_link_libraries(${EXECUTABLE} webthree) target_link_libraries(${EXECUTABLE} secp256k1) target_link_libraries(${EXECUTABLE} solidity) -target_link_libraries(${EXECUTABLE} serpent) + +if (NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")) + target_link_libraries(${EXECUTABLE} serpent) +endif() if (ETH_JSON_RPC_STUB) add_custom_target(jsonrpcstub) diff --git a/mix/QEther.cpp b/mix/QEther.cpp index 46562d440..4eef1fbdb 100644 --- a/mix/QEther.cpp +++ b/mix/QEther.cpp @@ -35,7 +35,7 @@ QBigInt* QEther::toWei() const const char* key = units.valueToKey(m_currentUnit); for (std::pair rawUnit: dev::eth::units()) { - if (rawUnit.second == QString(key).toLower().toStdString()) + if (QString::fromStdString(rawUnit.second).toLower() == QString(key).toLower()) return multiply(new QBigInt(rawUnit.first)); } return new QBigInt(dev::u256(0)); @@ -46,7 +46,7 @@ void QEther::setUnit(QString const& _unit) QMetaEnum units = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("EtherUnit")); for (int k = 0; k < units.keyCount(); k++) { - if (QString(units.key(k)).toLower() == _unit) + if (QString(units.key(k)).toLower() == _unit.toLower()) { m_currentUnit = static_cast(units.keysToValue(units.key(k))); return; diff --git a/mix/qml/Ether.qml b/mix/qml/Ether.qml index a5fd5dba2..f737b12b6 100644 --- a/mix/qml/Ether.qml +++ b/mix/qml/Ether.qml @@ -32,6 +32,11 @@ RowLayout { units.currentIndex = unit; } + SourceSansProRegular + { + id: regularFont + } + TextField { implicitWidth: 200 @@ -46,6 +51,7 @@ RowLayout { readOnly: !edit visible: edit id: etherValueEdit; + font.family: regularFont.name } ComboBox @@ -59,6 +65,7 @@ RowLayout { formattedValue.text = value.format(); } } + model: ListModel { id: unitsModel ListElement { text: "Uether"; } @@ -81,10 +88,15 @@ RowLayout { ListElement { text: "Kwei"; } ListElement { text: "wei"; } } + style: ComboBoxStyle { + font: regularFont.name + } } + Text { visible: displayFormattedValue id: formattedValue + font.family: regularFont.name } } diff --git a/mix/qml/FilesSection.qml b/mix/qml/FilesSection.qml index 76e235e7d..518e85595 100644 --- a/mix/qml/FilesSection.qml +++ b/mix/qml/FilesSection.qml @@ -48,16 +48,14 @@ ColumnLayout { model.remove(i); } - FontLoader + SourceSansProRegular { id: fileNameFont - source: "qrc:/qml/fonts/SourceSansPro-Regular.ttf" } - FontLoader + SourceSansProBold { id: boldFont - source: "qrc:/qml/fonts/SourceSansPro-Bold.ttf" } RowLayout diff --git a/mix/qml/NewProjectDialog.qml b/mix/qml/NewProjectDialog.qml index 8d5afc7ac..770775df2 100644 --- a/mix/qml/NewProjectDialog.qml +++ b/mix/qml/NewProjectDialog.qml @@ -5,7 +5,7 @@ import QtQuick.Window 2.0 import QtQuick.Dialogs 1.1 Window { - + id: newProjectWin modality: Qt.WindowModal width: 640 @@ -18,6 +18,8 @@ Window { signal accepted function open() { + newProjectWin.setX((Screen.width - width) / 2); + newProjectWin.setY((Screen.height - height) / 2); visible = true; titleField.focus = true; } diff --git a/mix/qml/ProjectList.qml b/mix/qml/ProjectList.qml index 0297c2441..925bb0bab 100644 --- a/mix/qml/ProjectList.qml +++ b/mix/qml/ProjectList.qml @@ -12,10 +12,10 @@ Item { anchors.fill: parent id: filesCol spacing: 0 - FontLoader + + SourceSansProLight { id: srcSansProLight - source: "qrc:/qml/fonts/SourceSansPro-Light.ttf" } Rectangle diff --git a/mix/qml/QHashTypeView.qml b/mix/qml/QHashTypeView.qml index e36514fab..6f3c1910e 100644 --- a/mix/qml/QHashTypeView.qml +++ b/mix/qml/QHashTypeView.qml @@ -4,13 +4,22 @@ Item { property alias text: textinput.text id: editRoot + + SourceSansProBold + { + id: boldFont + } + Rectangle { anchors.fill: parent + radius: 4 + color: "#f7f7f7" TextInput { id: textinput text: text anchors.fill: parent wrapMode: Text.WrapAnywhere + font.family: boldFont.name MouseArea { id: mouseArea anchors.fill: parent diff --git a/mix/qml/QIntTypeView.qml b/mix/qml/QIntTypeView.qml index f794a3b2d..00a08d819 100644 --- a/mix/qml/QIntTypeView.qml +++ b/mix/qml/QIntTypeView.qml @@ -4,12 +4,21 @@ Item { property alias text: textinput.text id: editRoot + + SourceSansProBold + { + id: boldFont + } + Rectangle { anchors.fill: parent + radius: 4 + color: "#f7f7f7" TextInput { id: textinput text: text anchors.fill: parent + font.family: boldFont.name MouseArea { id: mouseArea anchors.fill: parent diff --git a/mix/qml/QStringTypeView.qml b/mix/qml/QStringTypeView.qml index a78fc1d26..7e7d2ec76 100644 --- a/mix/qml/QStringTypeView.qml +++ b/mix/qml/QStringTypeView.qml @@ -4,13 +4,22 @@ Item { property alias text: textinput.text id: editRoot + + SourceSansProBold + { + id: boldFont + } + Rectangle { anchors.fill: parent + radius: 4 + color: "#f7f7f7" TextInput { id: textinput text: text anchors.fill: parent wrapMode: Text.WrapAnywhere + font.family: boldFont.name MouseArea { id: mouseArea anchors.fill: parent diff --git a/mix/qml/SourceSansProBold.qml b/mix/qml/SourceSansProBold.qml new file mode 100644 index 000000000..39c99cc8d --- /dev/null +++ b/mix/qml/SourceSansProBold.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +FontLoader +{ + source: "qrc:/qml/fonts/SourceSansPro-Bold.ttf" +} diff --git a/mix/qml/SourceSansProLight.qml b/mix/qml/SourceSansProLight.qml new file mode 100644 index 000000000..f46abedd5 --- /dev/null +++ b/mix/qml/SourceSansProLight.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +FontLoader +{ + source: "qrc:/qml/fonts/SourceSansPro-Light.ttf" +} + diff --git a/mix/qml/SourceSansProRegular.qml b/mix/qml/SourceSansProRegular.qml new file mode 100644 index 000000000..d9ce908e0 --- /dev/null +++ b/mix/qml/SourceSansProRegular.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 + +FontLoader +{ + source: "qrc:/qml/fonts/SourceSansPro-Regular.ttf" +} + + diff --git a/mix/qml/StateDialog.qml b/mix/qml/StateDialog.qml index 4384b81a6..a8ac27ecf 100644 --- a/mix/qml/StateDialog.qml +++ b/mix/qml/StateDialog.qml @@ -2,6 +2,7 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 import QtQuick.Layouts 1.1 import QtQuick.Window 2.0 +import QtQuick.Controls.Styles 1.3 import org.ethereum.qml.QEther 1.0 import "js/QEtherHelper.js" as QEtherHelper import "js/TransactionHelper.js" as TransactionHelper @@ -11,10 +12,11 @@ Window { id: modalStateDialog modality: Qt.WindowModal - width: 640 + width: 450 height: 480 - + title: qsTr("State Edition") visible: false + color: StateDialogStyle.generic.backgroundColor property alias stateTitle: titleField.text property alias stateBalance: balanceField.value @@ -34,6 +36,10 @@ Window { transactionsModel.append(item.transactions[t]); stateTransactions.push(item.transactions[t]); } + + modalStateDialog.setX((Screen.width - width) / 2); + modalStateDialog.setY((Screen.height - height) / 2); + visible = true; isDefault = setDefault; titleField.focus = true; @@ -54,74 +60,123 @@ Window { return item; } - GridLayout { - id: dialogContent - columns: 2 + SourceSansProRegular + { + id: regularFont + } + + Rectangle { anchors.fill: parent anchors.margins: 10 - rowSpacing: 10 - columnSpacing: 10 + color: StateDialogStyle.generic.backgroundColor + GridLayout { + id: dialogContent + columns: 2 + anchors.top: parent.top + rowSpacing: 10 + columnSpacing: 10 - Label { - text: qsTr("Title") - } - TextField { - id: titleField - focus: true - Layout.fillWidth: true - } + Label { + text: qsTr("Title") + font.family: regularFont.name + color: "#808080" + } + TextField { + id: titleField + focus: true + Layout.fillWidth: true + font.family: regularFont.name + } - Label { - text: qsTr("Balance") - } - Ether { - id: balanceField - edit: true - displayFormattedValue: true - Layout.fillWidth: true - } + Label { + text: qsTr("Balance") + font.family: regularFont.name + color: "#808080" + } + Ether { + id: balanceField + edit: true + displayFormattedValue: true + Layout.fillWidth: true + } - Label { - text: qsTr("Default") - } - CheckBox { - id: defaultCheckBox - Layout.fillWidth: true + Label { + text: qsTr("Default") + font.family: regularFont.name + color: "#808080" + } + CheckBox { + id: defaultCheckBox + Layout.fillWidth: true + } } - Label { - text: qsTr("Transactions") - } - ListView { - Layout.fillWidth: true - Layout.fillHeight: true - model: transactionsModel - delegate: transactionRenderDelegate - } + ColumnLayout { + anchors.top: dialogContent.bottom + anchors.topMargin: 5 + spacing: 5 + RowLayout + { + Label { + text: qsTr("Transactions") + font.family: regularFont.name + color: "#808080" + } - Label { + Button { + tooltip: qsTr("Create a new transaction") + onClicked: transactionsModel.addTransaction() + height: 5 + width: 5 + style: ButtonStyle { + label: Text { + font.family: regularFont.name + text: qsTr("+") + font.pointSize: 15 + color: "#808080" + height: 5 + width: 5 + } + background: Rectangle { + radius: 4 + border.width: 1 + color: "#f7f7f7" + height: 5 + implicitHeight: 5 + } + } + } + } + + ListView { + id: trList + Layout.preferredWidth: 200 + Layout.fillHeight: true + Layout.minimumHeight: 20 * transactionsModel.count + model: transactionsModel + delegate: transactionRenderDelegate + visible: transactionsModel.count > 0 + } } - Button { - text: qsTr("Add") - onClicked: transactionsModel.addTransaction() - } - } - RowLayout { - anchors.bottom: parent.bottom - anchors.right: parent.right; - Button { - text: qsTr("OK"); - onClicked: { - close(); - accepted(); + RowLayout + { + anchors.bottom: parent.bottom + anchors.right: parent.right; + + Button { + text: qsTr("OK"); + onClicked: { + close(); + accepted(); + } + } + Button { + text: qsTr("Cancel"); + onClicked: close(); } - } - Button { - text: qsTr("Cancel"); - onClicked: close(); } } @@ -161,26 +216,51 @@ Window { text: functionId font.pointSize: StateStyle.general.basicFontSize //12 verticalAlignment: Text.AlignBottom + font.family: regularFont.name } ToolButton { text: qsTr("Edit"); visible: !stdContract Layout.fillHeight: true onClicked: transactionsModel.editTransaction(index) + style: ButtonStyle { + label: Text { + font.family: regularFont.name + text: qsTr("Edit") + font.italic: true + font.pointSize: 9 + } + background: Rectangle { + color: "transparent" + } + } } ToolButton { visible: index >= 0 ? !transactionsModel.get(index).executeConstructor : false text: qsTr("Delete"); Layout.fillHeight: true onClicked: transactionsModel.deleteTransaction(index) + style: ButtonStyle { + label: Text { + font.family: regularFont.name + text: qsTr("Delete") + font.italic: true + font.pointSize: 9 + } + background: Rectangle { + color: "transparent" + } + } } } } } - TransactionDialog { + TransactionDialog + { id: transactionDialog - onAccepted: { + onAccepted: + { var item = transactionDialog.getItem(); if (transactionDialog.transactionIndex < transactionsModel.count) { @@ -192,5 +272,4 @@ Window { } } } - } diff --git a/mix/qml/StateDialogStyle.qml b/mix/qml/StateDialogStyle.qml new file mode 100644 index 000000000..39214312a --- /dev/null +++ b/mix/qml/StateDialogStyle.qml @@ -0,0 +1,17 @@ +pragma Singleton +import QtQuick 2.0 + +QtObject { + property QtObject generic: QtObject + { + property string backgroundColor: "#ededed" + } + + property QtObject stateDialog: QtObject + { + } + + property QtObject transactionDialog: QtObject + { + } +} diff --git a/mix/qml/StateListModel.qml b/mix/qml/StateListModel.qml index e87a96f76..fd7959477 100644 --- a/mix/qml/StateListModel.qml +++ b/mix/qml/StateListModel.qml @@ -2,6 +2,7 @@ import QtQuick 2.2 import QtQuick.Controls.Styles 1.1 import QtQuick.Controls 1.1 import QtQuick.Dialogs 1.1 +import QtQuick.Window 2.2 import QtQuick.Layouts 1.1 import org.ethereum.qml.QEther 1.0 import "js/QEtherHelper.js" as QEtherHelper diff --git a/mix/qml/TransactionDialog.qml b/mix/qml/TransactionDialog.qml index 3e6cf0236..4b2b46cd2 100644 --- a/mix/qml/TransactionDialog.qml +++ b/mix/qml/TransactionDialog.qml @@ -2,16 +2,19 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 import QtQuick.Layouts 1.1 import QtQuick.Window 2.0 +import QtQuick.Controls.Styles 1.3 import org.ethereum.qml.QEther 1.0 import "js/TransactionHelper.js" as TransactionHelper +import "." Window { id: modalTransactionDialog modality: Qt.WindowModal - width:640 - height:640 + width: 450 + height: (paramsModel.count > 0 ? 550 : 300) visible: false - + color: StateDialogStyle.generic.backgroundColor + title: qsTr("Transaction Edition") property int transactionIndex property alias transactionParams: paramsModel; property alias gas: gasField.value; @@ -63,6 +66,9 @@ Window { for (var p = 0; p < parameters.length; p++) loadParameter(parameters[p]); } + modalTransactionDialog.setX((Screen.width - width) / 2); + modalTransactionDialog.setY((Screen.height - height) / 2); + visible = true; valueField.focus = true; } @@ -105,6 +111,15 @@ Window { } } + function param(name) + { + for (var k = 0; k < paramsModel.count; k++) + { + if (paramsModel.get(k).name === name) + return paramsModel.get(k); + } + } + function close() { visible = false; @@ -155,264 +170,269 @@ Window { return item; } - ColumnLayout { - id: dialogContent - width: parent.width + SourceSansProRegular + { + id: regularFont + } + + Rectangle { + anchors.fill: parent anchors.left: parent.left anchors.right: parent.right + anchors.top: parent.top anchors.margins: 10 - spacing: 30 - RowLayout - { - id: rowFunction - Layout.fillWidth: true - height: 150 - Label { - Layout.preferredWidth: 75 - text: qsTr("Function") - } - ComboBox { - id: functionComboBox + color: StateDialogStyle.generic.backgroundColor + + ColumnLayout { + id: dialogContent + spacing: 30 + RowLayout + { + id: rowFunction Layout.fillWidth: true - currentIndex: -1 - textRole: "text" - editable: false - model: ListModel { - id: functionsModel + height: 150 + Label { + Layout.preferredWidth: 75 + text: qsTr("Function") + font.family: regularFont.name + color: "#808080" } - onCurrentIndexChanged: { - loadParameters(); + ComboBox { + id: functionComboBox + Layout.preferredWidth: 350 + currentIndex: -1 + textRole: "text" + editable: false + model: ListModel { + id: functionsModel + } + onCurrentIndexChanged: { + loadParameters(); + } + style: ComboBoxStyle { + font: regularFont.name + } } } - } - RowLayout - { - id: rowValue - Layout.fillWidth: true - Label { - Layout.preferredWidth: 75 - text: qsTr("Value") - } - Rectangle + RowLayout { + id: rowValue Layout.fillWidth: true + height: 150 + Label { + Layout.preferredWidth: 75 + text: qsTr("Value") + font.family: regularFont.name + color: "#808080" + } Ether { id: valueField edit: true displayFormattedValue: true } } - } - RowLayout - { - id: rowGas - Layout.fillWidth: true - Label { - Layout.preferredWidth: 75 - text: qsTr("Gas") - } - Rectangle + RowLayout { + id: rowGas Layout.fillWidth: true + height: 150 + Label { + Layout.preferredWidth: 75 + text: qsTr("Gas") + font.family: regularFont.name + color: "#808080" + } Ether { id: gasField edit: true displayFormattedValue: true } } - } - RowLayout - { - id: rowGasPrice - Layout.fillWidth: true - Label { - Layout.preferredWidth: 75 - text: qsTr("Gas Price") - } - Rectangle + RowLayout { + id: rowGasPrice Layout.fillWidth: true + height: 150 + Label { + Layout.preferredWidth: 75 + text: qsTr("Gas Price") + font.family: regularFont.name + color: "#808080" + } Ether { id: gasPriceField edit: true displayFormattedValue: true } } - } - RowLayout - { - Layout.fillWidth: true Label { text: qsTr("Parameters") Layout.preferredWidth: 75 + font.family: regularFont.name + color: "#808080" + visible: paramsModel.count > 0 } - TableView { - model: paramsModel - Layout.preferredWidth: 120 * 2 + 240 - Layout.minimumHeight: 150 - Layout.preferredHeight: 400 - Layout.maximumHeight: 600 - TableViewColumn { - role: "name" - title: qsTr("Name") - width: 120 - } - TableViewColumn { - role: "type" - title: qsTr("Type") - width: 120 - } - TableViewColumn { - role: "value" - title: qsTr("Value") - width: 240 - } - rowDelegate: rowDelegate - itemDelegate: editableDelegate - } - } - } - - RowLayout - { - anchors.bottom: parent.bottom - anchors.right: parent.right; - - Button { - text: qsTr("OK"); - onClicked: { - close(); - accepted(); - } - } - Button { - text: qsTr("Cancel"); - onClicked: close(); - } - } - - - ListModel { - id: paramsModel - } - - Component { - id: rowDelegate - Item { - height: 100 - } - } - - Component { - id: editableDelegate - Item { - Loader { - id: loaderEditor - anchors.fill: parent - anchors.margins: 4 - Connections { - target: loaderEditor.item - onTextChanged: { - if (styleData.role === "value" && styleData.row < paramsModel.count) - loaderEditor.updateValue(styleData.row, styleData.role, loaderEditor.item.text); - } - } - - function updateValue(row, role, value) - { - paramsModel.setProperty(styleData.row, styleData.role, value); - } - - sourceComponent: - { - if (styleData.role === "value") - { - if (paramsModel.get(styleData.row) === undefined) - return null; - if (paramsModel.get(styleData.row).type.indexOf("int") !== -1) - return intViewComp; - else if (paramsModel.get(styleData.row).type.indexOf("bool") !== -1) - return boolViewComp; - else if (paramsModel.get(styleData.row).type.indexOf("string") !== -1) - return stringViewComp; - else if (paramsModel.get(styleData.row).type.indexOf("hash") !== -1) - return hashViewComp; - } - else - return editor; - } - - Component - { - id: intViewComp - QIntTypeView - { - id: intView - text: styleData.value - } - } - - Component + ScrollView + { + Layout.fillWidth: true + visible: paramsModel.count > 0 + ColumnLayout { - id: boolViewComp - QBoolTypeView + id: paramRepeater + Layout.fillWidth: true + spacing: 10 + Repeater { - id: boolView - defaultValue: "1" - Component.onCompleted: + anchors.fill: parent + model: paramsModel + visible: paramsModel.count > 0 + RowLayout { - loaderEditor.updateValue(styleData.row, styleData.role, - (paramsModel.get(styleData.row).value === "" ? defaultValue : - paramsModel.get(styleData.row).value)); - text = (paramsModel.get(styleData.row).value === "" ? defaultValue : paramsModel.get(styleData.row).value); + id: row + Layout.fillWidth: true + height: 150 + + Label { + id: typeLabel + text: type + font.family: regularFont.name + Layout.preferredWidth: 50 + } + + Label { + id: nameLabel + text: name + font.family: regularFont.name + Layout.preferredWidth: 50 + } + + Label { + id: equalLabel + text: "=" + font.family: regularFont.name + Layout.preferredWidth: 15 + } + + Loader + { + id: typeLoader + Layout.preferredHeight: 50 + Layout.preferredWidth: 150 + function getCurrent() + { + return modalTransactionDialog.param(name); + } + + Connections { + target: typeLoader.item + onTextChanged: { + typeLoader.getCurrent().value = typeLoader.item.text; + } + } + + sourceComponent: + { + if (type.indexOf("int") !== -1) + return intViewComp; + else if (type.indexOf("bool") !== -1) + return boolViewComp; + else if (type.indexOf("string") !== -1) + return stringViewComp; + else if (type.indexOf("hash") !== -1) + return hashViewComp; + else + return null; + } + + Component + { + id: intViewComp + QIntTypeView + { + height: 50 + width: 150 + id: intView + text: typeLoader.getCurrent().value + } + } + + Component + { + id: boolViewComp + QBoolTypeView + { + height: 50 + width: 150 + id: boolView + defaultValue: "1" + Component.onCompleted: + { + var current = typeLoader.getCurrent().value; + (current === "" ? text = defaultValue : text = current); + } + } + } + + Component + { + id: stringViewComp + QStringTypeView + { + height: 50 + width: 150 + id: stringView + text: + { + return typeLoader.getCurrent().value + } + } + } + + Component + { + id: hashViewComp + QHashTypeView + { + height: 50 + width: 150 + id: hashView + text: typeLoader.getCurrent().value + } + } + } } } } + } + } - Component - { - id: stringViewComp - QStringTypeView - { - id: stringView - text: styleData.value - } - } - - - Component - { - id: hashViewComp - QHashTypeView - { - id: hashView - text: styleData.value - } - } - - Component { - id: editor - TextInput { - id: textinput - readOnly: true - color: styleData.textColor - text: styleData.value - MouseArea { - id: mouseArea - anchors.fill: parent - hoverEnabled: true - onClicked: textinput.forceActiveFocus() - } - } + RowLayout + { + anchors.bottom: parent.bottom + anchors.right: parent.right; + + Button { + text: qsTr("OK"); + onClicked: { + close(); + accepted(); } } + Button { + text: qsTr("Cancel"); + onClicked: close(); + } } } + + ListModel { + id: paramsModel + } } diff --git a/mix/qml/qmldir b/mix/qml/qmldir index 9eb0effd0..a90fd7135 100644 --- a/mix/qml/qmldir +++ b/mix/qml/qmldir @@ -1,3 +1,4 @@ +singleton StateDialogStyle 1.0 StateDialogStyle.qml singleton ProjectFilesStyle 1.0 ProjectFilesStyle.qml singleton DebuggerPaneStyle 1.0 DebuggerPaneStyle.qml singleton StateStyle 1.0 StateStyle.qml diff --git a/mix/res.qrc b/mix/res.qrc index cc37b1d32..5d44e1299 100644 --- a/mix/res.qrc +++ b/mix/res.qrc @@ -81,6 +81,10 @@ qml/img/closedtriangleindicator_filesproject.png qml/img/opentriangleindicator_filesproject.png qml/img/projecticon.png + qml/SourceSansProRegular.qml + qml/SourceSansProBold.qml + qml/SourceSansProLight.qml + qml/StateDialogStyle.qml qml/ProjectFilesStyle.qml qml/DebuggerPaneStyle.qml qml/CodeEditorStyle.qml diff --git a/test/SolidityEndToEndTest.cpp b/test/SolidityEndToEndTest.cpp index 13a666fbf..8a21290cb 100644 --- a/test/SolidityEndToEndTest.cpp +++ b/test/SolidityEndToEndTest.cpp @@ -963,7 +963,7 @@ BOOST_AUTO_TEST_CASE(multiple_elementary_accessors) compileAndRun(sourceCode); BOOST_CHECK(callContractFunction("data()") == encodeArgs(8)); BOOST_CHECK(callContractFunction("name()") == encodeArgs("Celina")); - BOOST_CHECK(callContractFunction("a_hash()") == encodeArgs(dev::sha3(bytes({0x7b})))); + BOOST_CHECK(callContractFunction("a_hash()") == encodeArgs(dev::sha3(bytes{0x7b}))); BOOST_CHECK(callContractFunction("an_address()") == encodeArgs(toBigEndian(u160(0x1337)))); BOOST_CHECK(callContractFunction("super_secret_data()") == bytes()); } @@ -2202,8 +2202,8 @@ BOOST_AUTO_TEST_CASE(sha3_multiple_arguments_with_numeric_literals) BOOST_CHECK(callContractFunction("foo(uint256,uint16)", 10, 12) == encodeArgs( dev::sha3( toBigEndian(u256(10)) + - bytes({0x0, 0xc}) + - bytes({0x91})))); + bytes{0x0, 0xc} + + bytes{0x91}))); } BOOST_AUTO_TEST_CASE(sha3_multiple_arguments_with_string_literals) @@ -2226,9 +2226,9 @@ BOOST_AUTO_TEST_CASE(sha3_multiple_arguments_with_string_literals) BOOST_CHECK(callContractFunction("bar(uint256,uint16)", 10, 12) == encodeArgs( dev::sha3( toBigEndian(u256(10)) + - bytes({0x0, 0xc}) + - bytes({0x91}) + - bytes({0x66, 0x6f, 0x6f})))); + bytes{0x0, 0xc} + + bytes{0x91} + + bytes{0x66, 0x6f, 0x6f}))); } BOOST_AUTO_TEST_CASE(generic_call)