From 2c93677d81664af1682168c21bd32144e0337f3d Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Thu, 5 Feb 2015 16:30:59 +0100 Subject: [PATCH] removed QNatspec... --- alethzero/CMakeLists.txt | 1 + alethzero/OurWebThreeStubServer.cpp | 30 ++--------------------------- alethzero/OurWebThreeStubServer.h | 16 --------------- 3 files changed, 3 insertions(+), 44 deletions(-) diff --git a/alethzero/CMakeLists.txt b/alethzero/CMakeLists.txt index 219a8cb99..9302743c7 100644 --- a/alethzero/CMakeLists.txt +++ b/alethzero/CMakeLists.txt @@ -47,6 +47,7 @@ target_link_libraries(${EXECUTABLE} evmcore) target_link_libraries(${EXECUTABLE} devcore) target_link_libraries(${EXECUTABLE} web3jsonrpc) target_link_libraries(${EXECUTABLE} jsqrc) +target_link_libraries(${EXECUTABLE} natspec) # eth_install_executable is defined in cmake/EthExecutableHelper.cmake eth_install_executable(${EXECUTABLE}) diff --git a/alethzero/OurWebThreeStubServer.cpp b/alethzero/OurWebThreeStubServer.cpp index 37d37bce1..02d7236df 100644 --- a/alethzero/OurWebThreeStubServer.cpp +++ b/alethzero/OurWebThreeStubServer.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include "MainWin.h" @@ -84,36 +85,9 @@ bool OurWebThreeStubServer::authenticate(TransactionSkeleton const& _t) return showAuthenticationPopup("Unverified Pending Transaction", "An undocumented transaction is about to be executed."); - QNatspecExpressionEvaluator evaluator(this, m_main); + NatspecExpressionEvaluator evaluator; userNotice = evaluator.evalExpression(QString::fromStdString(userNotice)).toStdString(); // otherwise it's a transaction to a contract for which we have the natspec return showAuthenticationPopup("Pending Transaction", userNotice); } - -QNatspecExpressionEvaluator::QNatspecExpressionEvaluator(OurWebThreeStubServer* _server, Main* _main) -: m_server(_server), m_main(_main) -{} - -QNatspecExpressionEvaluator::~QNatspecExpressionEvaluator() -{} - -QString QNatspecExpressionEvaluator::evalExpression(QString const& _expression) const -{ - // load natspec.js only when we need it for natspec evaluation - m_main->evalRaw(contentsOfQResource(":/js/natspec.js")); - QVariant result = m_main->evalRaw("evaluateExpression('" + _expression + "')"); - if (result.type() == QVariant::Invalid) - { - cerr << "Could not evaluate natspec expression: \"" << _expression.toStdString() << "\"" << endl; - // return the expression unevaluated - return _expression; - } - return result.toString(); -} - - - - - - diff --git a/alethzero/OurWebThreeStubServer.h b/alethzero/OurWebThreeStubServer.h index 16981f9e1..303b73111 100644 --- a/alethzero/OurWebThreeStubServer.h +++ b/alethzero/OurWebThreeStubServer.h @@ -47,19 +47,3 @@ private: dev::WebThreeDirect* m_web3; Main* m_main; }; - - -class QNatspecExpressionEvaluator: public QObject -{ - Q_OBJECT - -public: - QNatspecExpressionEvaluator(OurWebThreeStubServer* _server, Main* _main); - virtual ~QNatspecExpressionEvaluator(); - - QString evalExpression(QString const& _expression) const; - -private: - OurWebThreeStubServer* m_server; - Main* m_main; -};