From 742078fe221988d9445b559efc04e428125bca92 Mon Sep 17 00:00:00 2001 From: subtly Date: Mon, 21 Jul 2014 06:49:54 -0600 Subject: [PATCH] remove unnecessary _ptrs --- alethzero/MainWin.cpp | 21 ++++++++++----------- alethzero/MainWin.h | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 8856d7175..75749f7a5 100644 --- a/alethzero/MainWin.cpp +++ b/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
qmain(this); - shared_ptrqeth(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) }"); diff --git a/alethzero/MainWin.h b/alethzero/MainWin.h index dc717a230..4484cf70b 100644 --- a/alethzero/MainWin.h +++ b/alethzero/MainWin.h @@ -201,5 +201,5 @@ private: QList> m_consoleHistory; - std::unique_ptr m_ethereum; + QEthereum* m_ethereum; };