Copy txid from status bar
This commit is contained in:
@@ -5,9 +5,10 @@
|
|||||||
#include "rpc.h"
|
#include "rpc.h"
|
||||||
#include "balancestablemodel.h"
|
#include "balancestablemodel.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#include "precompiled.h"
|
#include "precompiled.h"
|
||||||
#include "ui_about.h"
|
|
||||||
|
|
||||||
using json = nlohmann::json;
|
using json = nlohmann::json;
|
||||||
|
|
||||||
@@ -28,6 +29,20 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
ui->statusBar->addPermanentWidget(loadingLabel);
|
ui->statusBar->addPermanentWidget(loadingLabel);
|
||||||
loadingLabel->setVisible(false);
|
loadingLabel->setVisible(false);
|
||||||
|
|
||||||
|
ui->statusBar->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
QObject::connect(ui->statusBar, &QStatusBar::customContextMenuRequested, [=](QPoint pos) {
|
||||||
|
auto msg = ui->statusBar->currentMessage();
|
||||||
|
if (!msg.isEmpty() && msg.startsWith(Utils::txidStatusMessage)) {
|
||||||
|
QMenu menu(this);
|
||||||
|
menu.addAction("Copy txid", [=]() {
|
||||||
|
QGuiApplication::clipboard()->setText(msg.split(":")[1].trimmed());
|
||||||
|
});
|
||||||
|
QPoint gpos(mapToGlobal(pos).x(), mapToGlobal(pos).y() + this->height() - ui->statusBar->height());
|
||||||
|
menu.exec(gpos);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
statusLabel = new QLabel();
|
statusLabel = new QLabel();
|
||||||
ui->statusBar->addPermanentWidget(statusLabel);
|
ui->statusBar->addPermanentWidget(statusLabel);
|
||||||
|
|
||||||
@@ -316,7 +331,6 @@ MainWindow::~MainWindow()
|
|||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
delete rpc;
|
delete rpc;
|
||||||
delete settings;
|
|
||||||
|
|
||||||
delete loadingMovie;
|
delete loadingMovie;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -273,8 +273,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>823</width>
|
<width>825</width>
|
||||||
<height>226</height>
|
<height>284</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="sendToLayout">
|
<layout class="QVBoxLayout" name="sendToLayout">
|
||||||
@@ -637,7 +637,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>889</width>
|
<width>889</width>
|
||||||
<height>22</height>
|
<height>21</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuBalance">
|
<widget class="QMenu" name="menuBalance">
|
||||||
@@ -645,7 +645,6 @@
|
|||||||
<string>File</string>
|
<string>File</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionImport_Private_Keys"/>
|
<addaction name="actionImport_Private_Keys"/>
|
||||||
<addaction name="separator"/>
|
|
||||||
<addaction name="actionSettings"/>
|
<addaction name="actionSettings"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionExit"/>
|
<addaction name="actionExit"/>
|
||||||
@@ -685,6 +684,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Import Private Keys</string>
|
<string>Import Private Keys</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="visible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "rpc.h"
|
#include "rpc.h"
|
||||||
|
#include "utils.h"
|
||||||
#include "transactionitem.h"
|
#include "transactionitem.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
@@ -443,9 +444,8 @@ void RPC::refreshTxStatus(const QString& newOpid) {
|
|||||||
QString status = QString::fromStdString(it["status"]);
|
QString status = QString::fromStdString(it["status"]);
|
||||||
if (status == "success") {
|
if (status == "success") {
|
||||||
auto txid = QString::fromStdString(it["result"]["txid"]);
|
auto txid = QString::fromStdString(it["result"]["txid"]);
|
||||||
qDebug() << "Tx complete. txid " << txid;
|
qDebug() << "Tx completed: " << txid;
|
||||||
QGuiApplication::clipboard()->setText(txid);
|
main->ui->statusBar->showMessage(Utils::txidStatusMessage + " " + txid);
|
||||||
main->ui->statusBar->showMessage("Tx completed! Txid copied to clipboard (" + txid + ")");
|
|
||||||
main->loadingLabel->setVisible(false);
|
main->loadingLabel->setVisible(false);
|
||||||
|
|
||||||
watchingOps.remove(id);
|
watchingOps.remove(id);
|
||||||
|
|||||||
@@ -26,4 +26,12 @@ Copy-Item README.md release/$target | Out-Null
|
|||||||
echo "Zipping"
|
echo "Zipping"
|
||||||
Compress-Archive -LiteralPath release/$target -DestinationPath "release/Windows-$target.zip"
|
Compress-Archive -LiteralPath release/$target -DestinationPath "release/Windows-$target.zip"
|
||||||
|
|
||||||
|
echo "Package Contents"
|
||||||
|
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem')
|
||||||
|
foreach($sourceFile in (Get-ChildItem "release/Windows-$target.zip"))
|
||||||
|
{
|
||||||
|
[IO.Compression.ZipFile]::OpenRead($sourceFile.FullName).Entries.FullName |
|
||||||
|
%{ "$sourcefile`:$_" }
|
||||||
|
}
|
||||||
|
|
||||||
echo "Done"
|
echo "Done"
|
||||||
@@ -152,6 +152,7 @@ public:
|
|||||||
actionDonate->setObjectName(QStringLiteral("actionDonate"));
|
actionDonate->setObjectName(QStringLiteral("actionDonate"));
|
||||||
actionImport_Private_Keys = new QAction(MainWindow);
|
actionImport_Private_Keys = new QAction(MainWindow);
|
||||||
actionImport_Private_Keys->setObjectName(QStringLiteral("actionImport_Private_Keys"));
|
actionImport_Private_Keys->setObjectName(QStringLiteral("actionImport_Private_Keys"));
|
||||||
|
actionImport_Private_Keys->setVisible(false);
|
||||||
centralWidget = new QWidget(MainWindow);
|
centralWidget = new QWidget(MainWindow);
|
||||||
centralWidget->setObjectName(QStringLiteral("centralWidget"));
|
centralWidget->setObjectName(QStringLiteral("centralWidget"));
|
||||||
gridLayout_3 = new QGridLayout(centralWidget);
|
gridLayout_3 = new QGridLayout(centralWidget);
|
||||||
@@ -348,7 +349,7 @@ public:
|
|||||||
sendToScrollArea->setWidgetResizable(true);
|
sendToScrollArea->setWidgetResizable(true);
|
||||||
sendToWidgets = new QWidget();
|
sendToWidgets = new QWidget();
|
||||||
sendToWidgets->setObjectName(QStringLiteral("sendToWidgets"));
|
sendToWidgets->setObjectName(QStringLiteral("sendToWidgets"));
|
||||||
sendToWidgets->setGeometry(QRect(0, 0, 823, 226));
|
sendToWidgets->setGeometry(QRect(0, 0, 825, 284));
|
||||||
sendToLayout = new QVBoxLayout(sendToWidgets);
|
sendToLayout = new QVBoxLayout(sendToWidgets);
|
||||||
sendToLayout->setSpacing(6);
|
sendToLayout->setSpacing(6);
|
||||||
sendToLayout->setContentsMargins(11, 11, 11, 11);
|
sendToLayout->setContentsMargins(11, 11, 11, 11);
|
||||||
@@ -604,7 +605,7 @@ public:
|
|||||||
MainWindow->setCentralWidget(centralWidget);
|
MainWindow->setCentralWidget(centralWidget);
|
||||||
menuBar = new QMenuBar(MainWindow);
|
menuBar = new QMenuBar(MainWindow);
|
||||||
menuBar->setObjectName(QStringLiteral("menuBar"));
|
menuBar->setObjectName(QStringLiteral("menuBar"));
|
||||||
menuBar->setGeometry(QRect(0, 0, 889, 22));
|
menuBar->setGeometry(QRect(0, 0, 889, 21));
|
||||||
menuBalance = new QMenu(menuBar);
|
menuBalance = new QMenu(menuBar);
|
||||||
menuBalance->setObjectName(QStringLiteral("menuBalance"));
|
menuBalance->setObjectName(QStringLiteral("menuBalance"));
|
||||||
menuHelp = new QMenu(menuBar);
|
menuHelp = new QMenu(menuBar);
|
||||||
@@ -634,7 +635,6 @@ public:
|
|||||||
menuBar->addAction(menuBalance->menuAction());
|
menuBar->addAction(menuBalance->menuAction());
|
||||||
menuBar->addAction(menuHelp->menuAction());
|
menuBar->addAction(menuHelp->menuAction());
|
||||||
menuBalance->addAction(actionImport_Private_Keys);
|
menuBalance->addAction(actionImport_Private_Keys);
|
||||||
menuBalance->addSeparator();
|
|
||||||
menuBalance->addAction(actionSettings);
|
menuBalance->addAction(actionSettings);
|
||||||
menuBalance->addSeparator();
|
menuBalance->addSeparator();
|
||||||
menuBalance->addAction(actionExit);
|
menuBalance->addAction(actionExit);
|
||||||
|
|||||||
3
utils.cpp
Normal file
3
utils.cpp
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#include "utils.h"
|
||||||
|
|
||||||
|
const QString Utils::txidStatusMessage = QString("Tx submitted (right click to copy) txid:");
|
||||||
14
utils.h
Normal file
14
utils.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#ifndef UTILS_H
|
||||||
|
#define UTILS_H
|
||||||
|
|
||||||
|
#include "precompiled.h"
|
||||||
|
|
||||||
|
class Utils
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static const QString txidStatusMessage;
|
||||||
|
private:
|
||||||
|
Utils() = delete;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // UTILS_H
|
||||||
@@ -49,7 +49,8 @@ SOURCES += \
|
|||||||
src/settings.cpp \
|
src/settings.cpp \
|
||||||
src/sendtab.cpp \
|
src/sendtab.cpp \
|
||||||
src/txtablemodel.cpp \
|
src/txtablemodel.cpp \
|
||||||
src/transactionitem.cpp
|
src/transactionitem.cpp \
|
||||||
|
utils.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
src/mainwindow.h \
|
src/mainwindow.h \
|
||||||
@@ -63,7 +64,8 @@ HEADERS += \
|
|||||||
src/3rdparty/json/json.hpp \
|
src/3rdparty/json/json.hpp \
|
||||||
src/settings.h \
|
src/settings.h \
|
||||||
src/txtablemodel.h \
|
src/txtablemodel.h \
|
||||||
src/transactionitem.h
|
src/transactionitem.h \
|
||||||
|
utils.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
src/mainwindow.ui \
|
src/mainwindow.ui \
|
||||||
|
|||||||
Reference in New Issue
Block a user