Change nullptr to Q_NULLPTR

This commit is contained in:
Alex Spataru 2021-12-06 09:28:41 -06:00
parent 3c6fb53acb
commit a113ed5d22
24 changed files with 55 additions and 55 deletions

View File

@ -40,7 +40,7 @@
namespace CSV
{
static Export *EXPORT = nullptr;
static Export *EXPORT = Q_NULLPTR;
/**
* Connect JSON Parser & Serial Manager signals to begin registering JSON

View File

@ -40,7 +40,7 @@
namespace CSV
{
static Player *PLAYER = nullptr;
static Player *PLAYER = Q_NULLPTR;
/**
* Constructor function

View File

@ -94,7 +94,7 @@ private slots:
private:
bool validateRow(const int row);
QJsonDocument getJsonFrame(const int row);
QString getCellValue(int row, int column, bool *error = nullptr);
QString getCellValue(int row, int column, bool *error = Q_NULLPTR);
int getDatasetIndex(const QString &groupKey, const QString &datasetKey);
private:

View File

@ -35,7 +35,7 @@
namespace IO
{
static Console *CONSOLE = nullptr;
static Console *CONSOLE = Q_NULLPTR;
/**
* Generates a hexdump of the given data
@ -603,7 +603,7 @@ QByteArray Console::hexToBytes(const QString &data)
{
auto chr1 = withoutSpaces.at(i);
auto chr2 = withoutSpaces.at(i + 1);
auto byte = QString("%1%2").arg(chr1, chr2).toInt(nullptr, 16);
auto byte = QString("%1%2").arg(chr1, chr2).toInt(Q_NULLPTR, 16);
array.append(byte);
}

View File

@ -29,7 +29,7 @@ namespace IO
{
namespace DataSources
{
static Network *NETWORK = nullptr;
static Network *NETWORK = Q_NULLPTR;
/**
* Constructor function
@ -174,7 +174,7 @@ QIODevice *Network::openNetworkPort()
disconnectDevice();
// Init socket pointer
QAbstractSocket *socket = nullptr;
QAbstractSocket *socket = Q_NULLPTR;
// Get host & port
auto hostAddr = remoteAddress();

View File

@ -30,13 +30,13 @@ namespace IO
{
namespace DataSources
{
static Serial *SERIAL = nullptr;
static Serial *SERIAL = Q_NULLPTR;
/**
* Constructor function
*/
Serial::Serial()
: m_port(nullptr)
: m_port(Q_NULLPTR)
, m_autoReconnect(false)
, m_lastSerialDeviceIndex(0)
, m_portIndex(0)
@ -74,7 +74,7 @@ Serial::~Serial()
*/
Serial *Serial::getInstance()
{
if (SERIAL == nullptr)
if (SERIAL == Q_NULLPTR)
SERIAL = new Serial;
return SERIAL;
@ -318,7 +318,7 @@ QSerialPort *Serial::openSerialPort()
void Serial::disconnectDevice()
{
// Check if serial port pointer is valid
if (port() != nullptr)
if (port() != Q_NULLPTR)
{
// Disconnect signals/slots
port()->disconnect(this, SLOT(handleError(QSerialPort::SerialPortError)));
@ -329,7 +329,7 @@ void Serial::disconnectDevice()
}
// Reset pointer
m_port = nullptr;
m_port = Q_NULLPTR;
emit portChanged();
emit availablePortsChanged();
}

View File

@ -32,7 +32,7 @@
namespace IO
{
static Manager *MANAGER = nullptr;
static Manager *MANAGER = Q_NULLPTR;
/**
* Adds support for C escape sequences to the given @a str.
@ -62,7 +62,7 @@ Manager::Manager()
: m_enableCrc(false)
, m_writeEnabled(true)
, m_maxBufferSize(1024 * 1024)
, m_device(nullptr)
, m_device(Q_NULLPTR)
, m_dataSource(DataSource::Serial)
, m_receivedBytes(0)
, m_startSequence("/*")
@ -130,7 +130,7 @@ bool Manager::connected()
*/
bool Manager::deviceAvailable()
{
return device() != nullptr;
return device() != Q_NULLPTR;
}
/**
@ -184,7 +184,7 @@ int Manager::maxBufferSize() const
/**
* Returns a pointer to the currently selected device.
*
* @warning you need to check this pointer before using it, it can have a @c nullptr
* @warning you need to check this pointer before using it, it can have a @c Q_NULLPTR
* value during normal operations.
*/
QIODevice *Manager::device()
@ -359,7 +359,7 @@ void Manager::disconnectDevice()
DataSources::Network::getInstance()->disconnectDevice();
// Update device pointer
m_device = nullptr;
m_device = Q_NULLPTR;
m_receivedBytes = 0;
m_dataBuffer.clear();
m_dataBuffer.reserve(maxBufferSize());

View File

@ -65,7 +65,7 @@ namespace JSON
class Dataset : public QObject
{
public:
Dataset(QObject *parent = nullptr);
Dataset(QObject *parent = Q_NULLPTR);
bool fft() const;
bool led() const;

View File

@ -35,7 +35,7 @@
namespace JSON
{
static Editor *EDITOR = nullptr;
static Editor *EDITOR = Q_NULLPTR;
//----------------------------------------------------------------------------------------
// Constructor/deconstructor & singleton
@ -285,7 +285,7 @@ bool Editor::saveJsonFile()
// Get file save path
if (jsonFilePath().isEmpty())
{
auto path = QFileDialog::getSaveFileName(nullptr, tr("Save JSON project"),
auto path = QFileDialog::getSaveFileName(Q_NULLPTR, tr("Save JSON project"),
jsonProjectsPath(), "*.json");
if (path.isEmpty())
return false;
@ -377,7 +377,7 @@ JSON::Group *Editor::getGroup(const int index)
if (index < groupCount())
return m_groups.at(index);
return nullptr;
return Q_NULLPTR;
}
/**
@ -389,7 +389,7 @@ JSON::Dataset *Editor::getDataset(const int group, const int index)
if (index < datasetCount(group))
return getGroup(group)->m_datasets.at(index);
return nullptr;
return Q_NULLPTR;
}
/**
@ -694,7 +694,7 @@ void Editor::newJsonFile()
void Editor::openJsonFile()
{
// clang-format off
auto path = QFileDialog::getOpenFileName(nullptr,
auto path = QFileDialog::getOpenFileName(Q_NULLPTR,
tr("Select JSON file"),
jsonProjectsPath(),
"*.json");

View File

@ -35,7 +35,7 @@
namespace JSON
{
static Generator *GENERATOR = nullptr;
static Generator *GENERATOR = Q_NULLPTR;
/**
* Initializes the JSON Parser class and connects appropiate SIGNALS/SLOTS

View File

@ -60,7 +60,7 @@ namespace JSON
class Group : public QObject
{
public:
Group(QObject *parent = nullptr);
Group(QObject *parent = Q_NULLPTR);
~Group();
QString title() const;

View File

@ -31,7 +31,7 @@
namespace MQTT
{
static Client *CLIENT = nullptr;
static Client *CLIENT = Q_NULLPTR;
/**
* Constructor function
@ -40,7 +40,7 @@ Client::Client()
: m_topic("")
, m_lookupActive(false)
, m_sentMessages(0)
, m_client(nullptr)
, m_client(Q_NULLPTR)
, m_clientMode(MQTTClientMode::ClientPublisher)
{
// Configure new client
@ -790,11 +790,11 @@ void Client::regenerateClient()
host = m_client->host().toString();
password = QString::fromUtf8(m_client->password());
disconnect(m_client, &QMQTT::Client::error, nullptr, 0);
disconnect(m_client, &QMQTT::Client::received, nullptr, 0);
disconnect(m_client, &QMQTT::Client::connected, nullptr, 0);
disconnect(m_client, &QMQTT::Client::sslErrors, nullptr, 0);
disconnect(m_client, &QMQTT::Client::disconnected, nullptr, 0);
disconnect(m_client, &QMQTT::Client::error, Q_NULLPTR, 0);
disconnect(m_client, &QMQTT::Client::received, Q_NULLPTR, 0);
disconnect(m_client, &QMQTT::Client::connected, Q_NULLPTR, 0);
disconnect(m_client, &QMQTT::Client::sslErrors, Q_NULLPTR, 0);
disconnect(m_client, &QMQTT::Client::disconnected, Q_NULLPTR, 0);
m_client->disconnectFromHost();
delete m_client;

View File

@ -29,7 +29,7 @@
namespace Misc
{
static MacExtras *MAC_EXTRAS = nullptr;
static MacExtras *MAC_EXTRAS = Q_NULLPTR;
MacExtras::MacExtras()
{
@ -58,7 +58,7 @@ MacExtras::MacExtras()
connect(&m_dashboardAction, SIGNAL(triggered()), this, SIGNAL(dashboardClicked()));
// Create touchbar
KDMacTouchBar *bar = new KDMacTouchBar((QWidget *)nullptr);
KDMacTouchBar *bar = new KDMacTouchBar((QWidget *)Q_NULLPTR);
bar->addAction(&m_setupAction);
bar->addAction(&m_consoleAction);
bar->addAction(&m_dashboardAction);

View File

@ -30,7 +30,7 @@ namespace Misc
/**
* Pointer to the only instance of the class
*/
static TimerEvents *TIMER_EVENTS = nullptr;
static TimerEvents *TIMER_EVENTS = Q_NULLPTR;
/**
* Converts the given @a hz to milliseconds

View File

@ -24,7 +24,7 @@
namespace Misc
{
static Translator *TRANSLATOR = nullptr;
static Translator *TRANSLATOR = Q_NULLPTR;
/**
* Constructor function

View File

@ -35,7 +35,7 @@
namespace Misc
{
static Utilities *UTILITIES = nullptr;
static Utilities *UTILITIES = Q_NULLPTR;
Utilities *Utilities::getInstance()
{

View File

@ -33,7 +33,7 @@
namespace Plugins
{
static Server *SERVER = nullptr;
static Server *SERVER = Q_NULLPTR;
/**
* Constructor function

View File

@ -30,7 +30,7 @@
namespace UI
{
static Dashboard *DASHBOARD = nullptr;
static Dashboard *DASHBOARD = Q_NULLPTR;
//----------------------------------------------------------------------------------------
// Constructor/deconstructor & singleton
@ -1053,7 +1053,7 @@ JSON::Group *Dashboard::getGroupWidget(const QVector<JSON::Group *> vector,
if (index < vector.count())
return vector.at(index);
return nullptr;
return Q_NULLPTR;
}
/**
@ -1066,6 +1066,6 @@ JSON::Dataset *Dashboard::getDatasetWidget(const QVector<JSON::Dataset *> vector
if (index < vector.count())
return vector.at(index);
return nullptr;
return Q_NULLPTR;
}
}

View File

@ -47,7 +47,7 @@ namespace UI
WidgetLoader::WidgetLoader(QQuickItem *parent)
: QQuickPaintedItem(parent)
, m_index(-1)
, m_widget(nullptr)
, m_widget(Q_NULLPTR)
, m_widgetVisible(false)
{
// Set render flags
@ -245,7 +245,7 @@ void WidgetLoader::setWidgetIndex(const int index)
if (m_widget)
{
delete m_widget;
m_widget = nullptr;
m_widget = Q_NULLPTR;
}
// Construct new widget

View File

@ -30,6 +30,6 @@ namespace Widgets
class AnalogGauge : public QwtDial
{
public:
AnalogGauge(QWidget *parent = nullptr);
AnalogGauge(QWidget *parent = Q_NULLPTR);
};
}

View File

@ -34,7 +34,7 @@ namespace Widgets
class AttitudeIndicator : public QwtDial
{
public:
AttitudeIndicator(QWidget *parent = nullptr);
AttitudeIndicator(QWidget *parent = Q_NULLPTR);
double angle() const;
double gradient() const;

View File

@ -30,7 +30,7 @@ namespace Widgets
{
BaseWidget::BaseWidget()
: m_index(-1)
, m_widget(nullptr)
, m_widget(Q_NULLPTR)
, m_resizeWidget(true)
{
// Workaround for unused variables
@ -76,9 +76,9 @@ void BaseWidget::setValue(const QString &label)
void BaseWidget::setWidget(QWidget *widget, Qt::Alignment alignment, bool autoresize)
{
Q_ASSERT(widget != nullptr);
Q_ASSERT(widget != Q_NULLPTR);
if (m_widget == nullptr)
if (m_widget == Q_NULLPTR)
{
m_widget = widget;
m_resizeWidget = autoresize;

View File

@ -80,7 +80,7 @@ public:
*
* @param parent The parent widget.
*/
explicit KLed(QWidget *parent = nullptr);
explicit KLed(QWidget *parent = Q_NULLPTR);
/**
* Constructs a round LED widget with the supplied color which will
@ -90,7 +90,7 @@ public:
* @param parent The parent widget.
* @short Constructor
*/
explicit KLed(const QColor &color, QWidget *parent = nullptr);
explicit KLed(const QColor &color, QWidget *parent = Q_NULLPTR);
/**
* Constructor with the color, state and look.
@ -105,7 +105,7 @@ public:
* @short Constructor
*/
KLed(const QColor &color, KLed::State state, KLed::Look look, KLed::Shape shape,
QWidget *parent = nullptr);
QWidget *parent = Q_NULLPTR);
/**
* Destroys the LED widget.

View File

@ -39,8 +39,8 @@ FFTPlot::FFTPlot(const int index)
auto theme = Misc::ThemeManager::getInstance();
// Initialize pointers to NULL
m_fft = nullptr;
m_samples = nullptr;
m_fft = Q_NULLPTR;
m_samples = Q_NULLPTR;
// Invalid index, abort initialization
if (m_index < 0 || m_index >= dash->fftCount())
@ -141,8 +141,8 @@ FFTPlot::~FFTPlot()
{
free(m_fft);
free(m_samples);
m_fft = nullptr;
m_samples = nullptr;
m_fft = Q_NULLPTR;
m_samples = Q_NULLPTR;
}
/**