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

@@ -38,25 +38,25 @@ public:
/// @brief Get the unique id (imported from removed class 'Stats')
/// @return The unique id
///
const QString &getID() const { return _uuid; };
QString getID() const { return _uuid; }
///
/// @brief Check authorization is required according to the user setting
/// @return True if authorization required else false
///
bool isAuthRequired() const { return _authRequired; };
bool isAuthRequired() const { return _authRequired; }
///
/// @brief Check if authorization is required for local network connections
/// @return True if authorization required else false
///
bool isLocalAuthRequired() const { return _localAuthRequired; };
bool isLocalAuthRequired() const { return _localAuthRequired; }
///
/// @brief Check if authorization is required for local network connections for admin access
/// @return True if authorization required else false
///
bool isLocalAdminAuthRequired() const { return _localAdminAuthRequired; };
bool isLocalAdminAuthRequired() const { return _localAdminAuthRequired; }
///
/// @brief Reset Hyperion user
@@ -68,18 +68,18 @@ public:
/// @brief Check if user auth is temporary blocked due to failed attempts
/// @return True on blocked and no further Auth requests will be accepted
///
bool isUserAuthBlocked() { return (_userAuthAttempts.length() >= 10); };
bool isUserAuthBlocked() const { return (_userAuthAttempts.length() >= 10); }
///
/// @brief Check if token auth is temporary blocked due to failed attempts
/// @return True on blocked and no further Auth requests will be accepted
///
bool isTokenAuthBlocked() { return (_tokenAuthAttempts.length() >= 25); };
bool isTokenAuthBlocked() const { return (_tokenAuthAttempts.length() >= 25); }
/// Pointer of this instance
static AuthManager *manager;
/// Get Pointer of this instance
static AuthManager *getInstance() { return manager; };
static AuthManager *getInstance() { return manager; }
public slots:
@@ -164,19 +164,19 @@ public slots:
/// @brief Get pending requests
/// @return All pending requests
///
QVector<AuthManager::AuthDefinition> getPendingRequests();
QVector<AuthManager::AuthDefinition> getPendingRequests() const;
///
/// @brief Get the current valid token for user. Make sure this call is allowed!
/// @param usr the defined user
/// @return The token
///
const QString getUserToken(const QString &usr = "Hyperion");
QString getUserToken(const QString &usr = "Hyperion") const;
///
/// @brief Get all available token entries
///
QVector<AuthManager::AuthDefinition> getTokenList();
QVector<AuthManager::AuthDefinition> getTokenList() const;
///
/// @brief Handle settings update from Hyperion Settingsmanager emit

View File

@@ -13,7 +13,7 @@ public:
/// Unique identifier for this color transform
QString _id;
/// The BLACK (RGB-Channel) adjustment
RgbChannelAdjustment _rgbBlackAdjustment;
/// The WHITE (RGB-Channel) adjustment

View File

@@ -20,7 +20,7 @@ class ComponentRegister : public QObject
public:
ComponentRegister(Hyperion* hyperion);
~ComponentRegister();
~ComponentRegister() override;
///
/// @brief Check if a component is currently enabled
@@ -30,7 +30,7 @@ public:
int isComponentEnabled(hyperion::Components comp) const;
/// contains all components and their state
std::map<hyperion::Components, bool> getRegister() const { return _componentStates; };
std::map<hyperion::Components, bool> getRegister() const { return _componentStates; }
signals:
///

View File

@@ -22,7 +22,7 @@ class Grabber : public QObject
Q_OBJECT
public:
Grabber(QString grabberName = "", int width=0, int height=0, int cropLeft=0, int cropRight=0, int cropTop=0, int cropBottom=0);
Grabber(const QString& grabberName = "", int width=0, int height=0, int cropLeft=0, int cropRight=0, int cropTop=0, int cropBottom=0);
///
/// Set the video mode (2D/3D)
@@ -119,35 +119,35 @@ public:
/// @brief Get a list of all available V4L devices
/// @return List of all available V4L devices on success else empty List
///
virtual QStringList getV4L2devices() { return QStringList(); }
virtual QStringList getV4L2devices() const { return QStringList(); }
///
/// @brief Get the V4L device name
/// @param devicePath The device path
/// @return The name of the V4L device on success else empty String
///
virtual QString getV4L2deviceName(QString devicePath) { return QString(); }
virtual QString getV4L2deviceName(const QString& /*devicePath*/) const { return QString(); }
///
/// @brief Get a name/index pair of supported device inputs
/// @param devicePath The device path
/// @return multi pair of name/index on success else empty pair
///
virtual QMultiMap<QString, int> getV4L2deviceInputs(QString devicePath) { return QMultiMap<QString, int>(); }
virtual QMultiMap<QString, int> getV4L2deviceInputs(const QString& /*devicePath*/) const { return QMultiMap<QString, int>(); }
///
/// @brief Get a list of supported device resolutions
/// @param devicePath The device path
/// @return List of resolutions on success else empty List
///
virtual QStringList getResolutions(QString devicePath) { return QStringList(); }
virtual QStringList getResolutions(const QString& /*devicePath*/) const { return QStringList(); }
///
/// @brief Get a list of supported device framerates
/// @param devicePath The device path
/// @return List of framerates on success else empty List
///
virtual QStringList getFramerates(QString devicePath) { return QStringList(); }
virtual QStringList getFramerates(const QString& devicePath) const { return QStringList(); }
protected:
ImageResampler _imageResampler;

View File

@@ -29,9 +29,9 @@ class GrabberWrapper : public QObject
{
Q_OBJECT
public:
GrabberWrapper(QString grabberName, Grabber * ggrabber, unsigned width, unsigned height, unsigned updateRate_Hz = 0);
GrabberWrapper(const QString& grabberName, Grabber * ggrabber, unsigned width, unsigned height, unsigned updateRate_Hz = 0);
virtual ~GrabberWrapper();
~GrabberWrapper() override;
static GrabberWrapper* instance;
static GrabberWrapper* getInstance(){ return instance; }
@@ -60,35 +60,35 @@ public:
/// @brief Get a list of all available V4L devices
/// @return List of all available V4L devices on success else empty List
///
virtual QStringList getV4L2devices();
virtual QStringList getV4L2devices() const;
///
/// @brief Get the V4L device name
/// @param devicePath The device path
/// @return The name of the V4L device on success else empty String
///
virtual QString getV4L2deviceName(QString devicePath);
virtual QString getV4L2deviceName(const QString& devicePath) const;
///
/// @brief Get a name/index pair of supported device inputs
/// @param devicePath The device path
/// @return multi pair of name/index on success else empty pair
///
virtual QMultiMap<QString, int> getV4L2deviceInputs(QString devicePath);
virtual QMultiMap<QString, int> getV4L2deviceInputs(const QString& devicePath) const;
///
/// @brief Get a list of supported device resolutions
/// @param devicePath The device path
/// @return List of resolutions on success else empty List
///
virtual QStringList getResolutions(QString devicePath);
virtual QStringList getResolutions(const QString& devicePath) const;
///
/// @brief Get a list of supported device framerates
/// @param devicePath The device path
/// @return List of framerates on success else empty List
///
virtual QStringList getFramerates(QString devicePath);
virtual QStringList getFramerates(const QString& devicePath) const;
static QStringList availableGrabbers();

View File

@@ -168,7 +168,7 @@ public slots:
/// Returns the list with unique adjustment identifiers
/// @return The list with adjustment identifiers
///
const QStringList & getAdjustmentIds() const;
QStringList getAdjustmentIds() const;
///
/// Returns the ColorAdjustment with the given identifier
@@ -233,15 +233,15 @@ public slots:
/// Get the list of available effects
/// @return The list of available effects
const std::list<EffectDefinition> &getEffects() const;
std::list<EffectDefinition> getEffects() const;
/// Get the list of active effects
/// @return The list of active effects
const std::list<ActiveEffectDefinition> &getActiveEffects() const;
std::list<ActiveEffectDefinition> getActiveEffects() const;
/// Get the list of available effect schema files
/// @return The list of available effect schema files
const std::list<EffectSchema> &getEffectSchemas() const;
std::list<EffectSchema> getEffectSchemas() const;
/// #############
/// PRIORITYMUXER
@@ -266,7 +266,7 @@ public slots:
/// gets current state of automatic/priorized source selection
/// @return the state
bool sourceAutoSelectEnabled();
bool sourceAutoSelectEnabled() const;
///
/// Returns the current priority
@@ -309,7 +309,7 @@ public slots:
/// gets the current json config object from SettingsManager
/// @return json config
const QJsonObject& getQJsonConfig() const;
QJsonObject getQJsonConfig() const;
///
/// @brief Save a complete json config
@@ -317,7 +317,7 @@ public slots:
/// @param correct If true will correct json against schema before save
/// @return True on success else false
///
bool saveSettings(QJsonObject config, bool correct = false);
bool saveSettings(const QJsonObject& config, bool correct = false);
/// ############
/// COMPONENTREGISTER
@@ -345,7 +345,7 @@ public slots:
/// @param The component to test
/// @return Component state
///
int isComponentEnabled(hyperion::Components comp);
int isComponentEnabled(hyperion::Components comp) const;
/// sets the methode how image is maped to leds at ImageProcessor
void setLedMappingType(int mappingType);
@@ -402,10 +402,10 @@ signals:
void forwardJsonMessage(QJsonObject);
/// Signal which is emitted, when a new system proto image should be forwarded
void forwardSystemProtoMessage(const QString, const Image<ColorRgb>);
void forwardSystemProtoMessage(const QString&, const Image<ColorRgb>&);
/// Signal which is emitted, when a new V4l proto image should be forwarded
void forwardV4lProtoMessage(const QString, const Image<ColorRgb>);
void forwardV4lProtoMessage(const QString&, const Image<ColorRgb>&);
///
/// @brief Is emitted from clients who request a videoMode change

View File

@@ -38,7 +38,7 @@ public slots:
/// @param inst The instance to check
/// @return True when running else false
///
bool IsInstanceRunning(quint8 inst) { return _runningInstances.contains(inst); }
bool IsInstanceRunning(quint8 inst) const { return _runningInstances.contains(inst); }
///
/// @brief Get a Hyperion instance by index
@@ -50,7 +50,7 @@ public slots:
///
/// @brief Get instance data of all instaces in db + running state
///
const QVector<QVariantMap> getInstanceData();
QVector<QVariantMap> getInstanceData() const;
///
/// @brief Start a Hyperion instance
@@ -172,7 +172,7 @@ private:
/// @brief check if a instance is allowed for management. Instance 0 represents the root instance
/// @apram inst The instance to check
///
bool isInstAllowed(quint8 inst) { return (inst > 0); }
bool isInstAllowed(quint8 inst) const { return (inst > 0); }
private:
Logger* _log;

View File

@@ -36,7 +36,7 @@ public:
///
ImageProcessor(const LedString& ledString, Hyperion* hyperion);
~ImageProcessor();
~ImageProcessor() override;
///
/// Specifies the width and height of 'incomming' images. This will resize the buffer-image to
@@ -54,15 +54,15 @@ public:
void setLedString(const LedString& ledString);
/// Returns starte of black border detector
bool blackBorderDetectorEnabled();
bool blackBorderDetectorEnabled() const;
/// Returns the current _userMappingType, this may not be the current applied type!
int getUserLedMappingType() { return _userMappingType; };
int getUserLedMappingType() const { return _userMappingType; }
/// Returns the current _mappingType
int ledMappingType() { return _mappingType; };
int ledMappingType() const { return _mappingType; }
static int mappingTypeToInt(QString mappingType);
static int mappingTypeToInt(const QString& mappingType);
static QString mappingTypeToStr(int mappingType);
///

View File

@@ -57,8 +57,8 @@ namespace hyperion
///
unsigned height() const;
unsigned horizontalBorder() { return _horizontalBorder; };
unsigned verticalBorder() { return _verticalBorder; };
unsigned horizontalBorder() const { return _horizontalBorder; }
unsigned verticalBorder() const { return _verticalBorder; }
///
/// Determines the mean color for each led using the mapping the image given

View File

@@ -20,7 +20,7 @@ enum class ColorOrder
ORDER_RGB, ORDER_RBG, ORDER_GRB, ORDER_BRG, ORDER_GBR, ORDER_BGR
};
inline QString colorOrderToString(const ColorOrder colorOrder)
inline QString colorOrderToString(ColorOrder colorOrder)
{
switch (colorOrder)
{

View File

@@ -34,10 +34,10 @@ class MessageForwarder : public QObject
Q_OBJECT
public:
MessageForwarder(Hyperion* hyperion);
~MessageForwarder();
~MessageForwarder() override;
void addJsonSlave(QString slave);
void addFlatbufferSlave(QString slave);
void addJsonSlave(const QString& slave);
void addFlatbufferSlave(const QString& slave);
private slots:
///

View File

@@ -26,7 +26,7 @@ public:
*/
void addAdjustment(ColorAdjustment * adjustment);
void setAdjustmentForLed(const QString& id, const unsigned startLed, unsigned endLed);
void setAdjustmentForLed(const QString& id, unsigned startLed, unsigned endLed);
bool verifyAdjustments() const;
@@ -36,7 +36,7 @@ public:
/// Returns the identifier of all the unique ColorAdjustment
///
/// @return The list with unique id's of the ColorAdjustment
const QStringList & getAdjustmentIds();
QStringList getAdjustmentIds() const;
///
/// Returns the pointer to the ColorAdjustment with the given id

View File

@@ -68,7 +68,7 @@ public:
///
/// Destructor
///
~PriorityMuxer();
~PriorityMuxer() override;
///
/// @brief Start/Stop the PriorityMuxer update timer; On disabled no priority and timeout updates will be performend
@@ -185,7 +185,7 @@ public:
///
/// @brief Queue a manual push where muxer doesn't recognize them (e.g. continous single color pushes)
///
void queuePush(){ emit timeRunner(); };
void queuePush() { emit timeRunner(); }
signals:
///
@@ -253,7 +253,7 @@ private:
/// @brief Get the component of the given priority
/// @return The component
///
hyperion::Components getComponentOfPriority(int priority);
hyperion::Components getComponentOfPriority(int priority) const;
/// Logger instance
Logger* _log;