Permalink
Browse files

Bitcoin-Qt: massive header and cpp cleanup

- try to enforce the same style to all Qt related files
- remove unneeded includes from the files
- add missing Q_OBJECT, QT_BEGIN_NAMESPACE / QT_END_NAMESPACE
- prepares for a pull-req to include Qt5 compatibility
  • Loading branch information...
1 parent 1a9ee5d commit 32af5266cfc604a32ed90b6099f8b2fb308d6c15 Philip Kaufmann committed Jan 23, 2013
Showing with 91 additions and 110 deletions.
  1. +4 −4 src/qt/addressbookpage.cpp
  2. +1 −1 src/qt/addresstablemodel.cpp
  3. +1 −0 src/qt/addresstablemodel.h
  4. +0 −1 src/qt/askpassphrasedialog.h
  5. +3 −1 src/qt/bitcoin.cpp
  6. +1 −1 src/qt/bitcoin.qrc
  7. +2 −5 src/qt/bitcoinaddressvalidator.h
  8. +2 −6 src/qt/bitcoinamountfield.cpp
  9. +2 −1 src/qt/bitcoinamountfield.h
  10. +5 −6 src/qt/bitcoingui.cpp
  11. +1 −4 src/qt/bitcoingui.h
  12. +3 −0 src/qt/bitcoinunits.h
  13. +1 −0 src/qt/clientmodel.cpp
  14. +2 −0 src/qt/clientmodel.h
  15. +1 −5 src/qt/csvmodelwriter.h
  16. +1 −0 src/qt/editaddressdialog.cpp
  17. +4 −4 src/qt/editaddressdialog.h
  18. +4 −2 src/qt/guiutil.cpp
  19. +2 −1 src/qt/guiutil.h
  20. +3 −2 src/qt/macdockiconhandler.h
  21. +0 −1 src/qt/macdockiconhandler.mm
  22. +0 −1 src/qt/monitoreddatamapper.cpp
  23. +2 −3 src/qt/monitoreddatamapper.h
  24. +1 −1 src/qt/notificator.cpp
  25. +4 −4 src/qt/notificator.h
  26. +0 −2 src/qt/optionsdialog.cpp
  27. +3 −2 src/qt/optionsmodel.cpp
  28. +4 −4 src/qt/overviewpage.h
  29. +4 −3 src/qt/paymentserver.cpp
  30. +1 −0 src/qt/qvalidatedlineedit.h
  31. +2 −2 src/qt/qvaluecombobox.h
  32. +3 −3 src/qt/rpcconsole.cpp
  33. +1 −1 src/qt/sendcoinsdialog.cpp
  34. +1 −0 src/qt/sendcoinsentry.cpp
  35. +2 −2 src/qt/signverifymessagedialog.cpp
  36. +0 −3 src/qt/signverifymessagedialog.h
  37. +0 −9 src/qt/test/uritests.cpp
  38. +2 −1 src/qt/transactiondesc.cpp
  39. +2 −1 src/qt/transactiondesc.h
  40. +1 −0 src/qt/transactiondescdialog.h
  41. +1 −0 src/qt/transactionfilterproxy.cpp
  42. +2 −5 src/qt/transactionfilterproxy.h
  43. +2 −2 src/qt/transactionrecord.h
  44. +1 −2 src/qt/transactiontablemodel.cpp
  45. +2 −0 src/qt/transactiontablemodel.h
  46. +5 −13 src/qt/transactionview.cpp
  47. +1 −0 src/qt/transactionview.h
  48. +1 −1 src/qt/walletmodel.h
@@ -8,15 +8,15 @@
#include "csvmodelwriter.h"
#include "guiutil.h"
+#ifdef USE_QRCODE
+#include "qrcodedialog.h"
+#endif
+
#include <QSortFilterProxyModel>
#include <QClipboard>
#include <QMessageBox>
#include <QMenu>
-#ifdef USE_QRCODE
-#include "qrcodedialog.h"
-#endif
-
AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
QDialog(parent),
ui(new Ui::AddressBookPage),
@@ -1,12 +1,12 @@
#include "addresstablemodel.h"
+
#include "guiutil.h"
#include "walletmodel.h"
#include "wallet.h"
#include "base58.h"
#include <QFont>
-#include <QColor>
const QString AddressTableModel::Send = "S";
const QString AddressTableModel::Receive = "R";
@@ -14,6 +14,7 @@ class WalletModel;
class AddressTableModel : public QAbstractTableModel
{
Q_OBJECT
+
public:
explicit AddressTableModel(CWallet *wallet, WalletModel *parent = 0);
~AddressTableModel();
@@ -6,7 +6,6 @@
namespace Ui {
class AskPassphraseDialog;
}
-
class WalletModel;
/** Multifunctional dialog to ask for passphrases. Used for encryption, unlocking, and changing the passphrase.
View
@@ -1,6 +1,9 @@
/*
* W.J. van der Laan 2011-2012
*/
+
+#include <QApplication>
+
#include "bitcoingui.h"
#include "clientmodel.h"
#include "walletmodel.h"
@@ -11,7 +14,6 @@
#include "ui_interface.h"
#include "paymentserver.h"
-#include <QApplication>
#include <QMessageBox>
#include <QTextCodec>
#include <QLocale>
View
@@ -1,4 +1,4 @@
-<RCC>
+<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/icons">
<file alias="bitcoin">res/icons/bitcoin.png</file>
<file alias="address-book">res/icons/address-book.png</file>
@@ -1,24 +1,21 @@
#ifndef BITCOINADDRESSVALIDATOR_H
#define BITCOINADDRESSVALIDATOR_H
-#include <QRegExpValidator>
+#include <QValidator>
/** Base48 entry widget validator.
Corrects near-miss characters and refuses characters that are no part of base48.
*/
class BitcoinAddressValidator : public QValidator
{
Q_OBJECT
+
public:
explicit BitcoinAddressValidator(QObject *parent = 0);
State validate(QString &input, int &pos) const;
static const int MaxAddressLength = 35;
-signals:
-
-public slots:
-
};
#endif // BITCOINADDRESSVALIDATOR_H
@@ -1,18 +1,14 @@
#include "bitcoinamountfield.h"
+
#include "qvaluecombobox.h"
#include "bitcoinunits.h"
-
#include "guiconstants.h"
-#include <QLabel>
-#include <QLineEdit>
-#include <QRegExpValidator>
#include <QHBoxLayout>
#include <QKeyEvent>
#include <QDoubleSpinBox>
-#include <QComboBox>
#include <QApplication>
-#include <qmath.h>
+#include <qmath.h> // for qPow()
BitcoinAmountField::BitcoinAmountField(QWidget *parent):
QWidget(parent), amount(0), currentUnit(-1)
@@ -13,7 +13,9 @@ QT_END_NAMESPACE
class BitcoinAmountField: public QWidget
{
Q_OBJECT
+
Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY textChanged USER true)
+
public:
explicit BitcoinAmountField(QWidget *parent = 0);
@@ -56,5 +58,4 @@ private slots:
};
-
#endif // BITCOINAMOUNTFIELD_H
View
@@ -4,7 +4,11 @@
* W.J. van der Laan 2011-2012
* The Bitcoin Developers 2011-2012
*/
+
+#include <QApplication>
+
#include "bitcoingui.h"
+
#include "transactiontablemodel.h"
#include "addressbookpage.h"
#include "sendcoinsdialog.h"
@@ -31,19 +35,13 @@
#include "macdockiconhandler.h"
#endif
-#include <QApplication>
-#include <QMainWindow>
#include <QMenuBar>
#include <QMenu>
#include <QIcon>
-#include <QTabWidget>
#include <QVBoxLayout>
#include <QToolBar>
#include <QStatusBar>
#include <QLabel>
-#include <QLineEdit>
-#include <QPushButton>
-#include <QLocale>
#include <QMessageBox>
#include <QProgressBar>
#include <QStackedWidget>
@@ -54,6 +52,7 @@
#include <QTimer>
#include <QDragEnterEvent>
#include <QUrl>
+#include <QMimeData>
#include <QStyle>
#include <iostream>
View
@@ -17,13 +17,9 @@ class RPCConsole;
QT_BEGIN_NAMESPACE
class QLabel;
-class QLineEdit;
-class QTableView;
-class QAbstractItemModel;
class QModelIndex;
class QProgressBar;
class QStackedWidget;
-class QUrl;
QT_END_NAMESPACE
/**
@@ -33,6 +29,7 @@ QT_END_NAMESPACE
class BitcoinGUI : public QMainWindow
{
Q_OBJECT
+
public:
explicit BitcoinGUI(QWidget *parent = 0);
~BitcoinGUI();
View
@@ -9,6 +9,8 @@
*/
class BitcoinUnits: public QAbstractListModel
{
+ Q_OBJECT
+
public:
explicit BitcoinUnits(QObject *parent);
@@ -58,6 +60,7 @@ class BitcoinUnits: public QAbstractListModel
int rowCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
///@}
+
private:
QList<BitcoinUnits::Unit> unitlist;
};
View
@@ -1,4 +1,5 @@
#include "clientmodel.h"
+
#include "guiconstants.h"
#include "optionsmodel.h"
#include "addresstablemodel.h"
View
@@ -24,6 +24,7 @@ enum BlockSource {
class ClientModel : public QObject
{
Q_OBJECT
+
public:
explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0);
~ClientModel();
@@ -66,6 +67,7 @@ class ClientModel : public QObject
void subscribeToCoreSignals();
void unsubscribeFromCoreSignals();
+
signals:
void numConnectionsChanged(int count);
void numBlocksChanged(int count, int countOfPeers);
View
@@ -14,6 +14,7 @@ QT_END_NAMESPACE
class CSVModelWriter : public QObject
{
Q_OBJECT
+
public:
explicit CSVModelWriter(const QString &filename, QObject *parent = 0);
@@ -36,11 +37,6 @@ class CSVModelWriter : public QObject
int role;
};
QList<Column> columns;
-
-signals:
-
-public slots:
-
};
#endif // CSVMODELWRITER_H
@@ -1,5 +1,6 @@
#include "editaddressdialog.h"
#include "ui_editaddressdialog.h"
+
#include "addresstablemodel.h"
#include "guiutil.h"
@@ -3,15 +3,15 @@
#include <QDialog>
-QT_BEGIN_NAMESPACE
-class QDataWidgetMapper;
-QT_END_NAMESPACE
-
namespace Ui {
class EditAddressDialog;
}
class AddressTableModel;
+QT_BEGIN_NAMESPACE
+class QDataWidgetMapper;
+QT_END_NAMESPACE
+
/** Dialog for editing an address and associated information.
*/
class EditAddressDialog : public QDialog
View
@@ -1,19 +1,21 @@
+#include <QApplication>
+
#include "guiutil.h"
+
#include "bitcoinaddressvalidator.h"
#include "walletmodel.h"
#include "bitcoinunits.h"
+
#include "util.h"
#include "init.h"
-#include <QString>
#include <QDateTime>
#include <QDoubleValidator>
#include <QFont>
#include <QLineEdit>
#include <QUrl>
#include <QTextDocument> // For Qt::escape
#include <QAbstractItemView>
-#include <QApplication>
#include <QClipboard>
#include <QFileDialog>
#include <QDesktopServices>
View
@@ -5,6 +5,8 @@
#include <QObject>
#include <QMessageBox>
+class SendCoinsRecipient;
+
QT_BEGIN_NAMESPACE
class QFont;
class QLineEdit;
@@ -13,7 +15,6 @@ class QDateTime;
class QUrl;
class QAbstractItemView;
QT_END_NAMESPACE
-class SendCoinsRecipient;
/** Utility functions used by the Bitcoin Qt UI.
*/
@@ -3,9 +3,11 @@
#include <QObject>
+QT_BEGIN_NAMESPACE
class QMenu;
class QIcon;
class QWidget;
+QT_END_NAMESPACE
#ifdef __OBJC__
@class DockIconClickEventHandler;
@@ -18,6 +20,7 @@ class DockIconClickEventHandler;
class MacDockIconHandler : public QObject
{
Q_OBJECT
+
public:
~MacDockIconHandler();
@@ -31,8 +34,6 @@ class MacDockIconHandler : public QObject
signals:
void dockIconClicked();
-public slots:
-
private:
MacDockIconHandler();
@@ -1,4 +1,3 @@
-
#include "macdockiconhandler.h"
#include <QMenu>
@@ -9,7 +9,6 @@ MonitoredDataMapper::MonitoredDataMapper(QObject *parent) :
{
}
-
void MonitoredDataMapper::addMapping(QWidget *widget, int section)
{
QDataWidgetMapper::addMapping(widget, section);
@@ -13,19 +13,18 @@ QT_END_NAMESPACE
class MonitoredDataMapper : public QDataWidgetMapper
{
Q_OBJECT
+
public:
explicit MonitoredDataMapper(QObject *parent=0);
void addMapping(QWidget *widget, int section);
void addMapping(QWidget *widget, int section, const QByteArray &propertyName);
+
private:
void addChangeMonitor(QWidget *widget);
signals:
void viewModified();
-
};
-
-
#endif // MONITOREDDATAMAPPER_H
View
@@ -12,7 +12,7 @@
#include <QImageWriter>
#ifdef USE_DBUS
-#include <QtDBus/QtDBus>
+#include <QtDBus>
#include <stdint.h>
#endif
Oops, something went wrong.

0 comments on commit 32af526

Please sign in to comment.