Browse Source

style

cl-refactor
subtly 10 years ago
parent
commit
521bf5b384
  1. 7
      alethzero/Connect.h
  2. 29
      alethzero/MainWin.cpp

7
alethzero/Connect.h

@ -32,17 +32,18 @@ class Connect : public QDialog
Q_OBJECT
public:
explicit Connect(QWidget *parent = 0);
explicit Connect(QWidget* _parent = 0);
~Connect();
void setEnvironment(QStringList const& _nodes);
/// clear dialogue inputs
void reset();
QString host();
// Form field values:
QString host();
QString nodeId();
bool required();
private:

29
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);
}
}

Loading…
Cancel
Save