Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix clazy issues after merging the 2.3 branch #3356

Merged
merged 3 commits into from
Nov 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/audio/signalinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ class SignalInfo final {
public:
constexpr SignalInfo() = default;
constexpr explicit SignalInfo(
OptionalSampleLayout sampleLayout)
const OptionalSampleLayout& sampleLayout)
: m_sampleLayout(sampleLayout) {
}
SignalInfo(
ChannelCount channelCount,
SampleRate sampleRate,
OptionalSampleLayout sampleLayout = std::nullopt)
const OptionalSampleLayout& sampleLayout = std::nullopt)
: m_channelCount(channelCount),
m_sampleRate(sampleRate),
m_sampleLayout(sampleLayout) {
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class ControllerJSProxy : public QObject {

// The length parameter is here for backwards compatibility for when scripts
// were required to specify it.
Q_INVOKABLE virtual void send(QList<int> data, unsigned int length = 0) {
Q_INVOKABLE virtual void send(const QList<int>& data, unsigned int length = 0) {
Q_UNUSED(length);
m_pController->send(data, data.length());
}
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/controllerpreset.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ControllerPreset {
}

void setModuleFileInfo(QFileInfo fileInfo) {
m_moduleFileInfo = fileInfo;
m_moduleFileInfo = std::move(fileInfo);
}

QFileInfo moduleFileInfo() const {
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/engine/colormapperjsproxy.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "controllers/engine/colormapperjsproxy.h"

ColorMapperJSProxy::ColorMapperJSProxy(QVariantMap availableColors)
ColorMapperJSProxy::ColorMapperJSProxy(const QVariantMap& availableColors)
: m_pColorMapper(nullptr) {
QMap<QRgb, QVariant> qrgbMap;
QVariantMap::const_iterator it;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/engine/colormapperjsproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ColorMapperJSProxy final : public QObject {
// the ColorMapper constructor segfaults. QJSEngine converts a JS object to
// a QVariantMap, so this constructor converts the QVariantMap to a
// QMap<QRgb, QVariant>.
Q_INVOKABLE ColorMapperJSProxy(QVariantMap availableColors);
Q_INVOKABLE ColorMapperJSProxy(const QVariantMap& availableColors);

// Mixxx would segfault without this if a script calls "new ColorMapper()"
// This should not actually be used.
Expand Down
13 changes: 7 additions & 6 deletions src/controllers/engine/controllerengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ void ControllerEngine::uninitializeScriptEngine() {
}
}

void ControllerEngine::loadModule(QFileInfo moduleFileInfo) {
void ControllerEngine::loadModule(const QFileInfo& moduleFileInfo) {
// QFileInfo does not have a isValid/isEmpty/isNull method to check if it
// actually contains a reference, so we check if the filePath is empty as a
// workaround.
Expand Down Expand Up @@ -291,7 +291,7 @@ void ControllerEngine::loadModule(QFileInfo moduleFileInfo) {
#endif
}

void ControllerEngine::handleInput(QByteArray data, mixxx::Duration timestamp) {
void ControllerEngine::handleInput(const QByteArray& data, mixxx::Duration timestamp) {
if (m_handleInputFunction.isCallable()) {
QJSValueList args;
args << byteArrayToScriptValue(data);
Expand Down Expand Up @@ -438,7 +438,8 @@ void ControllerEngine::throwJSError(const QString& message) {
#endif
}

void ControllerEngine::showScriptExceptionDialog(QJSValue evaluationResult, bool bFatalError) {
void ControllerEngine::showScriptExceptionDialog(
const QJSValue& evaluationResult, bool bFatalError) {
VERIFY_OR_DEBUG_ASSERT(evaluationResult.isError()) {
return;
}
Expand Down Expand Up @@ -679,7 +680,7 @@ void ControllerEngine::log(const QString& message) {
}

QJSValue ControllerEngine::makeConnection(
const QString& group, const QString& name, const QJSValue callback) {
const QString& group, const QString& name, const QJSValue& callback) {
VERIFY_OR_DEBUG_ASSERT(m_pScriptEngine != nullptr) {
return QJSValue();
}
Expand Down Expand Up @@ -714,7 +715,7 @@ QJSValue ControllerEngine::makeConnection(
return QJSValue();
}

bool ControllerEngine::removeScriptConnection(const ScriptConnection connection) {
bool ControllerEngine::removeScriptConnection(const ScriptConnection& connection) {
ControlObjectScript* coScript = getControlObjectScript(connection.key.group,
connection.key.item);

Expand All @@ -725,7 +726,7 @@ bool ControllerEngine::removeScriptConnection(const ScriptConnection connection)
return coScript->removeScriptConnection(connection);
}

void ControllerEngine::triggerScriptConnection(const ScriptConnection connection) {
void ControllerEngine::triggerScriptConnection(const ScriptConnection& connection) {
VERIFY_OR_DEBUG_ASSERT(m_pScriptEngine) {
return;
}
Expand Down
12 changes: 6 additions & 6 deletions src/controllers/engine/controllerengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ControllerEngine : public QObject {
ControllerEngine(Controller* controller);
virtual ~ControllerEngine();

void handleInput(QByteArray data, mixxx::Duration timestamp);
void handleInput(const QByteArray& data, mixxx::Duration timestamp);

bool executeFunction(QJSValue functionObject, const QJSValueList& arguments);
bool executeFunction(const QJSValue& functionObject, const QByteArray& data);
Expand All @@ -43,11 +43,11 @@ class ControllerEngine : public QObject {

/// Shows a UI dialog notifying of a script evaluation error.
/// Precondition: QJSValue.isError() == true
void showScriptExceptionDialog(QJSValue evaluationResult, bool bFatal = false);
void showScriptExceptionDialog(const QJSValue& evaluationResult, bool bFatal = false);

bool removeScriptConnection(const ScriptConnection conn);
bool removeScriptConnection(const ScriptConnection& conn);
/// Execute a ScriptConnection's JS callback
void triggerScriptConnection(const ScriptConnection conn);
void triggerScriptConnection(const ScriptConnection& conn);

inline void setTesting(bool testing) {
m_bTesting = testing;
Expand All @@ -64,7 +64,7 @@ class ControllerEngine : public QObject {
double getDefaultParameter(const QString& group, const QString& name);
/// Connect a ControlObject's valueChanged() signal to a script callback function
/// Returns to the script a ScriptConnectionJSProxy
QJSValue makeConnection(const QString& group, const QString& name, const QJSValue callback);
QJSValue makeConnection(const QString& group, const QString& name, const QJSValue& callback);
/// DEPRECATED: Use makeConnection instead.
QJSValue connectControl(const QString& group,
const QString& name,
Expand Down Expand Up @@ -105,7 +105,7 @@ class ControllerEngine : public QObject {
virtual void timerEvent(QTimerEvent* event);

public slots:
void loadModule(QFileInfo moduleFileInfo);
void loadModule(const QFileInfo& moduleFileInfo);
bool loadScriptFiles(const QList<ControllerPreset::ScriptFileInfo>& scripts);
void initializeScripts(const QList<ControllerPreset::ScriptFileInfo>& scripts);
void gracefulShutdown();
Expand Down
88 changes: 67 additions & 21 deletions src/controllers/engine/controllerenginejsproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,66 +8,100 @@ ControllerEngineJSProxy::ControllerEngineJSProxy(ControllerEngine* m_pEngine)
ControllerEngineJSProxy::~ControllerEngineJSProxy() {
}

double ControllerEngineJSProxy::getValue(QString group, QString name) {
double ControllerEngineJSProxy::getValue(
const QString& group,
const QString& name) {
return m_pEngine->getValue(group, name);
}

void ControllerEngineJSProxy::setValue(QString group, QString name, double newValue) {
void ControllerEngineJSProxy::setValue(
const QString& group,
const QString& name,
double newValue) {
m_pEngine->setValue(group, name, newValue);
}

double ControllerEngineJSProxy::getParameter(QString group, QString name) {
double ControllerEngineJSProxy::getParameter(
const QString& group,
const QString& name) {
return m_pEngine->getParameter(group, name);
}

void ControllerEngineJSProxy::setParameter(QString group, QString name, double newValue) {
void ControllerEngineJSProxy::setParameter(
const QString& group,
const QString& name,
double newValue) {
m_pEngine->setParameter(group, name, newValue);
}

double ControllerEngineJSProxy::getParameterForValue(QString group,
QString name,
double ControllerEngineJSProxy::getParameterForValue(
const QString& group,
const QString& name,
double value) {
return m_pEngine->getParameterForValue(group, name, value);
}

void ControllerEngineJSProxy::reset(QString group, QString name) {
void ControllerEngineJSProxy::reset(
const QString& group,
const QString& name) {
m_pEngine->reset(group, name);
}

double ControllerEngineJSProxy::getDefaultValue(QString group, QString name) {
double ControllerEngineJSProxy::getDefaultValue(
const QString& group,
const QString& name) {
return m_pEngine->getDefaultValue(group, name);
}

double ControllerEngineJSProxy::getDefaultParameter(QString group,
QString name) {
double ControllerEngineJSProxy::getDefaultParameter(
const QString& group,
const QString& name) {
return m_pEngine->getDefaultParameter(group, name);
}

QJSValue ControllerEngineJSProxy::makeConnection(QString group, QString name, const QJSValue callback) {
QJSValue ControllerEngineJSProxy::makeConnection(
const QString& group,
const QString& name,
const QJSValue& callback) {
return m_pEngine->makeConnection(group, name, callback);
}

QJSValue ControllerEngineJSProxy::connectControl(QString group, QString name, const QJSValue passedCallback, bool disconnect) {
QJSValue ControllerEngineJSProxy::connectControl(
const QString& group,
const QString& name,
const QJSValue& passedCallback,
bool disconnect) {
return m_pEngine->connectControl(group, name, passedCallback, disconnect);
}

void ControllerEngineJSProxy::trigger(QString group, QString name) {
void ControllerEngineJSProxy::trigger(
const QString& group,
const QString& name) {
m_pEngine->trigger(group, name);
}

void ControllerEngineJSProxy::log(QString message) {
void ControllerEngineJSProxy::log(const QString& message) {
m_pEngine->log(message);
}

int ControllerEngineJSProxy::beginTimer(int interval, QJSValue scriptCode, bool oneShot) {
int ControllerEngineJSProxy::beginTimer(
int interval,
const QJSValue& scriptCode,
bool oneShot) {
return m_pEngine->beginTimer(interval, scriptCode, oneShot);
}

void ControllerEngineJSProxy::stopTimer(int timerId) {
m_pEngine->stopTimer(timerId);
}

void ControllerEngineJSProxy::scratchEnable(int deck, int intervalsPerRev, double rpm, double alpha, double beta, bool ramp) {
void ControllerEngineJSProxy::scratchEnable(
int deck,
int intervalsPerRev,
double rpm,
double alpha,
double beta,
bool ramp) {
m_pEngine->scratchEnable(deck, intervalsPerRev, rpm, alpha, beta, ramp);
}

Expand All @@ -83,20 +117,32 @@ bool ControllerEngineJSProxy::isScratching(int deck) {
return m_pEngine->isScratching(deck);
}

void ControllerEngineJSProxy::softTakeover(QString group, QString name, bool set) {
void ControllerEngineJSProxy::softTakeover(
const QString& group,
const QString& name,
bool set) {
m_pEngine->softTakeover(group, name, set);
}

void ControllerEngineJSProxy::softTakeoverIgnoreNextValue(QString group,
QString name) {
void ControllerEngineJSProxy::softTakeoverIgnoreNextValue(
const QString& group,
const QString& name) {
m_pEngine->softTakeoverIgnoreNextValue(group, name);
}

void ControllerEngineJSProxy::brake(int deck, bool activate, double factor, double rate) {
void ControllerEngineJSProxy::brake(
int deck,
bool activate,
double factor,
double rate) {
m_pEngine->brake(deck, activate, factor, rate);
}

void ControllerEngineJSProxy::spinback(int deck, bool activate, double factor, double rate) {
void ControllerEngineJSProxy::spinback(
int deck,
bool activate,
double factor,
double rate) {
m_pEngine->spinback(deck, activate, factor, rate);
}

Expand Down
36 changes: 21 additions & 15 deletions src/controllers/engine/controllerenginejsproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,34 @@ class ControllerEngineJSProxy : public QObject {

virtual ~ControllerEngineJSProxy();

Q_INVOKABLE double getValue(QString group, QString name);
Q_INVOKABLE void setValue(QString group, QString name, double newValue);
Q_INVOKABLE double getParameter(QString group, QString name);
Q_INVOKABLE void setParameter(QString group, QString name, double newValue);
Q_INVOKABLE double getParameterForValue(QString group, QString name, double value);
Q_INVOKABLE void reset(QString group, QString name);
Q_INVOKABLE double getDefaultValue(QString group, QString name);
Q_INVOKABLE double getDefaultParameter(QString group, QString name);
Q_INVOKABLE QJSValue makeConnection(QString group, QString name, const QJSValue callback);
Q_INVOKABLE double getValue(const QString& group, const QString& name);
Q_INVOKABLE void setValue(const QString& group, const QString& name, double newValue);
Q_INVOKABLE double getParameter(const QString& group, const QString& name);
Q_INVOKABLE void setParameter(const QString& group, const QString& name, double newValue);
Q_INVOKABLE double getParameterForValue(
const QString& group, const QString& name, double value);
Q_INVOKABLE void reset(const QString& group, const QString& name);
Q_INVOKABLE double getDefaultValue(const QString& group, const QString& name);
Q_INVOKABLE double getDefaultParameter(const QString& group, const QString& name);
Q_INVOKABLE QJSValue makeConnection(const QString& group,
const QString& name,
const QJSValue& callback);
// DEPRECATED: Use makeConnection instead.
Q_INVOKABLE QJSValue connectControl(QString group, QString name, const QJSValue passedCallback, bool disconnect = false);
Q_INVOKABLE QJSValue connectControl(const QString& group,
const QString& name,
const QJSValue& passedCallback,
bool disconnect = false);
// Called indirectly by the objects returned by connectControl
Q_INVOKABLE void trigger(QString group, QString name);
Q_INVOKABLE void log(QString message);
Q_INVOKABLE int beginTimer(int interval, QJSValue scriptCode, bool oneShot = false);
Q_INVOKABLE void trigger(const QString& group, const QString& name);
Q_INVOKABLE void log(const QString& message);
Q_INVOKABLE int beginTimer(int interval, const QJSValue& scriptCode, bool oneShot = false);
Q_INVOKABLE void stopTimer(int timerId);
Q_INVOKABLE void scratchEnable(int deck, int intervalsPerRev, double rpm, double alpha, double beta, bool ramp = true);
Q_INVOKABLE void scratchTick(int deck, int interval);
Q_INVOKABLE void scratchDisable(int deck, bool ramp = true);
Q_INVOKABLE bool isScratching(int deck);
Q_INVOKABLE void softTakeover(QString group, QString name, bool set);
Q_INVOKABLE void softTakeoverIgnoreNextValue(QString group, QString name);
Q_INVOKABLE void softTakeover(const QString& group, const QString& name, bool set);
Q_INVOKABLE void softTakeoverIgnoreNextValue(const QString& group, const QString& name);
Q_INVOKABLE void brake(int deck, bool activate, double factor = 1.0, double rate = 1.0);
Q_INVOKABLE void spinback(int deck, bool activate, double factor = 1.8, double rate = -10.0);
Q_INVOKABLE void softStart(int deck, bool activate, double factor = 1.0);
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/engine/scriptconnectionjsproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ScriptConnectionJSProxy : public QObject {
Q_PROPERTY(QString id READ readId)
Q_PROPERTY(bool isConnected READ readIsConnected)
public:
ScriptConnectionJSProxy(ScriptConnection conn) {
ScriptConnectionJSProxy(const ScriptConnection& conn) {
m_scriptConnection = conn;
m_idString = conn.id.toString();
m_isConnected = true;
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/hid/hidcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ class HidControllerJSProxy : public ControllerJSProxy {
m_pHidController(m_pController) {
}

Q_INVOKABLE void send(QList<int> data, unsigned int length = 0) override {
Q_INVOKABLE void send(const QList<int>& data, unsigned int length = 0) override {
m_pHidController->send(data, length);
}

Q_INVOKABLE void send(QList<int> data, unsigned int length, unsigned int reportID) {
Q_INVOKABLE void send(const QList<int>& data, unsigned int length, unsigned int reportID) {
m_pHidController->sendReport(data, length, reportID);
}

Expand Down
2 changes: 1 addition & 1 deletion src/controllers/midi/midicontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class MidiControllerJSProxy : public ControllerJSProxy {
m_pMidiController->sendShortMsg(status, byte1, byte2);
}

Q_INVOKABLE void sendSysexMsg(QList<int> data, unsigned int length = 0) {
Q_INVOKABLE void sendSysexMsg(const QList<int>& data, unsigned int length = 0) {
m_pMidiController->sendSysexMsg(data, length);
}

Expand Down
4 changes: 2 additions & 2 deletions src/effects/effectsmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include "util/assert.h"

namespace {
const QString kEffectGroupSeparator = "_";
const QString kGroupClose = "]";
constexpr QChar kEffectGroupSeparator = '_';
constexpr QChar kGroupClose = ']';
const unsigned int kEffectMessagPipeFifoSize = 2048;
} // anonymous namespace

Expand Down
Loading