history: add option to show full txid

This commit is contained in:
tobtoht 2023-12-30 16:46:14 +01:00
parent 7e19d52788
commit 0ba22ea05b
No known key found for this signature in database
GPG key ID: E45B10DD027D2472
5 changed files with 26 additions and 1 deletions

View file

@ -5,6 +5,7 @@
#include "TransactionHistoryProxyModel.h"
#include "utils/Utils.h"
#include "utils/config.h"
#include <QHeaderView>
#include <QMenu>
@ -56,6 +57,10 @@ void HistoryView::setHistoryModel(TransactionHistoryProxyModel *model) {
}
connect(m_columnActions, &QActionGroup::triggered, this, &HistoryView::toggleColumnVisibility);
m_headerMenu->addSeparator();
auto action = m_headerMenu->addAction("Show full txid", this, &HistoryView::showFullTxid);
action->setCheckable(true);
action->setChecked(conf()->get(Config::historyShowFullTxid).toBool());
m_headerMenu->addSeparator();
m_headerMenu->addAction(tr("Fit to window"), this, &HistoryView::fitColumnsToWindow);
m_headerMenu->addAction(tr("Fit to contents"), this, &HistoryView::fitColumnsToContents);
@ -154,6 +159,16 @@ void HistoryView::toggleColumnVisibility(QAction* action)
action->setChecked(true);
}
void HistoryView::showFullTxid(bool enabled) {
conf()->set(Config::historyShowFullTxid, enabled);
this->reset();
if (!enabled) {
this->resizeColumnToContents(TransactionHistoryModel::TxID);
}
}
void HistoryView::fitColumnsToWindow()
{
header()->setSectionResizeMode(QHeaderView::ResizeToContents);

View file

@ -27,6 +27,7 @@ public:
private slots:
void showHeaderMenu(const QPoint& position);
void toggleColumnVisibility(QAction* action);
void showFullTxid(bool enabled);
void fitColumnsToWindow();
void fitColumnsToContents();
void resetViewToDefaults();

View file

@ -163,6 +163,9 @@ QVariant TransactionHistoryModel::parseTransactionInfo(const TransactionRow &tIn
return amount;
}
case Column::TxID: {
if (conf()->get(Config::historyShowFullTxid).toBool()) {
return tInfo.hash();
}
return Utils::displayAddress(tInfo.hash(), 1);
}
case Column::FiatAmount:

View file

@ -46,6 +46,9 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
{Config::enabledTabs, {QS("enabledTabs"), QStringList{"Home", "History", "Send", "Receive", "Calc"}}},
{Config::showSearchbar,{QS("showSearchbar"), true}},
// History
{Config::historyShowFullTxid, {QS("historyShowFullTxid"), false}},
// Receive
{Config::showUsedAddresses,{QS("showUsedAddresses"), false}},
{Config::showHiddenAddresses,{QS("showHiddenAddresses"), false}},

View file

@ -49,6 +49,9 @@ public:
enabledTabs,
showSearchbar,
// History
historyShowFullTxid,
// Receive
showUsedAddresses,
showHiddenAddresses,