This commit is contained in:
Aditya Kulkarni
2019-10-30 13:55:14 -07:00
7 changed files with 38 additions and 34 deletions

View File

@@ -1,4 +1,4 @@
ZecWallet-lite is z-Addr first, Sapling compatible wallet lightwallet for Zcash Zecwallet-Lite is z-Addr first, Sapling compatible wallet lightwallet for Zcash
## Compiling from source ## Compiling from source
* ZecWallet is written in C++ 14, and can be compiled with g++/clang++/visual c++. * ZecWallet is written in C++ 14, and can be compiled with g++/clang++/visual c++.
@@ -8,13 +8,11 @@ ZecWallet-lite is z-Addr first, Sapling compatible wallet lightwallet for Zcash
### Building on Linux ### Building on Linux
``` ```
git clone https://github.com/adityapk/zecwallet-lite.git git clone https://github.com/adityapk00/zecwallet-lite.git
cd zecwallet cd zecwallet-lite
/path/to/qt5/bin/qmake zecwallet-lite.pro CONFIG+=debug /path/to/qt5/bin/qmake zecwallet-lite.pro CONFIG+=debug
make -j$(nproc) make -j$(nproc)
./zecwallet ./zecwallet-lite
``` ```
Right now, you'll also need to run `lightwalletd` on your local machine for Zecwallet to connect to. _PS: Zecwallet-Lite is NOT an official wallet, and is not affiliated with the Electric Coin Company in any way._
_PS: ZecWallet is NOT an official wallet, and is not affiliated with the Electric Coin Company in any way._

View File

@@ -11,4 +11,4 @@ crate-type = ["staticlib"]
[dependencies] [dependencies]
libc = "0.2.58" libc = "0.2.58"
lazy_static = "1.4.0" lazy_static = "1.4.0"
zecwalletlitelib = { git = "https://github.com/adityapk00/zecwallet-light-cli", rev = "92d3804a5c67ca7621b141518a1f72451ca6ff40" } zecwalletlitelib = { git = "https://github.com/adityapk00/zecwallet-light-cli", rev = "fe82c0b43043867b6cc1ebc462cc7b42f91b1adf" }

View File

@@ -22,9 +22,12 @@ QString CAmount::toDecimalString() const {
QString r = QString::number(wholePart); QString r = QString::number(wholePart);
if (decimalPart > 0) { if (decimalPart > 0) {
QString decimalPartStr = QString::number(decimalPart); QString decimalPartStr = QString::number(decimalPart);
QString leadingZeros = QString("0").repeated(NUMPLACES - decimalPartStr.length()); r = r + "." + decimalPartStr.rightJustified(NUMPLACES, '0');
r = r + "." + leadingZeros + decimalPartStr; // Trim tailing 0s
while (r.right(1) == "0") {
r = r.left(r.length() - 1);
}
} }
return r; return r;

View File

@@ -372,10 +372,13 @@ void Controller::refreshTransactions() {
total_amount = total_amount + amount; total_amount = total_amount + amount;
} }
if (items.length() == 1) { {
address = items[0].address; // Concat all the addresses
} else { QList<QString> addresses;
address = "(Multiple)"; for (auto item : items) {
addresses.push_back(item.address);
}
address = addresses.join(",");
} }
txdata.push_back(TransactionItem{ txdata.push_back(TransactionItem{

View File

@@ -22,7 +22,7 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>3</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<attribute name="title"> <attribute name="title">
@@ -296,7 +296,7 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="title"> <property name="title">
<string>From</string> <string/>
</property> </property>
<property name="flat"> <property name="flat">
<bool>false</bool> <bool>false</bool>

View File

@@ -69,10 +69,20 @@ bool TxTableModel::exportToCsv(QString fileName) const {
return headers.size(); return headers.size();
} }
QString TxTableModel::concatMultipleMemos(const TransactionItem& dat) const {
// Concat all the memos
QString memo;
for (auto item : dat.items) {
if (!item.memo.trimmed().isEmpty()) {
memo += item.address + ": \"" + item.memo + "\"\n";
}
}
QVariant TxTableModel::data(const QModelIndex &index, int role) const return memo;
{ };
// Align numeric columns (confirmations, amount) right
QVariant TxTableModel::data(const QModelIndex &index, int role) const {
// Align numeric columns (confirmations, amount) right
if (role == Qt::TextAlignmentRole && if (role == Qt::TextAlignmentRole &&
(index.column() == Column::Confirmations || index.column() == Column::Amount)) (index.column() == Column::Confirmations || index.column() == Column::Amount))
return QVariant(Qt::AlignRight | Qt::AlignVCenter); return QVariant(Qt::AlignRight | Qt::AlignVCenter);
@@ -127,7 +137,7 @@ bool TxTableModel::exportToCsv(QString fileName) const {
(memo.isEmpty() ? "" : " tx memo: \"" + memo + "\""); (memo.isEmpty() ? "" : " tx memo: \"" + memo + "\"");
} }
} else { } else {
return "Multiple"; return concatMultipleMemos(dat);
} }
} }
case Column::Address: { case Column::Address: {
@@ -202,20 +212,8 @@ QString TxTableModel::getTxId(int row) const {
QString TxTableModel::getMemo(int row) const { QString TxTableModel::getMemo(int row) const {
auto dat = modeldata->at(row); auto dat = modeldata->at(row);
bool hasMemo = false;
for (int i=0; i < dat.items.length(); i++) { return concatMultipleMemos(dat);
if (!dat.items[i].memo.isEmpty()) {
hasMemo = true;
}
}
if (dat.items.length() == 1) {
return dat.items[0].memo;
} else if (hasMemo) {
return "(Multiple)";
} else {
return "";
}
} }
qint64 TxTableModel::getConfirmations(int row) const { qint64 TxTableModel::getConfirmations(int row) const {

View File

@@ -38,6 +38,8 @@ public:
QVariant headerData(int section, Qt::Orientation orientation, int role) const; QVariant headerData(int section, Qt::Orientation orientation, int role) const;
private: private:
QString concatMultipleMemos(const TransactionItem&) const;
QList<TransactionItem>* modeldata = nullptr; QList<TransactionItem>* modeldata = nullptr;
QList<QString> headers; QList<QString> headers;