mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 21:12:48 +01:00
ask fee
This commit is contained in:
parent
00b8acdf49
commit
b7726d924e
@ -22,7 +22,9 @@ This has been implemented:
|
|||||||
|
|
||||||
- Options dialog
|
- Options dialog
|
||||||
|
|
||||||
- Sending coins
|
- Sending coins (including ask for fee when needed)
|
||||||
|
|
||||||
|
- Show messages from core
|
||||||
|
|
||||||
This has to be done:
|
This has to be done:
|
||||||
|
|
||||||
@ -34,6 +36,4 @@ This has to be done:
|
|||||||
|
|
||||||
- Show details dialog for transactions (on double click)
|
- Show details dialog for transactions (on double click)
|
||||||
|
|
||||||
- Display error messages/alerts from core
|
|
||||||
|
|
||||||
- More thorough testing of the view with all the kinds of transactions (sendmany, generation)
|
- More thorough testing of the view with all the kinds of transactions (sendmany, generation)
|
||||||
|
@ -66,6 +66,7 @@ public slots:
|
|||||||
void setNumBlocks(int count);
|
void setNumBlocks(int count);
|
||||||
void setNumTransactions(int count);
|
void setNumTransactions(int count);
|
||||||
void error(const QString &title, const QString &message);
|
void error(const QString &title, const QString &message);
|
||||||
|
void askFee(qint64 nFeeRequired, bool *payFee);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void sendcoinsClicked();
|
void sendcoinsClicked();
|
||||||
|
@ -5,10 +5,12 @@
|
|||||||
#include "clientmodel.h"
|
#include "clientmodel.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
|
#include "main.h"
|
||||||
#include "externui.h"
|
#include "externui.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
// Need a global reference for the notifications to find the GUI
|
// Need a global reference for the notifications to find the GUI
|
||||||
BitcoinGUI *guiref;
|
BitcoinGUI *guiref;
|
||||||
@ -16,7 +18,6 @@ BitcoinGUI *guiref;
|
|||||||
int MyMessageBox(const std::string& message, const std::string& caption, int style, wxWindow* parent, int x, int y)
|
int MyMessageBox(const std::string& message, const std::string& caption, int style, wxWindow* parent, int x, int y)
|
||||||
{
|
{
|
||||||
// Message from main thread
|
// Message from main thread
|
||||||
printf("MyMessageBox\n");
|
|
||||||
if(guiref)
|
if(guiref)
|
||||||
{
|
{
|
||||||
guiref->error(QString::fromStdString(caption),
|
guiref->error(QString::fromStdString(caption),
|
||||||
@ -50,9 +51,26 @@ int ThreadSafeMessageBox(const std::string& message, const std::string& caption,
|
|||||||
|
|
||||||
bool ThreadSafeAskFee(int64 nFeeRequired, const std::string& strCaption, wxWindow* parent)
|
bool ThreadSafeAskFee(int64 nFeeRequired, const std::string& strCaption, wxWindow* parent)
|
||||||
{
|
{
|
||||||
// Query from network thread
|
if(!guiref)
|
||||||
// TODO
|
return false;
|
||||||
return true;
|
if(nFeeRequired < MIN_TX_FEE || nFeeRequired <= nTransactionFee || fDaemon)
|
||||||
|
return true;
|
||||||
|
bool payFee = false;
|
||||||
|
|
||||||
|
/* Call slot on GUI thread.
|
||||||
|
If called from another thread, use a blocking QueuedConnection.
|
||||||
|
*/
|
||||||
|
Qt::ConnectionType connectionType = Qt::DirectConnection;
|
||||||
|
if(QThread::currentThread() != QCoreApplication::instance()->thread())
|
||||||
|
{
|
||||||
|
connectionType = Qt::BlockingQueuedConnection;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMetaObject::invokeMethod(guiref, "askFee", connectionType,
|
||||||
|
Q_ARG(qint64, nFeeRequired),
|
||||||
|
Q_ARG(bool*, &payFee));
|
||||||
|
|
||||||
|
return payFee;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalledSetStatusBar(const std::string& strText, int nField)
|
void CalledSetStatusBar(const std::string& strText, int nField)
|
||||||
@ -73,13 +91,13 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
app.setQuitOnLastWindowClosed(false);
|
app.setQuitOnLastWindowClosed(false);
|
||||||
BitcoinGUI window;
|
|
||||||
guiref = &window;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if(AppInit2(argc, argv))
|
if(AppInit2(argc, argv))
|
||||||
{
|
{
|
||||||
|
BitcoinGUI window;
|
||||||
ClientModel model;
|
ClientModel model;
|
||||||
|
guiref = &window;
|
||||||
window.setModel(&model);
|
window.setModel(&model);
|
||||||
|
|
||||||
window.show();
|
window.show();
|
||||||
|
@ -380,3 +380,15 @@ void BitcoinGUI::closeEvent(QCloseEvent *event)
|
|||||||
}
|
}
|
||||||
QMainWindow::closeEvent(event);
|
QMainWindow::closeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BitcoinGUI::askFee(qint64 nFeeRequired, bool *payFee)
|
||||||
|
{
|
||||||
|
QString strMessage =
|
||||||
|
tr("This transaction is over the size limit. You can still send it for a fee of %1, "
|
||||||
|
"which goes to the nodes that process your transaction and helps to support the network. "
|
||||||
|
"Do you want to pay the fee?").arg(QString::fromStdString(FormatMoney(nFeeRequired)));
|
||||||
|
QMessageBox::StandardButton retval = QMessageBox::question(
|
||||||
|
this, tr("Sending..."), strMessage,
|
||||||
|
QMessageBox::Yes|QMessageBox::Cancel, QMessageBox::Yes);
|
||||||
|
*payFee = (retval == QMessageBox::Yes);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user