diff --git a/Software/grab/GrabberBase.cpp b/Software/grab/GrabberBase.cpp index 56a0b5712..ad86740d1 100644 --- a/Software/grab/GrabberBase.cpp +++ b/Software/grab/GrabberBase.cpp @@ -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) diff --git a/Software/src/ApiServer.cpp b/Software/src/ApiServer.cpp index 77916a820..2acfc7a97 100644 --- a/Software/src/ApiServer.cpp +++ b/Software/src/ApiServer.cpp @@ -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)), lightpack, SIGNAL(updateLedsColors(QList)), Qt::QueuedConnection); - connect(m_apiSetColorTask, SIGNAL(taskParseSetColorDone(QList)), lightpack, SLOT(updateColorsCache(QList)), Qt::QueuedConnection); + connect(m_apiSetColorTask, &ApiServerSetColorTask::taskParseSetColorDone, lightpack, &LightpackPluginInterface::updateLedsColors, Qt::QueuedConnection); + connect(m_apiSetColorTask, &ApiServerSetColorTask::taskParseSetColorDone, lightpack, &LightpackPluginInterface::updateColorsCache, Qt::QueuedConnection); } @@ -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() @@ -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(); } @@ -1259,12 +1259,12 @@ void ApiServer::initApiSetColorTask() m_apiSetColorTask = new ApiServerSetColorTask(); m_apiSetColorTask->setApiDeviceNumberOfLeds(Settings::getNumberOfLeds(Settings::getConnectedDevice())); - //connect(m_apiSetColorTask, SIGNAL(taskParseSetColorDone(QList)), this, SIGNAL(updateLedsColors(QList)), Qt::QueuedConnection); - connect(m_apiSetColorTask, SIGNAL(taskParseSetColorIsSuccess(bool)), this, SLOT(taskSetColorIsSuccess(bool)), Qt::QueuedConnection); + //connect(m_apiSetColorTask, &ApiServerSetColorTask::taskParseSetColorDone(QList)), this, &ApiServer::updateLedsColors(QList)), 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); @@ -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(); diff --git a/Software/src/ColorButton.cpp b/Software/src/ColorButton.cpp index 0980df148..51abbc14c 100644 --- a/Software/src/ColorButton.cpp +++ b/Software/src/ColorButton.cpp @@ -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() @@ -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); diff --git a/Software/src/LedDeviceAdalight.cpp b/Software/src/LedDeviceAdalight.cpp index 1ba24b39a..db42b744b 100644 --- a/Software/src/LedDeviceAdalight.cpp +++ b/Software/src/LedDeviceAdalight.cpp @@ -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"; @@ -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) { diff --git a/Software/src/LedDeviceAdalight.hpp b/Software/src/LedDeviceAdalight.hpp index 84e1c404a..985eb3813 100644 --- a/Software/src/LedDeviceAdalight.hpp +++ b/Software/src/LedDeviceAdalight.hpp @@ -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); diff --git a/Software/src/LedDeviceArdulight.cpp b/Software/src/LedDeviceArdulight.cpp index 295f5f273..ee5764601 100644 --- a/Software/src/LedDeviceArdulight.cpp +++ b/Software/src/LedDeviceArdulight.cpp @@ -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"; } @@ -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) { diff --git a/Software/src/LedDeviceArdulight.hpp b/Software/src/LedDeviceArdulight.hpp index 4c1c83f73..7e8329345 100644 --- a/Software/src/LedDeviceArdulight.hpp +++ b/Software/src/LedDeviceArdulight.hpp @@ -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); diff --git a/Software/src/LedDeviceLightpack.cpp b/Software/src/LedDeviceLightpack.cpp index ccb4e0941..483622714 100644 --- a/Software/src/LedDeviceLightpack.cpp +++ b/Software/src/LedDeviceLightpack.cpp @@ -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"; } @@ -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 diff --git a/Software/src/LedDeviceLightpack.hpp b/Software/src/LedDeviceLightpack.hpp index f3b88350f..1b1a7414f 100644 --- a/Software/src/LedDeviceLightpack.hpp +++ b/Software/src/LedDeviceLightpack.hpp @@ -76,7 +76,7 @@ public slots: void closeDevices(); private slots: - void restartPingDevice(bool isSuccess); + void restartPingDevice(); void timerPingDeviceTimeout(); private: diff --git a/Software/src/LedDeviceManager.cpp b/Software/src/LedDeviceManager.cpp index 839a6086f..47220b75d 100644 --- a/Software/src/LedDeviceManager.cpp +++ b/Software/src/LedDeviceManager.cpp @@ -89,13 +89,13 @@ void LedDeviceManager::init() m_cmdTimeoutTimer = new QTimer(this); m_cmdTimeoutTimer->setInterval(100); - connect(m_cmdTimeoutTimer, SIGNAL(timeout()), this, SLOT(ledDeviceCommandTimedOut())); + connect(m_cmdTimeoutTimer, &QTimer::timeout, this, &LedDeviceManager::ledDeviceCommandTimedOut); } if (!m_recreateTimer) { m_recreateTimer = new QTimer(this); m_recreateTimer->setSingleShot(true); - connect(m_recreateTimer, SIGNAL(timeout()), this, SLOT(recreateLedDevice())); + connect(m_recreateTimer, &QTimer::timeout, this, &LedDeviceManager::recreateLedDevice); } initLedDevice(); @@ -538,31 +538,31 @@ void LedDeviceManager::connectSignalSlotsLedDevice() return; } - connect(m_ledDevice, SIGNAL(commandCompleted(bool)), this, SLOT(ledDeviceCommandCompleted(bool)), Qt::QueuedConnection); - connect(m_ledDevice, SIGNAL(ioDeviceSuccess(bool)), this, SLOT(ledDeviceIoDeviceSuccess(bool)), Qt::QueuedConnection); - connect(m_ledDevice, SIGNAL(openDeviceSuccess(bool)), this, SLOT(ledDeviceOpenDeviceSuccess(bool)), Qt::QueuedConnection); - - connect(m_ledDevice, SIGNAL(firmwareVersion(QString)), this, SIGNAL(firmwareVersion(QString)), Qt::QueuedConnection); - connect(m_ledDevice, SIGNAL(firmwareVersionUnofficial(int)), this, SIGNAL(firmwareVersionUnofficial(int)), Qt::QueuedConnection); - connect(m_ledDevice, SIGNAL(colorsUpdated(QList)), this, SIGNAL(setColors_VirtualDeviceCallback(QList)), Qt::QueuedConnection); - - connect(this, SIGNAL(ledDeviceOpen()), m_ledDevice, SLOT(open()), Qt::QueuedConnection); - connect(this, SIGNAL(ledDeviceSetColors(QList)), m_ledDevice, SLOT(setColors(QList)), Qt::QueuedConnection); - connect(this, SIGNAL(ledDeviceOffLeds()), m_ledDevice, SLOT(switchOffLeds()), Qt::QueuedConnection); - connect(this, SIGNAL(ledDeviceSetUsbPowerLedDisabled(bool)), m_ledDevice, SLOT(setUsbPowerLedDisabled(bool)), Qt::QueuedConnection); - connect(this, SIGNAL(ledDeviceSetRefreshDelay(int)), m_ledDevice, SLOT(setRefreshDelay(int)), Qt::QueuedConnection); - connect(this, SIGNAL(ledDeviceSetColorDepth(int)), m_ledDevice, SLOT(setColorDepth(int)), Qt::QueuedConnection); - connect(this, SIGNAL(ledDeviceSetSmoothSlowdown(int)), m_ledDevice, SLOT(setSmoothSlowdown(int)), Qt::QueuedConnection); - connect(this, SIGNAL(ledDeviceSetGamma(double,bool)), m_ledDevice, SLOT(setGamma(double,bool)), Qt::QueuedConnection); - connect(this, SIGNAL(ledDeviceSetBrightness(int,bool)), m_ledDevice, SLOT(setBrightness(int,bool)), Qt::QueuedConnection); - connect(this, SIGNAL(ledDeviceSetBrightnessCap(int,bool)), m_ledDevice, SLOT(setBrightnessCap(int,bool)), Qt::QueuedConnection); - connect(this, SIGNAL(ledDeviceSetColorSequence(QString)), m_ledDevice, SLOT(setColorSequence(QString)), Qt::QueuedConnection); - connect(this, SIGNAL(ledDeviceSetLuminosityThreshold(int,bool)), m_ledDevice, SLOT(setLuminosityThreshold(int,bool)), Qt::QueuedConnection); - connect(this, SIGNAL(ledDeviceSetMinimumLuminosityEnabled(bool,bool)), m_ledDevice,SLOT(setMinimumLuminosityThresholdEnabled(bool,bool)), Qt::QueuedConnection); - connect(this, SIGNAL(ledDeviceSetDitheringEnabled(bool,bool)), m_ledDevice, SLOT(setDitheringEnabled(bool,bool)), Qt::QueuedConnection); - connect(this, SIGNAL(ledDeviceRequestFirmwareVersion()), m_ledDevice, SLOT(requestFirmwareVersion()), Qt::QueuedConnection); - connect(this, SIGNAL(ledDeviceUpdateWBAdjustments()), m_ledDevice, SLOT(updateWBAdjustments()), Qt::QueuedConnection); - connect(this, SIGNAL(ledDeviceUpdateDeviceSettings()), m_ledDevice, SLOT(updateDeviceSettings()), Qt::QueuedConnection); + connect(m_ledDevice, &AbstractLedDevice::commandCompleted, this, &LedDeviceManager::ledDeviceCommandCompleted, Qt::QueuedConnection); + connect(m_ledDevice, &AbstractLedDevice::ioDeviceSuccess, this, &LedDeviceManager::ledDeviceIoDeviceSuccess, Qt::QueuedConnection); + connect(m_ledDevice, &AbstractLedDevice::openDeviceSuccess, this, &LedDeviceManager::ledDeviceOpenDeviceSuccess, Qt::QueuedConnection); + + connect(m_ledDevice, &AbstractLedDevice::firmwareVersion, this, &LedDeviceManager::firmwareVersion, Qt::QueuedConnection); + connect(m_ledDevice, &AbstractLedDevice::firmwareVersionUnofficial, this, &LedDeviceManager::firmwareVersionUnofficial, Qt::QueuedConnection); + connect(m_ledDevice, &AbstractLedDevice::colorsUpdated, this, &LedDeviceManager::setColors_VirtualDeviceCallback, Qt::QueuedConnection); + + connect(this, &LedDeviceManager::ledDeviceOpen, m_ledDevice, &AbstractLedDevice::open, Qt::QueuedConnection); + connect(this, &LedDeviceManager::ledDeviceSetColors, m_ledDevice, &AbstractLedDevice::setColors, Qt::QueuedConnection); + connect(this, &LedDeviceManager::ledDeviceOffLeds, m_ledDevice, &AbstractLedDevice::switchOffLeds, Qt::QueuedConnection); + connect(this, &LedDeviceManager::ledDeviceSetUsbPowerLedDisabled, m_ledDevice, &AbstractLedDevice::setUsbPowerLedDisabled, Qt::QueuedConnection); + connect(this, &LedDeviceManager::ledDeviceSetRefreshDelay, m_ledDevice, &AbstractLedDevice::setRefreshDelay, Qt::QueuedConnection); + connect(this, &LedDeviceManager::ledDeviceSetColorDepth, m_ledDevice, &AbstractLedDevice::setColorDepth, Qt::QueuedConnection); + connect(this, &LedDeviceManager::ledDeviceSetSmoothSlowdown, m_ledDevice, &AbstractLedDevice::setSmoothSlowdown, Qt::QueuedConnection); + connect(this, &LedDeviceManager::ledDeviceSetGamma, m_ledDevice, &AbstractLedDevice::setGamma, Qt::QueuedConnection); + connect(this, &LedDeviceManager::ledDeviceSetBrightness, m_ledDevice, &AbstractLedDevice::setBrightness, Qt::QueuedConnection); + connect(this, &LedDeviceManager::ledDeviceSetBrightnessCap, m_ledDevice, &AbstractLedDevice::setBrightnessCap, Qt::QueuedConnection); + connect(this, &LedDeviceManager::ledDeviceSetColorSequence, m_ledDevice, &AbstractLedDevice::setColorSequence, Qt::QueuedConnection); + connect(this, &LedDeviceManager::ledDeviceSetLuminosityThreshold, m_ledDevice, &AbstractLedDevice::setLuminosityThreshold, Qt::QueuedConnection); + connect(this, &LedDeviceManager::ledDeviceSetMinimumLuminosityEnabled, m_ledDevice, &AbstractLedDevice::setMinimumLuminosityThresholdEnabled, Qt::QueuedConnection); + connect(this, &LedDeviceManager::ledDeviceSetDitheringEnabled, m_ledDevice, &AbstractLedDevice::setDitheringEnabled, Qt::QueuedConnection); + connect(this, &LedDeviceManager::ledDeviceRequestFirmwareVersion, m_ledDevice, &AbstractLedDevice::requestFirmwareVersion, Qt::QueuedConnection); + connect(this, &LedDeviceManager::ledDeviceUpdateWBAdjustments, m_ledDevice, qOverload<>(&AbstractLedDevice::updateWBAdjustments), Qt::QueuedConnection); + connect(this, &LedDeviceManager::ledDeviceUpdateDeviceSettings, m_ledDevice, &AbstractLedDevice::updateDeviceSettings, Qt::QueuedConnection); } void LedDeviceManager::disconnectSignalSlotsLedDevice() @@ -572,31 +572,34 @@ void LedDeviceManager::disconnectSignalSlotsLedDevice() qWarning() << Q_FUNC_INFO << "m_ledDevice == NULL"; return; } - - disconnect(m_ledDevice, SIGNAL(commandCompleted(bool)), this, SLOT(ledDeviceCommandCompleted(bool))); - disconnect(m_ledDevice, SIGNAL(ioDeviceSuccess(bool)), this, SLOT(ledDeviceIoDeviceSuccess(bool))); - disconnect(m_ledDevice, SIGNAL(openDeviceSuccess(bool)), this, SLOT(ledDeviceOpenDeviceSuccess(bool))); - - disconnect(m_ledDevice, SIGNAL(firmwareVersion(QString)), this, SIGNAL(firmwareVersion(QString))); - disconnect(m_ledDevice, SIGNAL(firmwareVersionUnofficial(int)), this, SIGNAL(firmwareVersionUnofficial(int))); - disconnect(m_ledDevice, SIGNAL(colorsUpdated(QList)), this, SIGNAL(setColors_VirtualDeviceCallback(QList))); - - disconnect(this, SIGNAL(ledDeviceOpen()), m_ledDevice, SLOT(open())); - disconnect(this, SIGNAL(ledDeviceSetColors(QList)), m_ledDevice, SLOT(setColors(QList))); - disconnect(this, SIGNAL(ledDeviceOffLeds()), m_ledDevice, SLOT(switchOffLeds())); - disconnect(this, SIGNAL(ledDeviceSetUsbPowerLedDisabled(bool)), m_ledDevice, SLOT(setUsbPowerLedDisabled(bool))); - disconnect(this, SIGNAL(ledDeviceSetRefreshDelay(int)), m_ledDevice, SLOT(setRefreshDelay(int))); - disconnect(this, SIGNAL(ledDeviceSetColorDepth(int)), m_ledDevice, SLOT(setColorDepth(int))); - disconnect(this, SIGNAL(ledDeviceSetSmoothSlowdown(int)), m_ledDevice, SLOT(setSmoothSlowdown(int))); - disconnect(this, SIGNAL(ledDeviceSetGamma(double,bool)), m_ledDevice, SLOT(setGamma(double,bool))); - disconnect(this, SIGNAL(ledDeviceSetBrightness(int,bool)), m_ledDevice, SLOT(setBrightness(int,bool))); - disconnect(this, SIGNAL(ledDeviceSetBrightnessCap(int,bool)), m_ledDevice, SLOT(setBrightnessCap(int,bool))); - disconnect(this, SIGNAL(ledDeviceSetColorSequence(QString)), m_ledDevice, SLOT(setColorSequence(QString))); - disconnect(this, SIGNAL(ledDeviceSetLuminosityThreshold(int,bool)), m_ledDevice, SLOT(setLuminosityThreshold(int,bool))); - disconnect(this, SIGNAL(ledDeviceSetMinimumLuminosityEnabled(bool,bool)), m_ledDevice, SLOT(setMinimumLuminosityThresholdEnabled(bool,bool))); - disconnect(this, SIGNAL(ledDeviceRequestFirmwareVersion()), m_ledDevice, SLOT(requestFirmwareVersion())); - disconnect(this, SIGNAL(ledDeviceUpdateWBAdjustments()), m_ledDevice, SLOT(updateWBAdjustments())); - disconnect(this, SIGNAL(ledDeviceUpdateDeviceSettings()), m_ledDevice, SLOT(updateDeviceSettings())); + m_ledDevice->disconnect(this, nullptr, nullptr, nullptr); + disconnect(m_ledDevice, nullptr, nullptr, nullptr); +/* + disconnect(m_ledDevice, &AbstractLedDevice::commandCompleted, this, &LedDeviceManager::ledDeviceCommandCompleted); + disconnect(m_ledDevice, &AbstractLedDevice::ioDeviceSuccess, this, &LedDeviceManager::ledDeviceIoDeviceSuccess); + disconnect(m_ledDevice, &AbstractLedDevice::openDeviceSuccess, this, &LedDeviceManager::ledDeviceOpenDeviceSuccess); + + disconnect(m_ledDevice, &AbstractLedDevice::firmwareVersion, this, &LedDeviceManager::firmwareVersion); + disconnect(m_ledDevice, &AbstractLedDevice::firmwareVersionUnofficial, this, &LedDeviceManager::firmwareVersionUnofficial); + disconnect(m_ledDevice, &AbstractLedDevice::colorsUpdated, this, &LedDeviceManager::setColors_VirtualDeviceCallback); + + disconnect(this, &LedDeviceManager::ledDeviceOpen, m_ledDevice, &AbstractLedDevice::open); + disconnect(this, &LedDeviceManager::ledDeviceSetColors, m_ledDevice, &AbstractLedDevice::setColors); + disconnect(this, &LedDeviceManager::ledDeviceOffLeds, m_ledDevice, &AbstractLedDevice::switchOffLeds); + disconnect(this, &LedDeviceManager::ledDeviceSetUsbPowerLedDisabled, m_ledDevice, &AbstractLedDevice::setUsbPowerLedDisabled); + disconnect(this, &LedDeviceManager::ledDeviceSetRefreshDelay, m_ledDevice, &AbstractLedDevice::setRefreshDelay); + disconnect(this, &LedDeviceManager::ledDeviceSetColorDepth, m_ledDevice, &AbstractLedDevice::setColorDepth); + disconnect(this, &LedDeviceManager::ledDeviceSetSmoothSlowdown, m_ledDevice, &AbstractLedDevice::setSmoothSlowdown); + disconnect(this, &LedDeviceManager::ledDeviceSetGamma, m_ledDevice, &AbstractLedDevice::setGamma); + disconnect(this, &LedDeviceManager::ledDeviceSetBrightness, m_ledDevice, &AbstractLedDevice::setBrightness); + disconnect(this, &LedDeviceManager::ledDeviceSetBrightnessCap, m_ledDevice, &AbstractLedDevice::setBrightnessCap); + disconnect(this, &LedDeviceManager::ledDeviceSetColorSequence, m_ledDevice, &AbstractLedDevice::setColorSequence); + disconnect(this, &LedDeviceManager::ledDeviceSetLuminosityThreshold, m_ledDevice, &AbstractLedDevice::setLuminosityThreshold); + disconnect(this, &LedDeviceManager::ledDeviceSetMinimumLuminosityEnabled, m_ledDevice, &AbstractLedDevice::setMinimumLuminosityThresholdEnabled); + disconnect(this, &LedDeviceManager::ledDeviceRequestFirmwareVersion, m_ledDevice, &AbstractLedDevice::requestFirmwareVersion); + disconnect(this, &LedDeviceManager::ledDeviceUpdateWBAdjustments, m_ledDevice, qOverload<>(&AbstractLedDevice::updateWBAdjustments)); + disconnect(this, &LedDeviceManager::ledDeviceUpdateDeviceSettings, m_ledDevice, &AbstractLedDevice::updateDeviceSettings); +*/ } void LedDeviceManager::cmdQueueAppend(LedDeviceCommands::Cmd cmd) diff --git a/Software/src/LightpackPluginInterface.cpp b/Software/src/LightpackPluginInterface.cpp index 56a93619d..4a35870c7 100644 --- a/Software/src/LightpackPluginInterface.cpp +++ b/Software/src/LightpackPluginInterface.cpp @@ -23,7 +23,7 @@ LightpackPluginInterface::LightpackPluginInterface(QObject *parent) : initColors(10); m_timerLock = new QTimer(this); m_timerLock->start(5000); // check in 5000 ms - connect(m_timerLock, SIGNAL(timeout()), this, SLOT(timeoutLock())); + connect(m_timerLock, &QTimer::timeout, this, &LightpackPluginInterface::timeoutLock); _plugins.clear(); } diff --git a/Software/src/LiquidColorGenerator.cpp b/Software/src/LiquidColorGenerator.cpp index 492c6f8cc..b4bc79999 100644 --- a/Software/src/LiquidColorGenerator.cpp +++ b/Software/src/LiquidColorGenerator.cpp @@ -48,7 +48,7 @@ LiquidColorGenerator::LiquidColorGenerator(QObject *parent) : QObject(parent) m_isEnabled = false; m_timer.setTimerType(Qt::PreciseTimer); - connect(&m_timer, SIGNAL(timeout()), this, SLOT(doColorUpdate())); + connect(&m_timer, &QTimer::timeout, this, &LiquidColorGenerator::doColorUpdate); } void LiquidColorGenerator::start() diff --git a/Software/src/MoodLampManager.cpp b/Software/src/MoodLampManager.cpp index fc787539e..1d8b1015c 100644 --- a/Software/src/MoodLampManager.cpp +++ b/Software/src/MoodLampManager.cpp @@ -37,7 +37,7 @@ MoodLampManager::MoodLampManager(QObject *parent) : QObject(parent) m_isMoodLampEnabled = false; m_timer.setTimerType(Qt::PreciseTimer); - connect(&m_timer, SIGNAL(timeout()), this, SLOT(updateColors())); + connect(&m_timer, &QTimer::timeout, this, qOverload<>(&MoodLampManager::updateColors)); initFromSettings(); } diff --git a/Software/src/MoodLampManager.hpp b/Software/src/MoodLampManager.hpp index becd39e84..ef48742bd 100644 --- a/Software/src/MoodLampManager.hpp +++ b/Software/src/MoodLampManager.hpp @@ -62,7 +62,8 @@ public slots: void setSendDataOnlyIfColorsChanged(bool state); private slots: - void updateColors(const bool forceUpdate = false); + void updateColors(const bool forceUpdate); + void updateColors() { updateColors(false); }; private: void initColors(int numberOfLeds); diff --git a/Software/src/Plugin.cpp b/Software/src/Plugin.cpp index 647cbdbf4..730d620bd 100644 --- a/Software/src/Plugin.cpp +++ b/Software/src/Plugin.cpp @@ -129,14 +129,14 @@ void Plugin::Start() process->disconnect(); - connect(process, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(stateChanged(QProcess::ProcessState))); - connect(process, SIGNAL(errorOccurred(QProcess::ProcessError)), this, SLOT(errorOccurred(QProcess::ProcessError))); + connect(process, &QProcess::stateChanged, this, &Plugin::stateChanged); + connect(process, &QProcess::errorOccurred, this, &Plugin::errorOccurred); - connect(process, SIGNAL(started()), this, SLOT(started())); - connect(process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(finished(int,QProcess::ExitStatus))); + connect(process, &QProcess::started, this, &Plugin::started); + connect(process, qOverload(&QProcess::finished), this, &Plugin::finished); - connect(process, SIGNAL(readyReadStandardError()), this, SLOT(readyReadStandardError())); - connect(process, SIGNAL(readyReadStandardOutput()), this, SLOT(readyReadStandardOutput())); + connect(process, &QProcess::readyReadStandardError, this, &Plugin::readyReadStandardError); + connect(process, &QProcess::readyReadStandardOutput, this, &Plugin::readyReadStandardOutput); process->setEnvironment(QProcess::systemEnvironment()); process->setProgram(_exec); diff --git a/Software/src/PluginsManager.cpp b/Software/src/PluginsManager.cpp index 7b45496e9..7cc41ede3 100644 --- a/Software/src/PluginsManager.cpp +++ b/Software/src/PluginsManager.cpp @@ -93,7 +93,7 @@ void PluginsManager::StartPlugins() p->disconnect(); if (p->isEnabled()) p->Start(); - connect(p, SIGNAL(pluginStateChanged(QProcess::ProcessState)), this, SLOT(onPluginStateChangedHandler())); + connect(p, &Plugin::pluginStateChanged, this, &PluginsManager::onPluginStateChangedHandler); } } @@ -109,9 +109,10 @@ void PluginsManager::StopPlugins() } -void PluginsManager::onPluginStateChangedHandler() +void PluginsManager::onPluginStateChangedHandler(QProcess::ProcessState state) { DEBUG_LOW_LEVEL << Q_FUNC_INFO; + Q_UNUSED(state) emit updatePlugin(_plugins.values()); } diff --git a/Software/src/PluginsManager.hpp b/Software/src/PluginsManager.hpp index 5790d1b73..dc2db356a 100644 --- a/Software/src/PluginsManager.hpp +++ b/Software/src/PluginsManager.hpp @@ -30,7 +30,7 @@ public slots: void StopPlugins(); private slots: - void onPluginStateChangedHandler(); + void onPluginStateChangedHandler(QProcess::ProcessState state); }; diff --git a/Software/src/PulseAudioSoundManager.cpp b/Software/src/PulseAudioSoundManager.cpp index b45a7eb9f..2f536a736 100644 --- a/Software/src/PulseAudioSoundManager.cpp +++ b/Software/src/PulseAudioSoundManager.cpp @@ -105,7 +105,7 @@ static void pa_context_state_cb(pa_context *c, void *userdata) PulseAudioSoundManager::PulseAudioSoundManager(QObject *parent) : SoundManagerBase(parent) { m_timer.setTimerType(Qt::PreciseTimer); - connect(&m_timer, SIGNAL(timeout()), this, SLOT(updateColors())); + connect(&m_timer, &QTimer::timeout, this, &PulseAudioSoundManager::updateColors); m_pa_alive_timer.setTimerType(Qt::PreciseTimer); connect(&m_pa_alive_timer, &QTimer::timeout, this, &PulseAudioSoundManager::checkPulse); diff --git a/Software/src/PulseAudioSoundManager.hpp b/Software/src/PulseAudioSoundManager.hpp index 0c920f41a..0bf2fab55 100644 --- a/Software/src/PulseAudioSoundManager.hpp +++ b/Software/src/PulseAudioSoundManager.hpp @@ -48,6 +48,7 @@ enum w_type class PulseAudioSoundManager : public SoundManagerBase { + Q_OBJECT public: PulseAudioSoundManager(QObject *parent = 0); virtual ~PulseAudioSoundManager(); diff --git a/Software/src/SelectWidget.cpp b/Software/src/SelectWidget.cpp index b34ea55fc..97027880f 100644 --- a/Software/src/SelectWidget.cpp +++ b/Software/src/SelectWidget.cpp @@ -5,8 +5,8 @@ SelectWidget::SelectWidget() { list = new QListWidget(this); upButton = new QPushButton(this); downButton = new QPushButton(this); - connect(upButton, SIGNAL(clicked()), this, SLOT(MoveUp())); - connect(downButton, SIGNAL(clicked()), this, SLOT(MoveDown())); + connect(upButton, &QPushButton::clicked, this, &SelectWidget::MoveUp); + connect(downButton, &QPushButton::clicked, this, &SelectWidget::MoveDown); list->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); } SelectWidget::SelectWidget(QWidget *parent) { @@ -14,8 +14,8 @@ SelectWidget::SelectWidget(QWidget *parent) { list = new QListWidget(this); upButton = new QPushButton(this); downButton = new QPushButton(this); - connect(upButton, SIGNAL(clicked()), this, SLOT(MoveUp())); - connect(downButton, SIGNAL(clicked()), this, SLOT(MoveDown())); + connect(upButton, &QPushButton::clicked, this, &SelectWidget::MoveUp); + connect(downButton, &QPushButton::clicked, this, &SelectWidget::MoveDown); list->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); } void SelectWidget::MoveUp() { diff --git a/Software/src/UpdatesProcessor.cpp b/Software/src/UpdatesProcessor.cpp index 468e0a09a..7a1967be4 100644 --- a/Software/src/UpdatesProcessor.cpp +++ b/Software/src/UpdatesProcessor.cpp @@ -63,8 +63,12 @@ void UpdatesProcessor::requestUpdates() QNetworkRequest request(QUrl(UPDATE_CHECK_URL)); request.setSslConfiguration(QSslConfiguration::defaultConfiguration()); _reply = _networkMan.get(request); - connect(_reply, SIGNAL(finished()), this, SIGNAL(readyRead())); - connect(_reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(error(QNetworkReply::NetworkError))); + connect(_reply, &QNetworkReply::finished, this, &UpdatesProcessor::readyRead); +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + connect(_reply, &QNetworkReply::errorOccurred, this, &UpdatesProcessor::error); +#else + connect(_reply, qOverload(&QNetworkReply::error), this, &UpdatesProcessor::error); +#endif } QList UpdatesProcessor::readUpdates() @@ -118,8 +122,13 @@ void UpdatesProcessor::loadUpdate(UpdateInfo& info) #endif _reply = _networkMan.get(request); - connect(_reply, SIGNAL(finished()), this, SLOT(updatePgkLoaded())); - connect(_reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(error(QNetworkReply::NetworkError))); + connect(_reply, &QNetworkReply::finished, this, &UpdatesProcessor::updatePgkLoaded); +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + connect(_reply, &QNetworkReply::errorOccurred, this, &UpdatesProcessor::error); +#else + connect(_reply, qOverload(&QNetworkReply::error), this, &UpdatesProcessor::error); +#endif + #else qWarning() << Q_FUNC_INFO << "Trying to load update on non-windows platform -- ignored"; #endif @@ -154,8 +163,12 @@ void UpdatesProcessor::updatePgkLoaded() #endif _reply = _networkMan.get(request); - connect(_reply, SIGNAL(finished()), this, SLOT(updateSigLoaded())); - connect(_reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(error(QNetworkReply::NetworkError))); + connect(_reply, &QNetworkReply::finished, this, &UpdatesProcessor::updateSigLoaded); +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + connect(_reply, &QNetworkReply::errorOccurred, this, &UpdatesProcessor::error); +#else + connect(_reply, qOverload(&QNetworkReply::error), this, &UpdatesProcessor::error); +#endif } void UpdatesProcessor::updateSigLoaded() diff --git a/Software/src/systrayicon/SysTrayIcon.cpp b/Software/src/systrayicon/SysTrayIcon.cpp index 2ab1a86b3..ed723ae4d 100644 --- a/Software/src/systrayicon/SysTrayIcon.cpp +++ b/Software/src/systrayicon/SysTrayIcon.cpp @@ -62,12 +62,10 @@ SysTrayIcon::~SysTrayIcon() void SysTrayIcon::init() { - connect(_qsystray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)) - , this, SLOT(onTrayIcon_Activated(QSystemTrayIcon::ActivationReason))); - connect(_qsystray, SIGNAL(messageClicked()) - , this, SLOT(onTrayIcon_MessageClicked())); + connect(_qsystray, &QSystemTrayIcon::activated, this, &SysTrayIcon::onTrayIcon_Activated); + connect(_qsystray, &QSystemTrayIcon::messageClicked, this, &SysTrayIcon::onTrayIcon_MessageClicked); - connect(&_updatesProcessor, SIGNAL(readyRead()), this, SLOT(onCheckUpdate_Finished())); + connect(&_updatesProcessor, &UpdatesProcessor::readyRead, this, &SysTrayIcon::onCheckUpdate_Finished); _pixmapCache.insert("lock32", new QPixmap(QPixmap(":/icons/lock.png").scaledToWidth(32, Qt::SmoothTransformation))); _pixmapCache.insert("on32", new QPixmap(QPixmap(":/icons/on.png").scaledToWidth(32, Qt::SmoothTransformation))); @@ -325,11 +323,11 @@ void SysTrayIcon::createActions() _switchOnBacklightAction = new QAction(QIcon(":/icons/on.png"), tr("&Turn on"), this); _switchOnBacklightAction->setIconVisibleInMenu(true); - connect(_switchOnBacklightAction, SIGNAL(triggered()), this, SIGNAL(backlightOn())); + connect(_switchOnBacklightAction, &QAction::triggered, this, &SysTrayIcon::backlightOn); _switchOffBacklightAction = new QAction(QIcon(":/icons/off.png"), tr("&Turn off"), this); _switchOffBacklightAction->setIconVisibleInMenu(true); - connect(_switchOffBacklightAction, SIGNAL(triggered()), this, SIGNAL(backlightOff())); + connect(_switchOffBacklightAction, &QAction::triggered, this, &SysTrayIcon::backlightOff); _profilesMenu = new QMenu(tr("&Profiles")); @@ -338,10 +336,10 @@ void SysTrayIcon::createActions() _settingsAction = new QAction(QIcon(":/icons/settings.png"), tr("&Settings"), this); _settingsAction->setIconVisibleInMenu(true); - connect(_settingsAction, SIGNAL(triggered()), this, SIGNAL(showSettings())); + connect(_settingsAction, &QAction::triggered, this, &SysTrayIcon::showSettings); _quitAction = new QAction(tr("&Quit"), this); - connect(_quitAction, SIGNAL(triggered()), this, SIGNAL(quit())); + connect(_quitAction, &QAction::triggered, this, &SysTrayIcon::quit); } void SysTrayIcon::fillProfilesFromSettings() @@ -360,6 +358,6 @@ void SysTrayIcon::fillProfilesFromSettings() profileAction->setChecked(true); } _profilesMenu->addAction(profileAction); - connect(profileAction, SIGNAL(triggered()), this, SLOT(onProfileAction_Triggered())); + connect(profileAction, &QAction::triggered, this, &SysTrayIcon::onProfileAction_Triggered); } }