Skip to content

Commit

Permalink
Fix simple clazy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cibomahto committed Oct 8, 2024
1 parent 86074f9 commit 109037c
Show file tree
Hide file tree
Showing 21 changed files with 50 additions and 50 deletions.
2 changes: 1 addition & 1 deletion src/app/gui/colorchooser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void ColorChooser::on_currentColorChanged(const QColor &color)
currentColor = color;
update();

emit(sendColor(color));
emit sendColor(color);
}

void ColorChooser::mousePressEvent(QMouseEvent *event)
Expand Down
8 changes: 4 additions & 4 deletions src/app/gui/frameeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ void FrameEditor::setScaleMode(FrameEditor::ScaleMode newScaleMode)
qDebug() << "newScaleMode:" << newScaleMode;
scaleMode = newScaleMode;

emit(fitToHeightChanged(scaleMode == FIT_TO_HEIGHT));
emit(fitToWidthChanged(scaleMode == FIT_TO_WIDTH));
emit(fitToScreenChanged(scaleMode == FIT_TO_SCREEN));
emit fitToHeightChanged(scaleMode == FIT_TO_HEIGHT);
emit fitToWidthChanged(scaleMode == FIT_TO_WIDTH);
emit fitToScreenChanged(scaleMode == FIT_TO_SCREEN);

updateSize();
update();
Expand Down Expand Up @@ -439,7 +439,7 @@ void FrameEditor::applyInstrument(QImage &newImage)
painter.drawImage(0, 0, newImage);
painter.end();

emit(dataEdited(frameIndex, frameData));
emit dataEdited(frameIndex, frameData);
}

void FrameEditor::pinchTriggered(QPinchGesture *gesture)
Expand Down
8 changes: 4 additions & 4 deletions src/app/gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ void MainWindow::populateExamplesMenu(QString directory, QMenu *menu)
QDir examplesDir(directory);
QFileInfoList examplesList = examplesDir.entryInfoList();

for (QFileInfo fileInfo : examplesList) {
for (const QFileInfo& fileInfo : examplesList) {
// If we found a directory, create a submenu and call ourselves again to populate it
if (fileInfo.isDir()) {
QMenu *submenu = new QMenu(this);
Expand Down Expand Up @@ -998,7 +998,7 @@ void MainWindow::applyScene(const SceneTemplate &scene)
QDir examplesDir(scene.examples);
QFileInfoList examplesList = examplesDir.entryInfoList();

for (QFileInfo fileinfo : examplesList) {
for (const QFileInfo& fileinfo : examplesList) {
if (!fileinfo.isDir()) {
Pattern::PatternType type = Pattern::Scrolling;
if (fileinfo.fileName().endsWith(".frames.png"))
Expand Down Expand Up @@ -1114,7 +1114,7 @@ void MainWindow::on_patternCollectionCurrentChanged(const QModelIndex &current,

actionSave_to_Blinky->setEnabled(false);

emit(patternStatusChanged(false));
emit patternStatusChanged(false);
return;
}

Expand Down Expand Up @@ -1166,7 +1166,7 @@ void MainWindow::on_patternCollectionCurrentChanged(const QModelIndex &current,
connect(timeline->model(), &QAbstractItemModel::dataChanged,
this, &MainWindow::on_PatternDataChanged);

emit(patternStatusChanged(true));
emit patternStatusChanged(true);
}

void MainWindow::on_timelineSelectedChanged(const QModelIndex &current, const QModelIndex &)
Expand Down
2 changes: 1 addition & 1 deletion src/app/gui/patternframelistview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ PatternFrameListView::~PatternFrameListView()
void PatternFrameListView::resizeEvent(QResizeEvent *event)
{
// Propigate the new size to the delegate
this->itemDelegate()->sizeHintChanged(QModelIndex());
emit this->itemDelegate()->sizeHintChanged(QModelIndex());

QListView::resizeEvent(event);
}
2 changes: 1 addition & 1 deletion src/app/gui/welcomescreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ void WelcomeScreen::accept()
scene.examples = "";

// Send scene apply signal here
emit(sceneSelected(scene));
emit sceneSelected(scene);
}
1 change: 0 additions & 1 deletion src/libblinky-test/eightbyeightcommandstests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ void EightByEightCommandsTests::openFileTest()

void EightByEightCommandsTests::openFileNameTooLongCropsTest()
{
QString name(31, 'x'); // Max filename length is 30 characters
QString expectedName(30, 'x');

EightByEightCommands::FileMode mode = EightByEightCommands::FileMode_Read;
Expand Down
2 changes: 1 addition & 1 deletion src/libblinky/avr109commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ QList<SerialCommand> writeEeprom(const QByteArray &data, unsigned int startAddre
commands.append(setAddress(startAddress));

// Write the data in small chunks, so that the write doesn't time out.
for (QByteArray chunk : ByteArrayHelpers::chunkData(data, EEPROM_CHUNK_SIZE_BYTES))
for (const QByteArray& chunk : ByteArrayHelpers::chunkData(data, EEPROM_CHUNK_SIZE_BYTES))
commands.append(writeEepromBlock(chunk));

return commands;
Expand Down
8 changes: 4 additions & 4 deletions src/libblinky/avr109firmwareloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void Avr109FirmwareLoader::setProgress(int newProgress)

int progressPercent = (progress*100)/maxProgress;

emit(progressChanged(progressPercent));
emit progressChanged(progressPercent);
}

void Avr109FirmwareLoader::setDialogText()
Expand All @@ -84,7 +84,7 @@ void Avr109FirmwareLoader::setDialogText()
float flashUsedPercent = float(flashUsed)*100/FLASH_MEMORY_AVAILABLE;
textLabel.append(QString("Flash used: %1%").arg(QString::number(flashUsedPercent,'f', 1)));

emit(setText(textLabel));
emit setText(textLabel);
}

// TODO: Remove this in favor of a global bootloader search utility.
Expand Down Expand Up @@ -205,7 +205,7 @@ void Avr109FirmwareLoader::handleError(QString error)

commandQueue.close();

emit(finished(false));
emit finished(false);
}

void Avr109FirmwareLoader::handleCommandFinished(QString command, QByteArray returnData)
Expand Down Expand Up @@ -239,7 +239,7 @@ void Avr109FirmwareLoader::handleLastCommandFinished()

case State_ResetBootloader:
commandQueue.close();
emit(finished(true));
emit finished(true);
break;

default:
Expand Down
2 changes: 1 addition & 1 deletion src/libblinky/blinkypendantcommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ QList<SerialCommand> writeFlash(const QByteArray &data)
while (paddedData.length() % PAGE_SIZE_BYTES != 0)
paddedData.append((char)0xFF);

for (QByteArray chunk : ByteArrayHelpers::chunkData(paddedData, CHUNK_SIZE_BYTES))
for (const QByteArray& chunk : ByteArrayHelpers::chunkData(paddedData, CHUNK_SIZE_BYTES))
commands.append(writeFlashChunk(chunk));

return commands;
Expand Down
2 changes: 1 addition & 1 deletion src/libblinky/blinkypendantuploaddata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ bool BlinkyPendantUploadData::init(DisplayMode displayMode, const QList<PatternW

QByteArray patternData;

for (PatternWriter pattern : patternWriters) {
for (const PatternWriter& pattern : patternWriters) {
// Make sure we have an image compatible with the BlinkyPendant
if (pattern.getLedCount() != 10) {
errorString = "Wrong pattern size- must be 10 pixels high!";
Expand Down
6 changes: 3 additions & 3 deletions src/libblinky/blinkypendantuploader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void BlinkyPendantUploader::handleError(QString error)

commandQueue.close();

emit(finished(false));
emit finished(false);
}

void BlinkyPendantUploader::handleCommandFinished(QString command, QByteArray returnData)
Expand All @@ -148,7 +148,7 @@ void BlinkyPendantUploader::handleCommandFinished(QString command, QByteArray re
// TODO: Let the receiver handle this instead.
if (command == "stopWrite") {
commandQueue.close();
emit(finished(true));
emit finished(true);
}
}

Expand All @@ -163,5 +163,5 @@ void BlinkyPendantUploader::setProgress(int newProgress)

int progressPercent = (progress*100)/maxProgress;

emit(progressChanged(progressPercent));
emit progressChanged(progressPercent);
}
4 changes: 2 additions & 2 deletions src/libblinky/blinkytape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ bool BlinkyTape::open()

resetTriesRemaining = 0;

emit(connectionStatusChanged(true));
emit connectionStatusChanged(true);

#if defined(CONNECTION_SCANNER_TIMER)
// Schedule the connection scanner
Expand All @@ -190,7 +190,7 @@ void BlinkyTape::close()

resetTriesRemaining = 0;

emit(connectionStatusChanged(isConnected()));
emit connectionStatusChanged(isConnected());
}

void BlinkyTape::handleReadData()
Expand Down
1 change: 0 additions & 1 deletion src/libblinky/blinkytapeuploaddata.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "blinkytapeuploaddata.h"

#include "blinkytape.h"
#include "firmwarestore.h"

#include "bytearrayhelpers.h"
Expand Down
4 changes: 2 additions & 2 deletions src/libblinky/eightbyeightcommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ QList<SerialCommand> write(const QByteArray &data)
QByteArray paddedData(data);
QList<SerialCommand> commands;

for (QByteArray chunk : ByteArrayHelpers::chunkData(paddedData, CHUNK_SIZE_BYTES))
for (const QByteArray& chunk : ByteArrayHelpers::chunkData(paddedData, CHUNK_SIZE_BYTES))
commands.append(writeChunk(chunk));

return commands;
Expand Down Expand Up @@ -118,7 +118,7 @@ QList<SerialCommand> verify(const QByteArray &data)
QByteArray paddedData(data);
QList<SerialCommand> commands;

for (QByteArray chunk : ByteArrayHelpers::chunkData(paddedData, CHUNK_SIZE_BYTES))
for (const QByteArray& chunk : ByteArrayHelpers::chunkData(paddedData, CHUNK_SIZE_BYTES))
commands.append(verifyChunk(chunk));

return commands;
Expand Down
10 changes: 5 additions & 5 deletions src/libblinky/eightbyeightuploader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ bool EightByEightUploader::storePatterns(BlinkyController &controller,
maxProgress = 1; // For the initial erase command

// For each pattern, append the image data to the sketch
for (PatternWriter patternWriter : patternWriters) {
for (const PatternWriter& patternWriter : patternWriters) {
if (patternWriter.getEncoding() != PatternWriter::RGB24) {
errorString = "EightByEight only supports RGB24 encoding";
return false;
Expand Down Expand Up @@ -176,7 +176,7 @@ void EightByEightUploader::handleError(QString error)

commandQueue.close();

emit(finished(false));
emit finished(false);
}

void EightByEightUploader::handleCommandStillRunning(QString command)
Expand Down Expand Up @@ -239,7 +239,7 @@ void EightByEightUploader::handleLastCommandFinished()
case State_unlockFileAccess:
commandQueue.close();
state = State_Done;
emit(finished(true));
emit finished(true);
break;

default:
Expand All @@ -259,7 +259,7 @@ void EightByEightUploader::setProgress(int newProgress)

int progressPercent = (progress*100)/maxProgress;

emit(progressChanged(progressPercent));
emit progressChanged(progressPercent);
}

void EightByEightUploader::setDialogText()
Expand All @@ -276,5 +276,5 @@ void EightByEightUploader::setDialogText()
float flashUsedPercent = float(flashUsed)*100/FLASH_MEMORY_AVAILABLE;
textLabel.append(QString("Flash used: %1%").arg(QString::number(flashUsedPercent,'f', 1)));

emit(setText(textLabel));
emit setText(textLabel);
}
8 changes: 4 additions & 4 deletions src/libblinky/esp8266firmwareloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void Esp8266FirmwareLoader::doWork()
magicLength, flashData.length(), ESP_BLOCK_SIZE, 0));

unsigned int sequence = 0;
for(QByteArray chunk : flashData) {
for(const QByteArray& chunk : flashData) {
commandQueue.enqueue(Esp8266BootloaderCommands::flashDownloadData(
sequence, chunk));
sequence++;
Expand All @@ -166,7 +166,7 @@ void Esp8266FirmwareLoader::doWork()
case State_Done:
{
commandQueue.close();
emit(finished(true));
emit finished(true);

break;
}
Expand Down Expand Up @@ -199,7 +199,7 @@ void Esp8266FirmwareLoader::handleError(QString error)
serialPort.close();
commandQueue.close();

emit(finished(false));
emit finished(false);
}

void Esp8266FirmwareLoader::handleCommandFinished(QString command, QByteArray returnData)
Expand Down Expand Up @@ -234,5 +234,5 @@ void Esp8266FirmwareLoader::setProgress(int newProgress)

int progressPercent = (progress*100)/maxProgress;

emit(progressChanged(progressPercent));
emit progressChanged(progressPercent);
}
4 changes: 2 additions & 2 deletions src/libblinky/firmwarestore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ QStringList FirmwareStore::listAvailableFirmware()
{
QStringList firmwareNames;

for(QString firmwarePath : listFirmwareSearchPaths()) {
for(const QString& firmwarePath : listFirmwareSearchPaths()) {
QDir directory(firmwarePath);
if (!directory.exists())
continue;
Expand All @@ -37,7 +37,7 @@ QStringList FirmwareStore::listAvailableFirmware()

QString FirmwareStore::getFirmwareDirectoryName(const QString &name)
{
for(QString firmwarePath : listFirmwareSearchPaths()) {
for(const QString& firmwarePath : listFirmwareSearchPaths()) {
QDir directory(firmwarePath);
if (directory.exists(name))
return directory.absoluteFilePath(name);
Expand Down
2 changes: 2 additions & 0 deletions src/libblinky/libblinkyglobal.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef LIBBLINKYGLOBAL_H
#define LIBBLINKYGLOBAL_H

#include <QtCore/qcompilerdetection.h>

#ifndef QT_STATIC
# if defined(BUILD_LIBBLINKY_LIB)
# define LIBBLINKY_EXPORT Q_DECL_EXPORT
Expand Down
8 changes: 4 additions & 4 deletions src/libblinky/lightbuddyuploader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ bool LightBuddyUploader::storePatterns(BlinkyController &controller,
maxProgress = 1; // For the initial erase command

// For each pattern, append the image data to the sketch
for (PatternWriter patternWriter : patternWriters) {
for (const PatternWriter& patternWriter : patternWriters) {
if (patternWriter.getEncoding() != PatternWriter::RGB24) {
errorString = "Lightbuddy only supports RGB24 encoding";
return false;
Expand Down Expand Up @@ -159,7 +159,7 @@ void LightBuddyUploader::handleError(QString error)

commandQueue.close();

emit(finished(false));
emit finished(false);
}

void LightBuddyUploader::handleCommandStillRunning(QString command)
Expand Down Expand Up @@ -191,7 +191,7 @@ void LightBuddyUploader::handleCommandFinished(QString command, QByteArray retur
if (state == State_Done) {
// TODO: Separate these with a small delay?
commandQueue.close();
emit(finished(true));
emit finished(true);
} else {
doWork();
}
Expand All @@ -209,5 +209,5 @@ void LightBuddyUploader::setProgress(int newProgress)

int progressPercent = (progress*100)/maxProgress;

emit(progressChanged(progressPercent));
emit progressChanged(progressPercent);
}
4 changes: 2 additions & 2 deletions src/libblinky/patterncollectionmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void PatternCollectionModel::on_patternDataChanged(const QModelIndex &topLeft, c
if (topLeft.row() == 0) {
QVector<int> emitRoles;
emitRoles.append(Qt::DisplayRole);
emit(dataChanged(index(0), index(patterns.count()-1), emitRoles));
emit dataChanged(index(0), index(patterns.count()-1), emitRoles);
}
}

Expand Down Expand Up @@ -100,7 +100,7 @@ bool PatternCollectionModel::setData(const QModelIndex &index, const QVariant &v
if (role == Qt::EditRole) {
// Find the UUID
QPointer<Pattern> source;
for (QPointer<Pattern> pattern : patterns) {
for (const QPointer<Pattern>& pattern : patterns) {
if (pattern->getUuid() == value.toUuid()) {
source = pattern;
break;
Expand Down
Loading

0 comments on commit 109037c

Please sign in to comment.