Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ BITCOIN_QT_H = \
qt/rpcconsole.h \
qt/sendcoinsdialog.h \
qt/sendcoinsentry.h \
qt/sendcoinsrecipient.h \
qt/signverifymessagedialog.h \
qt/splashscreen.h \
qt/trafficgraphwidget.h \
Expand Down
2 changes: 1 addition & 1 deletion src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <qt/bitcoinaddressvalidator.h>
#include <qt/bitcoinunits.h>
#include <qt/qvalidatedlineedit.h>
#include <qt/walletmodel.h>
#include <qt/sendcoinsrecipient.h>

#include <base58.h>
#include <chainparams.h>
Expand Down
2 changes: 1 addition & 1 deletion src/qt/openuridialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <qt/forms/ui_openuridialog.h>

#include <qt/guiutil.h>
#include <qt/walletmodel.h>
#include <qt/sendcoinsrecipient.h>

#include <QUrl>

Expand Down
6 changes: 5 additions & 1 deletion src/qt/paymentserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@
#include <config/bitcoin-config.h>
#endif

#include <qt/walletmodel.h>
#include <qt/sendcoinsrecipient.h>

#include <QObject>
#include <QString>

class OptionsModel;

namespace interfaces {
class Node;
} // namespace interfaces

QT_BEGIN_NAMESPACE
class QApplication;
class QByteArray;
Expand Down
1 change: 1 addition & 0 deletions src/qt/receiverequestdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <qt/bitcoinunits.h>
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
#include <qt/walletmodel.h>

#include <QClipboard>
#include <QPixmap>
Expand Down
4 changes: 3 additions & 1 deletion src/qt/receiverequestdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
#ifndef BITCOIN_QT_RECEIVEREQUESTDIALOG_H
#define BITCOIN_QT_RECEIVEREQUESTDIALOG_H

#include <qt/walletmodel.h>
#include <qt/sendcoinsrecipient.h>

#include <QDialog>

class WalletModel;

namespace Ui {
class ReceiveRequestDialog;
}
Expand Down
1 change: 1 addition & 0 deletions src/qt/recentrequeststablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <qt/bitcoinunits.h>
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
#include <qt/walletmodel.h>

#include <clientversion.h>
#include <streams.h>
Expand Down
4 changes: 3 additions & 1 deletion src/qt/recentrequeststablemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
#ifndef BITCOIN_QT_RECENTREQUESTSTABLEMODEL_H
#define BITCOIN_QT_RECENTREQUESTSTABLEMODEL_H

#include <qt/walletmodel.h>
#include <qt/sendcoinsrecipient.h>

#include <QAbstractTableModel>
#include <QStringList>
#include <QDateTime>

class WalletModel;

class RecentRequestEntry
{
public:
Expand Down
1 change: 1 addition & 0 deletions src/qt/sendcoinsentry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
#include <qt/platformstyle.h>
#include <qt/walletmodel.h>

#include <QApplication>
#include <QClipboard>
Expand Down
6 changes: 5 additions & 1 deletion src/qt/sendcoinsentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
#ifndef BITCOIN_QT_SENDCOINSENTRY_H
#define BITCOIN_QT_SENDCOINSENTRY_H

#include <qt/walletmodel.h>
#include <qt/sendcoinsrecipient.h>

#include <QStackedWidget>

class WalletModel;
class PlatformStyle;

namespace interfaces {
class Node;
} // namespace interfaces

namespace Ui {
class SendCoinsEntry;
}
Expand Down
74 changes: 74 additions & 0 deletions src/qt/sendcoinsrecipient.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Copyright (c) 2011-2019 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_SENDCOINSRECIPIENT_H
#define BITCOIN_QT_SENDCOINSRECIPIENT_H

#if defined(HAVE_CONFIG_H)
#include <config/bitcoin-config.h>
#endif

#include <amount.h>
#include <serialize.h>

#include <string>

#include <QString>

class SendCoinsRecipient
{
public:
explicit SendCoinsRecipient() : amount(0), fSubtractFeeFromAmount(false), nVersion(SendCoinsRecipient::CURRENT_VERSION) { }
explicit SendCoinsRecipient(const QString &addr, const QString &_label, const CAmount& _amount, const QString &_message):
address(addr), label(_label), amount(_amount), message(_message), fSubtractFeeFromAmount(false), nVersion(SendCoinsRecipient::CURRENT_VERSION) {}

// If from an unauthenticated payment request, this is used for storing
// the addresses, e.g. address-A<br />address-B<br />address-C.
// Info: As we don't need to process addresses in here when using
// payment requests, we can abuse it for displaying an address list.
// Todo: This is a hack, should be replaced with a cleaner solution!
QString address;
QString label;
CAmount amount;
// If from a payment request, this is used for storing the memo
QString message;
// Keep the payment request around as a serialized string to ensure
// load/store is lossless.
std::string sPaymentRequest;
// Empty if no authentication or invalid signature/cert/etc.
QString authenticatedMerchant;

bool fSubtractFeeFromAmount; // memory only

static const int CURRENT_VERSION = 1;
int nVersion;

ADD_SERIALIZE_METHODS;

template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
std::string sAddress = address.toStdString();
std::string sLabel = label.toStdString();
std::string sMessage = message.toStdString();
std::string sAuthenticatedMerchant = authenticatedMerchant.toStdString();

READWRITE(this->nVersion);
READWRITE(sAddress);
READWRITE(sLabel);
READWRITE(amount);
READWRITE(sMessage);
READWRITE(sPaymentRequest);
READWRITE(sAuthenticatedMerchant);

if (ser_action.ForRead())
{
address = QString::fromStdString(sAddress);
label = QString::fromStdString(sLabel);
message = QString::fromStdString(sMessage);
authenticatedMerchant = QString::fromStdString(sAuthenticatedMerchant);
}
}
};

#endif // BITCOIN_QT_SENDCOINSRECIPIENT_H
5 changes: 3 additions & 2 deletions src/qt/transactiondesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@

#include <consensus/consensus.h>
#include <interfaces/node.h>
#include <interfaces/wallet.h>
#include <key_io.h>
#include <validation.h>
#include <policy/policy.h>
#include <script/script.h>
#include <util/system.h>
#include <policy/policy.h>
#include <validation.h>
#include <wallet/ismine.h>

#include <stdint.h>
Expand Down
7 changes: 4 additions & 3 deletions src/qt/walletcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <qt/walletcontroller.h>

#include <qt/askpassphrasedialog.h>
#include <qt/createwalletdialog.h>
#include <qt/guiconstants.h>
#include <qt/guiutil.h>
#include <qt/walletcontroller.h>

#include <wallet/wallet.h>
#include <qt/walletmodel.h>

#include <interfaces/handler.h>
#include <interfaces/node.h>
#include <util/string.h>
#include <wallet/wallet.h>

#include <algorithm>

Expand Down
4 changes: 3 additions & 1 deletion src/qt/walletcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef BITCOIN_QT_WALLETCONTROLLER_H
#define BITCOIN_QT_WALLETCONTROLLER_H

#include <qt/walletmodel.h>
#include <qt/sendcoinsrecipient.h>
#include <support/allocators/secure.h>
#include <sync.h>

Expand All @@ -23,10 +23,12 @@

class OptionsModel;
class PlatformStyle;
class WalletModel;

namespace interfaces {
class Handler;
class Node;
class Wallet;
} // namespace interfaces

class AskPassphraseDialog;
Expand Down
58 changes: 1 addition & 57 deletions src/qt/walletmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
#include <config/bitcoin-config.h>
#endif

#include <amount.h>
#include <key.h>
#include <serialize.h>
#include <script/standard.h>

#include <qt/walletmodeltransaction.h>
Expand All @@ -29,6 +27,7 @@ class AddressTableModel;
class OptionsModel;
class PlatformStyle;
class RecentRequestsTableModel;
class SendCoinsRecipient;
class TransactionTableModel;
class WalletModelTransaction;

Expand All @@ -47,61 +46,6 @@ QT_BEGIN_NAMESPACE
class QTimer;
QT_END_NAMESPACE

class SendCoinsRecipient
{
public:
explicit SendCoinsRecipient() : amount(0), fSubtractFeeFromAmount(false), nVersion(SendCoinsRecipient::CURRENT_VERSION) { }
explicit SendCoinsRecipient(const QString &addr, const QString &_label, const CAmount& _amount, const QString &_message):
address(addr), label(_label), amount(_amount), message(_message), fSubtractFeeFromAmount(false), nVersion(SendCoinsRecipient::CURRENT_VERSION) {}

// If from an unauthenticated payment request, this is used for storing
// the addresses, e.g. address-A<br />address-B<br />address-C.
// Info: As we don't need to process addresses in here when using
// payment requests, we can abuse it for displaying an address list.
// Todo: This is a hack, should be replaced with a cleaner solution!
QString address;
QString label;
CAmount amount;
// If from a payment request, this is used for storing the memo
QString message;
// Keep the payment request around as a serialized string to ensure
// load/store is lossless.
std::string sPaymentRequest;
// Empty if no authentication or invalid signature/cert/etc.
QString authenticatedMerchant;

bool fSubtractFeeFromAmount; // memory only

static const int CURRENT_VERSION = 1;
int nVersion;

ADD_SERIALIZE_METHODS;

template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
std::string sAddress = address.toStdString();
std::string sLabel = label.toStdString();
std::string sMessage = message.toStdString();
std::string sAuthenticatedMerchant = authenticatedMerchant.toStdString();

READWRITE(this->nVersion);
READWRITE(sAddress);
READWRITE(sLabel);
READWRITE(amount);
READWRITE(sMessage);
READWRITE(sPaymentRequest);
READWRITE(sAuthenticatedMerchant);

if (ser_action.ForRead())
{
address = QString::fromStdString(sAddress);
label = QString::fromStdString(sLabel);
message = QString::fromStdString(sMessage);
authenticatedMerchant = QString::fromStdString(sAuthenticatedMerchant);
}
}
};

/** Interface to Bitcoin wallet from Qt view code. */
class WalletModel : public QObject
{
Expand Down
3 changes: 2 additions & 1 deletion src/qt/walletmodeltransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#ifndef BITCOIN_QT_WALLETMODELTRANSACTION_H
#define BITCOIN_QT_WALLETMODELTRANSACTION_H

#include <qt/walletmodel.h>
#include <primitives/transaction.h>
#include <qt/sendcoinsrecipient.h>

#include <amount.h>

Expand Down
3 changes: 0 additions & 3 deletions test/lint/lint-circular-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@ EXPECTED_CIRCULAR_DEPENDENCIES=(
"qt/bitcoingui -> qt/walletframe -> qt/bitcoingui"
"qt/bitcoingui -> qt/walletview -> qt/bitcoingui"
"qt/clientmodel -> qt/peertablemodel -> qt/clientmodel"
"qt/paymentserver -> qt/walletmodel -> qt/paymentserver"
"qt/recentrequeststablemodel -> qt/walletmodel -> qt/recentrequeststablemodel"
"qt/sendcoinsdialog -> qt/walletmodel -> qt/sendcoinsdialog"
"qt/transactiontablemodel -> qt/walletmodel -> qt/transactiontablemodel"
"qt/walletmodel -> qt/walletmodeltransaction -> qt/walletmodel"
"txmempool -> validation -> txmempool"
"wallet/coincontrol -> wallet/wallet -> wallet/coincontrol"
"wallet/fees -> wallet/wallet -> wallet/fees"
"wallet/wallet -> wallet/walletdb -> wallet/wallet"
"policy/fees -> txmempool -> validation -> policy/fees"
"qt/guiutil -> qt/walletmodel -> qt/optionsmodel -> qt/guiutil"
"txmempool -> validation -> validationinterface -> txmempool"
"wallet/scriptpubkeyman -> wallet/wallet -> wallet/scriptpubkeyman"
)
Expand Down