Browse Source

move getTransactionFee to OptionsModel

miguelfreitas
Wladimir J. van der Laan 14 years ago
parent
commit
968d55aafa
  1. 2
      gui/include/clientmodel.h
  2. 3
      gui/include/optionsmodel.h
  3. 5
      gui/src/clientmodel.cpp
  4. 5
      gui/src/optionsmodel.cpp
  5. 3
      gui/src/sendcoinsdialog.cpp

2
gui/include/clientmodel.h

@ -29,8 +29,6 @@ public:
int getNumBlocks(); int getNumBlocks();
int getNumTransactions(); int getNumTransactions();
qint64 getTransactionFee();
StatusCode sendCoins(const QString &payTo, qint64 payAmount); StatusCode sendCoins(const QString &payTo, qint64 payAmount);
private: private:
OptionsModel *options_model; OptionsModel *options_model;

3
gui/include/optionsmodel.h

@ -3,6 +3,7 @@
#include <QAbstractListModel> #include <QAbstractListModel>
/* Configuration data structure for bitcoin client */
class OptionsModel : public QAbstractListModel class OptionsModel : public QAbstractListModel
{ {
Q_OBJECT Q_OBJECT
@ -25,6 +26,8 @@ public:
QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const; QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole); bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
/* Explicit getters */
qint64 getTransactionFee();
signals: signals:
public slots: public slots:

5
gui/src/clientmodel.cpp

@ -54,11 +54,6 @@ int ClientModel::getNumTransactions()
return numTransactions; return numTransactions;
} }
qint64 ClientModel::getTransactionFee()
{
return nTransactionFee;
}
void ClientModel::update() void ClientModel::update()
{ {
emit balanceChanged(getBalance()); emit balanceChanged(getBalance());

5
gui/src/optionsmodel.cpp

@ -50,3 +50,8 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
emit dataChanged(index, index); emit dataChanged(index, index);
return true; return true;
} }
qint64 OptionsModel::getTransactionFee()
{
return nTransactionFee;
}

3
gui/src/sendcoinsdialog.cpp

@ -4,6 +4,7 @@
#include "addressbookdialog.h" #include "addressbookdialog.h"
#include "bitcoinaddressvalidator.h" #include "bitcoinaddressvalidator.h"
#include "optionsmodel.h"
#include <QApplication> #include <QApplication>
#include <QClipboard> #include <QClipboard>
@ -86,7 +87,7 @@ void SendCoinsDialog::on_sendButton_clicked()
case ClientModel::AmountWithFeeExceedsBalance: case ClientModel::AmountWithFeeExceedsBalance:
QMessageBox::warning(this, tr("Send Coins"), QMessageBox::warning(this, tr("Send Coins"),
tr("Total exceeds your balance when the %1 transaction fee is included"). tr("Total exceeds your balance when the %1 transaction fee is included").
arg(QString::fromStdString(FormatMoney(model->getTransactionFee()))), arg(QString::fromStdString(FormatMoney(model->getOptionsModel()->getTransactionFee()))),
QMessageBox::Ok, QMessageBox::Ok); QMessageBox::Ok, QMessageBox::Ok);
ui->payAmount->setFocus(); ui->payAmount->setFocus();
break; break;

Loading…
Cancel
Save