Explicit pointer declarations when using the auto keyword
This commit is contained in:
@@ -113,7 +113,7 @@ void Insight::startup() {
|
||||
*
|
||||
* This allows us to use Qt's event loop whilst still being able to process our own events.
|
||||
*/
|
||||
auto eventDispatchTimer = new QTimer(&(this->application));
|
||||
auto* eventDispatchTimer = new QTimer(&(this->application));
|
||||
QObject::connect(eventDispatchTimer, &QTimer::timeout, this, &Insight::dispatchEvents);
|
||||
eventDispatchTimer->start(100);
|
||||
|
||||
@@ -163,7 +163,7 @@ void Insight::shutdown() {
|
||||
void Insight::checkBloomVersion() {
|
||||
auto currentVersionNumber = Application::VERSION;
|
||||
|
||||
auto versionQueryTask = new QueryLatestVersionNumber(
|
||||
auto* versionQueryTask = new QueryLatestVersionNumber(
|
||||
currentVersionNumber
|
||||
);
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
using namespace Bloom;
|
||||
|
||||
void QueryLatestVersionNumber::run(TargetControllerConsole& targetControllerConsole) {
|
||||
auto networkAccessManager = new QNetworkAccessManager(this);
|
||||
auto* networkAccessManager = new QNetworkAccessManager(this);
|
||||
auto queryVersionEndpointUrl = QUrl("http://bloom.local/latest-version");
|
||||
queryVersionEndpointUrl.setQuery(QUrlQuery({
|
||||
{"currentVersionNumber", QString::fromStdString(this->currentVersionNumber.toString())}
|
||||
|
||||
@@ -120,7 +120,7 @@ InsightWindow::InsightWindow(InsightWorker& insightWorker): QMainWindow(nullptr)
|
||||
|
||||
this->targetRegistersButton = this->container->findChild<QToolButton*>("target-registers-btn");
|
||||
auto targetRegisterButtonLayout = this->targetRegistersButton->findChild<QVBoxLayout*>();
|
||||
auto registersBtnLabel = new RotatableLabel(270, "Registers", this->targetRegistersButton);
|
||||
auto* registersBtnLabel = new RotatableLabel(270, "Registers", this->targetRegistersButton);
|
||||
registersBtnLabel->setObjectName("target-registers-btn-label");
|
||||
registersBtnLabel->setContentsMargins(5,0,9,0);
|
||||
targetRegisterButtonLayout->insertWidget(0, registersBtnLabel, 0, Qt::AlignTop);
|
||||
@@ -415,7 +415,7 @@ void InsightWindow::activate() {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto variantAction = new QAction(this->variantMenu);
|
||||
auto* variantAction = new QAction(this->variantMenu);
|
||||
variantAction->setText(
|
||||
QString::fromStdString(targetVariant.name + " (" + targetVariant.packageName + ")")
|
||||
);
|
||||
|
||||
@@ -18,7 +18,7 @@ UiLoader::UiLoader(QObject* parent): QUiLoader(parent) {
|
||||
{
|
||||
"PanelWidget",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto widget = new PanelWidget(parent);
|
||||
auto* widget = new PanelWidget(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
@@ -27,7 +27,7 @@ UiLoader::UiLoader(QObject* parent): QUiLoader(parent) {
|
||||
{
|
||||
"RotatableLabel",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto widget = new RotatableLabel("", parent);
|
||||
auto* widget = new RotatableLabel("", parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
@@ -36,7 +36,7 @@ UiLoader::UiLoader(QObject* parent): QUiLoader(parent) {
|
||||
{
|
||||
"ExpandingHeightScrollAreaWidget",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto widget = new ExpandingHeightScrollAreaWidget(parent);
|
||||
auto* widget = new ExpandingHeightScrollAreaWidget(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
@@ -45,7 +45,7 @@ UiLoader::UiLoader(QObject* parent): QUiLoader(parent) {
|
||||
{
|
||||
"SvgWidget",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto widget = new SvgWidget(parent);
|
||||
auto* widget = new SvgWidget(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
@@ -54,7 +54,7 @@ UiLoader::UiLoader(QObject* parent): QUiLoader(parent) {
|
||||
{
|
||||
"SvgToolButton",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto widget = new SvgToolButton(parent);
|
||||
auto* widget = new SvgToolButton(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
@@ -63,7 +63,7 @@ UiLoader::UiLoader(QObject* parent): QUiLoader(parent) {
|
||||
{
|
||||
"TargetPackageWidgetContainer",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto widget = new InsightTargetWidgets::TargetPackageWidgetContainer(parent);
|
||||
auto* widget = new InsightTargetWidgets::TargetPackageWidgetContainer(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
|
||||
@@ -36,7 +36,7 @@ parent(parent) {
|
||||
for (std::size_t i = 0; i < memorySize; i++) {
|
||||
const auto address = static_cast<std::uint32_t>(startAddress + i);
|
||||
|
||||
auto byteWidget = new ByteItem(i, address, this->hoveredByteWidget);
|
||||
auto* byteWidget = new ByteItem(i, address, this->hoveredByteWidget);
|
||||
this->byteWidgetsByAddress.insert(std::pair(
|
||||
address,
|
||||
byteWidget
|
||||
|
||||
@@ -72,7 +72,7 @@ TargetMemoryInspectionPane::TargetMemoryInspectionPane(
|
||||
void TargetMemoryInspectionPane::refreshMemoryValues(std::optional<std::function<void(void)>> callback) {
|
||||
this->hexViewerWidget->refreshButton->setDisabled(true);
|
||||
|
||||
auto readMemoryTask = new ReadTargetMemory(
|
||||
auto* readMemoryTask = new ReadTargetMemory(
|
||||
this->targetMemoryDescriptor.type,
|
||||
this->targetMemoryDescriptor.addressRange.startAddress,
|
||||
this->targetMemoryDescriptor.size()
|
||||
|
||||
@@ -17,7 +17,7 @@ BitWidget::BitWidget(
|
||||
): QWidget(parent), bitIndex(bitIndex), bitNumber(bitNumber), bitset(bitset), readOnly(readOnly) {
|
||||
this->setFixedSize(BitWidget::WIDTH, BitWidget::HEIGHT);
|
||||
|
||||
auto layout = new QVBoxLayout(this);
|
||||
auto* layout = new QVBoxLayout(this);
|
||||
layout->setSpacing(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setAlignment(Qt::AlignmentFlag::AlignTop);
|
||||
|
||||
@@ -13,7 +13,7 @@ using namespace Bloom::Widgets;
|
||||
BitsetWidget::BitsetWidget(int byteNumber, unsigned char& byte, bool readOnly, QWidget* parent):
|
||||
QWidget(parent), byteNumber(byteNumber), byte(byte), readOnly(readOnly) {
|
||||
this->setObjectName("bitset-widget");
|
||||
auto bitLayout = new QHBoxLayout(this);
|
||||
auto* bitLayout = new QHBoxLayout(this);
|
||||
bitLayout->setSpacing(BitWidget::SPACING);
|
||||
bitLayout->setContentsMargins(0, 0, 0, 0);
|
||||
this->setContentsMargins(0, 0, 0, 0);
|
||||
@@ -23,7 +23,7 @@ QWidget(parent), byteNumber(byteNumber), byte(byte), readOnly(readOnly) {
|
||||
);
|
||||
|
||||
for (int bitIndex = (std::numeric_limits<unsigned char>::digits - 1); bitIndex >= 0; bitIndex--) {
|
||||
auto bitWidget = new BitWidget(
|
||||
auto* bitWidget = new BitWidget(
|
||||
bitIndex,
|
||||
(this->byteNumber * 8) + bitIndex,
|
||||
this->bitset,
|
||||
|
||||
@@ -27,7 +27,7 @@ RegisterHistoryItem::RegisterHistoryItem(
|
||||
this->descriptionLayout->setText("Register Written");
|
||||
this->descriptionLayout->setObjectName("description-label");
|
||||
|
||||
auto subLabelLayout = new QHBoxLayout();
|
||||
auto* subLabelLayout = new QHBoxLayout();
|
||||
subLabelLayout->setSpacing(0);
|
||||
subLabelLayout->setContentsMargins(0, 0, 0, 0);
|
||||
subLabelLayout->addWidget(this->valueLabel, 0, Qt::AlignmentFlag::AlignLeft);
|
||||
|
||||
@@ -71,9 +71,9 @@ RegisterHistoryWidget::RegisterHistoryWidget(
|
||||
this->itemContainerLayout->addWidget(this->currentItem);
|
||||
this->currentItem->setSelected(true);
|
||||
|
||||
auto separatorWidget = new QWidget(this);
|
||||
auto separatorLayout = new QHBoxLayout(separatorWidget);
|
||||
auto separatorLabel = new QLabel("Select an item to restore", separatorWidget);
|
||||
auto* separatorWidget = new QWidget(this);
|
||||
auto* separatorLayout = new QHBoxLayout(separatorWidget);
|
||||
auto* separatorLabel = new QLabel("Select an item to restore", separatorWidget);
|
||||
separatorWidget->setFixedHeight(40);
|
||||
separatorWidget->setObjectName("separator-widget");
|
||||
separatorLayout->setContentsMargins(0, 10, 0, 10);
|
||||
@@ -97,7 +97,7 @@ void RegisterHistoryWidget::selectCurrentItem() {
|
||||
}
|
||||
|
||||
void RegisterHistoryWidget::addItem(const Targets::TargetMemoryBuffer& registerValue, const QDateTime& changeDate) {
|
||||
auto item = new RegisterHistoryItem(registerValue, changeDate, this->itemContainer);
|
||||
auto* item = new RegisterHistoryItem(registerValue, changeDate, this->itemContainer);
|
||||
QObject::connect(item, &Item::selected, this, &RegisterHistoryWidget::onItemSelectionChange);
|
||||
this->itemContainerLayout->insertWidget(2, item);
|
||||
}
|
||||
|
||||
@@ -139,14 +139,14 @@ TargetRegisterInspectorWindow::TargetRegisterInspectorWindow(
|
||||
* Each row of the BitsetWidget container should hold two BitsetWidgets. So we have a horizontal layout nested
|
||||
* within a vertical layout.
|
||||
*/
|
||||
auto bitsetSingleHorizontalLayout = new QHBoxLayout();
|
||||
auto* bitsetSingleHorizontalLayout = new QHBoxLayout();
|
||||
bitsetSingleHorizontalLayout->setSpacing(BitWidget::SPACING);
|
||||
bitsetSingleHorizontalLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
// The register value will be in MSB, which is OK for us as we present the bit widgets in MSB.
|
||||
auto byteNumber = static_cast<int>(this->registerValue.size() - 1);
|
||||
for (std::uint32_t registerByteIndex = 0; registerByteIndex < this->registerValue.size(); registerByteIndex++) {
|
||||
auto bitsetWidget = new BitsetWidget(
|
||||
auto* bitsetWidget = new BitsetWidget(
|
||||
byteNumber,
|
||||
this->registerValue.at(registerByteIndex),
|
||||
!this->registerDescriptor.writable,
|
||||
@@ -308,7 +308,7 @@ void TargetRegisterInspectorWindow::updateValue() {
|
||||
|
||||
void TargetRegisterInspectorWindow::refreshRegisterValue() {
|
||||
this->registerValueContainer->setDisabled(true);
|
||||
auto readTargetRegisterTask = new ReadTargetRegisters({this->registerDescriptor});
|
||||
auto* readTargetRegisterTask = new ReadTargetRegisters({this->registerDescriptor});
|
||||
|
||||
QObject::connect(
|
||||
readTargetRegisterTask,
|
||||
@@ -340,7 +340,7 @@ void TargetRegisterInspectorWindow::refreshRegisterValue() {
|
||||
void TargetRegisterInspectorWindow::applyChanges() {
|
||||
this->registerValueContainer->setDisabled(true);
|
||||
const auto targetRegister = Targets::TargetRegister(this->registerDescriptor, this->registerValue);
|
||||
auto writeRegisterTask = new WriteTargetRegister(targetRegister);
|
||||
auto* writeRegisterTask = new WriteTargetRegister(targetRegister);
|
||||
|
||||
QObject::connect(writeRegisterTask, &InsightWorkerTask::completed, this, [this, targetRegister] {
|
||||
this->registerValueContainer->setDisabled(false);
|
||||
@@ -354,7 +354,7 @@ void TargetRegisterInspectorWindow::applyChanges() {
|
||||
|
||||
QObject::connect(writeRegisterTask, &InsightWorkerTask::failed, this, [this] (QString errorMessage) {
|
||||
this->registerValueContainer->setDisabled(false);
|
||||
auto errorDialogue = new ErrorDialogue(
|
||||
auto* errorDialogue = new ErrorDialogue(
|
||||
"Error",
|
||||
"Failed to update " + QString::fromStdString(
|
||||
this->registerDescriptor.name.value_or("")
|
||||
|
||||
@@ -23,7 +23,7 @@ RegisterGroupWidget::RegisterGroupWidget(
|
||||
|
||||
this->headerWidget->setObjectName("register-group-header");
|
||||
this->headerWidget->setFixedHeight(25);
|
||||
auto headerLayout = new QHBoxLayout(this->headerWidget);
|
||||
auto* headerLayout = new QHBoxLayout(this->headerWidget);
|
||||
headerLayout->setContentsMargins(5, 0, 0, 0);
|
||||
|
||||
this->label->setText(this->name);
|
||||
@@ -50,7 +50,7 @@ RegisterGroupWidget::RegisterGroupWidget(
|
||||
headerLayout->addWidget(this->registerGroupIcon);
|
||||
headerLayout->addWidget(this->label);
|
||||
|
||||
auto bodyLayout = new QVBoxLayout(this->bodyWidget);
|
||||
auto* bodyLayout = new QVBoxLayout(this->bodyWidget);
|
||||
bodyLayout->setContentsMargins(0, 0,0,0);
|
||||
bodyLayout->setSpacing(0);
|
||||
|
||||
@@ -63,7 +63,7 @@ RegisterGroupWidget::RegisterGroupWidget(
|
||||
continue;
|
||||
}
|
||||
|
||||
auto registerWidget = new RegisterWidget(descriptor, insightWorker, this->bodyWidget);
|
||||
auto* registerWidget = new RegisterWidget(descriptor, insightWorker, this->bodyWidget);
|
||||
bodyLayout->addWidget(registerWidget, 0, Qt::AlignmentFlag::AlignTop);
|
||||
|
||||
QObject::connect(
|
||||
|
||||
@@ -95,12 +95,12 @@ void RegisterWidget::clearInlineValue() {
|
||||
void RegisterWidget::contextMenuEvent(QContextMenuEvent* event) {
|
||||
this->setSelected(true);
|
||||
|
||||
auto menu = new QMenu(this);
|
||||
auto* menu = new QMenu(this);
|
||||
menu->addAction(this->openInspectionWindowAction);
|
||||
menu->addAction(this->refreshValueAction);
|
||||
menu->addSeparator();
|
||||
|
||||
auto copyMenu = new QMenu("Copy", this);
|
||||
auto* copyMenu = new QMenu("Copy", this);
|
||||
copyMenu->addAction(this->copyValueNameAction);
|
||||
copyMenu->addSeparator();
|
||||
copyMenu->addAction(this->copyValueDecimalAction);
|
||||
@@ -150,7 +150,7 @@ void RegisterWidget::openInspectionWindow() {
|
||||
}
|
||||
|
||||
void RegisterWidget::refreshValue() {
|
||||
auto readRegisterTask = new ReadTargetRegisters({this->descriptor});
|
||||
auto* readRegisterTask = new ReadTargetRegisters({this->descriptor});
|
||||
|
||||
QObject::connect(
|
||||
readRegisterTask,
|
||||
|
||||
@@ -41,7 +41,7 @@ TargetRegistersPaneWidget::TargetRegistersPaneWidget(
|
||||
this->container = uiLoader.load(&targetRegistersPaneUiFile, this);
|
||||
this->container->setFixedSize(parent->width(), parent->maximumHeight());
|
||||
|
||||
auto layout = new QVBoxLayout(this);
|
||||
auto* layout = new QVBoxLayout(this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addWidget(this->container);
|
||||
|
||||
@@ -74,7 +74,7 @@ TargetRegistersPaneWidget::TargetRegistersPaneWidget(
|
||||
registerDescriptors.at(TargetRegisterType::GENERAL_PURPOSE_REGISTER).end()
|
||||
);
|
||||
|
||||
auto generalPurposeRegisterGroupWidget = new RegisterGroupWidget(
|
||||
auto* generalPurposeRegisterGroupWidget = new RegisterGroupWidget(
|
||||
"CPU General Purpose",
|
||||
this->renderedDescriptors,
|
||||
insightWorker,
|
||||
@@ -94,7 +94,7 @@ TargetRegistersPaneWidget::TargetRegistersPaneWidget(
|
||||
}
|
||||
|
||||
for (const auto& [groupName, registerDescriptors] : registerDescriptorsByGroupName) {
|
||||
auto registerGroupWidget = new RegisterGroupWidget(
|
||||
auto* registerGroupWidget = new RegisterGroupWidget(
|
||||
QString::fromStdString(groupName).toUpper(),
|
||||
registerDescriptors,
|
||||
insightWorker,
|
||||
@@ -164,7 +164,7 @@ void TargetRegistersPaneWidget::refreshRegisterValues(std::optional<std::functio
|
||||
return;
|
||||
}
|
||||
|
||||
auto readRegisterTask = new ReadTargetRegisters(descriptors);
|
||||
auto* readRegisterTask = new ReadTargetRegisters(descriptors);
|
||||
QObject::connect(
|
||||
readRegisterTask,
|
||||
&ReadTargetRegisters::targetRegistersRead,
|
||||
|
||||
@@ -40,7 +40,7 @@ DualInlinePackageWidget::DualInlinePackageWidget(
|
||||
this->bottomPinLayout->setAlignment(Qt::AlignmentFlag::AlignHCenter);
|
||||
|
||||
for (const auto& [targetPinNumber, targetPinDescriptor]: targetVariant.pinDescriptorsByNumber) {
|
||||
auto pinWidget = new PinWidget(targetPinDescriptor, targetVariant, insightWorker, this);
|
||||
auto* pinWidget = new PinWidget(targetPinDescriptor, targetVariant, insightWorker, this);
|
||||
this->pinWidgets.push_back(pinWidget);
|
||||
|
||||
if (targetPinNumber <= (targetVariant.pinDescriptorsByNumber.size() / 2)) {
|
||||
|
||||
@@ -74,7 +74,7 @@ PinWidget::PinWidget(
|
||||
this->layout->addSpacing(3);
|
||||
|
||||
if (this->isLeftLayout || this->isRightLayout) {
|
||||
auto stackedLabelLayout = new QVBoxLayout();
|
||||
auto* stackedLabelLayout = new QVBoxLayout();
|
||||
stackedLabelLayout->addWidget(this->pinNameLabel);
|
||||
stackedLabelLayout->addSpacing(2);
|
||||
stackedLabelLayout->addWidget(this->pinNumberLabel);
|
||||
|
||||
@@ -58,7 +58,7 @@ QuadFlatPackageWidget::QuadFlatPackageWidget(
|
||||
|
||||
const auto pinCountPerLayout = static_cast<int>(targetVariant.pinDescriptorsByNumber.size() / 4);
|
||||
for (const auto& [targetPinNumber, targetPinDescriptor]: targetVariant.pinDescriptorsByNumber) {
|
||||
auto pinWidget = new PinWidget(targetPinDescriptor, targetVariant, insightWorker, this);
|
||||
auto* pinWidget = new PinWidget(targetPinDescriptor, targetVariant, insightWorker, this);
|
||||
this->pinWidgets.push_back(pinWidget);
|
||||
|
||||
if (targetPinNumber <= pinCountPerLayout) {
|
||||
|
||||
@@ -32,7 +32,7 @@ TargetPackageWidget::TargetPackageWidget(
|
||||
}
|
||||
|
||||
void TargetPackageWidget::refreshPinStates(std::optional<std::function<void(void)>> callback) {
|
||||
auto refreshTask = new RefreshTargetPinStates(this->targetVariant.id);
|
||||
auto* refreshTask = new RefreshTargetPinStates(this->targetVariant.id);
|
||||
QObject::connect(
|
||||
refreshTask,
|
||||
&RefreshTargetPinStates::targetPinStatesRetrieved,
|
||||
|
||||
@@ -35,7 +35,7 @@ void TargetPinWidget::onWidgetBodyClicked() {
|
||||
pinState.ioState = (pinState.ioState == TargetPinState::IoState::HIGH) ?
|
||||
TargetPinState::IoState::LOW : TargetPinState::IoState::HIGH;
|
||||
|
||||
auto setPinStateTask = new SetTargetPinState(this->pinDescriptor, pinState);
|
||||
auto* setPinStateTask = new SetTargetPinState(this->pinDescriptor, pinState);
|
||||
QObject::connect(setPinStateTask, &InsightWorkerTask::completed, this, [this, pinState] {
|
||||
this->updatePinState(pinState);
|
||||
this->setDisabled(false);
|
||||
|
||||
Reference in New Issue
Block a user