move getTransactionFee to OptionsModel

This commit is contained in:
Wladimir J. van der Laan 2011-06-01 09:34:12 +02:00
parent 92f20d53fb
commit 968d55aafa
5 changed files with 10 additions and 8 deletions

View file

@ -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;

View file

@ -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:

View file

@ -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());

View file

@ -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;
}

View file

@ -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;