@@ -22,9 +22,12 @@ QString CAmount::toDecimalString() const {
|
||||
QString r = QString::number(wholePart);
|
||||
if (decimalPart > 0) {
|
||||
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;
|
||||
|
||||
@@ -376,10 +376,13 @@ void Controller::refreshTransactions() {
|
||||
total_amount = total_amount + amount;
|
||||
}
|
||||
|
||||
if (items.length() == 1) {
|
||||
address = items[0].address;
|
||||
} else {
|
||||
address = "(Multiple)";
|
||||
{
|
||||
// Concat all the addresses
|
||||
QList<QString> addresses;
|
||||
for (auto item : items) {
|
||||
addresses.push_back(item.address);
|
||||
}
|
||||
address = addresses.join(",");
|
||||
}
|
||||
|
||||
txdata.push_back(TransactionItem{
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
@@ -296,7 +296,7 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>From</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
|
||||
@@ -69,10 +69,20 @@ bool TxTableModel::exportToCsv(QString fileName) const {
|
||||
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
|
||||
{
|
||||
// Align numeric columns (confirmations, amount) right
|
||||
return memo;
|
||||
};
|
||||
|
||||
QVariant TxTableModel::data(const QModelIndex &index, int role) const {
|
||||
// Align numeric columns (confirmations, amount) right
|
||||
if (role == Qt::TextAlignmentRole &&
|
||||
(index.column() == Column::Confirmations || index.column() == Column::Amount))
|
||||
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||
@@ -127,7 +137,7 @@ bool TxTableModel::exportToCsv(QString fileName) const {
|
||||
(memo.isEmpty() ? "" : " tx memo: \"" + memo + "\"");
|
||||
}
|
||||
} else {
|
||||
return "Multiple";
|
||||
return concatMultipleMemos(dat);
|
||||
}
|
||||
}
|
||||
case Column::Address: {
|
||||
@@ -202,20 +212,8 @@ QString TxTableModel::getTxId(int row) const {
|
||||
|
||||
QString TxTableModel::getMemo(int row) const {
|
||||
auto dat = modeldata->at(row);
|
||||
bool hasMemo = false;
|
||||
for (int i=0; i < dat.items.length(); i++) {
|
||||
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 "";
|
||||
}
|
||||
|
||||
return concatMultipleMemos(dat);
|
||||
}
|
||||
|
||||
qint64 TxTableModel::getConfirmations(int row) const {
|
||||
|
||||
@@ -38,6 +38,8 @@ public:
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
|
||||
private:
|
||||
QString concatMultipleMemos(const TransactionItem&) const;
|
||||
|
||||
QList<TransactionItem>* modeldata = nullptr;
|
||||
|
||||
QList<QString> headers;
|
||||
|
||||
Reference in New Issue
Block a user