Browse Source

UI improvements, refinements and optimisations.

cl-refactor
Gav Wood 11 years ago
parent
commit
8962b9c18a
  1. 30
      alethzero/Main.ui
  2. 15
      alethzero/MainWin.cpp
  3. 1
      alethzero/MainWin.h

30
alethzero/Main.ui

@ -127,6 +127,7 @@
<string>&amp;Network</string> <string>&amp;Network</string>
</property> </property>
<addaction name="upnp"/> <addaction name="upnp"/>
<addaction name="usePast"/>
<addaction name="net"/> <addaction name="net"/>
<addaction name="connect"/> <addaction name="connect"/>
</widget> </widget>
@ -140,6 +141,9 @@
<addaction name="create"/> <addaction name="create"/>
<addaction name="importKey"/> <addaction name="importKey"/>
<addaction name="exportKey"/> <addaction name="exportKey"/>
<addaction name="separator"/>
<addaction name="showAll"/>
<addaction name="showAllAccounts"/>
</widget> </widget>
<widget class="QMenu" name="menu_Help"> <widget class="QMenu" name="menu_Help">
<property name="title"> <property name="title">
@ -168,7 +172,7 @@
<set>QDockWidget::DockWidgetFeatureMask</set> <set>QDockWidget::DockWidgetFeatureMask</set>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>All Accounts</string> <string>Accounts</string>
</property> </property>
<attribute name="dockWidgetArea"> <attribute name="dockWidgetArea">
<number>2</number> <number>2</number>
@ -1074,6 +1078,30 @@
<string>&amp;Inject Transaction</string> <string>&amp;Inject Transaction</string>
</property> </property>
</action> </action>
<action name="showAll">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Show Ancient &amp;Blocks</string>
</property>
</action>
<action name="showAllAccounts">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Show Anonymous &amp;Accounts</string>
</property>
</action>
<action name="usePast">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Use &amp;Past Peers</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<customwidgets> <customwidgets>

15
alethzero/MainWin.cpp

@ -343,7 +343,10 @@ void Main::writeSettings()
s.setValue("address", b); s.setValue("address", b);
s.setValue("upnp", ui->upnp->isChecked()); s.setValue("upnp", ui->upnp->isChecked());
s.setValue("usePast", ui->usePast->isChecked());
s.setValue("paranoia", ui->paranoia->isChecked()); s.setValue("paranoia", ui->paranoia->isChecked());
s.setValue("showAll", ui->showAll->isChecked());
s.setValue("showAllAccounts", ui->showAllAccounts->isChecked());
s.setValue("clientName", ui->clientName->text()); s.setValue("clientName", ui->clientName->text());
s.setValue("idealPeers", ui->idealPeers->value()); s.setValue("idealPeers", ui->idealPeers->value());
s.setValue("port", ui->port->value()); s.setValue("port", ui->port->value());
@ -385,7 +388,10 @@ void Main::readSettings()
m_client->setAddress(m_myKeys.back().address()); m_client->setAddress(m_myKeys.back().address());
m_peers = s.value("peers").toByteArray(); m_peers = s.value("peers").toByteArray();
ui->upnp->setChecked(s.value("upnp", true).toBool()); ui->upnp->setChecked(s.value("upnp", true).toBool());
ui->upnp->setChecked(s.value("paranoia", false).toBool()); ui->usePast->setChecked(s.value("usePast", true).toBool());
ui->paranoia->setChecked(s.value("paranoia", false).toBool());
ui->showAll->setChecked(s.value("showAll", false).toBool());
ui->showAllAccounts->setChecked(s.value("showAllAccounts", false).toBool());
ui->clientName->setText(s.value("clientName", "").toString()); ui->clientName->setText(s.value("clientName", "").toString());
ui->idealPeers->setValue(s.value("idealPeers", ui->idealPeers->value()).toInt()); ui->idealPeers->setValue(s.value("idealPeers", ui->idealPeers->value()).toInt());
ui->port->setValue(s.value("port", ui->port->value()).toInt()); ui->port->setValue(s.value("port", ui->port->value()).toInt());
@ -472,7 +478,7 @@ void Main::refresh(bool _override)
auto acs = st.addresses(); auto acs = st.addresses();
ui->accounts->clear(); ui->accounts->clear();
ui->contracts->clear(); ui->contracts->clear();
for (auto n = 0; n < 2; ++n) for (auto n = 0; n < (ui->showAllAccounts->isChecked() ? 2 : 1); ++n)
for (auto i: acs) for (auto i: acs)
{ {
auto r = render(i.first); auto r = render(i.first);
@ -518,7 +524,8 @@ void Main::refresh(bool _override)
ui->blocks->clear(); ui->blocks->clear();
auto const& bc = m_client->blockChain(); auto const& bc = m_client->blockChain();
for (auto h = bc.currentHash(); h != bc.genesisHash(); h = bc.details(h).parent) unsigned i = ui->showAll->isChecked() ? (unsigned)-1 : 100;
for (auto h = bc.currentHash(); h != bc.genesisHash() && i; h = bc.details(h).parent, --i)
{ {
auto d = bc.details(h); auto d = bc.details(h);
QListWidgetItem* blockItem = new QListWidgetItem(QString("#%1 %2").arg(d.number).arg(h.abridged().c_str()), ui->blocks); QListWidgetItem* blockItem = new QListWidgetItem(QString("#%1 %2").arg(d.number).arg(h.abridged().c_str()), ui->blocks);
@ -973,7 +980,7 @@ void Main::on_net_triggered()
if (ui->net->isChecked()) if (ui->net->isChecked())
{ {
m_client->startNetwork(ui->port->value(), string(), 0, NodeMode::Full, ui->idealPeers->value(), std::string(), ui->upnp->isChecked()); m_client->startNetwork(ui->port->value(), string(), 0, NodeMode::Full, ui->idealPeers->value(), std::string(), ui->upnp->isChecked());
if (m_peers.size()) if (m_peers.size() && ui->usePast->isChecked())
m_client->peerServer()->restorePeers(bytesConstRef((byte*)m_peers.data(), m_peers.size())); m_client->peerServer()->restorePeers(bytesConstRef((byte*)m_peers.data(), m_peers.size()));
} }
else else

1
alethzero/MainWin.h

@ -80,6 +80,7 @@ private slots:
void on_importKey_triggered(); void on_importKey_triggered();
void on_exportKey_triggered(); void on_exportKey_triggered();
void on_inject_triggered(); void on_inject_triggered();
void on_showAll_triggered() { refresh(true); }
void refresh(bool _override = false); void refresh(bool _override = false);
void refreshNetwork(); void refreshNetwork();

Loading…
Cancel
Save