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

Qt: Replace remaining 0 with nullptr #15114

Merged
merged 2 commits into from Jan 14, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -59,7 +59,7 @@ class AddressBookSortFilterProxyModel final : public QSortFilterProxyModel
AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode, Tabs _tab, QWidget *parent) :
QDialog(parent),
ui(new Ui::AddressBookPage),
model(0),
model(nullptr),
mode(_mode),
tab(_tab)
{
@@ -38,7 +38,7 @@ class AddressBookPage : public QDialog
ForEditing /**< Open address book for editing */
};

explicit AddressBookPage(const PlatformStyle *platformStyle, Mode mode, Tabs tab, QWidget *parent = 0);
explicit AddressBookPage(const PlatformStyle *platformStyle, Mode mode, Tabs tab, QWidget *parent = nullptr);
~AddressBookPage();

void setModel(AddressTableModel *model);
@@ -153,7 +153,7 @@ class AddressTablePriv
}
else
{
return 0;
return nullptr;
}
}
};
@@ -300,8 +300,8 @@ QVariant AddressTableModel::headerData(int section, Qt::Orientation orientation,

Qt::ItemFlags AddressTableModel::flags(const QModelIndex &index) const
{
if(!index.isValid())
return 0;
if (!index.isValid()) return Qt::NoItemFlags;

This comment has been minimized.


AddressTableEntry *rec = static_cast<AddressTableEntry*>(index.internalPointer());

Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
@@ -25,7 +25,7 @@ class AddressTableModel : public QAbstractTableModel
Q_OBJECT

public:
explicit AddressTableModel(WalletModel *parent = 0);
explicit AddressTableModel(WalletModel *parent = nullptr);
~AddressTableModel();

enum ColumnIndex {
@@ -22,7 +22,7 @@ AskPassphraseDialog::AskPassphraseDialog(Mode _mode, QWidget *parent) :
QDialog(parent),
ui(new Ui::AskPassphraseDialog),
mode(_mode),
model(0),
model(nullptr),
fCapsLock(false)
{
ui->setupUi(this);
@@ -76,7 +76,7 @@ class BanTablePriv
if (idx >= 0 && idx < cachedBanlist.size())
return &cachedBanlist[idx];

return 0;
return nullptr;
}
};

@@ -145,8 +145,7 @@ QVariant BanTableModel::headerData(int section, Qt::Orientation orientation, int

Qt::ItemFlags BanTableModel::flags(const QModelIndex &index) const
{
if(!index.isValid())
return 0;
if (!index.isValid()) return Qt::NoItemFlags;

Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
return retval;
@@ -45,7 +45,7 @@ class BanTableModel : public QAbstractTableModel
Q_OBJECT

public:
explicit BanTableModel(interfaces::Node& node, ClientModel *parent = 0);
explicit BanTableModel(interfaces::Node& node, ClientModel *parent = nullptr);
~BanTableModel();
void startAutoRefresh();
void stopAutoRefresh();
@@ -178,18 +178,18 @@ void BitcoinCore::shutdown()

BitcoinApplication::BitcoinApplication(interfaces::Node& node, int &argc, char **argv):
QApplication(argc, argv),
coreThread(0),
coreThread(nullptr),
m_node(node),
optionsModel(0),
clientModel(0),
window(0),
pollShutdownTimer(0),
optionsModel(nullptr),
clientModel(nullptr),
window(nullptr),
pollShutdownTimer(nullptr),
#ifdef ENABLE_WALLET
paymentServer(0),
paymentServer(nullptr),
m_wallet_models(),
#endif
returnValue(0),
platformStyle(0)
platformStyle(nullptr)
{
setQuitOnLastWindowClosed(false);
}
@@ -218,15 +218,15 @@ BitcoinApplication::~BitcoinApplication()
}

delete window;
window = 0;
window = nullptr;
#ifdef ENABLE_WALLET
delete paymentServer;
paymentServer = 0;
paymentServer = nullptr;
#endif
delete optionsModel;
optionsModel = 0;
optionsModel = nullptr;
delete platformStyle;
platformStyle = 0;
platformStyle = nullptr;
}

#ifdef ENABLE_WALLET
@@ -243,15 +243,15 @@ void BitcoinApplication::createOptionsModel(bool resetSettings)

void BitcoinApplication::createWindow(const NetworkStyle *networkStyle)
{
window = new BitcoinGUI(m_node, platformStyle, networkStyle, 0);
window = new BitcoinGUI(m_node, platformStyle, networkStyle, nullptr);

pollShutdownTimer = new QTimer(window);
connect(pollShutdownTimer, &QTimer::timeout, window, &BitcoinGUI::detectShutdown);
}

void BitcoinApplication::createSplashScreen(const NetworkStyle *networkStyle)
{
SplashScreen *splash = new SplashScreen(m_node, 0, networkStyle);
SplashScreen *splash = new SplashScreen(m_node, nullptr, networkStyle);
// We don't hold a direct pointer to the splash screen after creation, but the splash
// screen will take care of deleting itself when finish() happens.
splash->show();
@@ -312,7 +312,7 @@ void BitcoinApplication::requestShutdown()
qDebug() << __func__ << ": Requesting shutdown";
startThread();
window->hide();
window->setClientModel(0);
window->setClientModel(nullptr);
pollShutdownTimer->stop();

#ifdef ENABLE_WALLET
@@ -323,7 +323,7 @@ void BitcoinApplication::requestShutdown()
m_wallet_models.clear();
#endif
delete clientModel;
clientModel = 0;
clientModel = nullptr;

m_node.startShutdown();

@@ -429,7 +429,7 @@ void BitcoinApplication::shutdownResult()

void BitcoinApplication::handleRunawayException(const QString &message)
{
QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. Bitcoin can no longer continue safely and will quit.") + QString("\n\n") + message);
QMessageBox::critical(nullptr, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. Bitcoin can no longer continue safely and will quit.") + QString("\n\n") + message);
::exit(EXIT_FAILURE);
}

@@ -503,7 +503,7 @@ int GuiMain(int argc, char* argv[])
SetupUIArgs();
std::string error;
if (!node->parseParameters(argc, argv, error)) {
QMessageBox::critical(0, QObject::tr(PACKAGE_NAME),
QMessageBox::critical(nullptr, QObject::tr(PACKAGE_NAME),
QObject::tr("Error parsing command line arguments: %1.").arg(QString::fromStdString(error)));
return EXIT_FAILURE;
}
@@ -540,12 +540,12 @@ int GuiMain(int argc, char* argv[])
/// - Do not call GetDataDir(true) before this step finishes
if (!fs::is_directory(GetDataDir(false)))
{
QMessageBox::critical(0, QObject::tr(PACKAGE_NAME),
QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(gArgs.GetArg("-datadir", ""))));
QMessageBox::critical(nullptr, QObject::tr(PACKAGE_NAME),
QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(gArgs.GetArg("-datadir", ""))));
return EXIT_FAILURE;
}
if (!node->readConfigFiles(error)) {
QMessageBox::critical(0, QObject::tr(PACKAGE_NAME),
QMessageBox::critical(nullptr, QObject::tr(PACKAGE_NAME),
QObject::tr("Error: Cannot parse configuration file: %1.").arg(QString::fromStdString(error)));
return EXIT_FAILURE;
}
@@ -560,7 +560,7 @@ int GuiMain(int argc, char* argv[])
try {
node->selectParams(gArgs.GetChainName());
} catch(std::exception &e) {
QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), QObject::tr("Error: %1").arg(e.what()));
QMessageBox::critical(nullptr, QObject::tr(PACKAGE_NAME), QObject::tr("Error: %1").arg(e.what()));
return EXIT_FAILURE;
}
#ifdef ENABLE_WALLET
@@ -60,7 +60,7 @@ class AmountSpinBox: public QAbstractSpinBox
}
}

CAmount value(bool *valid_out=0) const
CAmount value(bool *valid_out=nullptr) const
{
return parse(text(), valid_out);
}
@@ -159,7 +159,7 @@ class AmountSpinBox: public QAbstractSpinBox
* return validity.
* @note Must return 0 if !valid.
*/
CAmount parse(const QString &text, bool *valid_out=0) const
CAmount parse(const QString &text, bool *valid_out=nullptr) const
{
CAmount val = 0;
bool valid = BitcoinUnits::parse(currentUnit, text, &val);
@@ -196,7 +196,7 @@ class AmountSpinBox: public QAbstractSpinBox
if (text().isEmpty()) // Allow step-up with empty field
return StepUpEnabled;

StepEnabled rv = 0;
StepEnabled rv = StepNone;
bool valid = false;
CAmount val = value(&valid);
if (valid) {
@@ -216,7 +216,7 @@ class AmountSpinBox: public QAbstractSpinBox

BitcoinAmountField::BitcoinAmountField(QWidget *parent) :
QWidget(parent),
amount(0)
amount(nullptr)
{
amount = new AmountSpinBox(this);
amount->setLocale(QLocale::c());
@@ -26,9 +26,9 @@ class BitcoinAmountField: public QWidget
Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY valueChanged USER true)

public:
explicit BitcoinAmountField(QWidget *parent = 0);
explicit BitcoinAmountField(QWidget *parent = nullptr);

CAmount value(bool *value=0) const;
CAmount value(bool *value=nullptr) const;
void setValue(const CAmount& value);

/** If allow empty is set to false the field will be set to the minimum allowed value if left empty. **/
@@ -95,7 +95,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
setWindowIcon(networkStyle->getTrayAndWindowIcon());
setWindowTitle(windowTitle);

rpcConsole = new RPCConsole(node, _platformStyle, 0);
rpcConsole = new RPCConsole(node, _platformStyle, nullptr);
helpMessageDialog = new HelpMessageDialog(node, this, false);
#ifdef ENABLE_WALLET
if(enableWallet)
@@ -1196,7 +1196,7 @@ void BitcoinGUI::updateProxyIcon()
bool proxy_enabled = clientModel->getProxyInfo(ip_port);

if (proxy_enabled) {
if (labelProxyIcon->pixmap() == 0) {
if (labelProxyIcon->pixmap() == nullptr) {
QString ip_port_q = QString::fromStdString(ip_port);
labelProxyIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/proxy").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
labelProxyIcon->setToolTip(tr("Proxy is <b>enabled</b>: %1").arg(ip_port_q));
@@ -1242,7 +1242,7 @@ void BitcoinGUI::showProgress(const QString &title, int nProgress)
progressDialog = new QProgressDialog(title, "", 0, 100);
progressDialog->setWindowModality(Qt::ApplicationModal);
progressDialog->setMinimumDuration(0);
progressDialog->setCancelButton(0);
progressDialog->setCancelButton(nullptr);
progressDialog->setAutoClose(false);
progressDialog->setValue(0);
}
@@ -1304,8 +1304,8 @@ void BitcoinGUI::unsubscribeFromCoreSignals()
}

UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(const PlatformStyle *platformStyle) :
optionsModel(0),
menu(0)
optionsModel(nullptr),
menu(nullptr)
{
createContextMenu();
setToolTip(tr("Unit to show amounts in. Click to select another unit."));
@@ -67,7 +67,7 @@ class BitcoinGUI : public QMainWindow
public:
static const std::string DEFAULT_UIPLATFORM;

explicit BitcoinGUI(interfaces::Node& node, const PlatformStyle *platformStyle, const NetworkStyle *networkStyle, QWidget *parent = 0);
explicit BitcoinGUI(interfaces::Node& node, const PlatformStyle *platformStyle, const NetworkStyle *networkStyle, QWidget *parent = nullptr);
~BitcoinGUI();

/** Set the client model.
@@ -35,9 +35,9 @@ ClientModel::ClientModel(interfaces::Node& node, OptionsModel *_optionsModel, QO
QObject(parent),
m_node(node),
optionsModel(_optionsModel),
peerTableModel(0),
banTableModel(0),
pollTimer(0)
peerTableModel(nullptr),
banTableModel(nullptr),
pollTimer(nullptr)
{
cachedBestHeaderHeight = -1;
cachedBestHeaderTime = -1;
@@ -46,7 +46,7 @@ class ClientModel : public QObject
Q_OBJECT

public:
explicit ClientModel(interfaces::Node& node, OptionsModel *optionsModel, QObject *parent = 0);
explicit ClientModel(interfaces::Node& node, OptionsModel *optionsModel, QObject *parent = nullptr);
~ClientModel();

interfaces::Node& node() const { return m_node; }
@@ -49,7 +49,7 @@ bool CCoinControlWidgetItem::operator<(const QTreeWidgetItem &other) const {
CoinControlDialog::CoinControlDialog(const PlatformStyle *_platformStyle, QWidget *parent) :
QDialog(parent),
ui(new Ui::CoinControlDialog),
model(0),
model(nullptr),
platformStyle(_platformStyle)
{
ui->setupUi(this);
@@ -43,7 +43,7 @@ class CoinControlDialog : public QDialog
Q_OBJECT

public:
explicit CoinControlDialog(const PlatformStyle *platformStyle, QWidget *parent = 0);
explicit CoinControlDialog(const PlatformStyle *platformStyle, QWidget *parent = nullptr);
~CoinControlDialog();

void setModel(WalletModel *model);
@@ -13,7 +13,7 @@ class CoinControlTreeWidget : public QTreeWidget
Q_OBJECT

public:
explicit CoinControlTreeWidget(QWidget *parent = 0);
explicit CoinControlTreeWidget(QWidget *parent = nullptr);

protected:
virtual void keyPressEvent(QKeyEvent *event);
@@ -10,7 +10,7 @@

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

@@ -20,7 +20,7 @@ class CSVModelWriter : public QObject
Q_OBJECT

public:
explicit CSVModelWriter(const QString &filename, QObject *parent = 0);
explicit CSVModelWriter(const QString &filename, QObject *parent = nullptr);

void setModel(const QAbstractItemModel *model);
void addColumn(const QString &title, int column, int role=Qt::EditRole);
@@ -15,9 +15,9 @@
EditAddressDialog::EditAddressDialog(Mode _mode, QWidget *parent) :
QDialog(parent),
ui(new Ui::EditAddressDialog),
mapper(0),
mapper(nullptr),
mode(_mode),
model(0)
model(nullptr)
{
ui->setupUi(this);

@@ -30,7 +30,7 @@ class EditAddressDialog : public QDialog
EditSendingAddress
};

explicit EditAddressDialog(Mode mode, QWidget *parent = 0);
explicit EditAddressDialog(Mode mode, QWidget *parent = nullptr);
~EditAddressDialog();

void setModel(AddressTableModel *model);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.