Browse Source

remove unnecessary _ptrs

cl-refactor
subtly 10 years ago
parent
commit
742078fe22
  1. 21
      alethzero/MainWin.cpp
  2. 2
      alethzero/MainWin.h

21
alethzero/MainWin.cpp

@ -146,22 +146,21 @@ Main::Main(QWidget *parent) :
m_client.reset(new Client("AlethZero"));
m_client->start();
m_ethereum.reset(new QEthereum(this, this->m_client.get(), this->owned()));
shared_ptr<Main>qmain(this);
shared_ptr<QEthereum>qeth(m_ethereum.get());
connect(ui->webView, &QWebView::loadStarted, [qmain, qeth]()
connect(ui->webView, &QWebView::loadStarted, [this]()
{
Main::Main *self = qmain.get();
QEthereum *eth = new QEthereum(self, self->m_client.get(), self->owned());
connect(self, SIGNAL(changed()), eth, SIGNAL(changed()));
QEthereum *eth = new QEthereum(this, this->m_client.get(), this->owned());
this->m_ethereum = eth;
connect(this, SIGNAL(changed()), this->m_ethereum, SIGNAL(changed()));
QWebFrame* f = self->ui->webView->page()->mainFrame();
QWebFrame* f = this->ui->webView->page()->mainFrame();
f->disconnect(SIGNAL(javaScriptWindowObjectCleared()));
connect(f, &QWebFrame::javaScriptWindowObjectCleared, [f, eth, self]()
eth->setup(f);
f->addToJavaScriptWindowObject("env", this, QWebFrame::QtOwnership);
connect(f, &QWebFrame::javaScriptWindowObjectCleared, [f, eth, this]()
{
f->disconnect();
f->addToJavaScriptWindowObject("env", self, QWebFrame::QtOwnership);
f->addToJavaScriptWindowObject("env", this, QWebFrame::QtOwnership);
f->addToJavaScriptWindowObject("eth", eth, QWebFrame::ScriptOwnership);
f->evaluateJavaScript("eth.watch = function(a, s, f) { eth.changed.connect(f ? f : s) }");
f->evaluateJavaScript("eth.newBlock = function(f) { eth.changed.connect(f) }");

2
alethzero/MainWin.h

@ -201,5 +201,5 @@ private:
QList<QPair<QString, QString>> m_consoleHistory;
std::unique_ptr<QEthereum> m_ethereum;
QEthereum* m_ethereum;
};

Loading…
Cancel
Save