Cleanup code using forward declarations.

Use misc methods of avoiding unnecesary header includes.
Replace int typedefs with int##_t from stdint.h.
Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h.
Normalize QT_VERSION ifs where possible.
Resolve some indirect dependencies as direct ones.
Remove extern declarations from .cpp files.
This commit is contained in:
Brandon Dahler
2013-04-13 00:13:08 -05:00
parent 7c4c207be8
commit 51ed9ec971
177 changed files with 2084 additions and 1681 deletions

View File

@@ -6,6 +6,7 @@
#include "ui_aboutdialog.h"
#include "clientmodel.h"
#include "clientversion.h"
AboutDialog::AboutDialog(QWidget *parent) :

View File

@@ -7,10 +7,11 @@
#include <QDialog>
class ClientModel;
namespace Ui {
class AboutDialog;
}
class ClientModel;
/** "About" dialog box */
class AboutDialog : public QDialog

View File

@@ -11,14 +11,14 @@
#include "addresstablemodel.h"
#include "bitcoingui.h"
#include "editaddressdialog.h"
#include "csvmodelwriter.h"
#include "editaddressdialog.h"
#include "guiutil.h"
#include <QSortFilterProxyModel>
#include <QClipboard>
#include <QMessageBox>
#include <QIcon>
#include <QMenu>
#include <QMessageBox>
#include <QSortFilterProxyModel>
AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
QDialog(parent),

View File

@@ -7,17 +7,19 @@
#include <QDialog>
class AddressTableModel;
class OptionsModel;
namespace Ui {
class AddressBookPage;
}
class AddressTableModel;
QT_BEGIN_NAMESPACE
class QTableView;
class QItemSelection;
class QSortFilterProxyModel;
class QMenu;
class QModelIndex;
class QSortFilterProxyModel;
class QTableView;
QT_END_NAMESPACE
/** Widget that shows a list of sending or receiving addresses.

View File

@@ -7,8 +7,8 @@
#include "guiutil.h"
#include "walletmodel.h"
#include "wallet.h"
#include "base58.h"
#include "wallet.h"
#include <QFont>
#include <QDebug>

View File

@@ -9,9 +9,10 @@
#include <QStringList>
class AddressTablePriv;
class CWallet;
class WalletModel;
class CWallet;
/**
Qt model of the address book in the core. This allows views to access and modify the address book.
*/

View File

@@ -8,9 +8,11 @@
#include "guiconstants.h"
#include "walletmodel.h"
#include "allocators.h"
#include <QKeyEvent>
#include <QMessageBox>
#include <QPushButton>
#include <QKeyEvent>
AskPassphraseDialog::AskPassphraseDialog(Mode mode, QWidget *parent) :
QDialog(parent),

View File

@@ -7,10 +7,11 @@
#include <QDialog>
class WalletModel;
namespace Ui {
class AskPassphraseDialog;
}
class WalletModel;
/** Multifunctional dialog to ask for passphrases. Used for encryption, unlocking, and changing the passphrase.
*/

View File

@@ -3,28 +3,35 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "bitcoingui.h"
#include "clientmodel.h"
#include "walletmodel.h"
#include "optionsmodel.h"
#include "guiutil.h"
#include "guiconstants.h"
#include "init.h"
#include "util.h"
#include "ui_interface.h"
#include "guiutil.h"
#include "intro.h"
#include "optionsmodel.h"
#include "paymentserver.h"
#include "splashscreen.h"
#include "intro.h"
#include "walletmodel.h"
#include "init.h"
#include "main.h"
#include "ui_interface.h"
#include "util.h"
#include <stdint.h>
#include <boost/filesystem/operations.hpp>
#include <QApplication>
#include <QLibraryInfo>
#include <QLocale>
#include <QMessageBox>
#include <QSettings>
#include <QTimer>
#include <QTranslator>
#if QT_VERSION < 0x050000
#include <QTextCodec>
#endif
#include <QLocale>
#include <QTimer>
#include <QTranslator>
#include <QLibraryInfo>
#include <QSettings>
#if defined(BITCOIN_NEED_QT_PLUGINS) && !defined(_BITCOIN_QT_PLUGINS_INCLUDED)
#define _BITCOIN_QT_PLUGINS_INCLUDED
@@ -68,7 +75,7 @@ static bool ThreadSafeMessageBox(const std::string& message, const std::string&
}
}
static bool ThreadSafeAskFee(int64 nFeeRequired)
static bool ThreadSafeAskFee(int64_t nFeeRequired)
{
if(!guiref)
return false;

View File

@@ -4,15 +4,14 @@
#include "bitcoinamountfield.h"
#include "qvaluecombobox.h"
#include "bitcoinunits.h"
#include "guiconstants.h"
#include "qvaluecombobox.h"
#include <QApplication>
#include <QDoubleSpinBox>
#include <QHBoxLayout>
#include <QKeyEvent>
#include <QDoubleSpinBox>
#include <qmath.h> // for qPow()
BitcoinAmountField::BitcoinAmountField(QWidget *parent):

View File

@@ -4,49 +4,54 @@
#include "bitcoingui.h"
#include "optionsdialog.h"
#include "aboutdialog.h"
#include "clientmodel.h"
#include "walletmodel.h"
#include "walletframe.h"
#include "optionsmodel.h"
#include "bitcoinunits.h"
#include "clientmodel.h"
#include "guiconstants.h"
#include "notificator.h"
#include "guiutil.h"
#include "notificator.h"
#include "optionsdialog.h"
#include "optionsmodel.h"
#include "rpcconsole.h"
#include "ui_interface.h"
#include "wallet.h"
#include "init.h"
#include "walletframe.h"
#include "walletmodel.h"
#ifdef Q_OS_MAC
#include "macdockiconhandler.h"
#endif
#include "init.h"
#include "ui_interface.h"
#include <iostream>
#include <QApplication>
#include <QMenuBar>
#include <QMenu>
#include <QIcon>
#include <QVBoxLayout>
#include <QToolBar>
#include <QStatusBar>
#include <QLabel>
#include <QMessageBox>
#include <QProgressBar>
#include <QStackedWidget>
#include <QDateTime>
#include <QMovie>
#include <QTimer>
#include <QDesktopWidget>
#include <QDragEnterEvent>
#include <QIcon>
#include <QLabel>
#include <QListWidget>
#include <QMenu>
#include <QMenuBar>
#include <QMessageBox>
#include <QMimeData>
#include <QMovie>
#include <QProgressBar>
#include <QSettings>
#include <QStackedWidget>
#include <QStatusBar>
#include <QStyle>
#include <QTimer>
#include <QToolBar>
#include <QVBoxLayout>
#if QT_VERSION < 0x050000
#include <QUrl>
#include <QTextDocument>
#else
#include <QUrlQuery>
#endif
#include <QMimeData>
#include <QStyle>
#include <QListWidget>
#include <iostream>
const QString BitcoinGUI::DEFAULT_WALLET = "~Default";

View File

@@ -6,32 +6,22 @@
#define BITCOINGUI_H
#include <QMainWindow>
#include <QSystemTrayIcon>
#include <QMap>
#include <QSystemTrayIcon>
class WalletFrame;
class WalletView;
class ClientModel;
class WalletModel;
class WalletStack;
class OverviewPage;
class SendCoinsDialog;
class SendCoinsRecipient;
class SignVerifyMessageDialog;
class Notificator;
class RPCConsole;
class SendCoinsRecipient;
class WalletFrame;
class WalletModel;
class CWallet;
QT_BEGIN_NAMESPACE
class QLabel;
class QModelIndex;
class QProgressBar;
class QStackedWidget;
class QUrl;
class QListWidget;
class QPushButton;
class QAction;
class QLabel;
class QProgressBar;
QT_END_NAMESPACE
/**

View File

@@ -1,4 +1,7 @@
#include <QtGlobal>
// Automatically generated by extract_strings.py
#ifdef __GNUC__
#define UNUSED __attribute__((unused))
@@ -221,4 +224,4 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Warning"),
QT_TRANSLATE_NOOP("bitcoin-core", "Warning: This version is obsolete, upgrade required!"),
QT_TRANSLATE_NOOP("bitcoin-core", "You need to rebuild the database using -reindex to change -txindex"),
QT_TRANSLATE_NOOP("bitcoin-core", "wallet.dat corrupt, salvage failed"),
};
};

View File

@@ -5,8 +5,8 @@
#ifndef BITCOINUNITS_H
#define BITCOINUNITS_H
#include <QString>
#include <QAbstractListModel>
#include <QString>
/** Bitcoin unit definitions. Encapsulates parsing and formatting
and serves as list model for drop-down selection boxes.

View File

@@ -5,21 +5,21 @@
#include "clientmodel.h"
#include "guiconstants.h"
#include "optionsmodel.h"
#include "addresstablemodel.h"
#include "transactiontablemodel.h"
#include "chainparams.h"
#include "alert.h"
#include "main.h"
#include "chainparams.h"
#include "checkpoints.h"
#include "main.h"
#include "net.h"
#include "ui_interface.h"
#include <QDateTime>
#include <QTimer>
#include <QDebug>
#include <stdint.h>
static const int64 nClientStartupTime = GetTime();
#include <QDateTime>
#include <QDebug>
#include <QTimer>
static const int64_t nClientStartupTime = GetTime();
ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) :
QObject(parent), optionsModel(optionsModel),

View File

@@ -7,9 +7,10 @@
#include <QObject>
class OptionsModel;
class AddressTableModel;
class OptionsModel;
class TransactionTableModel;
class CWallet;
QT_BEGIN_NAMESPACE

View File

@@ -5,8 +5,8 @@
#ifndef CSVMODELWRITER_H
#define CSVMODELWRITER_H
#include <QObject>
#include <QList>
#include <QObject>
QT_BEGIN_NAMESPACE
class QAbstractItemModel;

View File

@@ -7,10 +7,11 @@
#include <QDialog>
class AddressTableModel;
namespace Ui {
class EditAddressDialog;
}
class AddressTableModel;
QT_BEGIN_NAMESPACE
class QDataWidgetMapper;

View File

@@ -5,33 +5,12 @@
#include "guiutil.h"
#include "bitcoinaddressvalidator.h"
#include "walletmodel.h"
#include "bitcoinunits.h"
#include "walletmodel.h"
#include "util.h"
#include "core.h"
#include "init.h"
#include <QApplication>
#include <QDateTime>
#include <QDoubleValidator>
#include <QFont>
#include <QLineEdit>
#if QT_VERSION >= 0x050000
#include <QUrlQuery>
#else
#include <QUrl>
#endif
#include <QTextDocument> // for Qt::mightBeRichText
#include <QAbstractItemView>
#include <QClipboard>
#include <QFileDialog>
#include <QDesktopServices>
#include <QThread>
#include <QSettings>
#include <QDesktopWidget>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include "util.h"
#ifdef WIN32
#ifdef _WIN32_WINNT
@@ -46,9 +25,31 @@
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include "shlwapi.h"
#include "shlobj.h"
#include "shellapi.h"
#include "shlobj.h"
#include "shlwapi.h"
#endif
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <QAbstractItemView>
#include <QApplication>
#include <QClipboard>
#include <QDateTime>
#include <QDesktopServices>
#include <QDesktopWidget>
#include <QDoubleValidator>
#include <QFileDialog>
#include <QFont>
#include <QLineEdit>
#include <QSettings>
#include <QTextDocument> // for Qt::mightBeRichText
#include <QThread>
#if QT_VERSION < 0x050000
#include <QUrl>
#else
#include <QUrlQuery>
#endif
namespace GUIUtil {

View File

@@ -5,19 +5,19 @@
#ifndef GUIUTIL_H
#define GUIUTIL_H
#include <QString>
#include <QObject>
#include <QMessageBox>
#include <QObject>
#include <QString>
class SendCoinsRecipient;
QT_BEGIN_NAMESPACE
class QAbstractItemView;
class QDateTime;
class QFont;
class QLineEdit;
class QWidget;
class QDateTime;
class QUrl;
class QAbstractItemView;
class QWidget;
QT_END_NAMESPACE
/** Utility functions used by the Bitcoin Qt UI.

View File

@@ -4,17 +4,17 @@
#include "intro.h"
#include "ui_intro.h"
#include "util.h"
#include <boost/filesystem.hpp>
#include <QFileDialog>
#include <QSettings>
#include <QMessageBox>
#include <boost/filesystem.hpp>
/* Minimum free space (in bytes) needed for data directory */
static const uint64 GB_BYTES = 1000000000LL;
static const uint64 BLOCK_CHAIN_SIZE = 10LL * GB_BYTES;
static const uint64_t GB_BYTES = 1000000000LL;
static const uint64_t BLOCK_CHAIN_SIZE = 10LL * GB_BYTES;
/* Check free space asynchronously to prevent hanging the UI thread.
@@ -60,7 +60,7 @@ void FreespaceChecker::check()
namespace fs = boost::filesystem;
QString dataDirStr = intro->getPathToCheck();
fs::path dataDir = fs::path(dataDirStr.toStdString());
uint64 freeBytesAvailable = 0;
uint64_t freeBytesAvailable = 0;
int replyStatus = ST_OK;
QString replyMessage = tr("A new data directory will be created.");

View File

@@ -6,13 +6,14 @@
#define INTRO_H
#include <QDialog>
#include <QThread>
#include <QMutex>
#include <QThread>
class FreespaceChecker;
namespace Ui {
class Intro;
}
class FreespaceChecker;
/** Introduction screen (pre-GUI startup).
Allows the user to choose a data directory,

View File

@@ -5,12 +5,12 @@
#ifndef MACDOCKICONHANDLER_H
#define MACDOCKICONHANDLER_H
#include <QObject>
#include <QMainWindow>
#include <QObject>
QT_BEGIN_NAMESPACE
class QMenu;
class QIcon;
class QMenu;
class QWidget;
QT_END_NAMESPACE

View File

@@ -4,6 +4,7 @@
#ifndef MACNOTIFICATIONHANDLER_H
#define MACNOTIFICATIONHANDLER_H
#include <QObject>
/** Macintosh-specific notification handler (supports UserNotificationCenter and Growl).

View File

@@ -4,9 +4,9 @@
#include "monitoreddatamapper.h"
#include <QWidget>
#include <QMetaObject>
#include <QMetaProperty>
#include <QWidget>
MonitoredDataMapper::MonitoredDataMapper(QObject *parent) :
QDataWidgetMapper(parent)

View File

@@ -4,27 +4,31 @@
#include "notificator.h"
#include <QApplication>
#include <QMetaType>
#include <QVariant>
#include <QIcon>
#include <QStyle>
#include <QByteArray>
#include <QSystemTrayIcon>
#include <QMessageBox>
#include <QTemporaryFile>
#include <QImageWriter>
#ifdef USE_DBUS
#include <QtDBus>
#include <stdint.h>
#endif
#include <QApplication>
#include <QByteArray>
#include <QIcon>
#include <QImageWriter>
#include <QMessageBox>
#include <QMetaType>
#include <QStyle>
#include <QSystemTrayIcon>
#include <QTemporaryFile>
#include <QVariant>
#ifdef Q_OS_MAC
#include <ApplicationServices/ApplicationServices.h>
#include "macnotificationhandler.h"
#include <ApplicationServices/ApplicationServices.h>
#endif
#ifdef USE_DBUS
#include <stdint.h>
#include <QtDBus>
#endif
// https://wiki.ubuntu.com/NotificationDevelopmentGuidelines recommends at least 128
const int FREEDESKTOP_NOTIFICATION_ICON_SIZE = 128;

View File

@@ -9,11 +9,12 @@
#include "bitcoin-config.h"
#endif
#include <QObject>
#include <QIcon>
#include <QObject>
QT_BEGIN_NAMESPACE
class QSystemTrayIcon;
#ifdef USE_DBUS
class QDBusInterface;
#endif

View File

@@ -11,9 +11,10 @@
#include "bitcoinunits.h"
#include "monitoreddatamapper.h"
#include "netbase.h"
#include "optionsmodel.h"
#include "netbase.h"
#include <QDir>
#include <QIntValidator>
#include <QLocale>

View File

@@ -7,12 +7,13 @@
#include <QDialog>
class MonitoredDataMapper;
class OptionsModel;
class QValidatedLineEdit;
namespace Ui {
class OptionsDialog;
}
class OptionsModel;
class MonitoredDataMapper;
class QValidatedLineEdit;
/** Preferences dialog. */
class OptionsDialog : public QDialog

View File

@@ -9,13 +9,13 @@
#include "optionsmodel.h"
#include "bitcoinunits.h"
#include "init.h"
#include "core.h"
#include "wallet.h"
#include "netbase.h"
#include "walletdb.h"
#include "guiutil.h"
#include "init.h"
#include "main.h"
#include "net.h"
#include "walletdb.h"
#include <QSettings>
OptionsModel::OptionsModel(QObject *parent) :
@@ -200,7 +200,7 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
return QVariant(5);
}
case Fee:
return QVariant(nTransactionFee);
return QVariant((qint64) nTransactionFee);
case DisplayUnit:
return QVariant(nDisplayUnit);
case DisplayAddresses:
@@ -274,7 +274,7 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
break;
case Fee:
nTransactionFee = value.toLongLong();
settings.setValue("nTransactionFee", nTransactionFee);
settings.setValue("nTransactionFee", (qint64) nTransactionFee);
break;
case DisplayUnit:
nDisplayUnit = value.toInt();
@@ -299,7 +299,7 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
qint64 OptionsModel::getTransactionFee()
{
return nTransactionFee;
return (qint64) nTransactionFee;
}
bool OptionsModel::getProxySettings(QString& proxyIP, quint16 &proxyPort) const

View File

@@ -5,14 +5,14 @@
#include "overviewpage.h"
#include "ui_overviewpage.h"
#include "clientmodel.h"
#include "walletmodel.h"
#include "bitcoinunits.h"
#include "optionsmodel.h"
#include "transactiontablemodel.h"
#include "transactionfilterproxy.h"
#include "guiutil.h"
#include "clientmodel.h"
#include "guiconstants.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "transactionfilterproxy.h"
#include "transactiontablemodel.h"
#include "walletmodel.h"
#include <QAbstractItemDelegate>
#include <QPainter>

View File

@@ -7,13 +7,14 @@
#include <QWidget>
class ClientModel;
class TransactionFilterProxy;
class TxViewDelegate;
class WalletModel;
namespace Ui {
class OverviewPage;
}
class ClientModel;
class WalletModel;
class TxViewDelegate;
class TransactionFilterProxy;
QT_BEGIN_NAMESPACE
class QModelIndex;

View File

@@ -7,16 +7,16 @@
// with some extra methods
//
#include "paymentrequestplus.h"
#include <stdexcept>
#include <openssl/x509.h>
#include <openssl/x509_vfy.h>
#include <QDateTime>
#include <QDebug>
#include <QSslCertificate>
#include <openssl/x509.h>
#include <openssl/x509_vfy.h>
#include <stdexcept>
#include "paymentrequestplus.h"
class SSLVerifyError : public std::runtime_error
{

View File

@@ -5,13 +5,14 @@
#ifndef PAYMENTREQUESTPLUS_H
#define PAYMENTREQUESTPLUS_H
#include "paymentrequest.pb.h"
#include "base58.h"
#include <QByteArray>
#include <QList>
#include <QString>
#include "base58.h"
#include "paymentrequest.pb.h"
//
// Wraps dumb protocol buffer paymentRequest
// with extra methods

View File

@@ -2,6 +2,23 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "paymentserver.h"
#include "bitcoinunits.h"
#include "guiconstants.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "paymentserver.h"
#include "walletmodel.h"
#include "base58.h"
#include "ui_interface.h"
#include "wallet.h"
#include <cstdlib>
#include <openssl/x509.h>
#include <openssl/x509_vfy.h>
#include <QApplication>
#include <QByteArray>
#include <QDataStream>
@@ -13,8 +30,6 @@
#include <QList>
#include <QLocalServer>
#include <QLocalSocket>
#include <QStringList>
#include <QTextDocument>
#include <QNetworkAccessManager>
#include <QNetworkProxy>
#include <QNetworkReply>
@@ -22,27 +37,16 @@
#include <QSslCertificate>
#include <QSslError>
#include <QSslSocket>
#include <QStringList>
#include <QTextDocument>
#if QT_VERSION < 0x050000
#include <QUrl>
#else
#include <QUrlQuery>
#endif
#include <cstdlib>
#include <openssl/x509.h>
#include <openssl/x509_vfy.h>
#include "base58.h"
#include "bitcoinunits.h"
#include "guiconstants.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "paymentserver.h"
#include "ui_interface.h"
#include "util.h"
#include "wallet.h"
#include "walletmodel.h"
using namespace boost;
const int BITCOIN_IPC_CONNECT_TIMEOUT = 1000; // milliseconds
const QString BITCOIN_IPC_PREFIX("bitcoin:");
@@ -357,10 +361,10 @@ void PaymentServer::handleURIOrFile(const QString& s)
if (s.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin:
{
#if QT_VERSION >= 0x050000
QUrlQuery uri((QUrl(s)));
#else
#if QT_VERSION < 0x050000
QUrl uri(s);
#else
QUrlQuery uri((QUrl(s)));
#endif
if (uri.hasQueryItem("request"))
{

View File

@@ -4,8 +4,6 @@
#ifndef PAYMENTSERVER_H
#define PAYMENTSERVER_H
//
// This class handles payment requests from clicking on
// bitcoin: URIs
//
@@ -32,13 +30,13 @@
// and, if a server is running in another process,
// sends them to the server.
//
#include <QObject>
#include <QString>
#include "paymentrequestplus.h"
#include "walletmodel.h"
class CWallet;
#include <QObject>
#include <QString>
class OptionsModel;
QT_BEGIN_NAMESPACE
@@ -51,6 +49,8 @@ class QSslError;
class QUrl;
QT_END_NAMESPACE
class CWallet;
class PaymentServer : public QObject
{
Q_OBJECT

View File

@@ -6,18 +6,20 @@
#include "ui_rpcconsole.h"
#include "clientmodel.h"
#include "bitcoinrpc.h"
#include "guiutil.h"
#include <QTime>
#include <QThread>
#include "bitcoinrpc.h"
#include "json/json_spirit_value.h"
#include <openssl/crypto.h>
#include <QKeyEvent>
#include <QScrollBar>
#include <QThread>
#include <QTime>
#if QT_VERSION < 0x050000
#include <QUrl>
#endif
#include <QScrollBar>
#include <openssl/crypto.h>
// TODO: add a scrollback limit, as there is currently none
// TODO: make it possible to filter out categories (esp debug messages when implemented)

View File

@@ -7,10 +7,11 @@
#include <QDialog>
class ClientModel;
namespace Ui {
class RPCConsole;
}
class ClientModel;
/** Local Bitcoin RPC console. */
class RPCConsole: public QDialog

View File

@@ -6,16 +6,17 @@
#include "ui_sendcoinsdialog.h"
#include "bitcoinunits.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "sendcoinsentry.h"
#include "guiutil.h"
#include "askpassphrasedialog.h"
#include "walletmodel.h"
#include "base58.h"
#include "ui_interface.h"
#include <QMessageBox>
#include <QTextDocument>
#include <QScrollBar>
#include <QTextDocument>
SendCoinsDialog::SendCoinsDialog(QWidget *parent) :
QDialog(parent),
@@ -324,7 +325,7 @@ bool SendCoinsDialog::handlePaymentRequest(const SendCoinsRecipient &rv)
if (rv.paymentRequest.IsInitialized()) {
// Expired payment request?
const payments::PaymentDetails& details = rv.paymentRequest.getDetails();
if (details.has_expires() && (int64)details.expires() < GetTime())
if (details.has_expires() && (int64_t)details.expires() < GetTime())
{
emit message(strSendCoins, tr("Payment request expired"),
CClientUIInterface::MSG_WARNING);

View File

@@ -8,12 +8,8 @@
#include "walletmodel.h"
#include <QDialog>
#include <QVariant>
#include <QPair>
namespace Ui {
class SendCoinsDialog;
}
class OptionsModel;
class SendCoinsEntry;
class SendCoinsRecipient;
@@ -21,6 +17,10 @@ QT_BEGIN_NAMESPACE
class QUrl;
QT_END_NAMESPACE
namespace Ui {
class SendCoinsDialog;
}
/** Dialog for sending bitcoins */
class SendCoinsDialog : public QDialog
{

View File

@@ -5,12 +5,11 @@
#include "sendcoinsentry.h"
#include "ui_sendcoinsentry.h"
#include "guiutil.h"
#include "bitcoinunits.h"
#include "addressbookpage.h"
#include "walletmodel.h"
#include "optionsmodel.h"
#include "addresstablemodel.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "walletmodel.h"
#include <QApplication>
#include <QClipboard>

View File

@@ -5,14 +5,15 @@
#ifndef SENDCOINSENTRY_H
#define SENDCOINSENTRY_H
#include "walletmodel.h"
#include <QStackedWidget>
#include "walletmodel.h"
class WalletModel;
namespace Ui {
class SendCoinsEntry;
}
class WalletModel;
/**
* A single entry in the dialog for sending bitcoins.

View File

@@ -6,19 +6,18 @@
#include "ui_signverifymessagedialog.h"
#include "addressbookpage.h"
#include "base58.h"
#include "guiutil.h"
#include "init.h"
#include "main.h"
#include "optionsmodel.h"
#include "walletmodel.h"
#include "wallet.h"
#include <QClipboard>
#include "base58.h"
#include "init.h"
#include "wallet.h"
#include <string>
#include <vector>
#include <QClipboard>
SignVerifyMessageDialog::SignVerifyMessageDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::SignVerifyMessageDialog),

View File

@@ -7,10 +7,11 @@
#include <QDialog>
class WalletModel;
namespace Ui {
class SignVerifyMessageDialog;
}
class WalletModel;
class SignVerifyMessageDialog : public QDialog
{

View File

@@ -3,9 +3,10 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "splashscreen.h"
#include "chainparams.h"
#include "clientversion.h"
#include "util.h"
#include "chainparams.h"
#include <QApplication>
#include <QPainter>

View File

@@ -1,17 +1,17 @@
#include <QCoreApplication>
#include <QDebug>
#include <QTemporaryFile>
#include <QVariant>
#include <QFileOpenEvent>
#include "paymentservertests.h"
#include "optionsmodel.h"
#include "paymentrequestdata.h"
#include "util.h"
#include <openssl/x509.h>
#include <openssl/x509_vfy.h>
#include "optionsmodel.h"
#include "paymentservertests.h"
#include "paymentrequestdata.h"
#include "util.h"
#include <QCoreApplication>
#include <QDebug>
#include <QFileOpenEvent>
#include <QTemporaryFile>
#include <QVariant>
X509 *parse_b64der_cert(const char* cert_data)

View File

@@ -1,11 +1,11 @@
#ifndef PAYMENTSERVERTESTS_H
#define PAYMENTSERVERTESTS_H
#include <QTest>
#include <QObject>
#include "../paymentserver.h"
#include <QObject>
#include <QTest>
class PaymentServerTests : public QObject
{
Q_OBJECT

View File

@@ -1,8 +1,10 @@
#include <QTest>
#include <QObject>
#include "uritests.h"
#include "paymentservertests.h"
#include "uritests.h"
#include <QObject>
#include <QTest>
// This is all you need to run all the tests
int main(int argc, char *argv[])

View File

@@ -1,6 +1,7 @@
#include "uritests.h"
#include "../guiutil.h"
#include "../walletmodel.h"
#include "guiutil.h"
#include "walletmodel.h"
#include <QUrl>

View File

@@ -1,8 +1,8 @@
#ifndef URITESTS_H
#define URITESTS_H
#include <QTest>
#include <QObject>
#include <QTest>
class URITests : public QObject
{

View File

@@ -4,16 +4,18 @@
#include "transactiondesc.h"
#include "guiutil.h"
#include "bitcoinunits.h"
#include "main.h"
#include "wallet.h"
#include "db.h"
#include "ui_interface.h"
#include "guiutil.h"
#include "base58.h"
#include "db.h"
#include "main.h"
#include "paymentserver.h"
#include "transactionrecord.h"
#include "ui_interface.h"
#include "wallet.h"
#include <stdint.h>
#include <string>
QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx)
@@ -46,10 +48,10 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, int vout, int u
strHTML.reserve(4000);
strHTML += "<html><font face='verdana, arial, helvetica, sans-serif'>";
int64 nTime = wtx.GetTxTime();
int64 nCredit = wtx.GetCredit();
int64 nDebit = wtx.GetDebit();
int64 nNet = nCredit - nDebit;
int64_t nTime = wtx.GetTxTime();
int64_t nCredit = wtx.GetCredit();
int64_t nDebit = wtx.GetDebit();
int64_t nNet = nCredit - nDebit;
strHTML += "<b>" + tr("Status") + ":</b> " + FormatTxStatus(wtx);
int nRequests = wtx.GetRequestCount();
@@ -129,7 +131,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, int vout, int u
//
// Coinbase
//
int64 nUnmatured = 0;
int64_t nUnmatured = 0;
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
nUnmatured += wallet->GetCredit(txout);
strHTML += "<b>" + tr("Credit") + ":</b> ";
@@ -186,13 +188,13 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, int vout, int u
if (fAllToMe)
{
// Payment to self
int64 nChange = wtx.GetChange();
int64 nValue = nCredit - nChange;
int64_t nChange = wtx.GetChange();
int64_t nValue = nCredit - nChange;
strHTML += "<b>" + tr("Debit") + ":</b> " + BitcoinUnits::formatWithUnit(unit, -nValue) + "<br>";
strHTML += "<b>" + tr("Credit") + ":</b> " + BitcoinUnits::formatWithUnit(unit, nValue) + "<br>";
}
int64 nTxFee = nDebit - GetValueOut(wtx);
int64_t nTxFee = nDebit - GetValueOut(wtx);
if (nTxFee > 0)
strHTML += "<b>" + tr("Transaction fee") + ":</b> " + BitcoinUnits::formatWithUnit(unit, -nTxFee) + "<br>";
}

View File

@@ -5,8 +5,8 @@
#ifndef TRANSACTIONDESC_H
#define TRANSACTIONDESC_H
#include <QString>
#include <QObject>
#include <QString>
class CWallet;
class CWalletTx;

View File

@@ -6,10 +6,10 @@
#include "transactiontablemodel.h"
#include <QDateTime>
#include <cstdlib>
#include <QDateTime>
// Earliest date that can be represented (far in the past)
const QDateTime TransactionFilterProxy::MIN_DATE = QDateTime::fromTime_t(0);
// Last date that can be represented (far in the future)

View File

@@ -5,8 +5,8 @@
#ifndef TRANSACTIONFILTERPROXY_H
#define TRANSACTIONFILTERPROXY_H
#include <QSortFilterProxyModel>
#include <QDateTime>
#include <QSortFilterProxyModel>
/** Filter the transaction list according to pre-specified rules. */
class TransactionFilterProxy : public QSortFilterProxyModel

View File

@@ -4,8 +4,10 @@
#include "transactionrecord.h"
#include "wallet.h"
#include "base58.h"
#include "wallet.h"
#include <stdint.h>
/* Return positive answer if transaction should be shown in list.
*/
@@ -28,10 +30,10 @@ bool TransactionRecord::showTransaction(const CWalletTx &wtx)
QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *wallet, const CWalletTx &wtx)
{
QList<TransactionRecord> parts;
int64 nTime = wtx.GetTxTime();
int64 nCredit = wtx.GetCredit(true);
int64 nDebit = wtx.GetDebit();
int64 nNet = nCredit - nDebit;
int64_t nTime = wtx.GetTxTime();
int64_t nCredit = wtx.GetCredit(true);
int64_t nDebit = wtx.GetDebit();
int64_t nNet = nCredit - nDebit;
uint256 hash = wtx.GetHash();
std::map<std::string, std::string> mapValue = wtx.mapValue;
@@ -83,7 +85,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
if (fAllFromMe && fAllToMe)
{
// Payment to self
int64 nChange = wtx.GetChange();
int64_t nChange = wtx.GetChange();
parts.append(TransactionRecord(hash, nTime, TransactionRecord::SendToSelf, "",
-(nDebit - nChange), nCredit - nChange));
@@ -93,7 +95,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
//
// Debit
//
int64 nTxFee = nDebit - GetValueOut(wtx);
int64_t nTxFee = nDebit - GetValueOut(wtx);
for (unsigned int nOut = 0; nOut < wtx.vout.size(); nOut++)
{
@@ -122,7 +124,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
sub.address = mapValue["to"];
}
int64 nValue = txout.nValue;
int64_t nValue = txout.nValue;
/* Add fee to first output */
if (nTxFee > 0)
{
@@ -198,7 +200,7 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx)
// For generated transactions, determine maturity
if(type == TransactionRecord::Generated)
{
int64 nCredit = wtx.GetCredit(true);
int64_t nCredit = wtx.GetCredit(true);
if (nCredit == 0)
{
status.maturity = TransactionStatus::Immature;

View File

@@ -51,8 +51,8 @@ public:
/** @name Reported status
@{*/
Status status;
int64 depth;
int64 open_for; /**< Timestamp if status==OpenUntilDate, otherwise number
qint64 depth;
qint64 open_for; /**< Timestamp if status==OpenUntilDate, otherwise number
of additional blocks that need to be mined before
finalization */
/**@}*/
@@ -86,15 +86,15 @@ public:
{
}
TransactionRecord(uint256 hash, int64 time):
TransactionRecord(uint256 hash, qint64 time):
hash(hash), time(time), type(Other), address(""), debit(0),
credit(0), idx(0)
{
}
TransactionRecord(uint256 hash, int64 time,
TransactionRecord(uint256 hash, qint64 time,
Type type, const std::string &address,
int64 debit, int64 credit):
qint64 debit, qint64 credit):
hash(hash), time(time), type(type), address(address), debit(debit), credit(credit),
idx(0)
{
@@ -108,11 +108,11 @@ public:
/** @name Immutable transaction attributes
@{*/
uint256 hash;
int64 time;
qint64 time;
Type type;
std::string address;
int64 debit;
int64 credit;
qint64 debit;
qint64 credit;
/**@}*/
/** Subtransaction index, for sort key */

View File

@@ -4,24 +4,27 @@
#include "transactiontablemodel.h"
#include "guiutil.h"
#include "transactionrecord.h"
#include "guiconstants.h"
#include "transactiondesc.h"
#include "walletmodel.h"
#include "optionsmodel.h"
#include "addresstablemodel.h"
#include "bitcoinunits.h"
#include "guiconstants.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "transactiondesc.h"
#include "transactionrecord.h"
#include "walletmodel.h"
#include "main.h"
#include "sync.h"
#include "uint256.h"
#include "util.h"
#include "wallet.h"
#include "ui_interface.h"
#include <QList>
#include <QColor>
#include <QTimer>
#include <QIcon>
#include <QDateTime>
#include <QDebug>
#include <QIcon>
#include <QList>
#include <QTimer>
// Amount column is right-aligned it contains numbers
static int column_alignments[] = {

View File

@@ -8,11 +8,12 @@
#include <QAbstractTableModel>
#include <QStringList>
class CWallet;
class TransactionTablePriv;
class TransactionRecord;
class TransactionTablePriv;
class WalletModel;
class CWallet;
/** UI model for the transaction table of a wallet.
*/
class TransactionTableModel : public QAbstractTableModel

View File

@@ -4,31 +4,32 @@
#include "transactionview.h"
#include "transactionfilterproxy.h"
#include "transactionrecord.h"
#include "walletmodel.h"
#include "addresstablemodel.h"
#include "transactiontablemodel.h"
#include "bitcoinunits.h"
#include "csvmodelwriter.h"
#include "transactiondescdialog.h"
#include "editaddressdialog.h"
#include "optionsmodel.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "transactiondescdialog.h"
#include "transactionfilterproxy.h"
#include "transactionrecord.h"
#include "transactiontablemodel.h"
#include "walletmodel.h"
#include "ui_interface.h"
#include <QScrollBar>
#include <QComboBox>
#include <QDateTimeEdit>
#include <QDoubleValidator>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QLineEdit>
#include <QTableView>
#include <QHeaderView>
#include <QPoint>
#include <QMenu>
#include <QLabel>
#include <QDateTimeEdit>
#include <QLineEdit>
#include <QMenu>
#include <QPoint>
#include <QScrollBar>
#include <QTableView>
#include <QVBoxLayout>
TransactionView::TransactionView(QWidget *parent) :
QWidget(parent), model(0), transactionProxyModel(0),

View File

@@ -7,17 +7,17 @@
#include <QWidget>
class WalletModel;
class TransactionFilterProxy;
class WalletModel;
QT_BEGIN_NAMESPACE
class QTableView;
class QComboBox;
class QLineEdit;
class QModelIndex;
class QMenu;
class QFrame;
class QDateTimeEdit;
class QFrame;
class QLineEdit;
class QMenu;
class QModelIndex;
class QTableView;
QT_END_NAMESPACE
/** Widget showing the transaction list for a wallet, including a filter row.

View File

@@ -3,12 +3,13 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "walletframe.h"
#include "walletview.h"
#include "bitcoingui.h"
#include "walletview.h"
#include <cstdio>
#include <QHBoxLayout>
#include <QMessageBox>
#include <QStackedWidget>
WalletFrame::WalletFrame(BitcoinGUI *_gui) :
QFrame(_gui),

View File

@@ -3,18 +3,25 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "walletmodel.h"
#include "guiconstants.h"
#include "optionsmodel.h"
#include "addresstablemodel.h"
#include "guiconstants.h"
#include "transactiontablemodel.h"
#include "ui_interface.h"
#include "walletdb.h" // for BackupWallet
#include "base58.h"
#include "db.h"
#include "keystore.h"
#include "main.h"
#include "sync.h"
#include "ui_interface.h"
#include "wallet.h"
#include "walletdb.h" // for BackupWallet
#include <stdint.h>
#include <QDebug>
#include <QSet>
#include <QTimer>
#include <QDebug>
WalletModel::WalletModel(CWallet *wallet, OptionsModel *optionsModel, QObject *parent) :
QObject(parent), wallet(wallet), optionsModel(optionsModel), addressTableModel(0),
@@ -133,7 +140,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
{
qint64 total = 0;
QList<SendCoinsRecipient> recipients = transaction.getRecipients();
std::vector<std::pair<CScript, int64> > vecSend;
std::vector<std::pair<CScript, int64_t> > vecSend;
if(recipients.empty())
{
@@ -148,7 +155,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
{
if (rcp.paymentRequest.IsInitialized())
{ // PaymentRequest...
int64 subtotal = 0;
int64_t subtotal = 0;
const payments::PaymentDetails& details = rcp.paymentRequest.getDetails();
for (int i = 0; i < details.outputs_size(); i++)
{
@@ -157,7 +164,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
subtotal += out.amount();
const unsigned char* scriptStr = (const unsigned char*)out.script().data();
CScript scriptPubKey(scriptStr, scriptStr+out.script().size());
vecSend.push_back(std::pair<CScript, int64>(scriptPubKey, out.amount()));
vecSend.push_back(std::pair<CScript, int64_t>(scriptPubKey, out.amount()));
}
if (subtotal <= 0)
{
@@ -180,7 +187,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
CScript scriptPubKey;
scriptPubKey.SetDestination(CBitcoinAddress(rcp.address.toStdString()).Get());
vecSend.push_back(std::pair<CScript, int64>(scriptPubKey, rcp.amount));
vecSend.push_back(std::pair<CScript, int64_t>(scriptPubKey, rcp.amount));
total += rcp.amount;
}
@@ -205,7 +212,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
LOCK2(cs_main, wallet->cs_wallet);
transaction.newPossibleKeyChange(wallet);
int64 nFeeRequired = 0;
int64_t nFeeRequired = 0;
std::string strFailReason;
CWalletTx *newTx = transaction.getTransaction();

View File

@@ -5,19 +5,20 @@
#ifndef WALLETMODEL_H
#define WALLETMODEL_H
#include <QObject>
#include "paymentrequestplus.h"
#include "walletmodeltransaction.h"
#include "allocators.h" /* for SecureString */
#include "wallet.h"
#include "walletmodeltransaction.h"
#include "paymentrequestplus.h"
class OptionsModel;
#include <QObject>
class AddressTableModel;
class OptionsModel;
class TransactionTableModel;
class CWallet;
class WalletModelTransaction;
class CWallet;
QT_BEGIN_NAMESPACE
class QTimer;
QT_END_NAMESPACE

View File

@@ -4,6 +4,8 @@
#include "walletmodeltransaction.h"
#include "wallet.h"
WalletModelTransaction::WalletModelTransaction(const QList<SendCoinsRecipient> &recipients) :
recipients(recipients),
walletTransaction(0),

View File

@@ -7,8 +7,14 @@
#include "walletmodel.h"
#include <QObject>
class SendCoinsRecipient;
class CReserveKey;
class CWallet;
class CWalletTx;
/** Data model for a walletmodel transaction. */
class WalletModelTransaction
{

View File

@@ -3,25 +3,29 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "walletview.h"
#include "bitcoingui.h"
#include "transactiontablemodel.h"
#include "addressbookpage.h"
#include "sendcoinsdialog.h"
#include "receivecoinsdialog.h"
#include "signverifymessagedialog.h"
#include "clientmodel.h"
#include "walletmodel.h"
#include "optionsmodel.h"
#include "transactionview.h"
#include "overviewpage.h"
#include "askpassphrasedialog.h"
#include "ui_interface.h"
#include "guiutil.h"
#include <QHBoxLayout>
#include <QVBoxLayout>
#include "addressbookpage.h"
#include "askpassphrasedialog.h"
#include "bitcoingui.h"
#include "clientmodel.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "overviewpage.h"
#include "receivecoinsdialog.h"
#include "sendcoinsdialog.h"
#include "signverifymessagedialog.h"
#include "transactiontablemodel.h"
#include "transactionview.h"
#include "walletmodel.h"
#include "ui_interface.h"
#include <QAction>
#include <QActionGroup>
#include <QFileDialog>
#include <QHBoxLayout>
#include <QPushButton>
#include <QVBoxLayout>
WalletView::WalletView(QWidget *parent):
QStackedWidget(parent),

View File

@@ -9,17 +9,14 @@
class BitcoinGUI;
class ClientModel;
class WalletModel;
class TransactionView;
class OverviewPage;
class SendCoinsDialog;
class ReceiveCoinsDialog;
class SendCoinsDialog;
class SendCoinsRecipient;
class SignVerifyMessageDialog;
class RPCConsole;
class TransactionView;
class WalletModel;
QT_BEGIN_NAMESPACE
class QLabel;
class QModelIndex;
QT_END_NAMESPACE