Skip to content

Commit

Permalink
clazy: new connects
Browse files Browse the repository at this point in the history
  • Loading branch information
zomfg committed Nov 23, 2020
1 parent 5055d07 commit b464611
Show file tree
Hide file tree
Showing 22 changed files with 140 additions and 113 deletions.
2 changes: 1 addition & 1 deletion Software/grab/GrabberBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ GrabberBase::GrabberBase(QObject *parent, GrabberContext *grabberContext) : QObj
m_timer->stop();
m_timer.reset(new QTimer(this));
m_timer->setTimerType(Qt::PreciseTimer);
connect(m_timer.data(), SIGNAL(timeout()), this, SLOT(grab()));
connect(m_timer.data(), &QTimer::timeout, this, &GrabberBase::grab);
}

void GrabberBase::setGrabInterval(int msec)
Expand Down
26 changes: 13 additions & 13 deletions Software/src/ApiServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ void ApiServer::setInterface(LightpackPluginInterface *lightpackInterface)
QString test = lightpack->Version();
DEBUG_LOW_LEVEL << Q_FUNC_INFO << test;
lightpack = lightpackInterface;
connect(m_apiSetColorTask, SIGNAL(taskParseSetColorDone(QList<QRgb>)), lightpack, SIGNAL(updateLedsColors(QList<QRgb>)), Qt::QueuedConnection);
connect(m_apiSetColorTask, SIGNAL(taskParseSetColorDone(QList<QRgb>)), lightpack, SLOT(updateColorsCache(QList<QRgb>)), Qt::QueuedConnection);
connect(m_apiSetColorTask, &ApiServerSetColorTask::taskParseSetColorDone, lightpack, &LightpackPluginInterface::updateLedsColors, Qt::QueuedConnection);
connect(m_apiSetColorTask, &ApiServerSetColorTask::taskParseSetColorDone, lightpack, &LightpackPluginInterface::updateColorsCache, Qt::QueuedConnection);

}

Expand Down Expand Up @@ -277,8 +277,8 @@ void ApiServer::incomingConnection(qintptr socketDescriptor)

DEBUG_LOW_LEVEL << "Incoming connection from:" << client->peerAddress().toString();

connect(client, SIGNAL(readyRead()), this, SLOT(clientProcessCommands()));
connect(client, SIGNAL(disconnected()), this, SLOT(clientDisconnected()));
connect(client, &QTcpSocket::readyRead, this, &ApiServer::clientProcessCommands);
connect(client, &QTcpSocket::disconnected, this, &ApiServer::clientDisconnected);
}

void ApiServer::clientDisconnected()
Expand All @@ -293,8 +293,8 @@ void ApiServer::clientDisconnected()

m_clients.remove(client);

disconnect(client, SIGNAL(readyRead()), this, SLOT(clientProcessCommands()));
disconnect(client, SIGNAL(disconnected()), this, SLOT(clientDisconnected()));
disconnect(client, &QTcpSocket::readyRead, this, &ApiServer::clientProcessCommands);
disconnect(client, &QTcpSocket::disconnected, this, &ApiServer::clientDisconnected);

client->deleteLater();
}
Expand Down Expand Up @@ -1259,12 +1259,12 @@ void ApiServer::initApiSetColorTask()
m_apiSetColorTask = new ApiServerSetColorTask();
m_apiSetColorTask->setApiDeviceNumberOfLeds(Settings::getNumberOfLeds(Settings::getConnectedDevice()));

//connect(m_apiSetColorTask, SIGNAL(taskParseSetColorDone(QList<QRgb>)), this, SIGNAL(updateLedsColors(QList<QRgb>)), Qt::QueuedConnection);
connect(m_apiSetColorTask, SIGNAL(taskParseSetColorIsSuccess(bool)), this, SLOT(taskSetColorIsSuccess(bool)), Qt::QueuedConnection);
//connect(m_apiSetColorTask, &ApiServerSetColorTask::taskParseSetColorDone(QList<QRgb>)), this, &ApiServer::updateLedsColors(QList<QRgb>)), Qt::QueuedConnection);
connect(m_apiSetColorTask, &ApiServerSetColorTask::taskParseSetColorIsSuccess, this, &ApiServer::taskSetColorIsSuccess, Qt::QueuedConnection);

connect(this, SIGNAL(startParseSetColorTask(QByteArray)), m_apiSetColorTask, SLOT(startParseSetColorTask(QByteArray)), Qt::QueuedConnection);
connect(this, SIGNAL(updateApiDeviceNumberOfLeds(int)), m_apiSetColorTask, SLOT(setApiDeviceNumberOfLeds(int)), Qt::QueuedConnection);
connect(this, SIGNAL(clearColorBuffers()), m_apiSetColorTask, SLOT(reinitColorBuffers()));
connect(this, &ApiServer::startParseSetColorTask, m_apiSetColorTask, &ApiServerSetColorTask::startParseSetColorTask, Qt::QueuedConnection);
connect(this, &ApiServer::updateApiDeviceNumberOfLeds, m_apiSetColorTask, &ApiServerSetColorTask::setApiDeviceNumberOfLeds, Qt::QueuedConnection);
connect(this, &ApiServer::clearColorBuffers, m_apiSetColorTask, &ApiServerSetColorTask::reinitColorBuffers);


m_apiSetColorTask->moveToThread(m_apiSetColorTaskThread);
Expand Down Expand Up @@ -1306,8 +1306,8 @@ void ApiServer::stopListening()
if (lightpack->CheckLock(sessionKey)==1)
lightpack->UnLock(sessionKey);

disconnect(client, SIGNAL(readyRead()), this, SLOT(clientProcessCommands()));
disconnect(client, SIGNAL(disconnected()), this, SLOT(clientDisconnected()));
disconnect(client, &QTcpSocket::readyRead, this, &ApiServer::clientProcessCommands);
disconnect(client, &QTcpSocket::disconnected, this, &ApiServer::clientDisconnected);

client->abort();
client->deleteLater();
Expand Down
4 changes: 2 additions & 2 deletions Software/src/ColorButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
ColorButton::ColorButton(QWidget * parent) : QPushButton(parent)
{
this->setText(QLatin1String(""));
connect(this, SIGNAL(clicked()), this, SLOT(click()));
connect(this, &ColorButton::clicked, this, qOverload<>(&ColorButton::click));
}

ColorButton::~ColorButton()
Expand Down Expand Up @@ -51,7 +51,7 @@ void ColorButton::click()
| Qt::WindowCloseButtonHint);

QColor savedColor = getColor();
connect(dialog, SIGNAL(currentColorChanged(QColor)), this, SLOT(currentColorChanged(QColor)));
connect(dialog, &QColorDialog::currentColorChanged, this, &ColorButton::currentColorChanged);
dialog->setCurrentColor(getColor());
if (dialog->exec() != QDialog::Accepted)
setColor(savedColor);
Expand Down
7 changes: 6 additions & 1 deletion Software/src/LedDeviceAdalight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ LedDeviceAdalight::LedDeviceAdalight(const QString &portName, const int baudRate
m_AdalightDevice = NULL;
m_lastWillTimer = new QTimer(this);
m_lastWillTimer->setTimerType(Qt::PreciseTimer);
connect(m_lastWillTimer, SIGNAL(timeout()), this, SLOT(writeLastWill()));
connect(m_lastWillTimer, &QTimer::timeout, this, qOverload<>(&LedDeviceAdalight::writeLastWill));
// TODO: think about init m_savedColors in all ILedDevices

DEBUG_LOW_LEVEL << Q_FUNC_INFO << "initialized";
Expand Down Expand Up @@ -255,6 +255,11 @@ void LedDeviceAdalight::open()
emit openDeviceSuccess(ok);
}

void LedDeviceAdalight::writeLastWill()
{
writeLastWill(false);
}

void LedDeviceAdalight::writeLastWill(const bool force)
{
if (force || m_AdalightDevice->bytesToWrite() == 0) {
Expand Down
3 changes: 2 additions & 1 deletion Software/src/LedDeviceAdalight.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public slots:
void setColorSequence(const QString& value);
void requestFirmwareVersion();
void updateDeviceSettings();
void writeLastWill(const bool force = false);
void writeLastWill();
void writeLastWill(const bool force);

private:
bool writeBuffer(const QByteArray & buff);
Expand Down
7 changes: 6 additions & 1 deletion Software/src/LedDeviceArdulight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ LedDeviceArdulight::LedDeviceArdulight(const QString &portName, const int baudRa

m_lastWillTimer = new QTimer(this);
m_lastWillTimer->setTimerType(Qt::PreciseTimer);
connect(m_lastWillTimer, SIGNAL(timeout()), this, SLOT(writeLastWill()));
connect(m_lastWillTimer, &QTimer::timeout, this, qOverload<>(&LedDeviceArdulight::writeLastWill));

DEBUG_LOW_LEVEL << Q_FUNC_INFO << "initialized";
}
Expand Down Expand Up @@ -262,6 +262,11 @@ void LedDeviceArdulight::open()
emit openDeviceSuccess(ok);
}

void LedDeviceArdulight::writeLastWill()
{
writeLastWill(false);
}

void LedDeviceArdulight::writeLastWill(const bool force)
{
if (force || m_ArdulightDevice->bytesToWrite() == 0) {
Expand Down
3 changes: 2 additions & 1 deletion Software/src/LedDeviceArdulight.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public slots:
void setColorSequence(const QString& value);
void requestFirmwareVersion();
void updateDeviceSettings();
void writeLastWill(const bool force = false);
void writeLastWill();
void writeLastWill(const bool force);

private:
bool writeBuffer(const QByteArray & buff);
Expand Down
10 changes: 4 additions & 6 deletions Software/src/LedDeviceLightpack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ LedDeviceLightpack::LedDeviceLightpack(QObject *parent) :

m_timerPingDevice = new QTimer(this);

connect(m_timerPingDevice, SIGNAL(timeout()), this, SLOT(timerPingDeviceTimeout()));
connect(this, SIGNAL(ioDeviceSuccess(bool)), this, SLOT(restartPingDevice(bool)));
connect(this, SIGNAL(openDeviceSuccess(bool)), this, SLOT(restartPingDevice(bool)));
connect(m_timerPingDevice, &QTimer::timeout, this, &LedDeviceLightpack::timerPingDeviceTimeout);
connect(this, &LedDeviceLightpack::ioDeviceSuccess, this, &LedDeviceLightpack::restartPingDevice);
connect(this, &LedDeviceLightpack::openDeviceSuccess, this, &LedDeviceLightpack::restartPingDevice);

DEBUG_LOW_LEVEL << Q_FUNC_INFO << "initialized";
}
Expand Down Expand Up @@ -478,10 +478,8 @@ void LedDeviceLightpack::closeDevices()
m_devices.clear();
}

void LedDeviceLightpack::restartPingDevice(bool isSuccess)
void LedDeviceLightpack::restartPingDevice()
{
Q_UNUSED(isSuccess);

if (Settings::isBacklightEnabled() && Settings::isPingDeviceEverySecond())
{
// Start ping device with PingDeviceInterval ms after last data transfer complete
Expand Down
2 changes: 1 addition & 1 deletion Software/src/LedDeviceLightpack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public slots:
void closeDevices();

private slots:
void restartPingDevice(bool isSuccess);
void restartPingDevice();
void timerPingDeviceTimeout();

private:
Expand Down
Loading

0 comments on commit b464611

Please sign in to comment.