Const correctness, override keyword, a bunch of stuff..

This commit is contained in:
Murat
2020-08-08 23:12:43 +02:00
parent 4099d12d9a
commit 4a688b932a
144 changed files with 622 additions and 566 deletions

View File

@@ -61,7 +61,7 @@ AuthManager::AuthDefinition AuthManager::createToken(const QString &comment)
return def;
}
QVector<AuthManager::AuthDefinition> AuthManager::getTokenList()
QVector<AuthManager::AuthDefinition> AuthManager::getTokenList() const
{
QVector<QVariantMap> vector = _authTable->getTokenList();
QVector<AuthManager::AuthDefinition> finalVec;
@@ -79,7 +79,7 @@ QVector<AuthManager::AuthDefinition> AuthManager::getTokenList()
return finalVec;
}
const QString AuthManager::getUserToken(const QString &usr)
QString AuthManager::getUserToken(const QString &usr) const
{
QString tok = _authTable->getUserToken(usr);
return QString(_authTable->getUserToken(usr));
@@ -192,7 +192,7 @@ void AuthManager::handlePendingTokenRequest(const QString &id, bool accept)
}
}
QVector<AuthManager::AuthDefinition> AuthManager::getPendingRequests()
QVector<AuthManager::AuthDefinition> AuthManager::getPendingRequests() const
{
QVector<AuthManager::AuthDefinition> finalVec;
for (const auto &entry : _pendingRequests)

View File

@@ -1,7 +1,6 @@
#include <hyperion/Grabber.h>
Grabber::Grabber(QString grabberName, int width, int height, int cropLeft, int cropRight, int cropTop, int cropBottom)
Grabber::Grabber(const QString& grabberName, int width, int height, int cropLeft, int cropRight, int cropTop, int cropBottom)
: _imageResampler()
, _useImageResampler(true)
, _videoMode(VideoMode::VIDEO_2D)

View File

@@ -11,7 +11,7 @@
GrabberWrapper* GrabberWrapper::instance = nullptr;
GrabberWrapper::GrabberWrapper(QString grabberName, Grabber * ggrabber, unsigned width, unsigned height, unsigned updateRate_Hz)
GrabberWrapper::GrabberWrapper(const QString& grabberName, Grabber * ggrabber, unsigned width, unsigned height, unsigned updateRate_Hz)
: _grabberName(grabberName)
, _timer(new QTimer(this))
, _updateInterval_ms(1000/updateRate_Hz)
@@ -201,7 +201,7 @@ void GrabberWrapper::tryStart()
}
}
QStringList GrabberWrapper::getV4L2devices()
QStringList GrabberWrapper::getV4L2devices() const
{
if(_grabberName.startsWith("V4L"))
return _ggrabber->getV4L2devices();
@@ -209,7 +209,7 @@ QStringList GrabberWrapper::getV4L2devices()
return QStringList();
}
QString GrabberWrapper::getV4L2deviceName(QString devicePath)
QString GrabberWrapper::getV4L2deviceName(const QString& devicePath) const
{
if(_grabberName.startsWith("V4L"))
return _ggrabber->getV4L2deviceName(devicePath);
@@ -217,7 +217,7 @@ QString GrabberWrapper::getV4L2deviceName(QString devicePath)
return QString();
}
QMultiMap<QString, int> GrabberWrapper::getV4L2deviceInputs(QString devicePath)
QMultiMap<QString, int> GrabberWrapper::getV4L2deviceInputs(const QString& devicePath) const
{
if(_grabberName.startsWith("V4L"))
return _ggrabber->getV4L2deviceInputs(devicePath);
@@ -225,7 +225,7 @@ QMultiMap<QString, int> GrabberWrapper::getV4L2deviceInputs(QString devicePath)
return QMultiMap<QString, int>();
}
QStringList GrabberWrapper::getResolutions(QString devicePath)
QStringList GrabberWrapper::getResolutions(const QString& devicePath) const
{
if(_grabberName.startsWith("V4L"))
return _ggrabber->getResolutions(devicePath);
@@ -233,7 +233,7 @@ QStringList GrabberWrapper::getResolutions(QString devicePath)
return QStringList();
}
QStringList GrabberWrapper::getFramerates(QString devicePath)
QStringList GrabberWrapper::getFramerates(const QString& devicePath) const
{
if(_grabberName.startsWith("V4L"))
return _ggrabber->getFramerates(devicePath);

View File

@@ -255,7 +255,7 @@ QJsonDocument Hyperion::getSetting(settings::type type) const
return _settingsManager->getSetting(type);
}
bool Hyperion::saveSettings(QJsonObject config, bool correct)
bool Hyperion::saveSettings(const QJsonObject& config, bool correct)
{
return _settingsManager->saveSettings(config, correct);
}
@@ -290,7 +290,7 @@ bool Hyperion::setVisiblePriority(int priority)
return _muxer.setPriority(priority);
}
bool Hyperion::sourceAutoSelectEnabled()
bool Hyperion::sourceAutoSelectEnabled() const
{
return _muxer.isSourceAutoSelectEnabled();
}
@@ -305,7 +305,7 @@ std::map<hyperion::Components, bool> Hyperion::getAllComponents() const
return _componentRegister.getRegister();
}
int Hyperion::isComponentEnabled(hyperion::Components comp)
int Hyperion::isComponentEnabled(hyperion::Components comp) const
{
return _componentRegister.isComponentEnabled(comp);
}
@@ -396,7 +396,7 @@ end:
_muxer.queuePush();
}
const QStringList & Hyperion::getAdjustmentIds() const
QStringList Hyperion::getAdjustmentIds() const
{
return _raw2ledAdjustment->getAdjustmentIds();
}
@@ -464,22 +464,22 @@ QString Hyperion::deleteEffect(const QString& effectName)
return _effectEngine->deleteEffect(effectName);
}
const std::list<EffectDefinition> & Hyperion::getEffects() const
std::list<EffectDefinition> Hyperion::getEffects() const
{
return _effectEngine->getEffects();
}
const std::list<ActiveEffectDefinition> & Hyperion::getActiveEffects() const
std::list<ActiveEffectDefinition> Hyperion::getActiveEffects() const
{
return _effectEngine->getActiveEffects();
}
const std::list<EffectSchema> & Hyperion::getEffectSchemas() const
std::list<EffectSchema> Hyperion::getEffectSchemas() const
{
return _effectEngine->getEffectSchemas();
}
const QJsonObject& Hyperion::getQJsonConfig() const
QJsonObject Hyperion::getQJsonConfig() const
{
return _settingsManager->getSettings();
}

View File

@@ -28,7 +28,7 @@ Hyperion* HyperionIManager::getHyperionInstance(quint8 instance)
return _runningInstances.value(0);
}
const QVector<QVariantMap> HyperionIManager::getInstanceData()
QVector<QVariantMap> HyperionIManager::getInstanceData() const
{
QVector<QVariantMap> instances = _instanceTable->getAllInstances();
for( auto & entry : instances)

View File

@@ -10,7 +10,7 @@
using namespace hyperion;
// global transform method
int ImageProcessor::mappingTypeToInt(QString mappingType)
int ImageProcessor::mappingTypeToInt(const QString& mappingType)
{
if (mappingType == "unicolor_mean" )
return 1;
@@ -99,7 +99,7 @@ void ImageProcessor::setBlackbarDetectDisable(bool enable)
_borderProcessor->setHardDisable(enable);
}
bool ImageProcessor::blackBorderDetectorEnabled()
bool ImageProcessor::blackBorderDetectorEnabled() const
{
return _borderProcessor->enabled();
}

View File

@@ -156,7 +156,7 @@ void MessageForwarder::handlePriorityChanges(quint8 priority)
}
}
void MessageForwarder::addJsonSlave(QString slave)
void MessageForwarder::addJsonSlave(const QString& slave)
{
QStringList parts = slave.split(":");
if (parts.size() != 2)
@@ -185,7 +185,7 @@ void MessageForwarder::addJsonSlave(QString slave)
_jsonSlaves << slave;
}
void MessageForwarder::addFlatbufferSlave(QString slave)
void MessageForwarder::addFlatbufferSlave(const QString& slave)
{
QStringList parts = slave.split(":");
if (parts.size() != 2)

View File

@@ -67,7 +67,7 @@ bool MultiColorAdjustment::verifyAdjustments() const
return ok;
}
const QStringList & MultiColorAdjustment::getAdjustmentIds()
QStringList MultiColorAdjustment::getAdjustmentIds() const
{
return _adjustmentIds;
}

View File

@@ -133,7 +133,7 @@ PriorityMuxer::InputInfo PriorityMuxer::getInputInfo(int priority) const
return elemIt.value();
}
hyperion::Components PriorityMuxer::getComponentOfPriority(int priority)
hyperion::Components PriorityMuxer::getComponentOfPriority(int priority) const
{
return _activeInputs[priority].componentId;
}

View File

@@ -130,7 +130,7 @@ bool SettingsManager::saveSettings(QJsonObject config, bool correct)
Warning(_log,"Fixing json data!");
config = schemaChecker.getAutoCorrectedConfig(config);
for (auto & schemaError : schemaChecker.getMessages())
for (const auto & schemaError : schemaChecker.getMessages())
Warning(_log, "Config Fix: %s", QSTRING_CSTR(schemaError));
}