Merge pull request #2210 from Diapolo/Qt_header_cpp_cleanup

Bitcoin-Qt: massive header and cpp cleanup
This commit is contained in:
Wladimir J. van der Laan 2013-03-17 22:58:37 -07:00
commit 74e4d80068
48 changed files with 91 additions and 110 deletions

View file

@ -8,15 +8,15 @@
#include "csvmodelwriter.h" #include "csvmodelwriter.h"
#include "guiutil.h" #include "guiutil.h"
#ifdef USE_QRCODE
#include "qrcodedialog.h"
#endif
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
#include <QClipboard> #include <QClipboard>
#include <QMessageBox> #include <QMessageBox>
#include <QMenu> #include <QMenu>
#ifdef USE_QRCODE
#include "qrcodedialog.h"
#endif
AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) : AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::AddressBookPage), ui(new Ui::AddressBookPage),

View file

@ -1,4 +1,5 @@
#include "addresstablemodel.h" #include "addresstablemodel.h"
#include "guiutil.h" #include "guiutil.h"
#include "walletmodel.h" #include "walletmodel.h"
@ -6,7 +7,6 @@
#include "base58.h" #include "base58.h"
#include <QFont> #include <QFont>
#include <QColor>
const QString AddressTableModel::Send = "S"; const QString AddressTableModel::Send = "S";
const QString AddressTableModel::Receive = "R"; const QString AddressTableModel::Receive = "R";

View file

@ -14,6 +14,7 @@ class WalletModel;
class AddressTableModel : public QAbstractTableModel class AddressTableModel : public QAbstractTableModel
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit AddressTableModel(CWallet *wallet, WalletModel *parent = 0); explicit AddressTableModel(CWallet *wallet, WalletModel *parent = 0);
~AddressTableModel(); ~AddressTableModel();

View file

@ -6,7 +6,6 @@
namespace Ui { namespace Ui {
class AskPassphraseDialog; class AskPassphraseDialog;
} }
class WalletModel; class WalletModel;
/** Multifunctional dialog to ask for passphrases. Used for encryption, unlocking, and changing the passphrase. /** Multifunctional dialog to ask for passphrases. Used for encryption, unlocking, and changing the passphrase.

View file

@ -1,6 +1,9 @@
/* /*
* W.J. van der Laan 2011-2012 * W.J. van der Laan 2011-2012
*/ */
#include <QApplication>
#include "bitcoingui.h" #include "bitcoingui.h"
#include "clientmodel.h" #include "clientmodel.h"
#include "walletmodel.h" #include "walletmodel.h"
@ -11,7 +14,6 @@
#include "ui_interface.h" #include "ui_interface.h"
#include "paymentserver.h" #include "paymentserver.h"
#include <QApplication>
#include <QMessageBox> #include <QMessageBox>
#include <QTextCodec> #include <QTextCodec>
#include <QLocale> #include <QLocale>

View file

@ -1,4 +1,4 @@
<RCC> <!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/icons"> <qresource prefix="/icons">
<file alias="bitcoin">res/icons/bitcoin.png</file> <file alias="bitcoin">res/icons/bitcoin.png</file>
<file alias="address-book">res/icons/address-book.png</file> <file alias="address-book">res/icons/address-book.png</file>

View file

@ -1,7 +1,7 @@
#ifndef BITCOINADDRESSVALIDATOR_H #ifndef BITCOINADDRESSVALIDATOR_H
#define BITCOINADDRESSVALIDATOR_H #define BITCOINADDRESSVALIDATOR_H
#include <QRegExpValidator> #include <QValidator>
/** Base48 entry widget validator. /** Base48 entry widget validator.
Corrects near-miss characters and refuses characters that are no part of base48. Corrects near-miss characters and refuses characters that are no part of base48.
@ -9,16 +9,13 @@
class BitcoinAddressValidator : public QValidator class BitcoinAddressValidator : public QValidator
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit BitcoinAddressValidator(QObject *parent = 0); explicit BitcoinAddressValidator(QObject *parent = 0);
State validate(QString &input, int &pos) const; State validate(QString &input, int &pos) const;
static const int MaxAddressLength = 35; static const int MaxAddressLength = 35;
signals:
public slots:
}; };
#endif // BITCOINADDRESSVALIDATOR_H #endif // BITCOINADDRESSVALIDATOR_H

View file

@ -1,18 +1,14 @@
#include "bitcoinamountfield.h" #include "bitcoinamountfield.h"
#include "qvaluecombobox.h" #include "qvaluecombobox.h"
#include "bitcoinunits.h" #include "bitcoinunits.h"
#include "guiconstants.h" #include "guiconstants.h"
#include <QLabel>
#include <QLineEdit>
#include <QRegExpValidator>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QKeyEvent> #include <QKeyEvent>
#include <QDoubleSpinBox> #include <QDoubleSpinBox>
#include <QComboBox>
#include <QApplication> #include <QApplication>
#include <qmath.h> #include <qmath.h> // for qPow()
BitcoinAmountField::BitcoinAmountField(QWidget *parent): BitcoinAmountField::BitcoinAmountField(QWidget *parent):
QWidget(parent), amount(0), currentUnit(-1) QWidget(parent), amount(0), currentUnit(-1)

View file

@ -13,7 +13,9 @@ QT_END_NAMESPACE
class BitcoinAmountField: public QWidget class BitcoinAmountField: public QWidget
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY textChanged USER true) Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY textChanged USER true)
public: public:
explicit BitcoinAmountField(QWidget *parent = 0); explicit BitcoinAmountField(QWidget *parent = 0);
@ -56,5 +58,4 @@ private slots:
}; };
#endif // BITCOINAMOUNTFIELD_H #endif // BITCOINAMOUNTFIELD_H

View file

@ -4,7 +4,11 @@
* W.J. van der Laan 2011-2012 * W.J. van der Laan 2011-2012
* The Bitcoin Developers 2011-2012 * The Bitcoin Developers 2011-2012
*/ */
#include <QApplication>
#include "bitcoingui.h" #include "bitcoingui.h"
#include "transactiontablemodel.h" #include "transactiontablemodel.h"
#include "addressbookpage.h" #include "addressbookpage.h"
#include "sendcoinsdialog.h" #include "sendcoinsdialog.h"
@ -31,19 +35,13 @@
#include "macdockiconhandler.h" #include "macdockiconhandler.h"
#endif #endif
#include <QApplication>
#include <QMainWindow>
#include <QMenuBar> #include <QMenuBar>
#include <QMenu> #include <QMenu>
#include <QIcon> #include <QIcon>
#include <QTabWidget>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QToolBar> #include <QToolBar>
#include <QStatusBar> #include <QStatusBar>
#include <QLabel> #include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QLocale>
#include <QMessageBox> #include <QMessageBox>
#include <QProgressBar> #include <QProgressBar>
#include <QStackedWidget> #include <QStackedWidget>
@ -54,6 +52,7 @@
#include <QTimer> #include <QTimer>
#include <QDragEnterEvent> #include <QDragEnterEvent>
#include <QUrl> #include <QUrl>
#include <QMimeData>
#include <QStyle> #include <QStyle>
#include <iostream> #include <iostream>

View file

@ -17,13 +17,9 @@ class RPCConsole;
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QLabel; class QLabel;
class QLineEdit;
class QTableView;
class QAbstractItemModel;
class QModelIndex; class QModelIndex;
class QProgressBar; class QProgressBar;
class QStackedWidget; class QStackedWidget;
class QUrl;
QT_END_NAMESPACE QT_END_NAMESPACE
/** /**
@ -33,6 +29,7 @@ QT_END_NAMESPACE
class BitcoinGUI : public QMainWindow class BitcoinGUI : public QMainWindow
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit BitcoinGUI(QWidget *parent = 0); explicit BitcoinGUI(QWidget *parent = 0);
~BitcoinGUI(); ~BitcoinGUI();

View file

@ -9,6 +9,8 @@
*/ */
class BitcoinUnits: public QAbstractListModel class BitcoinUnits: public QAbstractListModel
{ {
Q_OBJECT
public: public:
explicit BitcoinUnits(QObject *parent); explicit BitcoinUnits(QObject *parent);
@ -58,6 +60,7 @@ public:
int rowCount(const QModelIndex &parent) const; int rowCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const; QVariant data(const QModelIndex &index, int role) const;
///@} ///@}
private: private:
QList<BitcoinUnits::Unit> unitlist; QList<BitcoinUnits::Unit> unitlist;
}; };

View file

@ -1,4 +1,5 @@
#include "clientmodel.h" #include "clientmodel.h"
#include "guiconstants.h" #include "guiconstants.h"
#include "optionsmodel.h" #include "optionsmodel.h"
#include "addresstablemodel.h" #include "addresstablemodel.h"

View file

@ -24,6 +24,7 @@ enum BlockSource {
class ClientModel : public QObject class ClientModel : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0); explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0);
~ClientModel(); ~ClientModel();
@ -66,6 +67,7 @@ private:
void subscribeToCoreSignals(); void subscribeToCoreSignals();
void unsubscribeFromCoreSignals(); void unsubscribeFromCoreSignals();
signals: signals:
void numConnectionsChanged(int count); void numConnectionsChanged(int count);
void numBlocksChanged(int count, int countOfPeers); void numBlocksChanged(int count, int countOfPeers);

View file

@ -14,6 +14,7 @@ QT_END_NAMESPACE
class CSVModelWriter : public QObject class CSVModelWriter : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit CSVModelWriter(const QString &filename, QObject *parent = 0); explicit CSVModelWriter(const QString &filename, QObject *parent = 0);
@ -36,11 +37,6 @@ private:
int role; int role;
}; };
QList<Column> columns; QList<Column> columns;
signals:
public slots:
}; };
#endif // CSVMODELWRITER_H #endif // CSVMODELWRITER_H

View file

@ -1,5 +1,6 @@
#include "editaddressdialog.h" #include "editaddressdialog.h"
#include "ui_editaddressdialog.h" #include "ui_editaddressdialog.h"
#include "addresstablemodel.h" #include "addresstablemodel.h"
#include "guiutil.h" #include "guiutil.h"

View file

@ -3,15 +3,15 @@
#include <QDialog> #include <QDialog>
QT_BEGIN_NAMESPACE
class QDataWidgetMapper;
QT_END_NAMESPACE
namespace Ui { namespace Ui {
class EditAddressDialog; class EditAddressDialog;
} }
class AddressTableModel; class AddressTableModel;
QT_BEGIN_NAMESPACE
class QDataWidgetMapper;
QT_END_NAMESPACE
/** Dialog for editing an address and associated information. /** Dialog for editing an address and associated information.
*/ */
class EditAddressDialog : public QDialog class EditAddressDialog : public QDialog

View file

@ -1,11 +1,14 @@
#include <QApplication>
#include "guiutil.h" #include "guiutil.h"
#include "bitcoinaddressvalidator.h" #include "bitcoinaddressvalidator.h"
#include "walletmodel.h" #include "walletmodel.h"
#include "bitcoinunits.h" #include "bitcoinunits.h"
#include "util.h" #include "util.h"
#include "init.h" #include "init.h"
#include <QString>
#include <QDateTime> #include <QDateTime>
#include <QDoubleValidator> #include <QDoubleValidator>
#include <QFont> #include <QFont>
@ -13,7 +16,6 @@
#include <QUrl> #include <QUrl>
#include <QTextDocument> // For Qt::escape #include <QTextDocument> // For Qt::escape
#include <QAbstractItemView> #include <QAbstractItemView>
#include <QApplication>
#include <QClipboard> #include <QClipboard>
#include <QFileDialog> #include <QFileDialog>
#include <QDesktopServices> #include <QDesktopServices>

View file

@ -5,6 +5,8 @@
#include <QObject> #include <QObject>
#include <QMessageBox> #include <QMessageBox>
class SendCoinsRecipient;
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QFont; class QFont;
class QLineEdit; class QLineEdit;
@ -13,7 +15,6 @@ class QDateTime;
class QUrl; class QUrl;
class QAbstractItemView; class QAbstractItemView;
QT_END_NAMESPACE QT_END_NAMESPACE
class SendCoinsRecipient;
/** Utility functions used by the Bitcoin Qt UI. /** Utility functions used by the Bitcoin Qt UI.
*/ */

View file

@ -3,9 +3,11 @@
#include <QObject> #include <QObject>
QT_BEGIN_NAMESPACE
class QMenu; class QMenu;
class QIcon; class QIcon;
class QWidget; class QWidget;
QT_END_NAMESPACE
#ifdef __OBJC__ #ifdef __OBJC__
@class DockIconClickEventHandler; @class DockIconClickEventHandler;
@ -18,6 +20,7 @@ class DockIconClickEventHandler;
class MacDockIconHandler : public QObject class MacDockIconHandler : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
~MacDockIconHandler(); ~MacDockIconHandler();
@ -31,8 +34,6 @@ public:
signals: signals:
void dockIconClicked(); void dockIconClicked();
public slots:
private: private:
MacDockIconHandler(); MacDockIconHandler();

View file

@ -1,4 +1,3 @@
#include "macdockiconhandler.h" #include "macdockiconhandler.h"
#include <QMenu> #include <QMenu>

View file

@ -9,7 +9,6 @@ MonitoredDataMapper::MonitoredDataMapper(QObject *parent) :
{ {
} }
void MonitoredDataMapper::addMapping(QWidget *widget, int section) void MonitoredDataMapper::addMapping(QWidget *widget, int section)
{ {
QDataWidgetMapper::addMapping(widget, section); QDataWidgetMapper::addMapping(widget, section);

View file

@ -13,19 +13,18 @@ QT_END_NAMESPACE
class MonitoredDataMapper : public QDataWidgetMapper class MonitoredDataMapper : public QDataWidgetMapper
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit MonitoredDataMapper(QObject *parent=0); explicit MonitoredDataMapper(QObject *parent=0);
void addMapping(QWidget *widget, int section); void addMapping(QWidget *widget, int section);
void addMapping(QWidget *widget, int section, const QByteArray &propertyName); void addMapping(QWidget *widget, int section, const QByteArray &propertyName);
private: private:
void addChangeMonitor(QWidget *widget); void addChangeMonitor(QWidget *widget);
signals: signals:
void viewModified(); void viewModified();
}; };
#endif // MONITOREDDATAMAPPER_H #endif // MONITOREDDATAMAPPER_H

View file

@ -12,7 +12,7 @@
#include <QImageWriter> #include <QImageWriter>
#ifdef USE_DBUS #ifdef USE_DBUS
#include <QtDBus/QtDBus> #include <QtDBus>
#include <stdint.h> #include <stdint.h>
#endif #endif

View file

@ -15,6 +15,7 @@ QT_END_NAMESPACE
class Notificator: public QObject class Notificator: public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
/** Create a new notificator. /** Create a new notificator.
@note Ownership of trayIcon is not transferred to this object. @note Ownership of trayIcon is not transferred to this object.
@ -31,7 +32,6 @@ public:
}; };
public slots: public slots:
/** Show notification message. /** Show notification message.
@param[in] cls general message class @param[in] cls general message class
@param[in] title title shown with message @param[in] title title shown with message

View file

@ -10,8 +10,6 @@
#include <QIntValidator> #include <QIntValidator>
#include <QLocale> #include <QLocale>
#include <QMessageBox> #include <QMessageBox>
#include <QRegExp>
#include <QRegExpValidator>
OptionsDialog::OptionsDialog(QWidget *parent) : OptionsDialog::OptionsDialog(QWidget *parent) :
QDialog(parent), QDialog(parent),

View file

@ -1,11 +1,12 @@
#include "optionsmodel.h" #include "optionsmodel.h"
#include "bitcoinunits.h"
#include <QSettings>
#include "bitcoinunits.h"
#include "init.h" #include "init.h"
#include "walletdb.h" #include "walletdb.h"
#include "guiutil.h" #include "guiutil.h"
#include <QSettings>
OptionsModel::OptionsModel(QObject *parent) : OptionsModel::OptionsModel(QObject *parent) :
QAbstractListModel(parent) QAbstractListModel(parent)
{ {

View file

@ -3,10 +3,6 @@
#include <QWidget> #include <QWidget>
QT_BEGIN_NAMESPACE
class QModelIndex;
QT_END_NAMESPACE
namespace Ui { namespace Ui {
class OverviewPage; class OverviewPage;
} }
@ -15,6 +11,10 @@ class WalletModel;
class TxViewDelegate; class TxViewDelegate;
class TransactionFilterProxy; class TransactionFilterProxy;
QT_BEGIN_NAMESPACE
class QModelIndex;
QT_END_NAMESPACE
/** Overview ("home") page widget */ /** Overview ("home") page widget */
class OverviewPage : public QWidget class OverviewPage : public QWidget
{ {

View file

@ -2,14 +2,15 @@
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <QApplication>
#include "paymentserver.h" #include "paymentserver.h"
#include "guiconstants.h" #include "guiconstants.h"
#include "ui_interface.h" #include "ui_interface.h"
#include "util.h" #include "util.h"
#include <QApplication>
#include <QByteArray> #include <QByteArray>
#include <QCoreApplication>
#include <QDataStream> #include <QDataStream>
#include <QDebug> #include <QDebug>
#include <QFileOpenEvent> #include <QFileOpenEvent>
@ -59,7 +60,7 @@ bool PaymentServer::ipcSendCommandLine()
{ {
bool fResult = false; bool fResult = false;
const QStringList& args = QCoreApplication::arguments(); const QStringList& args = qApp->arguments();
for (int i = 1; i < args.size(); i++) for (int i = 1; i < args.size(); i++)
{ {
if (!args[i].startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) if (!args[i].startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive))

View file

@ -9,6 +9,7 @@
class QValidatedLineEdit : public QLineEdit class QValidatedLineEdit : public QLineEdit
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit QValidatedLineEdit(QWidget *parent = 0); explicit QValidatedLineEdit(QWidget *parent = 0);
void clear(); void clear();

View file

@ -8,7 +8,9 @@
class QValueComboBox : public QComboBox class QValueComboBox : public QComboBox
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged USER true) Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged USER true)
public: public:
explicit QValueComboBox(QWidget *parent = 0); explicit QValueComboBox(QWidget *parent = 0);
@ -21,8 +23,6 @@ public:
signals: signals:
void valueChanged(); void valueChanged();
public slots:
private: private:
int role; int role;

View file

@ -6,9 +6,7 @@
#include "guiutil.h" #include "guiutil.h"
#include <QTime> #include <QTime>
#include <QTimer>
#include <QThread> #include <QThread>
#include <QTextEdit>
#include <QKeyEvent> #include <QKeyEvent>
#include <QUrl> #include <QUrl>
#include <QScrollBar> #include <QScrollBar>
@ -35,12 +33,14 @@ const struct {
/* Object for executing console RPC commands in a separate thread. /* Object for executing console RPC commands in a separate thread.
*/ */
class RPCExecutor: public QObject class RPCExecutor : public QObject
{ {
Q_OBJECT Q_OBJECT
public slots: public slots:
void start(); void start();
void request(const QString &command); void request(const QString &command);
signals: signals:
void reply(int category, const QString &command); void reply(int category, const QString &command);
}; };

View file

@ -1,5 +1,6 @@
#include "sendcoinsdialog.h" #include "sendcoinsdialog.h"
#include "ui_sendcoinsdialog.h" #include "ui_sendcoinsdialog.h"
#include "walletmodel.h" #include "walletmodel.h"
#include "bitcoinunits.h" #include "bitcoinunits.h"
#include "addressbookpage.h" #include "addressbookpage.h"
@ -10,7 +11,6 @@
#include "base58.h" #include "base58.h"
#include <QMessageBox> #include <QMessageBox>
#include <QLocale>
#include <QTextDocument> #include <QTextDocument>
#include <QScrollBar> #include <QScrollBar>

View file

@ -1,5 +1,6 @@
#include "sendcoinsentry.h" #include "sendcoinsentry.h"
#include "ui_sendcoinsentry.h" #include "ui_sendcoinsentry.h"
#include "guiutil.h" #include "guiutil.h"
#include "bitcoinunits.h" #include "bitcoinunits.h"
#include "addressbookpage.h" #include "addressbookpage.h"

View file

@ -10,11 +10,11 @@
#include "walletmodel.h" #include "walletmodel.h"
#include "wallet.h" #include "wallet.h"
#include <QClipboard>
#include <string> #include <string>
#include <vector> #include <vector>
#include <QClipboard>
SignVerifyMessageDialog::SignVerifyMessageDialog(QWidget *parent) : SignVerifyMessageDialog::SignVerifyMessageDialog(QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::SignVerifyMessageDialog), ui(new Ui::SignVerifyMessageDialog),

View file

@ -8,9 +8,6 @@ namespace Ui {
} }
class WalletModel; class WalletModel;
QT_BEGIN_NAMESPACE
QT_END_NAMESPACE
class SignVerifyMessageDialog : public QDialog class SignVerifyMessageDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT

View file

@ -4,15 +4,6 @@
#include <QUrl> #include <QUrl>
/*
struct SendCoinsRecipient
{
QString address;
QString label;
qint64 amount;
};
*/
void URITests::uriTests() void URITests::uriTests()
{ {
SendCoinsRecipient rv; SendCoinsRecipient rv;

View file

@ -2,13 +2,14 @@
#include "guiutil.h" #include "guiutil.h"
#include "bitcoinunits.h" #include "bitcoinunits.h"
#include "main.h" #include "main.h"
#include "wallet.h" #include "wallet.h"
#include "db.h" #include "db.h"
#include "ui_interface.h" #include "ui_interface.h"
#include "base58.h" #include "base58.h"
#include <string>
QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx) QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx)
{ {
if (!wtx.IsFinal()) if (!wtx.IsFinal())

View file

@ -3,7 +3,6 @@
#include <QString> #include <QString>
#include <QObject> #include <QObject>
#include <string>
class CWallet; class CWallet;
class CWalletTx; class CWalletTx;
@ -13,8 +12,10 @@ class CWalletTx;
class TransactionDesc: public QObject class TransactionDesc: public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
static QString toHTML(CWallet *wallet, CWalletTx &wtx); static QString toHTML(CWallet *wallet, CWalletTx &wtx);
private: private:
TransactionDesc() {} TransactionDesc() {}

View file

@ -6,6 +6,7 @@
namespace Ui { namespace Ui {
class TransactionDescDialog; class TransactionDescDialog;
} }
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QModelIndex; class QModelIndex;
QT_END_NAMESPACE QT_END_NAMESPACE

View file

@ -1,4 +1,5 @@
#include "transactionfilterproxy.h" #include "transactionfilterproxy.h"
#include "transactiontablemodel.h" #include "transactiontablemodel.h"
#include <QDateTime> #include <QDateTime>

View file

@ -8,6 +8,7 @@
class TransactionFilterProxy : public QSortFilterProxyModel class TransactionFilterProxy : public QSortFilterProxyModel
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit TransactionFilterProxy(QObject *parent = 0); explicit TransactionFilterProxy(QObject *parent = 0);
@ -32,6 +33,7 @@ public:
void setLimit(int limit); void setLimit(int limit);
int rowCount(const QModelIndex &parent = QModelIndex()) const; int rowCount(const QModelIndex &parent = QModelIndex()) const;
protected: protected:
bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const; bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const;
@ -42,11 +44,6 @@ private:
quint32 typeFilter; quint32 typeFilter;
qint64 minAmount; qint64 minAmount;
int limitRows; int limitRows;
signals:
public slots:
}; };
#endif // TRANSACTIONFILTERPROXY_H #endif // TRANSACTIONFILTERPROXY_H

View file

@ -1,4 +1,5 @@
#include "transactiontablemodel.h" #include "transactiontablemodel.h"
#include "guiutil.h" #include "guiutil.h"
#include "transactionrecord.h" #include "transactionrecord.h"
#include "guiconstants.h" #include "guiconstants.h"
@ -11,13 +12,11 @@
#include "wallet.h" #include "wallet.h"
#include "ui_interface.h" #include "ui_interface.h"
#include <QLocale>
#include <QList> #include <QList>
#include <QColor> #include <QColor>
#include <QTimer> #include <QTimer>
#include <QIcon> #include <QIcon>
#include <QDateTime> #include <QDateTime>
#include <QtAlgorithms>
// Amount column is right-aligned it contains numbers // Amount column is right-aligned it contains numbers
static int column_alignments[] = { static int column_alignments[] = {

View file

@ -14,6 +14,7 @@ class WalletModel;
class TransactionTableModel : public QAbstractTableModel class TransactionTableModel : public QAbstractTableModel
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit TransactionTableModel(CWallet* wallet, WalletModel *parent = 0); explicit TransactionTableModel(CWallet* wallet, WalletModel *parent = 0);
~TransactionTableModel(); ~TransactionTableModel();
@ -55,6 +56,7 @@ public:
QVariant data(const QModelIndex &index, int role) const; QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const; QVariant headerData(int section, Qt::Orientation orientation, int role) const;
QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const; QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
private: private:
CWallet* wallet; CWallet* wallet;
WalletModel *walletModel; WalletModel *walletModel;

View file

@ -20,12 +20,9 @@
#include <QLineEdit> #include <QLineEdit>
#include <QTableView> #include <QTableView>
#include <QHeaderView> #include <QHeaderView>
#include <QPushButton>
#include <QMessageBox> #include <QMessageBox>
#include <QPoint> #include <QPoint>
#include <QMenu> #include <QMenu>
#include <QApplication>
#include <QClipboard>
#include <QLabel> #include <QLabel>
#include <QDateTimeEdit> #include <QDateTimeEdit>
@ -173,16 +170,11 @@ void TransactionView::setModel(WalletModel *model)
transactionView->sortByColumn(TransactionTableModel::Status, Qt::DescendingOrder); transactionView->sortByColumn(TransactionTableModel::Status, Qt::DescendingOrder);
transactionView->verticalHeader()->hide(); transactionView->verticalHeader()->hide();
transactionView->horizontalHeader()->resizeSection( transactionView->horizontalHeader()->resizeSection(TransactionTableModel::Status, 23);
TransactionTableModel::Status, 23); transactionView->horizontalHeader()->resizeSection(TransactionTableModel::Date, 120);
transactionView->horizontalHeader()->resizeSection( transactionView->horizontalHeader()->resizeSection(TransactionTableModel::Type, 120);
TransactionTableModel::Date, 120); transactionView->horizontalHeader()->setResizeMode(TransactionTableModel::ToAddress, QHeaderView::Stretch);
transactionView->horizontalHeader()->resizeSection( transactionView->horizontalHeader()->resizeSection(TransactionTableModel::Amount, 100);
TransactionTableModel::Type, 120);
transactionView->horizontalHeader()->setResizeMode(
TransactionTableModel::ToAddress, QHeaderView::Stretch);
transactionView->horizontalHeader()->resizeSection(
TransactionTableModel::Amount, 100);
} }
} }

View file

@ -22,6 +22,7 @@ QT_END_NAMESPACE
class TransactionView : public QWidget class TransactionView : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit TransactionView(QWidget *parent = 0); explicit TransactionView(QWidget *parent = 0);

View file

@ -26,6 +26,7 @@ public:
class WalletModel : public QObject class WalletModel : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit WalletModel(CWallet *wallet, OptionsModel *optionsModel, QObject *parent = 0); explicit WalletModel(CWallet *wallet, OptionsModel *optionsModel, QObject *parent = 0);
~WalletModel(); ~WalletModel();
@ -161,5 +162,4 @@ public slots:
void pollBalanceChanged(); void pollBalanceChanged();
}; };
#endif // WALLETMODEL_H #endif // WALLETMODEL_H