Browse Source

Minor bug fixes and UI improvments.

Version bump.
cl-refactor
Gav Wood 11 years ago
parent
commit
1f31096062
  1. 2
      CMakeLists.txt
  2. 56
      alethzero/Main.ui
  3. 27
      alethzero/MainWin.cpp
  4. 2
      alethzero/MainWin.h

2
CMakeLists.txt

@ -5,7 +5,7 @@ set(CMAKE_AUTOMOC ON)
cmake_policy(SET CMP0015 NEW)
set(ETH_VERSION 0.3.3)
set(ETH_VERSION 0.3.4)
set(ETH_BUILD_TYPE ${CMAKE_BUILD_TYPE})
# Default HEADLESS to 0.

56
alethzero/Main.ui

@ -382,21 +382,34 @@
</attribute>
<widget class="QWidget" name="dockWidgetContents_5">
<layout class="QGridLayout" name="gridLayout">
<item row="5" column="3">
<item row="1" column="1" colspan="3">
<widget class="QLineEdit" name="calculatedName">
<property name="enabled">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string/>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QPushButton" name="send">
<property name="text">
<string>Send</string>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="label5_2">
<property name="text">
<string>Amount</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QSpinBox" name="value">
<property name="suffix">
<string/>
@ -409,10 +422,10 @@
</property>
</widget>
</item>
<item row="2" column="2" colspan="2">
<item row="3" column="2" colspan="2">
<widget class="QComboBox" name="valueUnits"/>
</item>
<item row="4" column="0" colspan="4">
<item row="5" column="0" colspan="4">
<widget class="QSplitter" name="splitter_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -425,13 +438,6 @@
</widget>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="total">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1" colspan="3">
<widget class="QLineEdit" name="destination">
<property name="sizePolicy">
@ -445,7 +451,7 @@
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<item row="4" column="1" colspan="3">
<widget class="QLabel" name="fee">
<property name="text">
<string/>
@ -455,7 +461,7 @@
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
@ -471,20 +477,7 @@
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QLineEdit" name="calculatedName">
<property name="enabled">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string/>
</property>
</widget>
</item>
<item row="0" column="0" rowspan="2">
<item row="0" column="0">
<widget class="QLabel" name="label5">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@ -497,6 +490,13 @@
</property>
</widget>
</item>
<item row="6" column="0" colspan="3">
<widget class="QLabel" name="total">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</widget>

27
alethzero/MainWin.cpp

@ -52,6 +52,7 @@ Main::Main(QWidget *parent) :
#endif
on_verbosity_sliderMoved();
on_destination_textChanged();
initUnits(ui->valueUnits);
statusBar()->addPermanentWidget(ui->balance);
@ -65,15 +66,23 @@ Main::~Main()
writeSettings();
}
QString Main::render(eth::Address _a) const
QString Main::pretty(eth::Address _a) const
{
static const Address c_nameContract(fromUserHex("f28e4d396cfc7bae483e464221b0d2bd3c27f21f"));
if (h256 n = m_client->state().contractMemory(c_nameContract, (h256)(u256)(u160)_a))
{
std::string s((char const*)n.data(), 32);
s.resize(s.find_first_of('\0'));
return QString::fromStdString(s + " (" + _a.abridged() + ")");
return QString::fromStdString(s);
}
return QString();
}
QString Main::render(eth::Address _a) const
{
QString p = pretty(_a);
if (!p.isNull())
return p + "(" + QString::fromStdString(_a.abridged()) + ")";
return QString::fromStdString(_a.abridged());
}
@ -86,8 +95,9 @@ Address Main::fromString(QString const& _a) const
h256 n;
memcpy(n.data(), sn.data(), sn.size());
memset(n.data() + sn.size(), 0, 32 - sn.size());
if (h256 a = m_client->state().contractMemory(c_nameContract, n))
return right160(a);
if (_a.size())
if (h256 a = m_client->state().contractMemory(c_nameContract, n))
return right160(a);
if (_a.size() == 40)
return Address(fromUserHex(_a.toStdString()));
else
@ -281,7 +291,7 @@ void Main::on_blocks_currentItemChanged()
s << "&nbsp;&emsp;&nbsp;<b>" << timestamp << "</b></h4>";
s << "<br/>D/TD: <b>2^" << log2((double)info.difficulty) << "</b>/<b>2^" << log2((double)details.totalDifficulty) << "</b>";
s << "&nbsp;&emsp;&nbsp;Children: <b>" << details.children.size() << "</b></h5>";
s << "<br/>Coinbase: <b>" << info.coinbaseAddress << "</b>";
s << "<br/>Coinbase: <b>" << pretty(info.coinbaseAddress).toStdString() << "</b> " << info.coinbaseAddress;
s << "<br/>State: <b>" << info.stateRoot << "</b>";
s << "<br/>Nonce: <b>" << info.nonce << "</b>";
s << "<br/>Transactions: <b>" << block[1].itemCount() << "</b> @<b>" << info.sha3Transactions << "</b>";
@ -294,11 +304,12 @@ void Main::on_blocks_currentItemChanged()
h256 th = tx.sha3();
s << "<h3>" << th << "</h3>";
s << "<h4>" << h << "[<b>" << txi << "</b>]</h4>";
s << "<br/>From: <b>" << tx.safeSender() << "</b>";
auto ss = tx.safeSender();
s << "<br/>From: <b>" << pretty(ss).toStdString() << "</b> " << ss;
if (tx.receiveAddress)
s << "<br/>To: <b>" << tx.receiveAddress << "</b>";
s << "<br/>To: <b>" << pretty(tx.receiveAddress).toStdString() << "</b> " << tx.receiveAddress;
else
s << "<br/>Creates: <b>" << right160(th) << "</b>";
s << "<br/>Creates: <b>" << pretty(right160(th)).toStdString() << "</b> " << right160(th);
s << "<br/>Value: <b>" << formatBalance(tx.value) << "</b>";
s << "&nbsp;&emsp;&nbsp;#<b>" << tx.nonce << "</b>";
if (tx.data.size())

2
alethzero/MainWin.h

@ -47,6 +47,8 @@ private slots:
void refreshNetwork();
private:
QString pretty(eth::Address _a) const;
QString render(eth::Address _a) const;
eth::Address fromString(QString const& _a) const;

Loading…
Cancel
Save