Browse Source

show transaction ID in record list

kvazar
kvazar-network 5 months ago
parent
commit
1ead67cd11
  1. 1
      src/qt/kevadialog.cpp
  2. 1
      src/qt/kevadialog.h
  3. 6
      src/qt/kevatablemodel.cpp
  4. 4
      src/qt/kevatablemodel.h
  5. 2
      src/qt/walletmodel.cpp

1
src/qt/kevadialog.cpp

@ -101,6 +101,7 @@ void KevaDialog::setModel(WalletModel *_model)
tableView->setSelectionMode(QAbstractItemView::ContiguousSelection); tableView->setSelectionMode(QAbstractItemView::ContiguousSelection);
tableView->setColumnWidth(KevaTableModel::Date, DATE_COLUMN_WIDTH); tableView->setColumnWidth(KevaTableModel::Date, DATE_COLUMN_WIDTH);
tableView->setColumnWidth(KevaTableModel::Key, KEY_COLUMN_WIDTH); tableView->setColumnWidth(KevaTableModel::Key, KEY_COLUMN_WIDTH);
tableView->setColumnWidth(KevaTableModel::TransactionID, TRANSACTION_ID_MINIMUM_COLUMN_WIDTH);
tableView->setColumnWidth(KevaTableModel::Block, BLOCK_MINIMUM_COLUMN_WIDTH); tableView->setColumnWidth(KevaTableModel::Block, BLOCK_MINIMUM_COLUMN_WIDTH);
connect(ui->kevaView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), connect(ui->kevaView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),

1
src/qt/kevadialog.h

@ -36,6 +36,7 @@ public:
enum ColumnWidths { enum ColumnWidths {
DATE_COLUMN_WIDTH = 130, DATE_COLUMN_WIDTH = 130,
KEY_COLUMN_WIDTH = 120, KEY_COLUMN_WIDTH = 120,
TRANSACTION_ID_MINIMUM_COLUMN_WIDTH = 200,
BLOCK_MINIMUM_COLUMN_WIDTH = 100, BLOCK_MINIMUM_COLUMN_WIDTH = 100,
MINIMUM_COLUMN_WIDTH = 100 MINIMUM_COLUMN_WIDTH = 100
}; };

6
src/qt/kevatablemodel.cpp

@ -18,7 +18,7 @@ KevaTableModel::KevaTableModel(CWallet *wallet, WalletModel *parent) :
Q_UNUSED(wallet) Q_UNUSED(wallet)
/* These columns must match the indices in the ColumnIndex enumeration */ /* These columns must match the indices in the ColumnIndex enumeration */
columns << tr("Date") << tr("Key") << tr("Value") << tr("Block"); columns << tr("Date") << tr("Key") << tr("Value") << tr("Transaction ID") << tr("Block");
// TODO: display new keva entry when it arrives. // TODO: display new keva entry when it arrives.
// connect(walletModel->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); // connect(walletModel->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
@ -67,6 +67,8 @@ QVariant KevaTableModel::data(const QModelIndex &index, int role) const
return QString::fromStdString(rec->key); return QString::fromStdString(rec->key);
case Value: case Value:
return QString::fromStdString(rec->value); return QString::fromStdString(rec->value);
case TransactionID:
return QString::fromStdString(rec->transactionID);
case Block: case Block:
return QString::number(rec->block); return QString::number(rec->block);
} }
@ -172,6 +174,8 @@ bool KevaEntryLessThan::operator()(KevaEntry &left, KevaEntry &right) const
return pLeft->date.toTime_t() < pRight->date.toTime_t(); return pLeft->date.toTime_t() < pRight->date.toTime_t();
case KevaTableModel::Block: case KevaTableModel::Block:
return pLeft->block < pRight->block; return pLeft->block < pRight->block;
case KevaTableModel::TransactionID:
return pLeft->transactionID < pRight->transactionID;
case KevaTableModel::Key: case KevaTableModel::Key:
return pLeft->key < pRight->key; return pLeft->key < pRight->key;
case KevaTableModel::Value: case KevaTableModel::Value:

4
src/qt/kevatablemodel.h

@ -20,6 +20,7 @@ public:
std::string key; std::string key;
std::string value; std::string value;
std::string transactionID;
int64_t block; int64_t block;
QDateTime date; QDateTime date;
}; };
@ -51,7 +52,8 @@ public:
Date = 0, Date = 0,
Key = 1, Key = 1,
Value = 2, Value = 2,
Block = 3, TransactionID = 3,
Block = 4,
NUMBER_OF_COLUMNS NUMBER_OF_COLUMNS
}; };

2
src/qt/walletmodel.cpp

@ -805,6 +805,8 @@ void WalletModel::getKevaEntries(std::vector<KevaEntry>& vKevaEntries, std::stri
entry.key = ValtypeToString(key); entry.key = ValtypeToString(key);
entry.value = ValtypeToString(data.getValue()); entry.value = ValtypeToString(data.getValue());
entry.block = data.getHeight(); entry.block = data.getHeight();
entry.transactionID = data.getUpdateOutpoint().hash.ToString();
CBlockIndex* pblockindex = chainActive[entry.block]; CBlockIndex* pblockindex = chainActive[entry.block];
if (pblockindex) { if (pblockindex) {
entry.date.setTime_t(pblockindex->nTime); entry.date.setTime_t(pblockindex->nTime);

Loading…
Cancel
Save