From a51e49381d1ec75dea5bfa7af1f1a5de86702819 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Thu, 23 Oct 2014 02:44:06 +0200 Subject: [PATCH] common style changes --- alethzero/MainWin.cpp | 8 ++------ libqethereum/QEthereum.cpp | 34 ++++++++++++++++++++++++---------- libqethereum/QEthereum.h | 35 ++++++++++++++++++++++++++--------- 3 files changed, 52 insertions(+), 25 deletions(-) diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 0831e4db6..c68f79c0a 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -136,16 +136,12 @@ Main::Main(QWidget *parent) : connect(ui->webView, &QWebView::loadStarted, [this]() { // NOTE: no need to delete as QETH_INSTALL_JS_NAMESPACE adopts it. - + m_qweb = new QWebThree(this); + auto qweb = m_qweb; QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); QWebFrame* f = ui->webView->page()->mainFrame(); f->disconnect(SIGNAL(javaScriptWindowObjectCleared())); - - m_qweb = new QWebThree(this); - - - auto qweb = m_qweb; auto list = owned().toStdList(); m_server = auto_ptr(new WebThreeStubServer(new QWebThreeConnector(qweb), *web3(), {std::begin(list), std::end(list)})); diff --git a/libqethereum/QEthereum.cpp b/libqethereum/QEthereum.cpp index ca7bde290..a9b6a32ef 100644 --- a/libqethereum/QEthereum.cpp +++ b/libqethereum/QEthereum.cpp @@ -1,17 +1,30 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file QEthereum.cpp + * @authors: + * Gav Wood + * Marek Kotewicz + * @date 2014 + */ + #include -#include -#include -#include -#include -#include -#include -#include #include "QEthereum.h" using namespace std; -using namespace dev; -using namespace dev::eth; - QWebThree::QWebThree(QObject* _p): QObject(_p) { @@ -66,6 +79,7 @@ bool QWebThreeConnector::StopListening() bool QWebThreeConnector::SendResponse(std::string const& _response, void* _addInfo) { + Q_UNUSED(_addInfo); emit m_qweb->send(QString::fromStdString(_response)); return true; } diff --git a/libqethereum/QEthereum.h b/libqethereum/QEthereum.h index 176978944..95596deac 100644 --- a/libqethereum/QEthereum.h +++ b/libqethereum/QEthereum.h @@ -1,10 +1,30 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file QEthereum.h + * @authors: + * Gav Wood + * Marek Kotewicz + * @date 2014 + */ + #pragma once #include -#include -#include -#include -#include +#include #include class QWebThree: public QObject @@ -33,8 +53,7 @@ public: virtual bool StartListening(); virtual bool StopListening(); - bool virtual SendResponse(std::string const& _response, - void* _addInfo = NULL); + bool virtual SendResponse(std::string const& _response, void* _addInfo = NULL); public slots: void onMessage(QString const& _json); @@ -43,8 +62,6 @@ private: QWebThree* m_qweb; }; - -// TODO: p2p object condition #define QETH_INSTALL_JS_NAMESPACE(_frame, _env, qweb) [_frame, _env, qweb]() \ { \ _frame->disconnect(); \ @@ -61,7 +78,7 @@ private: _frame->evaluateJavaScript("navigator.qt.send.connect(function (res) {" \ "navigator.qt.handlers.forEach(function (handler) {" \ " handler(res);" \ - "})" \ + "})" \ "})"); \ }