Browse Source

Initial commit for viewing getblock info

custom_themes
fekt 9 months ago
parent
commit
ba2f322124
  1. 1
      silentdragon.pro
  2. 1
      silentdragonx.pro
  3. 27
      src/mainwindow.cpp
  4. 26
      src/mainwindow.ui
  5. 2
      src/rpc.cpp

1
silentdragon.pro

@ -89,6 +89,7 @@ HEADERS += \
src/viewalladdresses.h
FORMS += \
src/getblock.ui \
src/mainwindow.ui \
src/qrcode.ui \
src/rescandialog.ui \

1
silentdragonx.pro

@ -88,6 +88,7 @@ HEADERS += \
src/viewalladdresses.h
FORMS += \
src/getblock.ui \
src/mainwindow.ui \
src/qrcode.ui \
src/rescandialog.ui \

27
src/mainwindow.cpp

@ -14,6 +14,7 @@
#include "ui_viewalladdresses.h"
#include "ui_validateaddress.h"
#include "ui_rescandialog.h"
#include "ui_getblock.h"
#include "rpc.h"
#include "balancestablemodel.h"
#include "settings.h"
@ -96,7 +97,7 @@ MainWindow::MainWindow(QWidget *parent) :
QObject::connect(ui->actionValidate_Address, &QAction::triggered, this, &MainWindow::validateAddress);
// Get Block
//QObject::connect(ui->actionGet_Block, &QAction::triggered, this, &MainWindow::getBlock);
QObject::connect(ui->actionGet_Block, &QAction::triggered, this, &MainWindow::getBlock);
// Address Book
QObject::connect(ui->action_Address_Book, &QAction::triggered, this, &MainWindow::addressBook);
@ -903,27 +904,28 @@ void MainWindow::validateAddress() {
}
// Get block info
/*
void MainWindow::getBlock() {
// Make sure everything is up and running
if (!getRPC() || !getRPC()->getConnection())
return;
// First thing is ask the user for a blocj height
// First thing is ask the user for a block height
bool ok;
auto blockheight = QInputDialog::getText(this, tr("Enter Block Height"), QLineEdit::Normal, "", &ok);
auto blockheight = QInputDialog::getText(this, tr("Enter Block Height"),
QString(" ").repeated(140), // Pad the label so the dialog box is wide enough
QLineEdit::Normal, "", &ok);
if (!ok)
return;
getRPC()->validateAddress(address, [=] (QJsonValue props) {
getRPC()->getBlock(blockheight, [=] (QJsonValue props) {
QDialog d(this);
Ui_ValidateAddress va;
va.setupUi(&d);
Ui_GetBlock gb;
gb.setupUi(&d);
Settings::saveRestore(&d);
Settings::saveRestoreTableHeader(va.tblProps, &d, "validateaddressprops");
va.tblProps->horizontalHeader()->setStretchLastSection(true);
Settings::saveRestoreTableHeader(gb.tblProps, &d, "getblockprops");
gb.tblProps->horizontalHeader()->setStretchLastSection(true);
va.lblAddress->setText(address);
gb.lblHeight->setText(blockheight);
QList<QPair<QString, QString>> propsList;
@ -942,13 +944,12 @@ void MainWindow::getBlock() {
);
}
ValidateAddressesModel model(va.tblProps, propsList);
va.tblProps->setModel(&model);
ValidateAddressesModel model(gb.tblProps, propsList);
gb.tblProps->setModel(&model);
d.exec();
});
}
*/
void MainWindow::doImport(QList<QString>* keys) {
if (rpc->getConnection() == nullptr) {

26
src/mainwindow.ui

@ -121,6 +121,7 @@
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -133,6 +134,7 @@
<widget class="QLabel" name="balTotal">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -158,6 +160,7 @@
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -170,6 +173,7 @@
<widget class="QLabel" name="balUSDTotal">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -384,8 +388,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1409</width>
<height>865</height>
<width>1447</width>
<height>860</height>
</rect>
</property>
<layout class="QVBoxLayout" name="sendToLayout">
@ -1210,7 +1214,6 @@
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QLabel" name="clientnamespacer">
<property name="text">
@ -1245,7 +1248,6 @@
</property>
</widget>
</item>
<item row="16" column="2">
<widget class="QLabel" name="longestchain">
<property name="text">
@ -1273,7 +1275,6 @@
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="numconnections">
<property name="text">
@ -1281,8 +1282,6 @@
</property>
</widget>
</item>
<item row="18" column="0">
<widget class="QLabel" name="chaintxcountlabel">
<property name="sizePolicy">
@ -1296,7 +1295,6 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
@ -1391,7 +1389,6 @@
</property>
</widget>
</item>
<item row="12" column="2">
<widget class="QLabel" name="rpcport">
<property name="text">
@ -1446,7 +1443,6 @@
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QLabel" name="p2pportspacer">
<property name="text">
@ -1488,7 +1484,6 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_12">
<property name="sizePolicy">
@ -1549,7 +1544,6 @@
</property>
</widget>
</item>
<item row="18" column="1">
<widget class="QLabel" name="chaintxcountspacer">
<property name="text">
@ -1614,7 +1608,7 @@
<x>0</x>
<y>0</y>
<width>1487</width>
<height>24</height>
<height>30</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@ -1646,6 +1640,7 @@
<property name="title">
<string>&amp;Apps</string>
</property>
<addaction name="actionGet_Block"/>
<addaction name="actionValidate_Address"/>
<addaction name="separator"/>
</widget>
@ -1751,6 +1746,11 @@
<string>Validate Address</string>
</property>
</action>
<action name="actionGet_Block">
<property name="text">
<string>Get Block Info</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>

2
src/rpc.cpp

@ -375,7 +375,7 @@ void RPC::validateAddress(QString address, const std::function<void(QJsonValue)>
}
void RPC::getBlock(QString height, const std::function<void(QJsonValue)>& cb) {
conn->doRPCWithDefaultErrorHandling(makePayload(height), cb);
conn->doRPCWithDefaultErrorHandling(makePayload("getblock", height), cb);
}
void RPC::getBalance(const std::function<void(QJsonValue)>& cb) {

Loading…
Cancel
Save