Browse Source

changes populated to third

cl-refactor
Marek Kotewicz 10 years ago
parent
commit
64acc3c9e6
  1. 1
      alethzero/MainWin.h
  2. 1
      libwebthree/WebThree.h
  3. 1
      third/CMakeLists.txt
  4. 35
      third/MainWin.cpp
  5. 8
      third/MainWin.h

1
alethzero/MainWin.h

@ -76,7 +76,6 @@ public:
dev::WebThreeDirect* web3() const { return m_webThree.get(); }
dev::eth::Client* ethereum() const { return m_webThree->ethereum(); }
dev::p2p::Host* peer2peer() const { return m_webThree->peer2peer(); }
std::shared_ptr<dev::shh::WhisperHost> whisper() const { return m_webThree->whisper(); }
QList<dev::KeyPair> const& owned() const { return m_myKeys; }

1
libwebthree/WebThree.h

@ -76,7 +76,6 @@ public:
eth::Client* ethereum() const { if (!m_ethereum) BOOST_THROW_EXCEPTION(InterfaceNotSupported("eth")); return m_ethereum.get(); }
std::shared_ptr<shh::WhisperHost> whisper() const { auto w = m_whisper.lock(); if (!w) BOOST_THROW_EXCEPTION(InterfaceNotSupported("shh")); return w; }
bzz::Interface* swarm() const { BOOST_THROW_EXCEPTION(InterfaceNotSupported("bzz")); }
p2p::Host* peer2peer() { return &m_net; };
// Misc stuff:

1
third/CMakeLists.txt

@ -54,6 +54,7 @@ endif ()
qt5_use_modules(${EXECUTEABLE} Core)# Gui Widgets Network WebKit WebKitWidgets)
target_link_libraries(${EXECUTEABLE} webthree qethereum ethereum evm ethcore secp256k1 gmp ${CRYPTOPP_LS} serpent lll evmface devcore)
target_link_libraries(${EXECUTEABLE} ethrpc)
if (APPLE)
# First have qt5 install plugins and frameworks

35
third/MainWin.cpp

@ -39,6 +39,7 @@
#include <libethereum/Client.h>
#include <libethereum/EthereumHost.h>
#include <libwebthree/WebThree.h>
#include <libethrpc/WebThreeStubServer.h>
#include "BuildInfo.h"
#include "MainWin.h"
#include "ui_Main.h"
@ -105,23 +106,22 @@ Main::Main(QWidget *parent) :
connect(ui->webView, &QWebView::loadStarted, [this]()
{
// NOTE: no need to delete as QETH_INSTALL_JS_NAMESPACE adopts it.
m_dev = new QDev(this);
m_ethereum = new QEthereum(this, ethereum(), owned());
m_whisper = new QWhisper(this, whisper());
m_p2p = new QPeer2Peer(this, peer2peer());
m_qweb = new QWebThree(this);
auto qweb = m_qweb;
QWebFrame* f = ui->webView->page()->mainFrame();
f->disconnect(SIGNAL(javaScriptWindowObjectCleared()));
auto qdev = m_dev;
auto qeth = m_ethereum;
auto qshh = m_whisper;
auto qp2p = m_p2p;
connect(f, &QWebFrame::javaScriptWindowObjectCleared, QETH_INSTALL_JS_NAMESPACE(f, this, qdev, qeth, qshh, qp2p));
auto list = owned().toStdList();
m_server = auto_ptr<WebThreeStubServer>(new WebThreeStubServer(new QWebThreeConnector(qweb), *web3(), {std::begin(list), std::end(list)}));
m_server->StartListening();
connect(f, &QWebFrame::javaScriptWindowObjectCleared, QETH_INSTALL_JS_NAMESPACE(f, this, qweb));
});
connect(ui->webView, &QWebView::loadFinished, [=]()
{
m_ethereum->poll();
// m_ethereum->poll();
});
connect(ui->webView, &QWebView::titleChanged, [=]()
@ -149,7 +149,7 @@ Main::~Main()
{
// Must do this here since otherwise m_ethereum'll be deleted (and therefore clearWatches() called by the destructor)
// *after* the client is dead.
m_ethereum->clientDieing();
// m_ethereum->clientDieing();
writeSettings();
}
@ -159,11 +159,6 @@ eth::Client* Main::ethereum() const
return m_web3->ethereum();
}
dev::p2p::Host* Main::peer2peer() const
{
return web3()->peer2peer();
}
std::shared_ptr<dev::shh::WhisperHost> Main::whisper() const
{
return m_web3->whisper();
@ -527,8 +522,8 @@ void Main::timerEvent(QTimerEvent*)
else
interval += 100;
if (m_ethereum)
m_ethereum->poll();
// if (m_ethereum)
// m_ethereum->poll();
for (auto const& i: m_handlers)
if (ethereum()->checkWatch(i.first))
@ -547,8 +542,8 @@ void Main::ourAccountsRowsMoved()
myKeys.push_back(i);
}
m_myKeys = myKeys;
if (m_ethereum)
m_ethereum->setAccounts(myKeys);
// if (m_ethereum)
// m_ethereum->setAccounts(myKeys);
}
void Main::on_ourAccounts_doubleClicked()

8
third/MainWin.h

@ -48,6 +48,7 @@ class WhisperHost;
}
class QQuickView;
class WebThreeStubServer;
class Main : public QMainWindow
{
@ -59,7 +60,6 @@ public:
dev::WebThreeDirect* web3() const { return m_web3.get(); }
dev::eth::Client* ethereum() const;
dev::p2p::Host* peer2peer() const;
std::shared_ptr<dev::shh::WhisperHost> whisper() const;
QList<dev::KeyPair> const& owned() const { return m_myKeys; }
@ -133,8 +133,6 @@ private:
QNetworkAccessManager m_webCtrl;
QDev* m_dev = nullptr;
QEthereum* m_ethereum = nullptr;
QWhisper* m_whisper = nullptr;
QPeer2Peer* m_p2p = nullptr;
std::auto_ptr<WebThreeStubServer> m_server;
QWebThree* m_qweb = nullptr;
};

Loading…
Cancel
Save