summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Klotz <uklotz@mixxx.org>2020-11-15 13:39:50 +0100
committerGitHub <noreply@github.com>2020-11-15 13:39:50 +0100
commit3e1f1c44db104ccc806779802c00eb22cc35c74b (patch)
tree0a67fb0531c84cb68220db1e9deef35ee3a5d132
parent01b80f5718bc2db6b75ac4304431fa1520324e86 (diff)
parentf2eff452538d34c869b93ec53ce1a29e5ac28079 (diff)
Merge pull request #3302 from Holzhaus/clazy-old-style-connect-controllers
controllers: Replace old-style Qt connect() calls
-rw-r--r--.github/workflows/clazy.yml2
-rw-r--r--src/controllers/controllerengine.cpp24
-rw-r--r--src/controllers/controllermanager.cpp15
-rw-r--r--src/controllers/dlgcontrollerlearning.cpp123
-rw-r--r--src/controllers/dlgprefcontroller.cpp52
-rw-r--r--src/controllers/dlgprefcontrollers.cpp18
-rw-r--r--src/controllers/midi/hss1394controller.cpp36
-rw-r--r--src/controllers/midi/midicontroller.h5
8 files changed, 177 insertions, 98 deletions
diff --git a/.github/workflows/clazy.yml b/.github/workflows/clazy.yml
index ac21b184de..026bf17042 100644
--- a/.github/workflows/clazy.yml
+++ b/.github/workflows/clazy.yml
@@ -22,4 +22,4 @@ jobs:
LD: clang++
CC: clang
CXX: clazy
- CLAZY_CHECKS: level1,no-rule-of-two-soft,no-non-pod-global-static,no-qproperty-without-notify,no-wrong-qevent-cast,no-old-style-connect,no-connect-not-normalized
+ CLAZY_CHECKS: level1,no-rule-of-two-soft,no-non-pod-global-static,no-qproperty-without-notify,no-wrong-qevent-cast
diff --git a/src/controllers/controllerengine.cpp b/src/controllers/controllerengine.cpp
index c7f1b44c3c..53b6e0085e 100644
--- a/src/controllers/controllerengine.cpp
+++ b/src/controllers/controllerengine.cpp
@@ -283,8 +283,10 @@ bool ControllerEngine::loadScriptFiles(const QList<ControllerPreset::ScriptFileI
m_lastScriptFiles = scripts;
- connect(&m_scriptWatcher, SIGNAL(fileChanged(QString)),
- this, SLOT(scriptHasChanged(QString)));
+ connect(&m_scriptWatcher,
+ &QFileSystemWatcher::fileChanged,
+ this,
+ &ControllerEngine::scriptHasChanged);
bool success = result && m_scriptErrors.isEmpty();
if (!success) {
@@ -301,8 +303,10 @@ void ControllerEngine::scriptHasChanged(const QString& scriptFilename) {
qDebug() << "ControllerEngine: Reloading Scripts";
ControllerPresetPointer pPreset = m_pController->getPreset();
- disconnect(&m_scriptWatcher, SIGNAL(fileChanged(QString)),
- this, SLOT(scriptHasChanged(QString)));
+ disconnect(&m_scriptWatcher,
+ &QFileSystemWatcher::fileChanged,
+ this,
+ &ControllerEngine::scriptHasChanged);
gracefulShutdown();
uninitializeScriptEngine();
@@ -627,8 +631,10 @@ void ControllerEngine::scriptErrorDialog(
if (ErrorDialogHandler::instance()->requestErrorDialog(props)) {
// Enable custom handling of the dialog buttons
- connect(ErrorDialogHandler::instance(), SIGNAL(stdButtonClicked(QString, QMessageBox::StandardButton)),
- this, SLOT(errorDialogButton(QString, QMessageBox::StandardButton)));
+ connect(ErrorDialogHandler::instance(),
+ &ErrorDialogHandler::stdButtonClicked,
+ this,
+ &ControllerEngine::errorDialogButton);
}
}
@@ -642,9 +648,9 @@ void ControllerEngine::errorDialogButton(const QString& key, QMessageBox::Standa
// Something was clicked, so disable this signal now
disconnect(ErrorDialogHandler::instance(),
- SIGNAL(stdButtonClicked(QString, QMessageBox::StandardButton)),
- this,
- SLOT(errorDialogButton(QString, QMessageBox::StandardButton)));
+ &ErrorDialogHandler::stdButtonClicked,
+ this,
+ &ControllerEngine::errorDialogButton);
if (button == QMessageBox::Retry) {
emit resetController();
diff --git a/src/controllers/controllermanager.cpp b/src/controllers/controllermanager.cpp
index 8a301dc966..c70af0d1cc 100644
--- a/src/controllers/controllermanager.cpp
+++ b/src/controllers/controllermanager.cpp
@@ -98,8 +98,7 @@ ControllerManager::ControllerManager(UserSettingsPointer pConfig)
}
m_pollTimer.setInterval(kPollInterval.toIntegerMillis());
- connect(&m_pollTimer, SIGNAL(timeout()),
- this, SLOT(pollDevices()));
+ connect(&m_pollTimer, &QTimer::timeout, this, &ControllerManager::pollDevices);
m_pThread = new QThread;
m_pThread->setObjectName("Controller");
@@ -111,12 +110,12 @@ ControllerManager::ControllerManager(UserSettingsPointer pConfig)
// audio directly, like when scratching
m_pThread->start(QThread::HighPriority);
- connect(this, SIGNAL(requestInitialize()),
- this, SLOT(slotInitialize()));
- connect(this, SIGNAL(requestSetUpDevices()),
- this, SLOT(slotSetUpDevices()));
- connect(this, SIGNAL(requestShutdown()),
- this, SLOT(slotShutdown()));
+ connect(this, &ControllerManager::requestInitialize, this, &ControllerManager::slotInitialize);
+ connect(this,
+ &ControllerManager::requestSetUpDevices,
+ this,
+ &ControllerManager::slotSetUpDevices);
+ connect(this, &ControllerManager::requestShutdown, this, &ControllerManager::slotShutdown);
// Signal that we should run slotInitialize once our event loop has started
// up.
diff --git a/src/controllers/dlgcontrollerlearning.cpp b/src/controllers/dlgcontrollerlearning.cpp
index 2ce10ad7d8..b8e36df39c 100644
--- a/src/controllers/dlgcontrollerlearning.cpp
+++ b/src/controllers/dlgcontrollerlearning.cpp
@@ -71,25 +71,47 @@ DlgControllerLearning::DlgControllerLearning(QWidget * parent,
setAttribute(Qt::WA_DeleteOnClose);
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
- connect(&m_controlPickerMenu, SIGNAL(controlPicked(ConfigKey)),
- this, SLOT(controlPicked(ConfigKey)));
+ connect(&m_controlPickerMenu,
+ &ControlPickerMenu::controlPicked,
+ this,
+ &DlgControllerLearning::controlPicked);
comboBoxChosenControl->completer()->setCompletionMode(
QCompleter::PopupCompletion);
populateComboBox();
- connect(comboBoxChosenControl, SIGNAL(currentIndexChanged(int)),
- this, SLOT(comboboxIndexChanged(int)));
-
- connect(pushButtonChooseControl, SIGNAL(clicked()), this, SLOT(showControlMenu()));
- connect(pushButtonClose, SIGNAL(clicked()), this, SLOT(close()));
- connect(pushButtonClose_2, SIGNAL(clicked()), this, SLOT(close()));
- connect(pushButtonCancelLearn, SIGNAL(clicked()), this, SLOT(slotCancelLearn()));
- connect(pushButtonRetry, SIGNAL(clicked()), this, SLOT(slotRetry()));
- connect(pushButtonStartLearn, SIGNAL(clicked()), this, SLOT(slotStartLearningPressed()));
- connect(pushButtonLearnAnother, SIGNAL(clicked()), this, SLOT(slotChooseControlPressed()));
+ connect(comboBoxChosenControl,
+ QOverload<int>::of(&QComboBox::currentIndexChanged),
+ this,
+ &DlgControllerLearning::comboboxIndexChanged);
+
+ connect(pushButtonChooseControl,
+ &QAbstractButton::clicked,
+ this,
+ &DlgControllerLearning::showControlMenu);
+ connect(pushButtonClose, &QAbstractButton::clicked, this, &DlgControllerLearning::close);
+ connect(pushButtonClose_2, &QAbstractButton::clicked, this, &DlgControllerLearning::close);
+ connect(pushButtonCancelLearn,
+ &QAbstractButton::clicked,
+ this,
+ &DlgControllerLearning::slotCancelLearn);
+ connect(pushButtonRetry, &QAbstractButton::clicked, this, &DlgControllerLearning::slotRetry);
+ connect(pushButtonStartLearn,
+ &QAbstractButton::clicked,
+ this,
+ &DlgControllerLearning::slotStartLearningPressed);
+ connect(pushButtonLearnAnother,
+ &QAbstractButton::clicked,
+ this,
+ &DlgControllerLearning::slotChooseControlPressed);
#ifdef CONTROLLERLESSTESTING
- connect(pushButtonFakeControl, SIGNAL(clicked()), this, SLOT(DEBUGFakeMidiMessage()));
- connect(pushButtonFakeControl2, SIGNAL(clicked()), this, SLOT(DEBUGFakeMidiMessage2()));
+ connect(pushButtonFakeControl,
+ &QAbstractButton::clicked,
+ this,
+ &DlgControllerLearning::DEBUGFakeMidiMessage);
+ connect(pushButtonFakeControl2,
+ &QAbstractButton::clicked,
+ this,
+ &DlgControllerLearning::DEBUGFakeMidiMessage2);
#else
pushButtonFakeControl->hide();
pushButtonFakeControl2->hide();
@@ -97,27 +119,36 @@ DlgControllerLearning::DlgControllerLearning(QWidget * parent,
// We only want to listen to clicked() so we don't fire
// slotMidiOptionsChanged when we change the checkboxes programmatically.
- connect(midiOptionSwitchMode, SIGNAL(clicked()),
- this, SLOT(slotMidiOptionsChanged()));
- connect(midiOptionSoftTakeover, SIGNAL(clicked()),
- this, SLOT(slotMidiOptionsChanged()));
- connect(midiOptionInvert, SIGNAL(clicked()),
- this, SLOT(slotMidiOptionsChanged()));
- connect(midiOptionSelectKnob, SIGNAL(clicked()),
- this, SLOT(slotMidiOptionsChanged()));
+ connect(midiOptionSwitchMode,
+ &QAbstractButton::clicked,
+ this,
+ &DlgControllerLearning::slotMidiOptionsChanged);
+ connect(midiOptionSoftTakeover,
+ &QAbstractButton::clicked,
+ this,
+ &DlgControllerLearning::slotMidiOptionsChanged);
+ connect(midiOptionInvert,
+ &QAbstractButton::clicked,
+ this,
+ &DlgControllerLearning::slotMidiOptionsChanged);
+ connect(midiOptionSelectKnob,
+ &QAbstractButton::clicked,
+ this,
+ &DlgControllerLearning::slotMidiOptionsChanged);
slotChooseControlPressed();
// Wait 1 second until we detect the control the user moved.
m_lastMessageTimer.setInterval(1500);
m_lastMessageTimer.setSingleShot(true);
- connect(&m_lastMessageTimer, SIGNAL(timeout()),
- this, SLOT(slotTimerExpired()));
+ connect(&m_lastMessageTimer, &QTimer::timeout, this, &DlgControllerLearning::slotTimerExpired);
m_firstMessageTimer.setInterval(7000);
m_firstMessageTimer.setSingleShot(true);
- connect(&m_firstMessageTimer, SIGNAL(timeout()),
- this, SLOT(slotFirstMessageTimeout()));
+ connect(&m_firstMessageTimer,
+ &QTimer::timeout,
+ this,
+ &DlgControllerLearning::slotFirstMessageTimeout);
}
void DlgControllerLearning::populateComboBox() {
@@ -378,20 +409,32 @@ void DlgControllerLearning::visit(MidiController* pMidiController) {
m_pMidiController = pMidiController;
- connect(m_pMidiController, SIGNAL(messageReceived(unsigned char, unsigned char, unsigned char)),
- this, SLOT(slotMessageReceived(unsigned char, unsigned char, unsigned char)));
-
- connect(this, SIGNAL(learnTemporaryInputMappings(MidiInputMappings)),
- m_pMidiController, SLOT(learnTemporaryInputMappings(MidiInputMappings)));
- connect(this, SIGNAL(clearTemporaryInputMappings()),
- m_pMidiController, SLOT(clearTemporaryInputMappings()));
-
- connect(this, SIGNAL(commitTemporaryInputMappings()),
- m_pMidiController, SLOT(commitTemporaryInputMappings()));
- connect(this, SIGNAL(startLearning()),
- m_pMidiController, SLOT(startLearning()));
- connect(this, SIGNAL(stopLearning()),
- m_pMidiController, SLOT(stopLearning()));
+ connect(m_pMidiController,
+ &MidiController::messageReceived,
+ this,
+ &DlgControllerLearning::slotMessageReceived);
+
+ connect(this,
+ &DlgControllerLearning::learnTemporaryInputMappings,
+ m_pMidiController,
+ &MidiController::learnTemporaryInputMappings);
+ connect(this,
+ &DlgControllerLearning::clearTemporaryInputMappings,
+ m_pMidiController,
+ &MidiController::clearTemporaryInputMappings);
+
+ connect(this,
+ &DlgControllerLearning::commitTemporaryInputMappings,
+ m_pMidiController,
+ &MidiController::commitTemporaryInputMappings);
+ connect(this,
+ &DlgControllerLearning::startLearning,
+ m_pMidiController,
+ &MidiController::startLearning);
+ connect(this,
+ &DlgControllerLearning::stopLearning,
+ m_pMidiController,
+ &MidiController::stopLearning);
emit startLearning();
}
diff --git a/src/controllers/dlgprefcontroller.cpp b/src/controllers/dlgprefcontroller.cpp
index cbc5967ca9..20a9a192a5 100644
--- a/src/controllers/dlgprefcontroller.cpp
+++ b/src/controllers/dlgprefcontroller.cpp
@@ -82,35 +82,35 @@ DlgPrefController::DlgPrefController(QWidget* parent, Controller* controller,
// Input mappings
connect(m_ui.btnAddInputMapping,
- SIGNAL(clicked()),
+ &QAbstractButton::clicked,
this,
- SLOT(addInputMapping()));
+ &DlgPrefController::addInputMapping);
connect(m_ui.btnRemoveInputMappings,
- SIGNAL(clicked()),
+ &QAbstractButton::clicked,
this,
- SLOT(removeInputMappings()));
+ &DlgPrefController::removeInputMappings);
connect(m_ui.btnLearningWizard,
- SIGNAL(clicked()),
+ &QAbstractButton::clicked,
this,
- SLOT(showLearningWizard()));
+ &DlgPrefController::showLearningWizard);
connect(m_ui.btnClearAllInputMappings,
- SIGNAL(clicked()),
+ &QAbstractButton::clicked,
this,
- SLOT(clearAllInputMappings()));
+ &DlgPrefController::clearAllInputMappings);
// Output mappings
connect(m_ui.btnAddOutputMapping,
- SIGNAL(clicked()),
+ &QAbstractButton::clicked,
this,
- SLOT(addOutputMapping()));
+ &DlgPrefController::addOutputMapping);
connect(m_ui.btnRemoveOutputMappings,
- SIGNAL(clicked()),
+ &QAbstractButton::clicked,
this,
- SLOT(removeOutputMappings()));
+ &DlgPrefController::removeOutputMappings);
connect(m_ui.btnClearAllOutputMappings,
- SIGNAL(clicked()),
+ &QAbstractButton::clicked,
this,
- SLOT(clearAllOutputMappings()));
+ &DlgPrefController::clearAllOutputMappings);
}
DlgPrefController::~DlgPrefController() {
@@ -146,31 +146,31 @@ void DlgPrefController::showLearningWizard() {
m_pControllerManager->getControllerLearningEventFilter();
pControllerLearning->startListening();
connect(pControllerLearning,
- SIGNAL(controlClicked(ControlObject*)),
+ &ControllerLearningEventFilter::controlClicked,
m_pDlgControllerLearning,
- SLOT(controlClicked(ControlObject*)));
+ &DlgControllerLearning::controlClicked);
connect(m_pDlgControllerLearning,
- SIGNAL(listenForClicks()),
+ &DlgControllerLearning::listenForClicks,
pControllerLearning,
- SLOT(startListening()));
+ &ControllerLearningEventFilter::startListening);
connect(m_pDlgControllerLearning,
- SIGNAL(stopListeningForClicks()),
+ &DlgControllerLearning::stopListeningForClicks,
pControllerLearning,
- SLOT(stopListening()));
+ &ControllerLearningEventFilter::stopListening);
connect(m_pDlgControllerLearning,
- SIGNAL(stopLearning()),
+ &DlgControllerLearning::stopLearning,
this,
- SLOT(show()));
+ &DlgPrefController::show);
connect(m_pDlgControllerLearning,
- SIGNAL(inputMappingsLearned(MidiInputMappings)),
+ &DlgControllerLearning::inputMappingsLearned,
this,
- SLOT(midiInputMappingsLearned(MidiInputMappings)));
+ &DlgPrefController::midiInputMappingsLearned);
emit mappingStarted();
connect(m_pDlgControllerLearning,
- SIGNAL(stopLearning()),
+ &DlgControllerLearning::stopLearning,
this,
- SIGNAL(mappingEnded()));
+ &DlgPrefController::mappingEnded);
}
void DlgPrefController::midiInputMappingsLearned(
diff --git a/src/controllers/dlgprefcontrollers.cpp b/src/controllers/dlgprefcontrollers.cpp
index ccb066b0cb..f6d28a95f4 100644
--- a/src/controllers/dlgprefcontrollers.cpp
+++ b/src/controllers/dlgprefcontrollers.cpp
@@ -25,8 +25,10 @@ DlgPrefControllers::DlgPrefControllers(DlgPreferences* pPreferences,
this, [this, presetsPath] { slotOpenLocalFile(presetsPath); });
// Connections
- connect(m_pControllerManager, SIGNAL(devicesChanged()),
- this, SLOT(rescanControllers()));
+ connect(m_pControllerManager,
+ &ControllerManager::devicesChanged,
+ this,
+ &DlgPrefControllers::rescanControllers);
}
DlgPrefControllers::~DlgPrefControllers() {
@@ -111,10 +113,14 @@ void DlgPrefControllers::setupControllerWidgets() {
foreach (Controller* pController, controllerList) {
DlgPrefController* controllerDlg = new DlgPrefController(
this, pController, m_pControllerManager, m_pConfig);
- connect(controllerDlg, SIGNAL(mappingStarted()),
- m_pDlgPreferences, SLOT(hide()));
- connect(controllerDlg, SIGNAL(mappingEnded()),
- m_pDlgPreferences, SLOT(show()));
+ connect(controllerDlg,
+ &DlgPrefController::mappingStarted,
+ m_pDlgPreferences,
+ &DlgPreferences::hide);
+ connect(controllerDlg,
+ &DlgPrefController::mappingEnded,
+ m_pDlgPreferences,
+ &DlgPreferences::show);
m_controllerWindows.append(controllerDlg);
m_pDlgPreferences->addPageWidget(controllerDlg);
diff --git a/src/controllers/midi/hss1394controller.cpp b/src/controllers/midi/hss1394controller.cpp
index 886530d292..fc1b1b668b 100644
--- a/src/controllers/midi/hss1394controller.cpp
+++ b/src/controllers/midi/hss1394controller.cpp
@@ -110,10 +110,20 @@ int Hss1394Controller::open() {
}
m_pChannelListener = new DeviceChannelListener(this, getName());
- connect(m_pChannelListener, SIGNAL(incomingData(QByteArray, mixxx::Duration)),
- this, SLOT(receive(QByteArray, mixxx::Duration)));
- connect(m_pChannelListener, SIGNAL(incomingData(unsigned char, unsigned char, unsigned char, mixxx::Duration)),
- this, SLOT(receive(unsigned char, unsigned char, unsigned char, mixxx::Duration)));
+ connect(m_pChannelListener,
+ QOverload<unsigned char,
+ unsigned char,
+ unsigned char,
+ mixxx::Duration>::of(&DeviceChannelListener::incomingData),
+ this,
+ QOverload<unsigned char,
+ unsigned char,
+ unsigned char,
+ mixxx::Duration>::of(&Hss1394Controller::receive));
+ connect(m_pChannelListener,
+ QOverload<QByteArray, mixxx::Duration>::of(&DeviceChannelListener::incomingData),
+ this,
+ QOverload<QByteArray, mixxx::Duration>::of(&Hss1394Controller::receive));
if (!m_pChannel->InstallChannelListener(m_pChannelListener)) {
qDebug() << "HSS1394 channel listener could not be installed for device" << getName();
@@ -148,10 +158,20 @@ int Hss1394Controller::close() {
return -1;
}
- disconnect(m_pChannelListener, SIGNAL(incomingData(QByteArray, mixxx::Duration)),
- this, SLOT(receive(QByteArray, mixxx::Duration)));
- disconnect(m_pChannelListener, SIGNAL(incomingData(unsigned char, unsigned char, unsigned char, mixxx::Duration)),
- this, SLOT(receive(unsigned char, unsigned char, unsigned char, mixxx::Duration)));
+ disconnect(m_pChannelListener,
+ QOverload<unsigned char,
+ unsigned char,
+ unsigned char,
+ mixxx::Duration>::of(&DeviceChannelListener::incomingData),
+ this,
+ QOverload<unsigned char,
+ unsigned char,
+ unsigned char,
+ mixxx::Duration>::of(&Hss1394Controller::receive));
+ disconnect(m_pChannelListener,
+ QOverload<QByteArray, mixxx::Duration>::of(&DeviceChannelListener::incomingData),
+ this,
+ QOverload<QByteArray, mixxx::Duration>::of(&Hss1394Controller::receive));
stopEngine();
MidiController::close();
diff --git a/src/controllers/midi/midicontroller.h b/src/controllers/midi/midicontroller.h
index 0fe825f566..fcaa007aba 100644
--- a/src/controllers/midi/midicontroller.h
+++ b/src/controllers/midi/midicontroller.h
@@ -20,6 +20,8 @@
#include "controllers/midi/midioutputhandler.h"
#include "controllers/softtakeover.h"
+class DlgControllerLearning;
+
class MidiController : public Controller {
Q_OBJECT
public:
@@ -115,6 +117,9 @@ class MidiController : public Controller {
// So it can access sendShortMsg()
friend class MidiOutputHandler;
friend class MidiControllerTest;
+
+ // MIDI learning assistant
+ friend class DlgControllerLearning;
};
#endif