Browse Source

More UI power.

cl-refactor
Gav Wood 11 years ago
parent
commit
03c70793a1
  1. 2
      CMakeLists.txt
  2. 95
      alethzero/Main.ui
  3. 16
      alethzero/MainWin.cpp
  4. 1
      alethzero/MainWin.h
  5. 5
      eth/main.cpp
  6. 4
      libethereum/Client.h

2
CMakeLists.txt

@ -5,7 +5,7 @@ set(CMAKE_AUTOMOC ON)
cmake_policy(SET CMP0015 NEW)
set(ETH_VERSION 0.1.1)
set(ETH_VERSION 0.1.2)
set(ETH_BUILD_TYPE ${CMAKE_BUILD_TYPE})
set(ETH_BUILD_PLATFORM ${CMAKE_SYSTEM_NAME})
if (CMAKE_COMPILER_IS_MINGW)

95
alethzero/Main.ui

@ -139,44 +139,77 @@
<number>2</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_3">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>4</number>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="peers">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QListWidget" name="peers">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
</widget>
<widget class="QWidget" name="">
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Listen on</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="idealPeers">
<property name="minimum">
<number>1</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Ideal Peers</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="port">
<property name="minimum">
<number>1024</number>
</property>
<property name="maximum">
<number>32767</number>
</property>
<property name="value">
<number>30303</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Client Name</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="clientName">
<property name="placeholderText">
<string>Anonymous</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Listen on</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="port">
<property name="minimum">
<number>1024</number>
</property>
<property name="maximum">
<number>32767</number>
</property>
<property name="value">
<number>30303</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>

16
alethzero/MainWin.cpp

@ -25,7 +25,7 @@ Main::Main(QWidget *parent) :
setWindowFlags(Qt::Window);
ui->setupUi(this);
g_logPost = [=](std::string const& s, char const*) { ui->log->addItem(QString::fromStdString(s)); };
m_client = new Client("AlethZero/v" ADD_QUOTES(ETH_VERSION) "/" ADD_QUOTES(ETH_BUILD_TYPE) "/" ADD_QUOTES(ETH_BUILD_PLATFORM));
m_client = new Client("AlethZero");
readSettings();
refresh();
@ -171,6 +171,12 @@ void Main::refresh()
m_client->unlock();
}
void Main::on_idealPeers_valueChanged()
{
if (m_client->peerServer())
m_client->peerServer()->setIdealPeerCount(ui->idealPeers->value());
}
void Main::on_ourAccounts_doubleClicked()
{
qApp->clipboard()->setText(ui->ourAccounts->currentItem()->text().section(" @ ", 1));
@ -234,8 +240,14 @@ void Main::updateFee()
void Main::on_net_triggered()
{
ui->port->setEnabled(!ui->net->isChecked());
ui->clientName->setEnabled(!ui->net->isChecked());
string n = "AlethZero/v" ADD_QUOTES(ETH_VERSION);
if (ui->clientName->text().size())
n += "/" + ui->clientName->text().toStdString();
n += "/" ADD_QUOTES(ETH_BUILD_TYPE) "/" ADD_QUOTES(ETH_BUILD_PLATFORM);
m_client->setClientVersion(n);
if (ui->net->isChecked())
m_client->startNetwork(ui->port->value(), string(), 0, NodeMode::Full, 5, std::string(), ui->upnp->isChecked());
m_client->startNetwork(ui->port->value(), string(), 0, NodeMode::Full, ui->idealPeers->value(), std::string(), ui->upnp->isChecked());
else
m_client->stopNetwork();
}

1
alethzero/MainWin.h

@ -34,6 +34,7 @@ private slots:
void on_accounts_doubleClicked();
void on_destination_textChanged();
void on_data_textChanged();
void on_idealPeers_valueChanged();
void on_value_valueChanged() { updateFee(); }
void on_valueUnits_currentIndexChanged() { updateFee(); }
void on_log_doubleClicked();

5
eth/main.cpp

@ -32,6 +32,9 @@
using namespace std;
using namespace eth;
#define ADD_QUOTES_HELPER(s) #s
#define ADD_QUOTES(s) ADD_QUOTES_HELPER(s)
bytes contents(std::string const& _file)
{
std::ifstream is(_file, std::ifstream::binary);
@ -165,7 +168,7 @@ int main(int argc, char** argv)
remoteHost = argv[i];
}
Client c("Ethereum(++)/v0.1", coinbase, dbPath);
Client c("Ethereum(++)/v" ADD_QUOTES(ETH_VERSION) "/" ADD_QUOTES(ETH_BUILD_TYPE) "/" ADD_QUOTES(ETH_BUILD_PLATFORM), coinbase, dbPath);
if (interactive)
{
cout << "Ethereum (++)" << endl;

4
libethereum/Client.h

@ -96,6 +96,8 @@ public:
/// Get the object representing the transaction queue.
TransactionQueue const& transactionQueue() const { return m_tq; }
void setClientVersion(std::string const& _name) { m_clientVersion = _name; }
// Network stuff:
/// Get information on the current peer set.
@ -109,6 +111,8 @@ public:
void connect(std::string const& _seedHost, short _port = 30303);
/// Stop the network subsystem.
void stopNetwork();
/// Get access to the peer server object. This will be null if the network isn't online.
PeerServer* peerServer() const { return m_net; }
// Mining stuff:

Loading…
Cancel
Save