Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-tidy: Force checks for headers in src/qt #686

Merged
merged 2 commits into from
Jan 17, 2023
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/.clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ readability-redundant-string-init,
CheckOptions:
- key: performance-move-const-arg.CheckTriviallyCopyableMove
value: false
HeaderFilterRegex: './qt'
1 change: 0 additions & 1 deletion src/qt/addressbookpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class AddressBookSortFilterProxyModel final : public QSortFilterProxyModel
AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode, Tabs _tab, QWidget *parent) :
QDialog(parent, GUIUtil::dialog_flags),
ui(new Ui::AddressBookPage),
model(nullptr),
mode(_mode),
tab(_tab)
{
Expand Down
2 changes: 1 addition & 1 deletion src/qt/addressbookpage.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public Q_SLOTS:

private:
Ui::AddressBookPage *ui;
AddressTableModel *model;
AddressTableModel* model{nullptr};
Mode mode;
Tabs tab;
QString returnValue;
Expand Down
2 changes: 0 additions & 2 deletions src/qt/askpassphrasedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ AskPassphraseDialog::AskPassphraseDialog(Mode _mode, QWidget *parent, SecureStri
QDialog(parent, GUIUtil::dialog_flags),
ui(new Ui::AskPassphraseDialog),
mode(_mode),
model(nullptr),
fCapsLock(false),
m_passphrase_out(passphrase_out)
{
ui->setupUi(this);
Expand Down
4 changes: 2 additions & 2 deletions src/qt/askpassphrasedialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class AskPassphraseDialog : public QDialog
private:
Ui::AskPassphraseDialog *ui;
Mode mode;
WalletModel *model;
bool fCapsLock;
WalletModel* model{nullptr};
bool fCapsLock{false};
SecureString* m_passphrase_out;

private Q_SLOTS:
Expand Down
10 changes: 2 additions & 8 deletions src/qt/bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,8 @@ void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, cons
static int qt_argc = 1;
static const char* qt_argv = "bitcoin-qt";

BitcoinApplication::BitcoinApplication():
QApplication(qt_argc, const_cast<char **>(&qt_argv)),
optionsModel(nullptr),
clientModel(nullptr),
window(nullptr),
pollShutdownTimer(nullptr),
returnValue(0),
platformStyle(nullptr)
BitcoinApplication::BitcoinApplication()
: QApplication(qt_argc, const_cast<char**>(&qt_argv))
{
// Qt runs setlocale(LC_ALL, "") on initialization.
RegisterMetaTypes();
Expand Down
12 changes: 6 additions & 6 deletions src/qt/bitcoin.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,16 @@ public Q_SLOTS:

private:
std::optional<InitExecutor> m_executor;
OptionsModel *optionsModel;
ClientModel *clientModel;
BitcoinGUI *window;
QTimer *pollShutdownTimer;
OptionsModel* optionsModel{nullptr};
ClientModel* clientModel{nullptr};
BitcoinGUI* window{nullptr};
QTimer* pollShutdownTimer{nullptr};
#ifdef ENABLE_WALLET
PaymentServer* paymentServer{nullptr};
WalletController* m_wallet_controller{nullptr};
#endif
int returnValue;
const PlatformStyle *platformStyle;
int returnValue{0};
const PlatformStyle* platformStyle{nullptr};
std::unique_ptr<QWidget> shutdownWindow;
SplashScreen* m_splash = nullptr;
std::unique_ptr<interfaces::Node> m_node;
Expand Down
5 changes: 2 additions & 3 deletions src/qt/bitcoinamountfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,8 @@ class AmountSpinBox: public QAbstractSpinBox

#include <qt/bitcoinamountfield.moc>

BitcoinAmountField::BitcoinAmountField(QWidget *parent) :
QWidget(parent),
amount(nullptr)
BitcoinAmountField::BitcoinAmountField(QWidget* parent)
: QWidget(parent)
{
amount = new AmountSpinBox(this);
amount->setLocale(QLocale::c());
Expand Down
2 changes: 1 addition & 1 deletion src/qt/bitcoinamountfield.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class BitcoinAmountField: public QWidget
bool eventFilter(QObject *object, QEvent *event) override;

private:
AmountSpinBox *amount;
AmountSpinBox* amount{nullptr};
QValueComboBox *unit;

private Q_SLOTS:
Expand Down
6 changes: 2 additions & 4 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1541,10 +1541,8 @@ bool BitcoinGUI::isPrivacyModeActivated() const
return m_mask_values_action->isChecked();
}

UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(const PlatformStyle *platformStyle)
: optionsModel(nullptr),
menu(nullptr),
m_platform_style{platformStyle}
UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(const PlatformStyle* platformStyle)
: m_platform_style{platformStyle}
{
createContextMenu();
setToolTip(tr("Unit to show amounts in. Click to select another unit."));
Expand Down
4 changes: 2 additions & 2 deletions src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@ class UnitDisplayStatusBarControl : public QLabel
void changeEvent(QEvent* e) override;

private:
OptionsModel *optionsModel;
QMenu* menu;
OptionsModel* optionsModel{nullptr};
QMenu* menu{nullptr};
const PlatformStyle* m_platform_style;

/** Shows context menu with Display Unit options by the mouse coordinates */
Expand Down
2 changes: 0 additions & 2 deletions src/qt/clientmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ ClientModel::ClientModel(interfaces::Node& node, OptionsModel *_optionsModel, QO
QObject(parent),
m_node(node),
optionsModel(_optionsModel),
peerTableModel(nullptr),
banTableModel(nullptr),
m_thread(new QThread(this))
{
cachedBestHeaderHeight = -1;
Expand Down
4 changes: 2 additions & 2 deletions src/qt/clientmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ class ClientModel : public QObject
std::unique_ptr<interfaces::Handler> m_handler_notify_block_tip;
std::unique_ptr<interfaces::Handler> m_handler_notify_header_tip;
OptionsModel *optionsModel;
PeerTableModel *peerTableModel;
PeerTableModel* peerTableModel{nullptr};
PeerTableSortProxy* m_peer_table_sort_proxy{nullptr};
BanTableModel *banTableModel;
BanTableModel* banTableModel{nullptr};

//! A thread to interact with m_node asynchronously
QThread* const m_thread;
Expand Down
6 changes: 3 additions & 3 deletions src/qt/csvmodelwriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#include <QFile>
#include <QTextStream>

CSVModelWriter::CSVModelWriter(const QString &_filename, QObject *parent) :
QObject(parent),
filename(_filename), model(nullptr)
CSVModelWriter::CSVModelWriter(const QString& _filename, QObject* parent)
: QObject(parent),
filename(_filename)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/qt/csvmodelwriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CSVModelWriter : public QObject

private:
QString filename;
const QAbstractItemModel *model;
const QAbstractItemModel* model{nullptr};

struct Column
{
Expand Down
10 changes: 4 additions & 6 deletions src/qt/editaddressdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
#include <QMessageBox>


EditAddressDialog::EditAddressDialog(Mode _mode, QWidget *parent) :
QDialog(parent, GUIUtil::dialog_flags),
ui(new Ui::EditAddressDialog),
mapper(nullptr),
mode(_mode),
model(nullptr)
EditAddressDialog::EditAddressDialog(Mode _mode, QWidget* parent)
: QDialog(parent, GUIUtil::dialog_flags),
ui(new Ui::EditAddressDialog),
mode(_mode)
{
ui->setupUi(this);

Expand Down
4 changes: 2 additions & 2 deletions src/qt/editaddressdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public Q_SLOTS:
QString getDuplicateAddressWarning() const;

Ui::EditAddressDialog *ui;
QDataWidgetMapper *mapper;
QDataWidgetMapper* mapper{nullptr};
Mode mode;
AddressTableModel *model;
AddressTableModel* model{nullptr};

QString address;
};
Expand Down
2 changes: 0 additions & 2 deletions src/qt/intro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ int GetPruneTargetGB()
Intro::Intro(QWidget *parent, int64_t blockchain_size_gb, int64_t chain_state_size_gb) :
QDialog(parent, GUIUtil::dialog_flags),
ui(new Ui::Intro),
thread(nullptr),
signalled(false),
m_blockchain_size_gb(blockchain_size_gb),
m_chain_state_size_gb(chain_state_size_gb),
m_prune_target_gb{GetPruneTargetGB()}
Expand Down
4 changes: 2 additions & 2 deletions src/qt/intro.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ private Q_SLOTS:

private:
Ui::Intro *ui;
QThread *thread;
QThread* thread{nullptr};
QMutex mutex;
bool signalled;
bool signalled{false};
QString pathToCheck;
const int64_t m_blockchain_size_gb;
const int64_t m_chain_state_size_gb;
Expand Down
11 changes: 4 additions & 7 deletions src/qt/modaloverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,10 @@
#include <QPropertyAnimation>
#include <QResizeEvent>

ModalOverlay::ModalOverlay(bool enable_wallet, QWidget *parent) :
QWidget(parent),
ui(new Ui::ModalOverlay),
bestHeaderHeight(0),
bestHeaderDate(QDateTime()),
layerIsVisible(false),
userClosed(false)
ModalOverlay::ModalOverlay(bool enable_wallet, QWidget* parent)
: QWidget(parent),
ui(new Ui::ModalOverlay),
bestHeaderDate(QDateTime())
{
ui->setupUi(this);
connect(ui->closeButton, &QPushButton::clicked, this, &ModalOverlay::closeClicked);
Expand Down
6 changes: 3 additions & 3 deletions src/qt/modaloverlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ public Q_SLOTS:

private:
Ui::ModalOverlay *ui;
int bestHeaderHeight; //best known height (based on the headers)
int bestHeaderHeight{0}; // best known height (based on the headers)
QDateTime bestHeaderDate;
QVector<QPair<qint64, double> > blockProcessTime;
bool layerIsVisible;
bool userClosed;
bool layerIsVisible{false};
bool userClosed{false};
QPropertyAnimation m_animation;
void UpdateHeaderSyncLabel();
void UpdateHeaderPresyncLabel(int height, const QDateTime& blockDate);
Expand Down
4 changes: 0 additions & 4 deletions src/qt/notificator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ Notificator::Notificator(const QString &_programName, QSystemTrayIcon *_trayIcon
QObject(_parent),
parent(_parent),
programName(_programName),
mode(None),
trayIcon(_trayIcon)
#ifdef USE_DBUS
,interface(nullptr)
#endif
{
if(_trayIcon && _trayIcon->supportsMessages())
{
Expand Down
4 changes: 2 additions & 2 deletions src/qt/notificator.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ public Q_SLOTS:
UserNotificationCenter /**< Use the 10.8+ User Notification Center (Mac only) */
};
QString programName;
Mode mode;
Mode mode{None};
QSystemTrayIcon *trayIcon;
#ifdef USE_DBUS
QDBusInterface *interface;
QDBusInterface* interface{nullptr};

void notifyDBus(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout);
#endif
Expand Down
8 changes: 3 additions & 5 deletions src/qt/optionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@
#include <QSystemTrayIcon>
#include <QTimer>

OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
QDialog(parent, GUIUtil::dialog_flags),
ui(new Ui::OptionsDialog),
model(nullptr),
mapper(nullptr)
OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
: QDialog(parent, GUIUtil::dialog_flags),
ui(new Ui::OptionsDialog)
{
ui->setupUi(this);

Expand Down
4 changes: 2 additions & 2 deletions src/qt/optionsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ private Q_SLOTS:
private:
Ui::OptionsDialog *ui;
ClientModel* m_client_model{nullptr};
OptionsModel *model;
QDataWidgetMapper *mapper;
OptionsModel* model{nullptr};
QDataWidgetMapper* mapper{nullptr};
};

#endif // BITCOIN_QT_OPTIONSDIALOG_H
2 changes: 0 additions & 2 deletions src/qt/overviewpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ class TxViewDelegate : public QAbstractItemDelegate
OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent) :
QWidget(parent),
ui(new Ui::OverviewPage),
clientModel(nullptr),
walletModel(nullptr),
m_platform_style{platformStyle},
txdelegate(new TxViewDelegate(platformStyle, this))
{
Expand Down
4 changes: 2 additions & 2 deletions src/qt/overviewpage.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public Q_SLOTS:

private:
Ui::OverviewPage *ui;
ClientModel *clientModel;
WalletModel *walletModel;
ClientModel* clientModel{nullptr};
WalletModel* walletModel{nullptr};
bool m_privacy{false};

const PlatformStyle* m_platform_style;
Expand Down
7 changes: 2 additions & 5 deletions src/qt/paymentserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,8 @@ bool PaymentServer::ipcSendCommandLine()
return fResult;
}

PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) :
QObject(parent),
saveURIs(true),
uriServer(nullptr),
optionsModel(nullptr)
PaymentServer::PaymentServer(QObject* parent, bool startLocalServer)
: QObject(parent)
{
// Install global event filter to catch QFileOpenEvents
// on Mac: sent when you click bitcoin: links
Expand Down
6 changes: 3 additions & 3 deletions src/qt/paymentserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ private Q_SLOTS:
bool eventFilter(QObject *object, QEvent *event) override;

private:
bool saveURIs; // true during startup
QLocalServer* uriServer;
OptionsModel *optionsModel;
bool saveURIs{true}; // true during startup
QLocalServer* uriServer{nullptr};
OptionsModel* optionsModel{nullptr};
};

#endif // BITCOIN_QT_PAYMENTSERVER_H
7 changes: 3 additions & 4 deletions src/qt/peertablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
#include <QList>
#include <QTimer>

PeerTableModel::PeerTableModel(interfaces::Node& node, QObject* parent) :
QAbstractTableModel(parent),
m_node(node),
timer(nullptr)
PeerTableModel::PeerTableModel(interfaces::Node& node, QObject* parent)
: QAbstractTableModel(parent),
m_node(node)
{
// set up timer for auto refresh
timer = new QTimer(this);
Expand Down
2 changes: 1 addition & 1 deletion src/qt/peertablemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public Q_SLOTS:
/*: Title of Peers Table column which contains the peer's
User Agent string. */
tr("User Agent")};
QTimer *timer;
QTimer* timer{nullptr};
};

#endif // BITCOIN_QT_PEERTABLEMODEL_H
4 changes: 2 additions & 2 deletions src/qt/qrimagewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include <qrencode.h>
#endif

QRImageWidget::QRImageWidget(QWidget *parent):
QLabel(parent), contextMenu(nullptr)
QRImageWidget::QRImageWidget(QWidget* parent)
: QLabel(parent)
{
contextMenu = new QMenu(this);
contextMenu->addAction(tr("&Save Image…"), this, &QRImageWidget::saveImage);
Expand Down
2 changes: 1 addition & 1 deletion src/qt/qrimagewidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public Q_SLOTS:
virtual void contextMenuEvent(QContextMenuEvent *event) override;

private:
QMenu *contextMenu;
QMenu* contextMenu{nullptr};
};

#endif // BITCOIN_QT_QRIMAGEWIDGET_H
Loading