diff --git a/alethzero/Connect.cpp b/alethzero/Connect.cpp index cf19f83b8..32fa74f38 100644 --- a/alethzero/Connect.cpp +++ b/alethzero/Connect.cpp @@ -1,18 +1,18 @@ /* - This file is part of cpp-ethereum. + 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 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. + 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 . + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . */ /** @file Connect.cpp * @author Alex Leverington @@ -25,15 +25,15 @@ #include "ui_Connect.h" Connect::Connect(QWidget *parent) : - QDialog(parent), - ui(new Ui::Connect) + QDialog(parent), + ui(new Ui::Connect) { - ui->setupUi(this); + ui->setupUi(this); } Connect::~Connect() { - delete ui; + delete ui; } void Connect::setEnvironment(QStringList const& _nodes) diff --git a/alethzero/Connect.h b/alethzero/Connect.h index d8059acd4..89b25617c 100644 --- a/alethzero/Connect.h +++ b/alethzero/Connect.h @@ -1,18 +1,18 @@ /* - This file is part of cpp-ethereum. + 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 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. + 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 . + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . */ /** @file Connect.h * @author Alex Leverington @@ -29,22 +29,23 @@ namespace dev { namespace p2p { class Host; } } class Connect : public QDialog { - Q_OBJECT + Q_OBJECT public: - explicit Connect(QWidget *parent = 0); - ~Connect(); + explicit Connect(QWidget* _parent = 0); + ~Connect(); - void setEnvironment(QStringList const& _nodes); - + void setEnvironment(QStringList const& _nodes); + + /// clear dialogue inputs void reset(); + + // Form field values: QString host(); - QString nodeId(); - bool required(); - + private: - Ui::Connect *ui; + Ui::Connect* ui; }; diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index eb09d4991..712318442 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -252,30 +252,30 @@ void Main::addNewId(QString _ids) NetworkPreferences Main::netPrefs() const { - auto listenip = ui->listenIP->text().toStdString(); + auto listenIP = ui->listenIP->text().toStdString(); try { - listenip = bi::address::from_string(listenip).to_string(); + listenIP = bi::address::from_string(listenIP).to_string(); } catch (...) { - listenip = ""; + listenIP = ""; } - auto publicip = ui->forcePublicIP->text().toStdString(); + auto publicIP = ui->forcePublicIP->text().toStdString(); try { - publicip = bi::address::from_string(publicip).to_string(); + publicIP = bi::address::from_string(publicIP).to_string(); } catch (...) { - publicip = ""; + publicIP = ""; } - if (isPublicAddress(publicip)) - return NetworkPreferences(publicip, ui->listenIP->text().toStdString(), ui->port->value(), ui->upnp->isChecked()); + if (isPublicAddress(publicIP)) + return NetworkPreferences(publicIP, ui->listenIP->text().toStdString(), ui->port->value(), ui->upnp->isChecked()); else - return NetworkPreferences(listenip, ui->port->value(), ui->upnp->isChecked()); + return NetworkPreferences(listenIP, ui->port->value(), ui->upnp->isChecked()); } void Main::onKeysChanged() @@ -1790,21 +1790,20 @@ void Main::on_connect_triggered() if (m_connect.exec() == QDialog::Accepted) { bool required = m_connect.required(); - string host(m_connect.host().toUtf8().constData()); - NodeId nodeid; + string host(m_connect.host().toStdString()); + NodeId nodeID; try { - string nstr(m_connect.nodeId().toUtf8().constData()); - nodeid = NodeId(fromHex(nstr)); + nodeID = NodeId(fromHex(m_connect.nodeId().toStdString())); } catch (BadHexCharacter()) {} m_connect.reset(); if (required) - web3()->requirePeer(nodeid, host); + web3()->requirePeer(nodeID, host); else - web3()->addNode(nodeid, host); + web3()->addNode(nodeID, host); } } diff --git a/libp2p/NodeTable.cpp b/libp2p/NodeTable.cpp index 7b9852672..407b99942 100644 --- a/libp2p/NodeTable.cpp +++ b/libp2p/NodeTable.cpp @@ -555,8 +555,8 @@ void NodeTable::doRefreshBuckets(boost::system::error_code const& _ec) if (connected) { NodeId randNodeId; - crypto::Nonce::get().ref().copyTo(randNodeId.ref().cropped(0,h256::size)); - crypto::Nonce::get().ref().copyTo(randNodeId.ref().cropped(h256::size,h256::size)); + crypto::Nonce::get().ref().copyTo(randNodeId.ref().cropped(0, h256::size)); + crypto::Nonce::get().ref().copyTo(randNodeId.ref().cropped(h256::size, h256::size)); discover(randNodeId); }