From 70eafae18736d4c59728b897f54d60de3e525761 Mon Sep 17 00:00:00 2001 From: debris Date: Sun, 8 Feb 2015 21:41:42 +0100 Subject: [PATCH 01/10] fixed arrays << error in msvc --- libdevcore/CommonIO.h | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) 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) From 92bfd9181208f9e9c66f0b9d3f8b3e0e0107fd70 Mon Sep 17 00:00:00 2001 From: debris Date: Sun, 8 Feb 2015 21:56:15 +0100 Subject: [PATCH 02/10] cmake mess --- alethzero/CMakeLists.txt | 9 ++++++--- eth/CMakeLists.txt | 1 + libweb3jsonrpc/CMakeLists.txt | 5 ++++- lllc/CMakeLists.txt | 2 ++ mix/CMakeLists.txt | 2 ++ solc/CMakeLists.txt | 2 ++ test/CMakeLists.txt | 6 ++++++ third/CMakeLists.txt | 2 ++ 8 files changed, 25 insertions(+), 4 deletions(-) diff --git a/alethzero/CMakeLists.txt b/alethzero/CMakeLists.txt index b58446935..2cd6f43a4 100644 --- a/alethzero/CMakeLists.txt +++ b/alethzero/CMakeLists.txt @@ -32,6 +32,8 @@ eth_add_executable(${EXECUTABLE} add_dependencies(${EXECUTABLE} BuildInfo.h) +target_link_libraries(${EXECUTABLE} ${Boost_CHRONO_LIBRARIES}) +target_link_libraries(${EXECUTABLE} ${Boost_DATE_TIME_LIBRARIES}) target_link_libraries(${EXECUTABLE} Qt5::Core) target_link_libraries(${EXECUTABLE} webthree) target_link_libraries(${EXECUTABLE} qwebthree) @@ -40,9 +42,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 +50,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..bdd966bfc 100644 --- a/eth/CMakeLists.txt +++ b/eth/CMakeLists.txt @@ -17,6 +17,7 @@ add_dependencies(${EXECUTABLE} BuildInfo.h) target_link_libraries(${EXECUTABLE} ${Boost_REGEX_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${Boost_DATE_TIME_LIBRARIES}) +target_link_libraries(${EXECUTABLE} ${Boost_CHRONO_LIBRARIES}) if (READLINE_FOUND) target_link_libraries(${EXECUTABLE} ${READLINE_LIBRARIES}) diff --git a/libweb3jsonrpc/CMakeLists.txt b/libweb3jsonrpc/CMakeLists.txt index f371024e6..e4e71e885 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() install( TARGETS ${EXECUTABLE} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) install( FILES ${HEADERS} DESTINATION include/${EXECUTABLE} ) diff --git a/lllc/CMakeLists.txt b/lllc/CMakeLists.txt index 2e76aa6ff..f41584e04 100644 --- a/lllc/CMakeLists.txt +++ b/lllc/CMakeLists.txt @@ -13,6 +13,8 @@ add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) add_dependencies(${EXECUTABLE} BuildInfo.h) +target_link_libraries(${EXECUTABLE} ${Boost_DATE_TIME_LIBRARIES}) +target_link_libraries(${EXECUTABLE} ${Boost_CHRONO_LIBRARIES}) target_link_libraries(${EXECUTABLE} lll) target_link_libraries(${EXECUTABLE} evmcore) target_link_libraries(${EXECUTABLE} devcore) diff --git a/mix/CMakeLists.txt b/mix/CMakeLists.txt index db9452061..235c41b92 100644 --- a/mix/CMakeLists.txt +++ b/mix/CMakeLists.txt @@ -34,6 +34,8 @@ eth_add_executable(${EXECUTABLE} UI_RESOURCES ${UI_RESOURCES} ) +target_link_libraries(${EXECUTABLE} ${Boost_DATE_TIME_LIBRARIES}) +target_link_libraries(${EXECUTABLE} ${Boost_CHRONO_LIBRARIES}) target_link_libraries(${EXECUTABLE} Qt5::Core) target_link_libraries(${EXECUTABLE} Qt5::Gui) target_link_libraries(${EXECUTABLE} Qt5::Widgets) diff --git a/solc/CMakeLists.txt b/solc/CMakeLists.txt index 8c0ece27e..96129c499 100644 --- a/solc/CMakeLists.txt +++ b/solc/CMakeLists.txt @@ -13,6 +13,8 @@ add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) target_link_libraries(${EXECUTABLE} ${Boost_FILESYSTEM_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${Boost_PROGRAM_OPTIONS_LIBRARIES}) +target_link_libraries(${EXECUTABLE} ${Boost_DATE_TIME_LIBRARIES}) +target_link_libraries(${EXECUTABLE} ${Boost_CHRONO_LIBRARIES}) target_link_libraries(${EXECUTABLE} solidity) install( TARGETS ${EXECUTABLE} DESTINATION bin ) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 36876eea6..4d240a0ee 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -16,6 +16,8 @@ add_executable(createRandomTest createRandomTest.cpp vm.cpp TestHelper.cpp) add_executable(checkRandomTest checkRandomTest.cpp vm.cpp TestHelper.cpp) target_link_libraries(testeth ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES}) +target_link_libraries(testeth ${Boost_DATE_TIME_LIBRARIES}) +target_link_libraries(testeth ${Boost_CHRONO_LIBRARIES}) target_link_libraries(testeth ${CURL_LIBRARIES}) target_link_libraries(testeth ethereum) target_link_libraries(testeth ethcore) @@ -30,9 +32,13 @@ if (JSONRPC) endif() target_link_libraries(createRandomTest ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES}) +target_link_libraries(createRandomTest ${Boost_DATE_TIME_LIBRARIES}) +target_link_libraries(createRandomTest ${Boost_CHRONO_LIBRARIES}) target_link_libraries(createRandomTest ethereum) target_link_libraries(createRandomTest ethcore) target_link_libraries(checkRandomTest ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES}) +target_link_libraries(checkRandomTest ${Boost_DATE_TIME_LIBRARIES}) +target_link_libraries(checkRandomTest ${Boost_CHRONO_LIBRARIES}) target_link_libraries(checkRandomTest ethereum) target_link_libraries(checkRandomTest ethcore) diff --git a/third/CMakeLists.txt b/third/CMakeLists.txt index 71f1e70f2..db72cdebd 100644 --- a/third/CMakeLists.txt +++ b/third/CMakeLists.txt @@ -31,6 +31,8 @@ eth_add_executable(${EXECUTABLE} add_dependencies(${EXECUTABLE} BuildInfo.h) +target_link_libraries(${EXECUTABLE} ${Boost_DATE_TIME_LIBRARIES}) +target_link_libraries(${EXECUTABLE} ${Boost_CHRONO_LIBRARIES}) target_link_libraries(${EXECUTABLE} Qt5::Core) target_link_libraries(${EXECUTABLE} webthree) target_link_libraries(${EXECUTABLE} qwebthree) From e3368ad364d67b1e802e2f15191cb43f5b73b02b Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Wed, 11 Feb 2015 07:58:21 +0100 Subject: [PATCH 03/10] cmake replace with ${CMAKE_COMMAND}, fixed #1006 --- CMakeLists.txt | 2 +- libweb3jsonrpc/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 70598f614..5aa1f5fcd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,7 +88,7 @@ function(createBuildInfo) # Generate header file containing useful build information add_custom_target(BuildInfo.h ALL WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMAND cmake -DETH_SOURCE_DIR="${CMAKE_SOURCE_DIR}" -DETH_DST_DIR="${CMAKE_BINARY_DIR}" + COMMAND ${CMAKE_COMMAND} -DETH_SOURCE_DIR="${CMAKE_SOURCE_DIR}" -DETH_DST_DIR="${CMAKE_BINARY_DIR}" -DETH_BUILD_TYPE="${_cmake_build_type}" -DETH_BUILD_PLATFORM="${ETH_BUILD_PLATFORM}" -P "${ETH_SCRIPTS_DIR}/buildinfo.cmake" ) diff --git a/libweb3jsonrpc/CMakeLists.txt b/libweb3jsonrpc/CMakeLists.txt index e18a53cd8..3e0574ced 100644 --- a/libweb3jsonrpc/CMakeLists.txt +++ b/libweb3jsonrpc/CMakeLists.txt @@ -38,7 +38,7 @@ if (ETH_JSON_RPC_STUB) POST_BUILD WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${ETH_JSON_RPC_STUB} spec.json --cpp-server=AbstractWebThreeStubServer --cpp-client=WebThreeStubClient - COMMAND cmake -E rename webthreestubclient.h ../test/webthreestubclient.h + COMMAND ${CMAKE_COMMAND} -E rename webthreestubclient.h ../test/webthreestubclient.h ) add_dependencies(${EXECUTABLE} jsonrpcstub) endif() From dfcebb93e4b87dfe6a9e9680978d67da7a911d24 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Wed, 11 Feb 2015 09:19:49 +0100 Subject: [PATCH 04/10] checking for changes in jsonrpcstub, fixed #1004 --- cmake/EthUtils.cmake | 24 ++++++++++++++++++++++ cmake/scripts/buildinfo.cmake | 21 ++++--------------- cmake/scripts/jsonrpcstub.cmake | 36 +++++++++++++++++++++++++++++++++ libweb3jsonrpc/CMakeLists.txt | 7 +++++-- 4 files changed, 69 insertions(+), 19 deletions(-) create mode 100644 cmake/EthUtils.cmake create mode 100644 cmake/scripts/jsonrpcstub.cmake diff --git a/cmake/EthUtils.cmake b/cmake/EthUtils.cmake new file mode 100644 index 000000000..c6fd43ed4 --- /dev/null +++ b/cmake/EthUtils.cmake @@ -0,0 +1,24 @@ +# +# renames the file if it is different from its destination +include(CMakeParseArguments) +# +macro(replace_if_different SOURCE DST) + set(extra_macro_args ${ARGN}) + set(options CREATE) + set(one_value_args) + set(multi_value_args) + cmake_parse_arguments(REPLACE_IF_DIFFERENT "${options}" "${one_value_args}" "${multi_value_args}" "${extra_macro_args}") + + if (REPLACE_IF_DIFFERENT_CREATE AND (NOT (EXISTS "${DST}"))) + file(WRITE "${DST}" "") + endif() + + execute_process(COMMAND ${CMAKE_COMMAND} -E compare_files "${SOURCE}" "${DST}" RESULT_VARIABLE DIFFERENT) + + if (DIFFERENT) + execute_process(COMMAND ${CMAKE_COMMAND} -E rename "${SOURCE}" "${DST}") + else() + execute_process(COMMAND ${CMAKE_COMMAND} -E remove "${SOURCE}") + endif() +endmacro() + diff --git a/cmake/scripts/buildinfo.cmake b/cmake/scripts/buildinfo.cmake index e61e3fa15..a0666c9f5 100644 --- a/cmake/scripts/buildinfo.cmake +++ b/cmake/scripts/buildinfo.cmake @@ -19,7 +19,7 @@ endif() execute_process( COMMAND git --git-dir=${ETH_SOURCE_DIR}/.git --work-tree=${ETH_SOURCE_DIR} rev-parse HEAD - OUTPUT_VARIABLE ETH_COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE ETH_COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET ) if (NOT ETH_COMMIT_HASH) @@ -28,7 +28,7 @@ endif() execute_process( COMMAND git --git-dir=${ETH_SOURCE_DIR}/.git --work-tree=${ETH_SOURCE_DIR} diff --shortstat - OUTPUT_VARIABLE ETH_LOCAL_CHANGES OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE ETH_LOCAL_CHANGES OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET ) if (ETH_LOCAL_CHANGES) @@ -41,21 +41,8 @@ set(INFILE "${ETH_SOURCE_DIR}/BuildInfo.h.in") set(TMPFILE "${ETH_DST_DIR}/BuildInfo.h.tmp") set(OUTFILE "${ETH_DST_DIR}/BuildInfo.h") -# create outfile if it doesn't exist -if (NOT (EXISTS "${OUTFILE}")) - execute_process(COMMAND touch "${OUTFILE}") -endif() - configure_file("${INFILE}" "${TMPFILE}") -execute_process( - COMMAND diff "${OUTFILE}" "${TMPFILE}" - OUTPUT_VARIABLE ETH_FILE_OUTDATED -) - -if (ETH_FILE_OUTDATED) - execute_process(COMMAND mv "${TMPFILE}" "${OUTFILE}") -else() - execute_process(COMMAND rm "${TMPFILE}") -endif() +include("${ETH_SOURCE_DIR}/cmake/EthUtils.cmake") +replace_if_different("${TMPFILE}" "${OUTFILE}" CREATE) diff --git a/cmake/scripts/jsonrpcstub.cmake b/cmake/scripts/jsonrpcstub.cmake new file mode 100644 index 000000000..a9b2c44ab --- /dev/null +++ b/cmake/scripts/jsonrpcstub.cmake @@ -0,0 +1,36 @@ +# generates JSONRPC Stub Server && Client +# +# this script expects +# ETH_SOURCE_DIR - main CMAKE_SOURCE_DIR +# ETH_SPEC_PATH +# ETH_SERVER_DIR +# ETH_CLIENT_DIR +# ETH_SERVER_NAME +# ETH_CLIENT_NAME +# ETH_JSON_RPC_STUB +# +# example usage: +# cmake -DETH_SPEC_PATH=spec.json -DETH_SERVER_DIR=libweb3jsonrpc -DETH_CLIENT_DIR=test +# -DETH_SERVER_NAME=AbstractWebThreeStubServer -DETH_CLIENT_NAME=WebThreeStubClient -DETH_JSON_RPC_STUB=/usr/local/bin/jsonrpcstub + +# by default jsonrpcstub produces files in lowercase, we want to stick to this +string(TOLOWER ${ETH_SERVER_NAME} ETH_SERVER_NAME_LOWER) +string(TOLOWER ${ETH_CLIENT_NAME} ETH_CLIENT_NAME_LOWER) + +# setup names +set(SERVER_TMPFILE "${ETH_SERVER_DIR}/${ETH_SERVER_NAME_LOWER}.h.tmp") +set(SERVER_OUTFILE "${ETH_SERVER_DIR}/${ETH_SERVER_NAME_LOWER}.h") +set(CLIENT_TMPFILE "${ETH_CLIENT_DIR}/${ETH_CLIENT_NAME_LOWER}.h.tmp") +set(CLIENT_OUTFILE "${ETH_CLIENT_DIR}/${ETH_CLIENT_NAME_LOWER}.h") + +# create tmp files +execute_process( + COMMAND ${ETH_JSON_RPC_STUB} ${ETH_SPEC_PATH} + --cpp-server=${ETH_SERVER_NAME} --cpp-server-file=${SERVER_TMPFILE} + --cpp-client=${ETH_CLIENT_NAME} --cpp-client-file=${CLIENT_TMPFILE} +) + +include("${ETH_SOURCE_DIR}/cmake/EthUtils.cmake") +replace_if_different("${SERVER_TMPFILE}" "${SERVER_OUTFILE}") +replace_if_different("${CLIENT_TMPFILE}" "${CLIENT_OUTFILE}") + diff --git a/libweb3jsonrpc/CMakeLists.txt b/libweb3jsonrpc/CMakeLists.txt index 3e0574ced..c9b2aa39d 100644 --- a/libweb3jsonrpc/CMakeLists.txt +++ b/libweb3jsonrpc/CMakeLists.txt @@ -37,8 +37,11 @@ if (ETH_JSON_RPC_STUB) add_custom_command(TARGET jsonrpcstub POST_BUILD WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND ${ETH_JSON_RPC_STUB} spec.json --cpp-server=AbstractWebThreeStubServer --cpp-client=WebThreeStubClient - COMMAND ${CMAKE_COMMAND} -E rename webthreestubclient.h ../test/webthreestubclient.h + COMMAND ${CMAKE_COMMAND} -DETH_SPEC_PATH="${CMAKE_CURRENT_SOURCE_DIR}/spec.json" -DETH_SOURCE_DIR="${CMAKE_SOURCE_DIR}" + -DETH_SERVER_DIR="${CMAKE_CURRENT_SOURCE_DIR}" -DETH_CLIENT_DIR="${CMAKE_SOURCE_DIR}/test" + -DETH_SERVER_NAME=AbstractWebThreeStubServer -DETH_CLIENT_NAME=WebThreeStubClient + -DETH_JSON_RPC_STUB="${ETH_JSON_RPC_STUB}" + -P "${ETH_SCRIPTS_DIR}/jsonrpcstub.cmake" ) add_dependencies(${EXECUTABLE} jsonrpcstub) endif() From f36b043f9f400840a4ebe2431fd057f5d89567f6 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Wed, 11 Feb 2015 10:38:50 +0100 Subject: [PATCH 05/10] We should search for jsonrpcstub headless or not --- cmake/EthDependencies.cmake | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmake/EthDependencies.cmake b/cmake/EthDependencies.cmake index 3f012212f..bcb0780c1 100644 --- a/cmake/EthDependencies.cmake +++ b/cmake/EthDependencies.cmake @@ -95,6 +95,10 @@ find_package (CURL) message(" - curl header: ${CURL_INCLUDE_DIRS}") message(" - curl lib : ${CURL_LIBRARIES}") +# find location of jsonrpcstub +find_program(ETH_JSON_RPC_STUB jsonrpcstub) +message(" - jsonrpcstub location : ${ETH_JSON_RPC_STUB}") + # do not compile GUI if (NOT HEADLESS) @@ -130,9 +134,6 @@ if (NOT HEADLESS) string(REGEX REPLACE "npm" "" ETH_NPM_DIRECTORY ${ETH_NPM}) message(" - npm location : ${ETH_NPM}") - find_program(ETH_JSON_RPC_STUB jsonrpcstub) - message(" - jsonrpcstub location : ${ETH_JSON_RPC_STUB}") - endif() #HEADLESS # use multithreaded boost libraries, with -mt suffix From 6e5b352dc007e31bb59f555531580994f7c2bf56 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 11 Feb 2015 10:42:10 +0100 Subject: [PATCH 06/10] - Add SourceSansPro*.qml - Ui changes on state/transaction dialog --- mix/QEther.cpp | 4 +- mix/qml/Ether.qml | 11 ++ mix/qml/FilesSection.qml | 6 +- mix/qml/ProjectList.qml | 4 +- mix/qml/QHashTypeView.qml | 7 + mix/qml/QIntTypeView.qml | 7 + mix/qml/QStringTypeView.qml | 7 + mix/qml/SourceSansProBold.qml | 6 + mix/qml/SourceSansProLight.qml | 7 + mix/qml/SourceSansProRegular.qml | 8 + mix/qml/StateDialog.qml | 155 +++++++++++----- mix/qml/StateDialogStyle.qml | 17 ++ mix/qml/TransactionDialog.qml | 294 ++++++++++++++++++++----------- mix/qml/qmldir | 1 + mix/res.qrc | 4 + 15 files changed, 382 insertions(+), 156 deletions(-) create mode 100644 mix/qml/SourceSansProBold.qml create mode 100644 mix/qml/SourceSansProLight.qml create mode 100644 mix/qml/SourceSansProRegular.qml create mode 100644 mix/qml/StateDialogStyle.qml 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..61727b848 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 @@ -81,10 +87,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 32202f839..e002d6394 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/ProjectList.qml b/mix/qml/ProjectList.qml index 138e86fe9..66dc7de2a 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..b97284a34 100644 --- a/mix/qml/QHashTypeView.qml +++ b/mix/qml/QHashTypeView.qml @@ -4,6 +4,12 @@ Item { property alias text: textinput.text id: editRoot + + SourceSansProBold + { + id: boldFont + } + Rectangle { anchors.fill: parent TextInput { @@ -11,6 +17,7 @@ Item 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..6bf7f1aa7 100644 --- a/mix/qml/QIntTypeView.qml +++ b/mix/qml/QIntTypeView.qml @@ -4,12 +4,19 @@ Item { property alias text: textinput.text id: editRoot + + SourceSansProBold + { + id: boldFont + } + Rectangle { anchors.fill: parent 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..7f0059cc9 100644 --- a/mix/qml/QStringTypeView.qml +++ b/mix/qml/QStringTypeView.qml @@ -4,6 +4,12 @@ Item { property alias text: textinput.text id: editRoot + + SourceSansProBold + { + id: boldFont + } + Rectangle { anchors.fill: parent TextInput { @@ -11,6 +17,7 @@ Item 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 fa48c640e..7f659e7f4 100644 --- a/mix/qml/StateDialog.qml +++ b/mix/qml/StateDialog.qml @@ -2,9 +2,11 @@ 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 +import "." Window { id: modalStateDialog @@ -14,6 +16,7 @@ Window { height: 480 visible: false + color: StateDialogStyle.generic.backgroundColor property alias stateTitle: titleField.text property alias stateBalance: balanceField.value @@ -53,59 +56,96 @@ 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 + { + width: parent.width + anchors.top: dialogContent.bottom + anchors.topMargin: 5 + spacing: 5 + Label { + text: qsTr("Transactions") + font.family: regularFont.name + color: "#808080" + } - Label { + ListView { + id: trList + Layout.preferredWidth: 200 + Layout.fillHeight: true + Layout.minimumHeight: 20 * transactionsModel.count + model: transactionsModel + delegate: transactionRenderDelegate + visible: transactionsModel.count > 0 + } + ToolButton { + onClicked: transactionsModel.addTransaction() + style: ButtonStyle + { + label: Text { + font.family: regularFont.name + text: qsTr("+") + font.pointSize: 20 + color: "#808080" + } + background: Rectangle { + color: "transparent" + } + } + } } - Button { - text: qsTr("Add") - onClicked: transactionsModel.addTransaction() - } - } RowLayout { anchors.bottom: parent.bottom @@ -123,6 +163,10 @@ Window { onClicked: close(); } } +} + + + ListModel { id: transactionsModel @@ -160,18 +204,43 @@ Window { text: functionId font.pointSize: 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" + } + } } } } 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/TransactionDialog.qml b/mix/qml/TransactionDialog.qml index 3e6cf0236..90e7e03ba 100644 --- a/mix/qml/TransactionDialog.qml +++ b/mix/qml/TransactionDialog.qml @@ -2,15 +2,18 @@ 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: 640 + height: 700 visible: false + color: StateDialogStyle.generic.backgroundColor property int transactionIndex property alias transactionParams: paramsModel; @@ -155,11 +158,17 @@ Window { return item; } + SourceSansProRegular + { + id: regularFont + } + ColumnLayout { id: dialogContent width: parent.width anchors.left: parent.left anchors.right: parent.right + anchors.top: parent.top anchors.margins: 10 spacing: 30 RowLayout @@ -170,10 +179,12 @@ Window { Label { Layout.preferredWidth: 75 text: qsTr("Function") + font.family: regularFont.name + color: "#808080" } ComboBox { id: functionComboBox - Layout.fillWidth: true + Layout.preferredWidth: 350 currentIndex: -1 textRole: "text" editable: false @@ -183,6 +194,10 @@ Window { onCurrentIndexChanged: { loadParameters(); } + style: ComboBoxStyle + { + font: regularFont.name + } } } @@ -191,18 +206,17 @@ Window { { id: rowValue Layout.fillWidth: true + height: 150 Label { Layout.preferredWidth: 75 text: qsTr("Value") + font.family: regularFont.name + color: "#808080" } - Rectangle - { - Layout.fillWidth: true - Ether { - id: valueField - edit: true - displayFormattedValue: true - } + Ether { + id: valueField + edit: true + displayFormattedValue: true } } @@ -211,18 +225,17 @@ Window { { id: rowGas Layout.fillWidth: true + height: 150 Label { Layout.preferredWidth: 75 text: qsTr("Gas") + font.family: regularFont.name + color: "#808080" } - Rectangle - { - Layout.fillWidth: true - Ether { - id: gasField - edit: true - displayFormattedValue: true - } + Ether { + id: gasField + edit: true + displayFormattedValue: true } } @@ -230,31 +243,153 @@ Window { { id: rowGasPrice Layout.fillWidth: true + height: 150 Label { Layout.preferredWidth: 75 text: qsTr("Gas Price") + font.family: regularFont.name + color: "#808080" } - Rectangle - { - Layout.fillWidth: true - Ether { - id: gasPriceField - edit: true - displayFormattedValue: true - } + Ether { + id: gasPriceField + edit: true + displayFormattedValue: true } } - RowLayout - { - Layout.fillWidth: true - Label { - text: qsTr("Parameters") - Layout.preferredWidth: 75 - } - TableView { + //ColumnLayout + //{ + //Layout.fillHeight: true; + //Layout.fillWidth: true; + //visible: paramsModel.count > 0 + + Label { + text: qsTr("Parameters") + Layout.preferredWidth: 75 + font.family: regularFont.name + color: "#808080" + visible: paramsModel.count > 0 + } + + Repeater + { + model: paramsModel + visible: paramsModel.count > 0 + Rectangle + { + color: "transparent" + Layout.fillWidth: true + height: 150 + Label { + id: typeLabel + text: type + } + + Label { + anchors.left: typeLabel.right + id: nameLabel + text: name + } + + Label { + anchors.left: nameLabel.right + id: equalLabel + text: "=" + } + + Loader + { + anchors.left: equalLabel.right + id: typeLoader + height: 50 + width: 150 + Connections { + target: typeLoader.item + onTextChanged: { + console.log("text changed 0 " + value); + value = typeLoader.item.text; + console.log("text changed 1 " + value); + } + } + + sourceComponent: + { + console.log(type); + 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: value + } + } + + Component + { + id: boolViewComp + QBoolTypeView + { + height: 50 + width: 150 + id: boolView + defaultValue: "1" + Component.onCompleted: + { + /*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);*/ + } + } + } + + Component + { + id: stringViewComp + QStringTypeView + { + height: 50 + width: 150 + id: stringView + text: value + } + } + + Component + { + id: hashViewComp + QHashTypeView + { + height: 50 + width: 150 + id: hashView + text: value + } + } + } + + } + } + //} + + /*TableView { model: paramsModel - Layout.preferredWidth: 120 * 2 + 240 + Layout.fillWidth: true Layout.minimumHeight: 150 Layout.preferredHeight: 400 Layout.maximumHeight: 600 @@ -276,27 +411,26 @@ Window { rowDelegate: rowDelegate itemDelegate: editableDelegate - } + }*/ } - } - 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(); - } - } ListModel { @@ -332,6 +466,7 @@ Window { sourceComponent: { + console.log("role " + styleData.role); if (styleData.role === "value") { if (paramsModel.get(styleData.row) === undefined) @@ -349,53 +484,7 @@ Window { return editor; } - Component - { - id: intViewComp - QIntTypeView - { - id: intView - text: styleData.value - } - } - - Component - { - id: boolViewComp - QBoolTypeView - { - id: boolView - defaultValue: "1" - Component.onCompleted: - { - 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); - } - } - } - - Component - { - id: stringViewComp - QStringTypeView - { - id: stringView - text: styleData.value - } - } - - Component - { - id: hashViewComp - QHashTypeView - { - id: hashView - text: styleData.value - } - } Component { id: editor @@ -404,12 +493,7 @@ Window { readOnly: true color: styleData.textColor text: styleData.value - MouseArea { - id: mouseArea - anchors.fill: parent - hoverEnabled: true - onClicked: textinput.forceActiveFocus() - } + font.family: regularFont.name } } } diff --git a/mix/qml/qmldir b/mix/qml/qmldir index 819842274..0fefc3b29 100644 --- a/mix/qml/qmldir +++ b/mix/qml/qmldir @@ -1 +1,2 @@ singleton Style 1.0 Style.qml +singleton StateDialogStyle 1.0 StateDialogStyle.qml diff --git a/mix/res.qrc b/mix/res.qrc index a33323870..d05c3f5b1 100644 --- a/mix/res.qrc +++ b/mix/res.qrc @@ -83,5 +83,9 @@ 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 From 5ca7b3209f2ef9f8b24097502c45a0f533f06c47 Mon Sep 17 00:00:00 2001 From: debris Date: Wed, 11 Feb 2015 11:41:56 +0100 Subject: [PATCH 07/10] fixed transitive dependencies for msvc --- alethzero/CMakeLists.txt | 2 -- eth/CMakeLists.txt | 2 -- libdevcore/CMakeLists.txt | 7 ++++++- lllc/CMakeLists.txt | 2 -- mix/CMakeLists.txt | 2 -- solc/CMakeLists.txt | 2 -- test/CMakeLists.txt | 6 ------ third/CMakeLists.txt | 2 -- 8 files changed, 6 insertions(+), 19 deletions(-) diff --git a/alethzero/CMakeLists.txt b/alethzero/CMakeLists.txt index 2cd6f43a4..8f355def7 100644 --- a/alethzero/CMakeLists.txt +++ b/alethzero/CMakeLists.txt @@ -32,8 +32,6 @@ eth_add_executable(${EXECUTABLE} add_dependencies(${EXECUTABLE} BuildInfo.h) -target_link_libraries(${EXECUTABLE} ${Boost_CHRONO_LIBRARIES}) -target_link_libraries(${EXECUTABLE} ${Boost_DATE_TIME_LIBRARIES}) target_link_libraries(${EXECUTABLE} Qt5::Core) target_link_libraries(${EXECUTABLE} webthree) target_link_libraries(${EXECUTABLE} qwebthree) diff --git a/eth/CMakeLists.txt b/eth/CMakeLists.txt index bdd966bfc..31aa8df96 100644 --- a/eth/CMakeLists.txt +++ b/eth/CMakeLists.txt @@ -16,8 +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}) -target_link_libraries(${EXECUTABLE} ${Boost_CHRONO_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/lllc/CMakeLists.txt b/lllc/CMakeLists.txt index f41584e04..2e76aa6ff 100644 --- a/lllc/CMakeLists.txt +++ b/lllc/CMakeLists.txt @@ -13,8 +13,6 @@ add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) add_dependencies(${EXECUTABLE} BuildInfo.h) -target_link_libraries(${EXECUTABLE} ${Boost_DATE_TIME_LIBRARIES}) -target_link_libraries(${EXECUTABLE} ${Boost_CHRONO_LIBRARIES}) target_link_libraries(${EXECUTABLE} lll) target_link_libraries(${EXECUTABLE} evmcore) target_link_libraries(${EXECUTABLE} devcore) diff --git a/mix/CMakeLists.txt b/mix/CMakeLists.txt index 235c41b92..db9452061 100644 --- a/mix/CMakeLists.txt +++ b/mix/CMakeLists.txt @@ -34,8 +34,6 @@ eth_add_executable(${EXECUTABLE} UI_RESOURCES ${UI_RESOURCES} ) -target_link_libraries(${EXECUTABLE} ${Boost_DATE_TIME_LIBRARIES}) -target_link_libraries(${EXECUTABLE} ${Boost_CHRONO_LIBRARIES}) target_link_libraries(${EXECUTABLE} Qt5::Core) target_link_libraries(${EXECUTABLE} Qt5::Gui) target_link_libraries(${EXECUTABLE} Qt5::Widgets) diff --git a/solc/CMakeLists.txt b/solc/CMakeLists.txt index 96129c499..8c0ece27e 100644 --- a/solc/CMakeLists.txt +++ b/solc/CMakeLists.txt @@ -13,8 +13,6 @@ add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) target_link_libraries(${EXECUTABLE} ${Boost_FILESYSTEM_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${Boost_PROGRAM_OPTIONS_LIBRARIES}) -target_link_libraries(${EXECUTABLE} ${Boost_DATE_TIME_LIBRARIES}) -target_link_libraries(${EXECUTABLE} ${Boost_CHRONO_LIBRARIES}) target_link_libraries(${EXECUTABLE} solidity) install( TARGETS ${EXECUTABLE} DESTINATION bin ) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4d240a0ee..36876eea6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -16,8 +16,6 @@ add_executable(createRandomTest createRandomTest.cpp vm.cpp TestHelper.cpp) add_executable(checkRandomTest checkRandomTest.cpp vm.cpp TestHelper.cpp) target_link_libraries(testeth ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES}) -target_link_libraries(testeth ${Boost_DATE_TIME_LIBRARIES}) -target_link_libraries(testeth ${Boost_CHRONO_LIBRARIES}) target_link_libraries(testeth ${CURL_LIBRARIES}) target_link_libraries(testeth ethereum) target_link_libraries(testeth ethcore) @@ -32,13 +30,9 @@ if (JSONRPC) endif() target_link_libraries(createRandomTest ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES}) -target_link_libraries(createRandomTest ${Boost_DATE_TIME_LIBRARIES}) -target_link_libraries(createRandomTest ${Boost_CHRONO_LIBRARIES}) target_link_libraries(createRandomTest ethereum) target_link_libraries(createRandomTest ethcore) target_link_libraries(checkRandomTest ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES}) -target_link_libraries(checkRandomTest ${Boost_DATE_TIME_LIBRARIES}) -target_link_libraries(checkRandomTest ${Boost_CHRONO_LIBRARIES}) target_link_libraries(checkRandomTest ethereum) target_link_libraries(checkRandomTest ethcore) diff --git a/third/CMakeLists.txt b/third/CMakeLists.txt index db72cdebd..71f1e70f2 100644 --- a/third/CMakeLists.txt +++ b/third/CMakeLists.txt @@ -31,8 +31,6 @@ eth_add_executable(${EXECUTABLE} add_dependencies(${EXECUTABLE} BuildInfo.h) -target_link_libraries(${EXECUTABLE} ${Boost_DATE_TIME_LIBRARIES}) -target_link_libraries(${EXECUTABLE} ${Boost_CHRONO_LIBRARIES}) target_link_libraries(${EXECUTABLE} Qt5::Core) target_link_libraries(${EXECUTABLE} webthree) target_link_libraries(${EXECUTABLE} qwebthree) From 1966e57e396e33145b86ae41ba6776eb24030806 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 11 Feb 2015 13:37:32 +0100 Subject: [PATCH 08/10] Avoid making blocks with invalid timestamps. --- libethereum/State.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 785cde6492e83e803c8cac21daf59c6abf203e93 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 11 Feb 2015 15:51:59 +0100 Subject: [PATCH 09/10] StateDialog.qml / TransactionDialog.qml redesign TODO: refactor using Style.qml --- mix/qml/NewProjectDialog.qml | 4 +- mix/qml/QHashTypeView.qml | 2 + mix/qml/QIntTypeView.qml | 2 + mix/qml/QStringTypeView.qml | 2 + mix/qml/StateDialog.qml | 65 +++++++++----- mix/qml/StateListModel.qml | 1 + mix/qml/TransactionDialog.qml | 164 +++++++++++++++++----------------- 7 files changed, 132 insertions(+), 108 deletions(-) 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/QHashTypeView.qml b/mix/qml/QHashTypeView.qml index b97284a34..6f3c1910e 100644 --- a/mix/qml/QHashTypeView.qml +++ b/mix/qml/QHashTypeView.qml @@ -12,6 +12,8 @@ Item Rectangle { anchors.fill: parent + radius: 4 + color: "#f7f7f7" TextInput { id: textinput text: text diff --git a/mix/qml/QIntTypeView.qml b/mix/qml/QIntTypeView.qml index 6bf7f1aa7..00a08d819 100644 --- a/mix/qml/QIntTypeView.qml +++ b/mix/qml/QIntTypeView.qml @@ -12,6 +12,8 @@ Item Rectangle { anchors.fill: parent + radius: 4 + color: "#f7f7f7" TextInput { id: textinput text: text diff --git a/mix/qml/QStringTypeView.qml b/mix/qml/QStringTypeView.qml index 7f0059cc9..7e7d2ec76 100644 --- a/mix/qml/QStringTypeView.qml +++ b/mix/qml/QStringTypeView.qml @@ -12,6 +12,8 @@ Item Rectangle { anchors.fill: parent + radius: 4 + color: "#f7f7f7" TextInput { id: textinput text: text diff --git a/mix/qml/StateDialog.qml b/mix/qml/StateDialog.qml index 532d40857..886805cca 100644 --- a/mix/qml/StateDialog.qml +++ b/mix/qml/StateDialog.qml @@ -12,9 +12,9 @@ Window { id: modalStateDialog modality: Qt.WindowModal - width: 640 + width: 450 height: 480 - + title: qsTr("State Edition") visible: false color: StateDialogStyle.generic.backgroundColor @@ -36,10 +36,16 @@ 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; defaultCheckBox.enabled = !isDefault; + + } function close() { @@ -110,15 +116,43 @@ Window { ColumnLayout { - width: parent.width anchors.top: dialogContent.bottom anchors.topMargin: 5 spacing: 5 - Label { - text: qsTr("Transactions") - font.family: regularFont.name - color: "#808080" + RowLayout + { + Label { + text: qsTr("Transactions") + font.family: regularFont.name + color: "#808080" + } + + 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 @@ -129,22 +163,6 @@ Window { delegate: transactionRenderDelegate visible: transactionsModel.count > 0 } - - ToolButton { - onClicked: transactionsModel.addTransaction() - style: ButtonStyle - { - label: Text { - font.family: regularFont.name - text: qsTr("+") - font.pointSize: 20 - color: "#808080" - } - background: Rectangle { - color: "transparent" - } - } - } } RowLayout { @@ -260,5 +278,4 @@ Window { } } } - } 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 90e7e03ba..c2b531367 100644 --- a/mix/qml/TransactionDialog.qml +++ b/mix/qml/TransactionDialog.qml @@ -10,11 +10,11 @@ import "." Window { id: modalTransactionDialog modality: Qt.WindowModal - width: 640 - height: 700 + 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; @@ -66,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; } @@ -108,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; @@ -163,13 +175,16 @@ Window { id: regularFont } - ColumnLayout { - id: dialogContent - width: parent.width + Rectangle { + anchors.fill: parent anchors.left: parent.left anchors.right: parent.right anchors.top: parent.top anchors.margins: 10 + color: StateDialogStyle.generic.backgroundColor + + ColumnLayout { + id: dialogContent spacing: 30 RowLayout { @@ -257,64 +272,74 @@ Window { } } - //ColumnLayout - //{ - //Layout.fillHeight: true; - //Layout.fillWidth: true; - //visible: paramsModel.count > 0 - - Label { - text: qsTr("Parameters") - Layout.preferredWidth: 75 - font.family: regularFont.name - color: "#808080" - visible: paramsModel.count > 0 - } + Label { + text: qsTr("Parameters") + Layout.preferredWidth: 75 + font.family: regularFont.name + color: "#808080" + visible: paramsModel.count > 0 + } + ScrollView + { + Layout.fillWidth: true + visible: paramsModel.count > 0 + ColumnLayout + { + id: paramRepeater + Layout.fillWidth: true + spacing: 10 Repeater { + anchors.fill: parent model: paramsModel visible: paramsModel.count > 0 - Rectangle + RowLayout { - color: "transparent" + id: row Layout.fillWidth: true height: 150 + Label { id: typeLabel text: type + font.family: regularFont.name + Layout.preferredWidth: 50 } Label { - anchors.left: typeLabel.right id: nameLabel text: name + font.family: regularFont.name + Layout.preferredWidth: 50 } Label { - anchors.left: nameLabel.right id: equalLabel text: "=" + font.family: regularFont.name + Layout.preferredWidth: 15 } Loader { - anchors.left: equalLabel.right id: typeLoader - height: 50 - width: 150 + Layout.preferredHeight: 50 + Layout.preferredWidth: 150 + function getCurrent() + { + return modalTransactionDialog.param(name); + } + Connections { target: typeLoader.item onTextChanged: { - console.log("text changed 0 " + value); - value = typeLoader.item.text; - console.log("text changed 1 " + value); + typeLoader.getCurrent().value = typeLoader.item.text; } } sourceComponent: { - console.log(type); if (type.indexOf("int") !== -1) return intViewComp; else if (type.indexOf("bool") !== -1) @@ -335,7 +360,7 @@ Window { height: 50 width: 150 id: intView - text: value + text: typeLoader.getCurrent().value } } @@ -350,10 +375,8 @@ Window { defaultValue: "1" Component.onCompleted: { - /*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);*/ + var current = typeLoader.getCurrent().value; + (current === "" ? text = defaultValue : text = current); } } } @@ -366,7 +389,10 @@ Window { height: 50 width: 150 id: stringView - text: value + text: + { + return typeLoader.getCurrent().value + } } } @@ -378,61 +404,34 @@ Window { height: 50 width: 150 id: hashView - text: value + text: typeLoader.getCurrent().value } } } - } } - //} - - /*TableView { - model: paramsModel - Layout.fillWidth: true - 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(); + 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 } @@ -466,7 +465,6 @@ Window { sourceComponent: { - console.log("role " + styleData.role); if (styleData.role === "value") { if (paramsModel.get(styleData.row) === undefined) From ae5d53bc78a656f6dae92eee1e821589c17302c2 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 11 Feb 2015 17:32:49 +0100 Subject: [PATCH 10/10] fix indentation issues --- mix/qml/Ether.qml | 7 +- mix/qml/StateDialog.qml | 122 +++++---- mix/qml/TransactionDialog.qml | 452 +++++++++++++++------------------- 3 files changed, 257 insertions(+), 324 deletions(-) diff --git a/mix/qml/Ether.qml b/mix/qml/Ether.qml index 61727b848..f737b12b6 100644 --- a/mix/qml/Ether.qml +++ b/mix/qml/Ether.qml @@ -65,6 +65,7 @@ RowLayout { formattedValue.text = value.format(); } } + model: ListModel { id: unitsModel ListElement { text: "Uether"; } @@ -87,11 +88,11 @@ RowLayout { ListElement { text: "Kwei"; } ListElement { text: "wei"; } } - style: ComboBoxStyle - { - font: regularFont.name + style: ComboBoxStyle { + font: regularFont.name } } + Text { visible: displayFormattedValue diff --git a/mix/qml/StateDialog.qml b/mix/qml/StateDialog.qml index 886805cca..a8ac27ecf 100644 --- a/mix/qml/StateDialog.qml +++ b/mix/qml/StateDialog.qml @@ -44,8 +44,6 @@ Window { isDefault = setDefault; titleField.focus = true; defaultCheckBox.enabled = !isDefault; - - } function close() { @@ -67,8 +65,7 @@ Window { id: regularFont } - Rectangle - { + Rectangle { anchors.fill: parent anchors.margins: 10 color: StateDialogStyle.generic.backgroundColor @@ -114,8 +111,7 @@ Window { } } - ColumnLayout - { + ColumnLayout { anchors.top: dialogContent.bottom anchors.topMargin: 5 spacing: 5 @@ -132,27 +128,26 @@ Window { 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 + 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 @@ -165,26 +160,25 @@ Window { } } - 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(); } } -} - - - ListModel { id: transactionsModel @@ -229,17 +223,16 @@ Window { 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" - } + style: ButtonStyle { + label: Text { + font.family: regularFont.name + text: qsTr("Edit") + font.italic: true + font.pointSize: 9 + } + background: Rectangle { + color: "transparent" + } } } ToolButton { @@ -247,26 +240,27 @@ Window { 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" - } + 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) { diff --git a/mix/qml/TransactionDialog.qml b/mix/qml/TransactionDialog.qml index c2b531367..4b2b46cd2 100644 --- a/mix/qml/TransactionDialog.qml +++ b/mix/qml/TransactionDialog.qml @@ -183,228 +183,228 @@ Window { anchors.margins: 10 color: StateDialogStyle.generic.backgroundColor - ColumnLayout { - id: dialogContent - spacing: 30 - RowLayout - { - id: rowFunction - Layout.fillWidth: true - height: 150 - Label { - Layout.preferredWidth: 75 - text: qsTr("Function") - font.family: regularFont.name - color: "#808080" - } - ComboBox { - id: functionComboBox - Layout.preferredWidth: 350 - currentIndex: -1 - textRole: "text" - editable: false - model: ListModel { - id: functionsModel - } - onCurrentIndexChanged: { - loadParameters(); + ColumnLayout { + id: dialogContent + spacing: 30 + RowLayout + { + id: rowFunction + Layout.fillWidth: true + height: 150 + Label { + Layout.preferredWidth: 75 + text: qsTr("Function") + font.family: regularFont.name + color: "#808080" } - style: ComboBoxStyle - { - font: regularFont.name + 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 - height: 150 - Label { - Layout.preferredWidth: 75 - text: qsTr("Value") - font.family: regularFont.name - color: "#808080" - } - Ether { - id: valueField - edit: true - displayFormattedValue: true + 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 - height: 150 - Label { - Layout.preferredWidth: 75 - text: qsTr("Gas") - font.family: regularFont.name - color: "#808080" + 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 + } } - Ether { - id: gasField - edit: true - displayFormattedValue: true + + 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 - { - id: rowGasPrice - Layout.fillWidth: true - height: 150 Label { + text: qsTr("Parameters") Layout.preferredWidth: 75 - text: qsTr("Gas Price") font.family: regularFont.name color: "#808080" + visible: paramsModel.count > 0 } - Ether { - id: gasPriceField - edit: true - displayFormattedValue: true - } - } - - Label { - text: qsTr("Parameters") - Layout.preferredWidth: 75 - font.family: regularFont.name - color: "#808080" - visible: paramsModel.count > 0 - } - ScrollView - { - Layout.fillWidth: true - visible: paramsModel.count > 0 - ColumnLayout + ScrollView { - id: paramRepeater Layout.fillWidth: true - spacing: 10 - Repeater + visible: paramsModel.count > 0 + ColumnLayout { - anchors.fill: parent - model: paramsModel - visible: paramsModel.count > 0 - RowLayout + id: paramRepeater + Layout.fillWidth: true + spacing: 10 + Repeater { - 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 + anchors.fill: parent + model: paramsModel + visible: paramsModel.count > 0 + RowLayout { - id: typeLoader - Layout.preferredHeight: 50 - Layout.preferredWidth: 150 - function getCurrent() - { - return modalTransactionDialog.param(name); + id: row + Layout.fillWidth: true + height: 150 + + Label { + id: typeLabel + text: type + font.family: regularFont.name + Layout.preferredWidth: 50 } - Connections { - target: typeLoader.item - onTextChanged: { - typeLoader.getCurrent().value = typeLoader.item.text; - } + Label { + id: nameLabel + text: name + font.family: regularFont.name + Layout.preferredWidth: 50 } - 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; + Label { + id: equalLabel + text: "=" + font.family: regularFont.name + Layout.preferredWidth: 15 } - Component + Loader { - id: intViewComp - QIntTypeView + id: typeLoader + Layout.preferredHeight: 50 + Layout.preferredWidth: 150 + function getCurrent() { - height: 50 - width: 150 - id: intView - text: typeLoader.getCurrent().value + return modalTransactionDialog.param(name); } - } - Component - { - id: boolViewComp - QBoolTypeView + Connections { + target: typeLoader.item + onTextChanged: { + typeLoader.getCurrent().value = typeLoader.item.text; + } + } + + sourceComponent: { - height: 50 - width: 150 - id: boolView - defaultValue: "1" - Component.onCompleted: + 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 { - var current = typeLoader.getCurrent().value; - (current === "" ? text = defaultValue : text = current); + height: 50 + width: 150 + id: intView + text: typeLoader.getCurrent().value } } - } - Component - { - id: stringViewComp - QStringTypeView + Component { - height: 50 - width: 150 - id: stringView - text: + id: boolViewComp + QBoolTypeView { - return typeLoader.getCurrent().value + height: 50 + width: 150 + id: boolView + defaultValue: "1" + Component.onCompleted: + { + var current = typeLoader.getCurrent().value; + (current === "" ? text = defaultValue : text = current); + } } } - } - Component - { - id: hashViewComp - QHashTypeView + Component { - height: 50 - width: 150 - id: hashView - text: typeLoader.getCurrent().value + 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 + } } } } @@ -412,89 +412,27 @@ Window { } } } - } - 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(); } } -} + 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: editor - TextInput { - id: textinput - readOnly: true - color: styleData.textColor - text: styleData.value - font.family: regularFont.name - } - } - } - } - } }