diff --git a/alethzero/Connect.h b/alethzero/Connect.h index 89b25617c..917c98d67 100644 --- a/alethzero/Connect.h +++ b/alethzero/Connect.h @@ -35,17 +35,21 @@ public: explicit Connect(QWidget* _parent = 0); ~Connect(); + /// Populate host chooser with default host entries void setEnvironment(QStringList const& _nodes); /// clear dialogue inputs void reset(); - // Form field values: - + /// @returns host string chosen or entered QString host(); + + /// @returns NodeId entered QString nodeId(); + + /// @returns true if Required is checked bool required(); private: - Ui::Connect* ui; + Ui::Connect* ui; }; diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 1784fbf96..0de7e2cb8 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -259,7 +259,7 @@ NetworkPreferences Main::netPrefs() const } catch (...) { - listenIP = ""; + listenIP.clear(); } auto publicIP = ui->forcePublicIP->text().toStdString(); @@ -269,11 +269,11 @@ NetworkPreferences Main::netPrefs() const } catch (...) { - publicIP = ""; + publicIP.clear(); } if (isPublicAddress(publicIP)) - return NetworkPreferences(publicIP, ui->listenIP->text().toStdString(), ui->port->value(), ui->upnp->isChecked()); + return NetworkPreferences(publicIP, listenIP, ui->port->value(), ui->upnp->isChecked()); else return NetworkPreferences(listenIP, ui->port->value(), ui->upnp->isChecked()); } @@ -1796,7 +1796,7 @@ void Main::on_connect_triggered() { nodeID = NodeId(fromHex(m_connect.nodeId().toStdString())); } - catch (BadHexCharacter()) {} + catch (BadHexCharacter&) {} m_connect.reset(); diff --git a/libp2p/Network.h b/libp2p/Network.h index 4185cfea5..d02ce3cbe 100644 --- a/libp2p/Network.h +++ b/libp2p/Network.h @@ -43,10 +43,10 @@ struct NetworkPreferences NetworkPreferences(unsigned short lp = 30303): listenPort(lp) {} // Network Preferences with specific Listen IP - NetworkPreferences(std::string l, unsigned short lp = 30303, bool u = true): publicIPAddress(), listenIPAddress(l), listenPort(lp), traverseNAT(u) {} + NetworkPreferences(std::string const& l, unsigned short lp = 30303, bool u = true): publicIPAddress(), listenIPAddress(l), listenPort(lp), traverseNAT(u) {} // Network Preferences with intended Public IP - NetworkPreferences(std::string publicIP, std::string l = std::string(), unsigned short lp = 30303, bool u = true): publicIPAddress(publicIP), listenIPAddress(l), listenPort(lp), traverseNAT(u) { if (!publicIPAddress.empty() && !isPublicAddress(publicIPAddress)) BOOST_THROW_EXCEPTION(InvalidPublicIPAddress()); } + NetworkPreferences(std::string const& publicIP, std::string const& l = std::string(), unsigned short lp = 30303, bool u = true): publicIPAddress(publicIP), listenIPAddress(l), listenPort(lp), traverseNAT(u) { if (!publicIPAddress.empty() && !isPublicAddress(publicIPAddress)) BOOST_THROW_EXCEPTION(InvalidPublicIPAddress()); } std::string publicIPAddress; std::string listenIPAddress;