Browse Source

removed unused code

cl-refactor
Marek Kotewicz 10 years ago
parent
commit
b3eec4bac3
  1. 8
      alethzero/MainWin.cpp
  2. 6
      alethzero/MainWin.h
  3. 21
      alethzero/OurWebThreeStubServer.cpp
  4. 4
      alethzero/OurWebThreeStubServer.h

8
alethzero/MainWin.cpp

@ -48,7 +48,6 @@
#include <libethereum/EthereumHost.h> #include <libethereum/EthereumHost.h>
#include <libethereum/DownloadMan.h> #include <libethereum/DownloadMan.h>
#include <libweb3jsonrpc/WebThreeStubServer.h> #include <libweb3jsonrpc/WebThreeStubServer.h>
#include <libweb3jsonrpc/CorsHttpServer.h>
#include "MainWin.h" #include "MainWin.h"
#include "DownloadView.h" #include "DownloadView.h"
#include "MiningView.h" #include "MiningView.h"
@ -159,7 +158,6 @@ Main::Main(QWidget *parent) :
m_webThree.reset(new WebThreeDirect(string("AlethZero/v") + dev::Version + "/" DEV_QUOTED(ETH_BUILD_TYPE) "/" DEV_QUOTED(ETH_BUILD_PLATFORM), getDataDir() + "/AlethZero", false, {"eth", "shh"})); m_webThree.reset(new WebThreeDirect(string("AlethZero/v") + dev::Version + "/" DEV_QUOTED(ETH_BUILD_TYPE) "/" DEV_QUOTED(ETH_BUILD_PLATFORM), getDataDir() + "/AlethZero", false, {"eth", "shh"}));
m_qwebConnector.reset(new QWebThreeConnector()); m_qwebConnector.reset(new QWebThreeConnector());
// m_httpConnector.reset(new jsonrpc::CorsHttpServer(8080));
m_server.reset(new OurWebThreeStubServer(*m_qwebConnector, *web3(), keysAsVector(m_myKeys), this)); m_server.reset(new OurWebThreeStubServer(*m_qwebConnector, *web3(), keysAsVector(m_myKeys), this));
connect(&*m_server, SIGNAL(onNewId(QString)), SLOT(addNewId(QString))); connect(&*m_server, SIGNAL(onNewId(QString)), SLOT(addNewId(QString)));
m_server->setIdentities(keysAsVector(owned())); m_server->setIdentities(keysAsVector(owned()));
@ -436,12 +434,6 @@ QVariant Main::evalRaw(QString const& _js)
return ui->webView->page()->currentFrame()->evaluateJavaScript(_js); return ui->webView->page()->currentFrame()->evaluateJavaScript(_js);
} }
void Main::addToWindowObject(QObject* _object, QString const& _name)
{
QWebFrame* f = ui->webView->page()->mainFrame();
f->addToJavaScriptWindowObject(_name, _object, QWebFrame::QtOwnership);
}
void Main::eval(QString const& _js) void Main::eval(QString const& _js)
{ {
if (_js.trimmed().isEmpty()) if (_js.trimmed().isEmpty())

6
alethzero/MainWin.h

@ -49,10 +49,6 @@ class Client;
class State; class State;
}} }}
namespace jsonrpc {
class CorsHttpServer;
}
class QQuickView; class QQuickView;
class OurWebThreeStubServer; class OurWebThreeStubServer;
@ -95,7 +91,6 @@ public:
QList<dev::KeyPair> owned() const { return m_myIdentities + m_myKeys; } QList<dev::KeyPair> owned() const { return m_myIdentities + m_myKeys; }
QVariant evalRaw(QString const& _js); QVariant evalRaw(QString const& _js);
void addToWindowObject(QObject* _object, QString const& _name);
public slots: public slots:
void load(QString _file); void load(QString _file);
@ -284,7 +279,6 @@ private:
bool m_logChanged = true; bool m_logChanged = true;
std::unique_ptr<QWebThreeConnector> m_qwebConnector; std::unique_ptr<QWebThreeConnector> m_qwebConnector;
// std::unique_ptr<jsonrpc::CorsHttpServer> m_httpConnector;
std::unique_ptr<OurWebThreeStubServer> m_server; std::unique_ptr<OurWebThreeStubServer> m_server;
QWebThree* m_qweb = nullptr; QWebThree* m_qweb = nullptr;

21
alethzero/OurWebThreeStubServer.cpp

@ -87,31 +87,10 @@ QNatspecExpressionEvaluator::QNatspecExpressionEvaluator(OurWebThreeStubServer*
QNatspecExpressionEvaluator::~QNatspecExpressionEvaluator() QNatspecExpressionEvaluator::~QNatspecExpressionEvaluator()
{} {}
QString QNatspecExpressionEvaluator::stateAt(QString _key)
{
(void)_key;
return "1";
}
QString QNatspecExpressionEvaluator::call(QString _json)
{
QJsonObject jsonObject = QJsonDocument::fromJson(_json.toUtf8()).object();
Json::Value input;
input["to"] = jsonObject["to"].toString().toStdString();
input["data"] = jsonObject["data"].toString().toStdString();
return QString::fromStdString(m_server->eth_call(input));
}
QString QNatspecExpressionEvaluator::sha3(QString _method)
{
return QString::fromStdString(m_server->web3_sha3(_method.toStdString()));
}
QString QNatspecExpressionEvaluator::evalExpression(QString const& _expression) QString QNatspecExpressionEvaluator::evalExpression(QString const& _expression)
{ {
// evaluate the natspec // evaluate the natspec
m_main->addToWindowObject(this, "_natspec");
m_main->evalRaw(contentsOfQResource(":/js/natspec.js")); m_main->evalRaw(contentsOfQResource(":/js/natspec.js"));
(void)_expression; (void)_expression;

4
alethzero/OurWebThreeStubServer.h

@ -58,10 +58,6 @@ public:
QString evalExpression(QString const& _expression); QString evalExpression(QString const& _expression);
Q_INVOKABLE QString stateAt(QString _key);
Q_INVOKABLE QString call(QString _json);
Q_INVOKABLE QString sha3(QString _method);
private: private:
OurWebThreeStubServer* m_server; OurWebThreeStubServer* m_server;
Main* m_main; Main* m_main;

Loading…
Cancel
Save