From 17fe007acad5021ab8bb92b95a875af014972273 Mon Sep 17 00:00:00 2001 From: Just Wonder Date: Sun, 5 Apr 2020 22:06:46 -0700 Subject: [PATCH] WIP: Showed value detail. --- src/Makefile.qt.include | 5 + src/qt/forms/kevadetaildialog.ui | 74 +++++++++ src/qt/forms/kevadialog.ui | 41 +++-- src/qt/kevadetaildialog.cpp | 27 ++++ src/qt/kevadetaildialog.h | 34 ++++ src/qt/kevadialog.cpp | 30 ++-- src/qt/kevadialog.h | 4 +- src/qt/locale/bitcoin_en.ts | 257 +++++-------------------------- 8 files changed, 227 insertions(+), 245 deletions(-) create mode 100644 src/qt/forms/kevadetaildialog.ui create mode 100644 src/qt/kevadetaildialog.cpp create mode 100644 src/qt/kevadetaildialog.h diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index 0d762860f..bf87d3168 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -136,6 +136,7 @@ QT_FORMS_UI = \ qt/forms/receivecoinsdialog.ui \ qt/forms/receiverequestdialog.ui \ qt/forms/kevadialog.ui \ + qt/forms/kevadetaildialog.ui \ qt/forms/debugwindow.ui \ qt/forms/sendcoinsdialog.ui \ qt/forms/sendcoinsentry.ui \ @@ -175,6 +176,7 @@ QT_MOC_CPP = \ qt/moc_receiverequestdialog.cpp \ qt/moc_recentrequeststablemodel.cpp \ qt/moc_kevatablemodel.cpp \ + qt/moc_kevadetaildialog.cpp \ qt/moc_rpcconsole.cpp \ qt/moc_sendcoinsdialog.cpp \ qt/moc_sendcoinsentry.cpp \ @@ -262,6 +264,8 @@ BITCOIN_QT_H = \ qt/transactiontablemodel.h \ qt/transactionview.h \ qt/kevadialog.h \ + qt/kevatablemodel.h \ + qt/kevadetaildialog.h \ qt/utilitydialog.h \ qt/walletframe.h \ qt/walletmodel.h \ @@ -379,6 +383,7 @@ BITCOIN_QT_WALLET_CPP = \ qt/transactionview.cpp \ qt/kevadialog.cpp \ qt/kevatablemodel.cpp \ + qt/kevadetaildialog.cpp \ qt/walletframe.cpp \ qt/walletmodel.cpp \ qt/walletmodeltransaction.cpp \ diff --git a/src/qt/forms/kevadetaildialog.ui b/src/qt/forms/kevadetaildialog.ui new file mode 100644 index 000000000..8788f55e6 --- /dev/null +++ b/src/qt/forms/kevadetaildialog.ui @@ -0,0 +1,74 @@ + + + KevaDetailDialog + + + + 0 + 0 + 800 + 400 + + + + Value + + + + + + This pane shows the value associated with a give key + + + true + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + + + + + + + buttonBox + accepted() + KevaDetailDialog + accept() + + + 20 + 20 + + + 20 + 20 + + + + + buttonBox + rejected() + KevaDetailDialog + reject() + + + 20 + 20 + + + 20 + 20 + + + + + diff --git a/src/qt/forms/kevadialog.ui b/src/qt/forms/kevadialog.ui index 74fe9422a..26b1637c1 100644 --- a/src/qt/forms/kevadialog.ui +++ b/src/qt/forms/kevadialog.ui @@ -48,7 +48,7 @@ The namespace ID with a prefix "N". - &Namespace: + Namespace: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -72,7 +72,7 @@ Show content of the namespace. - Show content + Show @@ -85,14 +85,17 @@ - - - 150 - 0 - + + + 0 + 0 + + + + Bookmark this namespace - &Previously used namespaces + &Bookmark @@ -100,6 +103,26 @@ + + + + + 0 + 0 + + + + Create a new namespace + + + &Create + + + + :/icons/add:/icons/add + + + @@ -169,7 +192,7 @@ - + Qt::CustomContextMenu diff --git a/src/qt/kevadetaildialog.cpp b/src/qt/kevadetaildialog.cpp new file mode 100644 index 000000000..b1c2d0dfa --- /dev/null +++ b/src/qt/kevadetaildialog.cpp @@ -0,0 +1,27 @@ +// Copyright (c) 2011-2017 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include +#include + +#include + +#include + +KevaDetailDialog::KevaDetailDialog(const QModelIndex &idx, QWidget *parent) : + QDialog(parent), + ui(new Ui::KevaDetailDialog) +{ + ui->setupUi(this); + QModelIndex keyIdx = idx.sibling(idx.row(), KevaTableModel::Key); + QModelIndex valueIdx = idx.sibling(idx.row(), KevaTableModel::Value); + setWindowTitle(tr("Value for %1").arg(keyIdx.data(Qt::DisplayRole).toString())); + QString desc = valueIdx.data(Qt::DisplayRole).toString(); + ui->detailText->setHtml(desc); +} + +KevaDetailDialog::~KevaDetailDialog() +{ + delete ui; +} \ No newline at end of file diff --git a/src/qt/kevadetaildialog.h b/src/qt/kevadetaildialog.h new file mode 100644 index 000000000..a4a43e105 --- /dev/null +++ b/src/qt/kevadetaildialog.h @@ -0,0 +1,34 @@ +// Copyright (c) 2011-2014 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_QT_KEVADETAILDIALOG_H +#define BITCOIN_QT_KEVADETAILDIALOG_H + +#include +#include + +#include + +namespace Ui { + class KevaDetailDialog; +} + +QT_BEGIN_NAMESPACE +class QModelIndex; +QT_END_NAMESPACE + +/** Dialog showing transaction details. */ +class KevaDetailDialog : public QDialog +{ + Q_OBJECT + +public: + explicit KevaDetailDialog(const QModelIndex &idx, QWidget *parent = 0); + ~KevaDetailDialog(); + +private: + Ui::KevaDetailDialog *ui; +}; + +#endif // BITCOIN_QT_KEVADETAILDIALOG_H diff --git a/src/qt/kevadialog.cpp b/src/qt/kevadialog.cpp index a8b63ff23..c6751bd7a 100644 --- a/src/qt/kevadialog.cpp +++ b/src/qt/kevadialog.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -56,7 +57,7 @@ KevaDialog::KevaDialog(const PlatformStyle *_platformStyle, QWidget *parent) : contextMenu->addAction(copyAmountAction); // context menu signals - connect(ui->recentRequestsView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint))); + connect(ui->kevaView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint))); connect(copyURIAction, SIGNAL(triggered()), this, SLOT(copyURI())); connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel())); connect(copyMessageAction, SIGNAL(triggered()), this, SLOT(copyMessage())); @@ -71,7 +72,7 @@ void KevaDialog::setModel(WalletModel *_model) if(_model && _model->getOptionsModel()) { _model->getKevaTableModel()->sort(KevaTableModel::Block, Qt::DescendingOrder); - QTableView* tableView = ui->recentRequestsView; + QTableView* tableView = ui->kevaView; tableView->verticalHeader()->hide(); tableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -137,40 +138,37 @@ void KevaDialog::on_showContent_clicked() model->getKevaTableModel()->sort(KevaTableModel::Date, Qt::DescendingOrder); } -void KevaDialog::on_recentRequestsView_doubleClicked(const QModelIndex &index) +void KevaDialog::on_kevaView_doubleClicked(const QModelIndex &index) { - const KevaTableModel *submodel = model->getKevaTableModel(); - ReceiveRequestDialog *dialog = new ReceiveRequestDialog(this); - dialog->setModel(model->getOptionsModel()); - //dialog->setInfo(submodel->entry(index.row()).recipient); + KevaDetailDialog *dialog = new KevaDetailDialog(index, this); dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->show(); } -void KevaDialog::recentRequestsView_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) +void KevaDialog::kevaView_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) { // Enable Show/Remove buttons only if anything is selected. - bool enable = !ui->recentRequestsView->selectionModel()->selectedRows().isEmpty(); + bool enable = !ui->kevaView->selectionModel()->selectedRows().isEmpty(); ui->showRequestButton->setEnabled(enable); ui->removeRequestButton->setEnabled(enable); } void KevaDialog::on_showRequestButton_clicked() { - if(!model || !model->getKevaTableModel() || !ui->recentRequestsView->selectionModel()) + if(!model || !model->getKevaTableModel() || !ui->kevaView->selectionModel()) return; - QModelIndexList selection = ui->recentRequestsView->selectionModel()->selectedRows(); + QModelIndexList selection = ui->kevaView->selectionModel()->selectedRows(); for (const QModelIndex& index : selection) { - on_recentRequestsView_doubleClicked(index); + on_kevaView_doubleClicked(index); } } void KevaDialog::on_removeRequestButton_clicked() { - if(!model || !model->getKevaTableModel() || !ui->recentRequestsView->selectionModel()) + if(!model || !model->getKevaTableModel() || !ui->kevaView->selectionModel()) return; - QModelIndexList selection = ui->recentRequestsView->selectionModel()->selectedRows(); + QModelIndexList selection = ui->kevaView->selectionModel()->selectedRows(); if(selection.empty()) return; // correct for selection mode ContiguousSelection @@ -204,9 +202,9 @@ void KevaDialog::keyPressEvent(QKeyEvent *event) QModelIndex KevaDialog::selectedRow() { - if(!model || !model->getKevaTableModel() || !ui->recentRequestsView->selectionModel()) + if(!model || !model->getKevaTableModel() || !ui->kevaView->selectionModel()) return QModelIndex(); - QModelIndexList selection = ui->recentRequestsView->selectionModel()->selectedRows(); + QModelIndexList selection = ui->kevaView->selectionModel()->selectedRows(); if(selection.empty()) return QModelIndex(); // correct for selection mode ContiguousSelection diff --git a/src/qt/kevadialog.h b/src/qt/kevadialog.h index fb83c521f..03cdc55ab 100644 --- a/src/qt/kevadialog.h +++ b/src/qt/kevadialog.h @@ -67,8 +67,8 @@ private Q_SLOTS: void on_showContent_clicked(); void on_showRequestButton_clicked(); void on_removeRequestButton_clicked(); - void on_recentRequestsView_doubleClicked(const QModelIndex &index); - void recentRequestsView_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); + void on_kevaView_doubleClicked(const QModelIndex &index); + void kevaView_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); void updateDisplayUnit(); void showMenu(const QPoint &point); void copyURI(); diff --git a/src/qt/locale/bitcoin_en.ts b/src/qt/locale/bitcoin_en.ts index 4e6d17222..f32c15590 100644 --- a/src/qt/locale/bitcoin_en.ts +++ b/src/qt/locale/bitcoin_en.ts @@ -1160,87 +1160,79 @@ - KevaDialog + KevaDetailDialog - - - An optional amount to request. Leave this empty or zero to not request a specific amount. + + This pane shows the value associated with a give key - - &Amount: + + Value for %1 + + + KevaDialog - - - An optional message to attach to the payment request, which will be displayed when the request is opened. Note: The message will not be sent with the payment over the Kevacoin network. + + Show the selected request (does the same as double clicking an entry) - - &Message: + + + Show - + - An optional label to associate with the new receiving address. + The namespace ID with a prefix "N". - Use this form to request payments. All fields are <b>optional</b>. + Use this form to perform Keva database operations. - &Label: - &Label: - - - - &Request payment + Namespace: - - Clear all fields of the form. - - - - - Clear + + Show content of the namespace. - - Native segwit addresses (aka Bech32 or BIP-173) reduce your transaction fees later on and offer better protection against typos, but old wallets don't support them. When unchecked, an address compatible with older wallets will be created instead. + + Bookmark this namespace - Generate native segwit (Bech32) address + &Bookmark - - Requested payments history + + Create a new namespace - - Show the selected request (does the same as double clicking an entry) + + &Create - - Show + + Content of namespace - + Remove the selected entries from the list @@ -1271,201 +1263,30 @@ - KevaView - - - - All - - - - - Today - - - - - This week - - - - - This month - - - - - Last month - - - - - This year - - - - - Range... - - - - - Received with - - - - - Sent to - - - - - To yourself - - - - - Mined - - - - - Other - - - - - Enter address, transaction id, or label to search - - - - - Min amount - - - - - Abandon transaction - - + KevaTableModel - - Increase transaction fee - - - - - Copy address - - - - - Copy label - - - - - Copy amount - - - - - Copy transaction ID - - - - - Copy raw transaction - - - - - Copy full transaction details - - - - - Edit label - - - - - Show transaction details - - - - - Export Transaction History - - - - - Comma separated file (*.csv) - - - - - Confirmed - Confirmed - - - - Watch-only - - - - + Date Date - - - Type - - - - - Label - - - - - Address - - - - - ID - - - - - Exporting Failed - - - There was an error trying to save the transaction history to %1. - - - - - Exporting Successful + Key - The transaction history was successfully saved to %1. + Value - - Range: + + Block - - to + + Requested @@ -4199,12 +4020,12 @@ WalletModel - + Send Coins Send Coins - + Fee bump error