]> Nutra Git (v2) - gamesguru/feather.git/commitdiff
history: add option to show full txid
authortobtoht <tob@featherwallet.org>
Sat, 30 Dec 2023 15:46:14 +0000 (16:46 +0100)
committertobtoht <tob@featherwallet.org>
Sat, 30 Dec 2023 15:46:14 +0000 (16:46 +0100)
src/model/HistoryView.cpp
src/model/HistoryView.h
src/model/TransactionHistoryModel.cpp
src/utils/config.cpp
src/utils/config.h

index 9fe311df6b5130b1092eb18f42cd07ee56a7ee67..218ad507df788e0047fa6e6a5702f902fe27cc8d 100644 (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);
index bab00f35d387f2548bd4aa4102aa4abc9b81cddd..57262e07835866bf0f50110d1f2a160ec124c8ce 100644 (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();
index dd7eb74a1f94761758f96329c09a588f9402f644..2ea28a9a5462ae987f5d42296d94daeec988b648 100644 (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:
index 1ad5f387d7c92c6e3b7fe87c4bed4e18095cc0d8..0670df4245819bb74d399be6157b693d3fb35d34 100644 (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}},
index 224e3053a95c621e1221e8f4858a60edd48b19f5..cbc887829042e9da34f0c75d8e5b32382be24586 100644 (file)
@@ -48,7 +48,10 @@ public:
         // Tabs
         enabledTabs,
         showSearchbar,
-        
+
+        // History
+        historyShowFullTxid,
+
         // Receive
         showUsedAddresses,
         showHiddenAddresses,