From a18014b6d4bfa5d72aee181e817254d2732bfa60 Mon Sep 17 00:00:00 2001 From: Duke Date: Sat, 16 Dec 2023 10:44:05 -0500 Subject: [PATCH] Render valuePools json and each tx in their own property This means a user can copy + paste individual txids which is much better than the previous behavior. And now we render something useful for valuePools in case anybody wants to see that. --- src/mainwindow.cpp | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 18bb54d..d908414 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -943,18 +943,33 @@ void MainWindow::getBlock() { property_value = props.toObject()[property_name].toBool() ? "true" : "false" ; } else if (props.toObject()[property_name].isArray()) { DEBUG( property_name << " is an array"); - auto txs = props.toObject()[property_name].toArray(); - for (const auto& tx : txs) { - property_value += tx.toString() + " , "; + if( property_name == "tx") { + auto txs = props.toObject()[property_name].toArray(); + int index = 0; + // create a property for each tx in the block so it renders in a more useful way + for (const auto& tx : txs) { + QString this_property_name = "tx " + QString::number(index); + propsList.append( + QPair( this_property_name, tx.toString() ) + ); + index++; + } + } else if (property_name == "valuePools") { + auto stuff = props.toObject()[property_name].toArray(); + property_value = QJsonDocument(stuff).toJson(); + property_value.remove("\n"); + property_value.remove(" "); } - // property_value = QJsonDocument(txs).toJson(); } else if (props.toObject()[property_name].isObject()) { DEBUG( property_name << " is an object"); } - propsList.append( - QPair( property_name, property_value ) - ); + // tx properties are added in their own special way above + if (property_name != "tx") { + propsList.append( + QPair( property_name, property_value ) + ); + } } ValidateAddressesModel model(gb.tblProps, propsList);