Browse Source

Split confirm addresses for readability

import_zecw
Aditya Kulkarni 5 years ago
parent
commit
50b645bd19
  1. 24
      src/confirm.ui
  2. 24
      src/sendtab.cpp

24
src/confirm.ui

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>429</width>
<height>371</height>
<width>538</width>
<height>458</height>
</rect>
</property>
<property name="windowTitle">
@ -23,7 +23,7 @@
<item>
<widget class="QLabel" name="sendFrom">
<property name="text">
<string/>
<string notr="true"/>
</property>
<property name="wordWrap">
<bool>true</bool>
@ -67,6 +67,12 @@
</item>
<item row="0" column="0">
<widget class="QLabel" name="Addr1">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">TextLabel</string>
</property>
@ -93,6 +99,12 @@
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelMinerFee">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">Miner Textlabel</string>
</property>
@ -101,7 +113,7 @@
<item row="0" column="1">
<widget class="QLabel" name="Amt1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -117,7 +129,7 @@
<item row="2" column="1">
<widget class="QLabel" name="minerFee">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -168,7 +180,7 @@
<string notr="true">color: red;</string>
</property>
<property name="text">
<string>zcashd doesn't seem to have any peers. You might not be connected to the internet, so this Transaction might not work.</string>
<string>zcashd doesn't seem to have any peers. You might not be connected to the internet, so this transaction might not work.</string>
</property>
<property name="wordWrap">
<bool>true</bool>

24
src/sendtab.cpp

@ -552,12 +552,24 @@ Tx MainWindow::createTxFromSendPage() {
}
bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
// Function to split the address to make it easier to read.
// Split it into chunks of 4 chars.
auto fnSplitAddressForWrap = [=] (const QString& a) -> QString {
if (! Settings::isZAddress(a)) return a;
QStringList ans;
static int splitSize = 8;
for (int i=0; i < a.length(); i+= splitSize) {
ans << a.mid(i, splitSize);
}
auto half = a.length() / 2;
auto splitted = a.left(half) + "\n" + a.right(a.length() - half);
return splitted;
return ans.join(" ");
// if (! Settings::isZAddress(a)) return a;
// auto half = a.length() / 2;
// auto splitted = a.left(half) + "\n" + a.right(a.length() - half);
// return splitted;
};
// Update the recurring info with the latest Tx
@ -570,6 +582,8 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
Ui_confirm confirm;
confirm.setupUi(&d);
const QFont fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
// Remove all existing address/amt qlabels on the confirm dialog.
int totalConfirmAddrItems = confirm.sendToAddrs->children().size();
for (int i = 0; i < totalConfirmAddrItems / 3; i++) {
@ -605,6 +619,7 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
Addr->setObjectName(QString("Addr") % QString::number(i + 1));
Addr->setWordWrap(true);
Addr->setText(fnSplitAddressForWrap(toAddr.addr));
Addr->setFont(fixedFont);
confirm.gridLayout->addWidget(Addr, row, 0, 1, 1);
// Amount (ZEC)
@ -696,6 +711,7 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
// And FromAddress in the confirm dialog
confirm.sendFrom->setText(fnSplitAddressForWrap(tx.fromAddr));
confirm.sendFrom->setFont(fixedFont);
QString tooltip = tr("Current balance : ") +
Settings::getZECUSDDisplayFormat(rpc->getAllBalances()->value(tx.fromAddr));
tooltip += "\n" + tr("Balance after this Tx: ") +

Loading…
Cancel
Save