From 4a688b932a261e1398fcf3b73f16c87911195448 Mon Sep 17 00:00:00 2001 From: Murat Date: Sat, 8 Aug 2020 23:12:43 +0200 Subject: [PATCH] Const correctness, override keyword, a bunch of stuff.. --- include/blackborder/BlackBorderProcessor.h | 2 +- include/boblightserver/BoblightServer.h | 4 +- include/bonjour/bonjourservicebrowser.h | 2 +- include/bonjour/bonjourserviceregister.h | 14 +- include/bonjour/bonjourserviceresolver.h | 4 +- include/commandline/ColorOption.h | 6 +- include/commandline/ColorsOption.h | 6 +- include/commandline/ImageOption.h | 8 +- include/commandline/IntOption.h | 15 +- include/commandline/Option.h | 9 +- include/commandline/Parser.h | 140 +++++++++++------- include/commandline/RegularExpressionOption.h | 30 +++- include/commandline/SwitchOption.h | 2 - include/commandline/ValidatorOption.h | 3 + include/db/AuthTable.h | 1 - include/db/DBManager.h | 2 +- include/db/InstanceTable.h | 2 - include/db/MetaTable.h | 3 +- include/db/SettingsTable.h | 1 - include/effectengine/Effect.h | 10 +- include/effectengine/EffectEngine.h | 10 +- include/effectengine/EffectFileHandler.h | 4 +- include/flatbufserver/FlatBufferConnection.h | 2 +- include/flatbufserver/FlatBufferServer.h | 2 +- include/grabber/V4L2Grabber.h | 30 ++-- include/grabber/V4L2Wrapper.h | 6 +- include/grabber/VideoStandard.h | 10 +- include/hyperion/AuthManager.h | 20 +-- include/hyperion/ColorAdjustment.h | 2 +- include/hyperion/ComponentRegister.h | 4 +- include/hyperion/Grabber.h | 12 +- include/hyperion/GrabberWrapper.h | 14 +- include/hyperion/Hyperion.h | 20 +-- include/hyperion/HyperionIManager.h | 6 +- include/hyperion/ImageProcessor.h | 10 +- include/hyperion/ImageToLedsMap.h | 4 +- include/hyperion/LedString.h | 2 +- include/hyperion/MessageForwarder.h | 6 +- include/hyperion/MultiColorAdjustment.h | 4 +- include/hyperion/PriorityMuxer.h | 6 +- include/jsonserver/JsonServer.h | 2 +- include/leddevice/LedDeviceFactory.h | 5 +- include/leddevice/LedDeviceWrapper.h | 10 +- include/python/PythonInit.h | 2 +- include/ssdp/SSDPDiscover.h | 4 +- include/ssdp/SSDPHandler.h | 5 +- include/ssdp/SSDPServer.h | 11 +- include/utils/Components.h | 30 ++-- include/utils/FileUtils.h | 4 +- include/utils/Logger.h | 4 +- include/utils/NetOrigin.h | 4 +- include/utils/PixelFormat.h | 18 +-- include/utils/Process.h | 2 +- include/utils/Profiler.h | 4 +- include/utils/RgbToRgbw.h | 3 +- include/utils/VideoMode.h | 8 +- include/utils/jsonschema/QJsonSchemaChecker.h | 2 +- include/utils/jsonschema/QJsonUtils.h | 16 +- include/utils/settings.h | 2 +- include/webserver/WebServer.h | 3 +- libsrc/api/JsonAPI.cpp | 2 +- libsrc/blackborder/BlackBorderProcessor.cpp | 4 +- libsrc/boblightserver/BoblightServer.cpp | 2 +- libsrc/bonjour/bonjourserviceregister.cpp | 2 +- libsrc/commandline/Option.cpp | 9 +- libsrc/effectengine/EffectEngine.cpp | 10 +- libsrc/grabber/amlogic/IonBuffer.h | 2 - .../dispmanx/DispmanxFrameGrabberMock.cpp | 8 +- libsrc/grabber/osx/OsxFrameGrabberMock.cpp | 8 +- libsrc/grabber/v4l2/V4L2Grabber.cpp | 18 +-- libsrc/grabber/v4l2/V4L2Wrapper.cpp | 14 +- libsrc/hyperion/AuthManager.cpp | 6 +- libsrc/hyperion/Grabber.cpp | 3 +- libsrc/hyperion/GrabberWrapper.cpp | 12 +- libsrc/hyperion/Hyperion.cpp | 16 +- libsrc/hyperion/HyperionIManager.cpp | 2 +- libsrc/hyperion/ImageProcessor.cpp | 4 +- libsrc/hyperion/MessageForwarder.cpp | 4 +- libsrc/hyperion/MultiColorAdjustment.cpp | 2 +- libsrc/hyperion/PriorityMuxer.cpp | 2 +- libsrc/hyperion/SettingsManager.cpp | 2 +- libsrc/leddevice/LedDeviceTemplate.h | 8 +- libsrc/leddevice/LedDeviceWrapper.cpp | 10 +- .../dev_hid/LedDeviceHyperionUsbasp.h | 6 +- libsrc/leddevice/dev_hid/LedDeviceLightpack.h | 12 +- .../dev_hid/LedDeviceMultiLightpack.h | 10 +- libsrc/leddevice/dev_hid/LedDevicePaintpack.h | 4 +- libsrc/leddevice/dev_hid/LedDeviceRawHID.h | 4 +- libsrc/leddevice/dev_hid/ProviderHID.cpp | 14 +- libsrc/leddevice/dev_hid/ProviderHID.h | 10 +- libsrc/leddevice/dev_net/LedDeviceAtmoOrb.h | 10 +- .../leddevice/dev_net/LedDeviceFadeCandy.cpp | 4 +- libsrc/leddevice/dev_net/LedDeviceFadeCandy.h | 14 +- .../leddevice/dev_net/LedDeviceNanoleaf.cpp | 4 +- libsrc/leddevice/dev_net/LedDeviceNanoleaf.h | 16 +- .../leddevice/dev_net/LedDevicePhilipsHue.cpp | 24 +-- .../leddevice/dev_net/LedDevicePhilipsHue.h | 52 +++---- libsrc/leddevice/dev_net/LedDeviceTpm2net.h | 4 +- libsrc/leddevice/dev_net/LedDeviceUdpArtNet.h | 4 +- libsrc/leddevice/dev_net/LedDeviceUdpE131.h | 4 +- libsrc/leddevice/dev_net/LedDeviceUdpH801.h | 4 +- libsrc/leddevice/dev_net/LedDeviceUdpRaw.h | 4 +- libsrc/leddevice/dev_net/LedDeviceWled.cpp | 4 +- libsrc/leddevice/dev_net/LedDeviceWled.h | 16 +- .../leddevice/dev_net/LedDeviceYeelight.cpp | 6 +- libsrc/leddevice/dev_net/LedDeviceYeelight.h | 29 ++-- libsrc/leddevice/dev_net/ProviderRestApi.h | 3 +- libsrc/leddevice/dev_net/ProviderUdp.h | 8 +- libsrc/leddevice/dev_net/ProviderUdpSSL.cpp | 2 +- libsrc/leddevice/dev_net/ProviderUdpSSL.h | 10 +- libsrc/leddevice/dev_other/LedDeviceFile.h | 10 +- .../leddevice/dev_other/LedDevicePiBlaster.h | 6 +- .../leddevice/dev_rpi_pwm/LedDeviceWS281x.cpp | 4 +- .../leddevice/dev_rpi_pwm/LedDeviceWS281x.h | 10 +- .../leddevice/dev_serial/LedDeviceAdalight.h | 4 +- libsrc/leddevice/dev_serial/LedDeviceAtmo.h | 4 +- libsrc/leddevice/dev_serial/LedDeviceDMX.h | 6 +- libsrc/leddevice/dev_serial/LedDeviceKarate.h | 4 +- libsrc/leddevice/dev_serial/LedDeviceSedu.h | 4 +- libsrc/leddevice/dev_serial/LedDeviceTpm2.h | 4 +- libsrc/leddevice/dev_serial/ProviderRs232.h | 18 +-- libsrc/leddevice/dev_spi/LedDeviceAPA102.h | 4 +- libsrc/leddevice/dev_spi/LedDeviceAPA104.h | 4 +- libsrc/leddevice/dev_spi/LedDeviceLpd6803.h | 4 +- libsrc/leddevice/dev_spi/LedDeviceLpd8806.h | 4 +- libsrc/leddevice/dev_spi/LedDeviceP9813.h | 4 +- libsrc/leddevice/dev_spi/LedDeviceSk6812SPI.h | 4 +- libsrc/leddevice/dev_spi/LedDeviceSk6822SPI.h | 4 +- libsrc/leddevice/dev_spi/LedDeviceWs2801.h | 4 +- libsrc/leddevice/dev_spi/LedDeviceWs2812SPI.h | 4 +- libsrc/leddevice/dev_spi/ProviderSpi.h | 8 +- .../dev_tinker/LedDeviceTinkerforge.h | 8 +- libsrc/ssdp/SSDPDiscover.cpp | 8 +- libsrc/utils/FileUtils.cpp | 4 +- libsrc/utils/Logger.cpp | 2 +- libsrc/utils/NetOrigin.cpp | 4 +- libsrc/utils/Process.cpp | 4 +- libsrc/utils/Profiler.cpp | 4 +- libsrc/utils/RgbToRgbw.cpp | 2 +- .../utils/jsonschema/QJsonSchemaChecker.cpp | 2 +- libsrc/webserver/CgiHandler.h | 9 +- libsrc/webserver/QtHttpServer.h | 2 +- libsrc/webserver/StaticFileServing.h | 9 +- libsrc/webserver/WebSocketClient.h | 3 +- 144 files changed, 622 insertions(+), 566 deletions(-) diff --git a/include/blackborder/BlackBorderProcessor.h b/include/blackborder/BlackBorderProcessor.h index 9741139d..bfbd4d9d 100644 --- a/include/blackborder/BlackBorderProcessor.h +++ b/include/blackborder/BlackBorderProcessor.h @@ -25,7 +25,7 @@ namespace hyperion Q_OBJECT public: BlackBorderProcessor(Hyperion* hyperion, QObject* parent); - ~BlackBorderProcessor(); + ~BlackBorderProcessor() override; /// /// Return the current (detected) border /// @return The current border diff --git a/include/boblightserver/BoblightServer.h b/include/boblightserver/BoblightServer.h index fddfe137..153177e1 100644 --- a/include/boblightserver/BoblightServer.h +++ b/include/boblightserver/BoblightServer.h @@ -32,7 +32,7 @@ public: /// @param port port number on which to start listening for connections /// BoblightServer(Hyperion* hyperion, const QJsonDocument& config); - ~BoblightServer(); + ~BoblightServer() override; /// /// @return the port number on which this TCP listens for incoming connections @@ -41,7 +41,7 @@ public: /// @return true if server is active (bind to a port) /// - bool active(); + bool active() const; public slots: /// diff --git a/include/bonjour/bonjourservicebrowser.h b/include/bonjour/bonjourservicebrowser.h index 948fdb9f..6c6874c7 100644 --- a/include/bonjour/bonjourservicebrowser.h +++ b/include/bonjour/bonjourservicebrowser.h @@ -44,7 +44,7 @@ class BonjourServiceBrowser : public QObject Q_OBJECT public: BonjourServiceBrowser(QObject *parent = 0); - ~BonjourServiceBrowser(); + ~BonjourServiceBrowser() override; void browseForServiceType(const QString &serviceType); inline QList currentRecords() const { return bonjourRecords; } inline QString serviceType() const { return browsingType; } diff --git a/include/bonjour/bonjourserviceregister.h b/include/bonjour/bonjourserviceregister.h index 621a0dbc..d656dd08 100644 --- a/include/bonjour/bonjourserviceregister.h +++ b/include/bonjour/bonjourserviceregister.h @@ -45,13 +45,13 @@ class BonjourServiceRegister : public QObject Q_OBJECT public: BonjourServiceRegister(QObject *parent = 0); - ~BonjourServiceRegister(); + ~BonjourServiceRegister() override; - void registerService(const QString& service, int port); - void registerService(const BonjourRecord &record, quint16 servicePort, std::vector> txt = std::vector>()); - inline BonjourRecord registeredRecord() const {return finalRecord; } + void registerService(const QString& service, int port); + void registerService(const BonjourRecord &record, quint16 servicePort, const std::vector>& txt = {}); + inline BonjourRecord registeredRecord() const { return finalRecord; } - quint16 getPort() const { return _port; }; + quint16 getPort() const { return _port; } signals: void error(DNSServiceErrorType error); @@ -69,8 +69,8 @@ private: QSocketNotifier *bonjourSocket; BonjourRecord finalRecord; - // current port - quint16 _port = 0; + // current port + quint16 _port = 0; }; #endif // BONJOURSERVICEREGISTER_H diff --git a/include/bonjour/bonjourserviceresolver.h b/include/bonjour/bonjourserviceresolver.h index ed10e1ba..5ff1ebcb 100644 --- a/include/bonjour/bonjourserviceresolver.h +++ b/include/bonjour/bonjourserviceresolver.h @@ -44,8 +44,8 @@ class BonjourServiceResolver : public QObject { Q_OBJECT public: - BonjourServiceResolver(QObject *parent); - ~BonjourServiceResolver(); + BonjourServiceResolver(QObject *parent); + ~BonjourServiceResolver() override; bool resolveBonjourRecord(const BonjourRecord &record); diff --git a/include/commandline/ColorOption.h b/include/commandline/ColorOption.h index 1814143c..a2ec42e3 100644 --- a/include/commandline/ColorOption.h +++ b/include/commandline/ColorOption.h @@ -12,6 +12,7 @@ class ColorOption: public Option { protected: QColor _color; + public: ColorOption(const QString &name, const QString &description = QString(), @@ -31,9 +32,8 @@ public: : Option(other) {} - virtual bool validate(Parser & parser, QString & value) override; - QColor getColor(Parser &parser) - { return _color; } + bool validate(Parser & parser, QString & value) override; + QColor getColor(Parser &parser) const { return _color; } }; } diff --git a/include/commandline/ColorsOption.h b/include/commandline/ColorsOption.h index eafe1b07..299d44bf 100644 --- a/include/commandline/ColorsOption.h +++ b/include/commandline/ColorsOption.h @@ -12,6 +12,7 @@ class ColorsOption: public Option { protected: QList _colors; + public: ColorsOption(const QString &name, const QString &description = QString(), @@ -20,6 +21,7 @@ public: ) : Option(name, description, valueName, defaultValue) {} + ColorsOption(const QStringList &names, const QString &description = QString(), const QString &valueName = QString(), @@ -27,13 +29,13 @@ public: ) : Option(names, description, valueName, defaultValue) {} + ColorsOption(const QCommandLineOption &other) : Option(other) {} virtual bool validate(Parser & parser, QString & value) override; - QList &getColors(Parser &parser) - { return _colors; } + QList getColors(Parser &parser) const { return _colors; } }; } diff --git a/include/commandline/ImageOption.h b/include/commandline/ImageOption.h index 535d501e..83c3768c 100644 --- a/include/commandline/ImageOption.h +++ b/include/commandline/ImageOption.h @@ -12,6 +12,7 @@ class ImageOption: public Option { protected: QImage _image; + public: ImageOption(const QString &name, const QString &description = QString(), @@ -20,6 +21,7 @@ public: ) : Option(name, description, valueName, defaultValue) {} + ImageOption(const QStringList &names, const QString &description = QString(), const QString &valueName = QString(), @@ -27,13 +29,13 @@ public: ) : Option(names, description, valueName, defaultValue) {} + ImageOption(const QCommandLineOption &other) : Option(other) {} - virtual bool validate(Parser & parser, QString & value) override; - QImage &getImage(Parser &parser) - { return _image; } + bool validate(Parser & parser, QString & value) override; + QImage& getImage(Parser &parser) { return _image; } }; } diff --git a/include/commandline/IntOption.h b/include/commandline/IntOption.h index 2f59fae3..806bf0bb 100644 --- a/include/commandline/IntOption.h +++ b/include/commandline/IntOption.h @@ -12,6 +12,7 @@ class IntOption: public ValidatorOption { protected: int _int; + public: IntOption(const QString &name, const QString &description = QString(), @@ -19,18 +20,26 @@ public: const QString &defaultValue = QString(), int minimum = std::numeric_limits::min(), int maximum = std::numeric_limits::max()) : ValidatorOption(name, description, valueName, defaultValue) - { setValidator(new QIntValidator(minimum, maximum)); } + { + setValidator(new QIntValidator(minimum, maximum)); + } + IntOption(const QStringList &names, const QString &description = QString(), const QString &valueName = QString(), const QString &defaultValue = QString(), int minimum = std::numeric_limits::min(), int maximum = std::numeric_limits::max()) : ValidatorOption(names, description, valueName, defaultValue) - { setValidator(new QIntValidator(minimum, maximum)); } + { + setValidator(new QIntValidator(minimum, maximum)); + } + IntOption(const QCommandLineOption &other, int minimum = std::numeric_limits::min(), int maximum = std::numeric_limits::max()) : ValidatorOption(other) - { setValidator(new QIntValidator(minimum, maximum)); } + { + setValidator(new QIntValidator(minimum, maximum)); + } int getInt(Parser &parser, bool *ok = 0, int base = 10); int *getIntPtr(Parser &parser, bool *ok = 0, int base = 10); diff --git a/include/commandline/Option.h b/include/commandline/Option.h index 43ab70ee..b84526fa 100644 --- a/include/commandline/Option.h +++ b/include/commandline/Option.h @@ -26,13 +26,12 @@ public: ); Option(const QCommandLineOption &other); - virtual ~Option() = default; virtual bool validate(Parser &parser, QString &value); - QString name(); - QString getError(); - QString value(Parser &parser); - const char* getCString(Parser &parser); + QString name() const; + QString getError() const; + QString value(Parser &parser) const; + const char* getCString(Parser &parser) const; protected: QString _error; diff --git a/include/commandline/Parser.h b/include/commandline/Parser.h index 7b1a806e..b315787e 100644 --- a/include/commandline/Parser.h +++ b/include/commandline/Parser.h @@ -93,76 +93,108 @@ public: return *option; } - Parser(QString description=QString()) + Parser(const QString& description = QString()) { - if(description.size())setApplicationDescription(description); + if(description.size()) + setApplicationDescription(description); }; - + QCommandLineOption addHelpOption() { return _parser.addHelpOption(); }; - + bool addOption(Option &option); bool addOption(Option *option); void addPositionalArgument(const QString &name, const QString &description, const QString &syntax = QString()) { _parser.addPositionalArgument(name, description, syntax); }; - + QCommandLineOption addVersionOption() - { + { return _parser.addVersionOption(); }; - - QString applicationDescription() const - { return _parser.applicationDescription(); } - - void clearPositionalArguments() - { _parser.clearPositionalArguments(); } - - QString helpText() const - { return _parser.helpText(); } - - bool isSet(const QString &name) const - { return _parser.isSet(name); } - - bool isSet(const Option &option) const - { return _parser.isSet(option); } - - bool isSet(const Option *option) const - { return _parser.isSet(*option); } - - QStringList optionNames() const - { return _parser.optionNames(); } - - QStringList positionalArguments() const - { return _parser.positionalArguments(); } - - void setApplicationDescription(const QString &description) - { _parser.setApplicationDescription(description); } - - void setSingleDashWordOptionMode(QCommandLineParser::SingleDashWordOptionMode singleDashWordOptionMode) - { _parser.setSingleDashWordOptionMode(singleDashWordOptionMode); } - - void showHelp(int exitCode = 0) - { _parser.showHelp(exitCode); } - - QStringList unknownOptionNames() const - { return _parser.unknownOptionNames(); } - - QString value(const QString &optionName) const - { return _parser.value(optionName); } - - QString value(const Option &option) const - { return _parser.value(option); } - - QStringList values(const QString &optionName) const - { return _parser.values(optionName); } - - QStringList values(const Option &option) const - { return _parser.values(option); } + QString applicationDescription() const + { + return _parser.applicationDescription(); + } + + void clearPositionalArguments() + { + _parser.clearPositionalArguments(); + } + + QString helpText() const + { + return _parser.helpText(); + } + + bool isSet(const QString &name) const + { + return _parser.isSet(name); + } + + bool isSet(const Option &option) const + { + return _parser.isSet(option); + } + + bool isSet(const Option *option) const + { + return _parser.isSet(*option); + } + + QStringList optionNames() const + { + return _parser.optionNames(); + } + + QStringList positionalArguments() const + { + return _parser.positionalArguments(); + } + + void setApplicationDescription(const QString &description) + { + _parser.setApplicationDescription(description); + } + + void setSingleDashWordOptionMode(QCommandLineParser::SingleDashWordOptionMode singleDashWordOptionMode) + { + _parser.setSingleDashWordOptionMode(singleDashWordOptionMode); + } + + void showHelp(int exitCode = 0) + { + _parser.showHelp(exitCode); + } + + QStringList unknownOptionNames() const + { + return _parser.unknownOptionNames(); + } + + QString value(const QString &optionName) const + { + return _parser.value(optionName); + } + + QString value(const Option &option) const + { + return _parser.value(option); + } + + QStringList values(const QString &optionName) const + { + return _parser.values(optionName); + } + + QStringList values(const Option &option) const + { + return _parser.values(option); + } }; } diff --git a/include/commandline/RegularExpressionOption.h b/include/commandline/RegularExpressionOption.h index 36094754..0ba3dbb1 100644 --- a/include/commandline/RegularExpressionOption.h +++ b/include/commandline/RegularExpressionOption.h @@ -17,12 +17,14 @@ public: const QString &defaultValue = QString()) : ValidatorOption(name, description, valueName, defaultValue) {} + RegularExpressionOption(const QStringList &names, const QString &description = QString(), const QString &valueName = QString(), const QString &defaultValue = QString()) : ValidatorOption(names, description, valueName, defaultValue) {} + RegularExpressionOption(const QCommandLineOption &other) : ValidatorOption(other) {} @@ -33,18 +35,26 @@ public: const QString &defaultValue = QString(), const QRegularExpression &expression = QRegularExpression()) : ValidatorOption(name, description, valueName, defaultValue) - { setValidator(new QRegularExpressionValidator(expression)); } + { + setValidator(new QRegularExpressionValidator(expression)); + } + RegularExpressionOption(const QStringList &names, const QString &description = QString(), const QString &valueName = QString(), const QString &defaultValue = QString(), const QRegularExpression &expression = QRegularExpression()) : ValidatorOption(names, description, valueName, defaultValue) - { setValidator(new QRegularExpressionValidator(expression)); } + { + setValidator(new QRegularExpressionValidator(expression)); + } + RegularExpressionOption(const QCommandLineOption &other, const QRegularExpression &expression = QRegularExpression()) : ValidatorOption(other) - { setValidator(new QRegularExpressionValidator(expression)); } + { + setValidator(new QRegularExpressionValidator(expression)); + } RegularExpressionOption(const QString &name, const QString &description = QString(), @@ -52,18 +62,26 @@ public: const QString &defaultValue = QString(), const QString &expression = QString()) : ValidatorOption(name, description, valueName, defaultValue) - { setValidator(new QRegularExpressionValidator(QRegularExpression(expression))); } + { + setValidator(new QRegularExpressionValidator(QRegularExpression(expression))); + } + RegularExpressionOption(const QStringList &names, const QString &description = QString(), const QString &valueName = QString(), const QString &defaultValue = QString(), const QString &expression = QString()) : ValidatorOption(names, description, valueName, defaultValue) - { setValidator(new QRegularExpressionValidator(QRegularExpression(expression))); } + { + setValidator(new QRegularExpressionValidator(QRegularExpression(expression))); + } + RegularExpressionOption(const QCommandLineOption &other, const QString &expression = QString()) : ValidatorOption(other) - { setValidator(new QRegularExpressionValidator(QRegularExpression(expression))); } + { + setValidator(new QRegularExpressionValidator(QRegularExpression(expression))); + } }; } diff --git a/include/commandline/SwitchOption.h b/include/commandline/SwitchOption.h index 54060c51..b23393d1 100644 --- a/include/commandline/SwitchOption.h +++ b/include/commandline/SwitchOption.h @@ -30,8 +30,6 @@ public: : Option(other), _switches(switches) {} - virtual ~SwitchOption() {} - const QMap &getSwitches() const { return _switches; } virtual bool validate(Parser &parser, QString &switch_) override { return hasSwitch(switch_); } bool hasSwitch(const QString &switch_) { return _switches.contains(switch_.toLower()); } diff --git a/include/commandline/ValidatorOption.h b/include/commandline/ValidatorOption.h index c7349ccf..ae618fa5 100644 --- a/include/commandline/ValidatorOption.h +++ b/include/commandline/ValidatorOption.h @@ -13,6 +13,7 @@ class ValidatorOption: public Option protected: const QValidator *validator; virtual void setValidator(const QValidator *validator); + public: ValidatorOption(const QString &name, const QString &description = QString(), @@ -21,6 +22,7 @@ public: const QValidator *validator = nullptr) : Option(name, description, valueName, defaultValue), validator(validator) {} + ValidatorOption(const QStringList &names, const QString &description = QString(), const QString &valueName = QString(), @@ -28,6 +30,7 @@ public: const QValidator *validator = nullptr) : Option(names, description, valueName, defaultValue), validator(validator) {} + ValidatorOption(const QCommandLineOption &other, const QValidator *validator = nullptr) : Option(other), validator(validator) diff --git a/include/db/AuthTable.h b/include/db/AuthTable.h index 13508850..ae5918b6 100644 --- a/include/db/AuthTable.h +++ b/include/db/AuthTable.h @@ -29,7 +29,6 @@ public: // create table columns createTable(QStringList()<<"user TEXT"<<"password BLOB"<<"token BLOB"<<"salt BLOB"<<"comment TEXT"<<"id TEXT"<<"created_at TEXT"<<"last_use TEXT"); }; - ~AuthTable(){}; /// /// @brief Create a user record, if called on a existing user the auth is recreated diff --git a/include/db/DBManager.h b/include/db/DBManager.h index 724a3ae7..8ea6761f 100644 --- a/include/db/DBManager.h +++ b/include/db/DBManager.h @@ -27,7 +27,7 @@ class DBManager : public QObject public: DBManager(QObject* parent = nullptr); - ~DBManager(); + ~DBManager() override; /// set root path void setRootPath(const QString& rootPath); diff --git a/include/db/InstanceTable.h b/include/db/InstanceTable.h index cd46a2b3..aff7d73f 100644 --- a/include/db/InstanceTable.h +++ b/include/db/InstanceTable.h @@ -27,9 +27,7 @@ public: // start/create the first Hyperion instance index 0 createInstance(); - }; - ~InstanceTable(){}; /// /// @brief Create a new Hyperion instance entry, the name needs to be unique diff --git a/include/db/MetaTable.h b/include/db/MetaTable.h index e23d1ac8..acc27d03 100644 --- a/include/db/MetaTable.h +++ b/include/db/MetaTable.h @@ -23,13 +23,12 @@ public: setTable("meta"); createTable(QStringList()<<"uuid TEXT"<<"created_at TEXT"); }; - ~MetaTable(){}; /// /// @brief Get the uuid, if the uuid is not set it will be created /// @return The uuid /// - inline const QString getUUID() + inline QString getUUID() const { QVector results; getRecords(results, QStringList() << "uuid"); diff --git a/include/db/SettingsTable.h b/include/db/SettingsTable.h index b4ebd3f3..19bf1054 100644 --- a/include/db/SettingsTable.h +++ b/include/db/SettingsTable.h @@ -23,7 +23,6 @@ public: // create table columns createTable(QStringList()<<"type TEXT"<<"config TEXT"<<"hyperion_inst INTEGER"<<"updated_at TEXT"); }; - ~SettingsTable(){}; /// /// @brief Create or update a settings record diff --git a/include/effectengine/Effect.h b/include/effectengine/Effect.h index 47a85236..778f158b 100644 --- a/include/effectengine/Effect.h +++ b/include/effectengine/Effect.h @@ -38,23 +38,23 @@ public: , const QJsonObject &args = QJsonObject() , const QString &imageData = "" ); - virtual ~Effect(); + ~Effect() override; - virtual void run(); + void run() override; - int getPriority() const { return _priority; }; + int getPriority() const { return _priority; } /// /// @brief Set manual interuption to true, /// Note: DO NOT USE QThread::interuption! /// - void requestInterruption() { _interupt = true; }; + void requestInterruption() { _interupt = true; } /// /// @brief Check if the interuption flag has been set /// @return The flag state /// - bool isInterruptionRequested() { return _interupt; }; + bool isInterruptionRequested() { return _interupt; } QString getScript() const { return _script; } QString getName() const { return _name; } diff --git a/include/effectengine/EffectEngine.h b/include/effectengine/EffectEngine.h index e657d523..0288a1ac 100644 --- a/include/effectengine/EffectEngine.h +++ b/include/effectengine/EffectEngine.h @@ -27,17 +27,17 @@ class EffectEngine : public QObject public: EffectEngine(Hyperion * hyperion); - virtual ~EffectEngine(); + ~EffectEngine() override; - const std::list & getEffects() const { return _availableEffects; }; + std::list getEffects() const { return _availableEffects; } - const std::list & getActiveEffects(); + std::list getActiveEffects() const; /// /// Get available schemas from EffectFileHandler /// @return all schemas /// - const std::list & getEffectSchemas(); + std::list getEffectSchemas() const; /// /// @brief Save an effect with EffectFileHandler @@ -115,8 +115,6 @@ private: std::list _activeEffects; - std::list _availableActiveEffects; - std::list _cachedActiveEffects; Logger * _log; diff --git a/include/effectengine/EffectFileHandler.h b/include/effectengine/EffectFileHandler.h index 5cee25dc..428a8712 100644 --- a/include/effectengine/EffectFileHandler.h +++ b/include/effectengine/EffectFileHandler.h @@ -20,12 +20,12 @@ public: /// /// @brief Get all available effects /// - const std::list & getEffects() const { return _availableEffects; }; + std::list getEffects() const { return _availableEffects; } /// /// @brief Get all available schemas /// - const std::list & getEffectSchemas() { return _effectSchemas; }; + std::list getEffectSchemas() const { return _effectSchemas; } /// /// @brief Save an effect diff --git a/include/flatbufserver/FlatBufferConnection.h b/include/flatbufserver/FlatBufferConnection.h index 79e64512..1234d7b6 100644 --- a/include/flatbufserver/FlatBufferConnection.h +++ b/include/flatbufserver/FlatBufferConnection.h @@ -40,7 +40,7 @@ public: /// /// @brief Destructor /// - ~FlatBufferConnection(); + ~FlatBufferConnection() override; /// @brief Do not read reply messages from Hyperion if set to true void setSkipReply(bool skip); diff --git a/include/flatbufserver/FlatBufferServer.h b/include/flatbufserver/FlatBufferServer.h index b361b838..c5390c52 100644 --- a/include/flatbufserver/FlatBufferServer.h +++ b/include/flatbufserver/FlatBufferServer.h @@ -21,7 +21,7 @@ class FlatBufferServer : public QObject Q_OBJECT public: FlatBufferServer(const QJsonDocument& config, QObject* parent = nullptr); - ~FlatBufferServer(); + ~FlatBufferServer() override; public slots: /// diff --git a/include/grabber/V4L2Grabber.h b/include/grabber/V4L2Grabber.h index 6e7b684a..894317d3 100644 --- a/include/grabber/V4L2Grabber.h +++ b/include/grabber/V4L2Grabber.h @@ -62,13 +62,13 @@ public: ); ~V4L2Grabber() override; - QRectF getSignalDetectionOffset() + QRectF getSignalDetectionOffset() const { return QRectF(_x_frac_min, _y_frac_min, _x_frac_max, _y_frac_max); } - bool getSignalDetectionEnabled() { return _signalDetectionEnabled; } - bool getCecDetectionEnabled() { return _cecDetectionEnabled; } + bool getSignalDetectionEnabled() const { return _signalDetectionEnabled; } + bool getCecDetectionEnabled() const { return _cecDetectionEnabled; } int grabFrame(Image &); @@ -128,27 +128,27 @@ public: /// /// @brief overwrite Grabber.h implementation /// - QStringList getV4L2devices() override; + QStringList getV4L2devices() const override; /// /// @brief overwrite Grabber.h implementation /// - QString getV4L2deviceName(QString devicePath) override; + QString getV4L2deviceName(const QString& devicePath) const override; /// /// @brief overwrite Grabber.h implementation /// - QMultiMap getV4L2deviceInputs(QString devicePath) override; + QMultiMap getV4L2deviceInputs(const QString& devicePath) const override; /// /// @brief overwrite Grabber.h implementation /// - QStringList getResolutions(QString devicePath) override; + QStringList getResolutions(const QString& devicePath) const override; /// /// @brief overwrite Grabber.h implementation /// - QStringList getFramerates(QString devicePath) override; + QStringList getFramerates(const QString& devicePath) const override; public slots: @@ -169,6 +169,7 @@ private: void getV4Ldevices(); bool init(); + void uninit(); bool open_device(); @@ -250,12 +251,13 @@ private: private: QString _deviceName; - std::map _v4lDevices; - QMap _deviceProperties; - VideoStandard _videoStandard; - io_method _ioMethod; - int _fileDescriptor; - std::vector _buffers; + std::map _v4lDevices; + QMap _deviceProperties; + + VideoStandard _videoStandard; + io_method _ioMethod; + int _fileDescriptor; + std::vector _buffers; PixelFormat _pixelFormat; int _pixelDecimation; diff --git a/include/grabber/V4L2Wrapper.h b/include/grabber/V4L2Wrapper.h index 5bd229ee..78474fd6 100644 --- a/include/grabber/V4L2Wrapper.h +++ b/include/grabber/V4L2Wrapper.h @@ -18,8 +18,8 @@ public: int pixelDecimation ); ~V4L2Wrapper() override; - bool getSignalDetectionEnable(); - bool getCecDetectionEnable(); + bool getSignalDetectionEnable() const; + bool getCecDetectionEnable() const; public slots: bool start() override; @@ -30,7 +30,7 @@ public slots: void setSignalDetectionOffset(double verticalMin, double horizontalMin, double verticalMax, double horizontalMax); void setSignalDetectionEnable(bool enable); void setCecDetectionEnable(bool enable); - void setDeviceVideoStandard(QString device, VideoStandard videoStandard); + void setDeviceVideoStandard(const QString& device, VideoStandard videoStandard); void handleCecEvent(CECEvent event); void handleSettingsUpdate(settings::type type, const QJsonDocument& config) override; diff --git a/include/grabber/VideoStandard.h b/include/grabber/VideoStandard.h index 5b22f8f6..adcf43be 100644 --- a/include/grabber/VideoStandard.h +++ b/include/grabber/VideoStandard.h @@ -10,20 +10,20 @@ enum class VideoStandard { NO_CHANGE }; -inline VideoStandard parseVideoStandard(QString videoStandard) +inline VideoStandard parseVideoStandard(const QString& videoStandard) { // convert to lower case - videoStandard = videoStandard.toLower(); + QString standard = videoStandard.toLower(); - if (videoStandard == "pal") + if (standard == "pal") { return VideoStandard::PAL; } - else if (videoStandard == "ntsc") + else if (standard == "ntsc") { return VideoStandard::NTSC; } - else if (videoStandard == "secam") + else if (standard == "secam") { return VideoStandard::SECAM; } diff --git a/include/hyperion/AuthManager.h b/include/hyperion/AuthManager.h index 74a88b1f..41906465 100644 --- a/include/hyperion/AuthManager.h +++ b/include/hyperion/AuthManager.h @@ -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 getPendingRequests(); + QVector 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 getTokenList(); + QVector getTokenList() const; /// /// @brief Handle settings update from Hyperion Settingsmanager emit diff --git a/include/hyperion/ColorAdjustment.h b/include/hyperion/ColorAdjustment.h index 2e04b07c..ce2146aa 100644 --- a/include/hyperion/ColorAdjustment.h +++ b/include/hyperion/ColorAdjustment.h @@ -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 diff --git a/include/hyperion/ComponentRegister.h b/include/hyperion/ComponentRegister.h index c56d61ca..9512923d 100644 --- a/include/hyperion/ComponentRegister.h +++ b/include/hyperion/ComponentRegister.h @@ -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 getRegister() const { return _componentStates; }; + std::map getRegister() const { return _componentStates; } signals: /// diff --git a/include/hyperion/Grabber.h b/include/hyperion/Grabber.h index 0dc948f5..d198842e 100644 --- a/include/hyperion/Grabber.h +++ b/include/hyperion/Grabber.h @@ -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 getV4L2deviceInputs(QString devicePath) { return QMultiMap(); } + virtual QMultiMap getV4L2deviceInputs(const QString& /*devicePath*/) const { return QMultiMap(); } /// /// @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; diff --git a/include/hyperion/GrabberWrapper.h b/include/hyperion/GrabberWrapper.h index a9de103f..dd1880f0 100644 --- a/include/hyperion/GrabberWrapper.h +++ b/include/hyperion/GrabberWrapper.h @@ -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 getV4L2deviceInputs(QString devicePath); + virtual QMultiMap 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(); diff --git a/include/hyperion/Hyperion.h b/include/hyperion/Hyperion.h index fc9222f1..09d8be6b 100644 --- a/include/hyperion/Hyperion.h +++ b/include/hyperion/Hyperion.h @@ -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 &getEffects() const; + std::list getEffects() const; /// Get the list of active effects /// @return The list of active effects - const std::list &getActiveEffects() const; + std::list getActiveEffects() const; /// Get the list of available effect schema files /// @return The list of available effect schema files - const std::list &getEffectSchemas() const; + std::list 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); + void forwardSystemProtoMessage(const QString&, const Image&); /// Signal which is emitted, when a new V4l proto image should be forwarded - void forwardV4lProtoMessage(const QString, const Image); + void forwardV4lProtoMessage(const QString&, const Image&); /// /// @brief Is emitted from clients who request a videoMode change diff --git a/include/hyperion/HyperionIManager.h b/include/hyperion/HyperionIManager.h index 48389849..73b86654 100644 --- a/include/hyperion/HyperionIManager.h +++ b/include/hyperion/HyperionIManager.h @@ -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 getInstanceData(); + QVector 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; diff --git a/include/hyperion/ImageProcessor.h b/include/hyperion/ImageProcessor.h index 5e569c0e..5c6f2e46 100644 --- a/include/hyperion/ImageProcessor.h +++ b/include/hyperion/ImageProcessor.h @@ -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); /// diff --git a/include/hyperion/ImageToLedsMap.h b/include/hyperion/ImageToLedsMap.h index f58e19c5..d53cd839 100644 --- a/include/hyperion/ImageToLedsMap.h +++ b/include/hyperion/ImageToLedsMap.h @@ -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 diff --git a/include/hyperion/LedString.h b/include/hyperion/LedString.h index 4756bee3..afd41666 100644 --- a/include/hyperion/LedString.h +++ b/include/hyperion/LedString.h @@ -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) { diff --git a/include/hyperion/MessageForwarder.h b/include/hyperion/MessageForwarder.h index fca588ac..be4fd4db 100644 --- a/include/hyperion/MessageForwarder.h +++ b/include/hyperion/MessageForwarder.h @@ -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: /// diff --git a/include/hyperion/MultiColorAdjustment.h b/include/hyperion/MultiColorAdjustment.h index d6fb4764..3db3f47e 100644 --- a/include/hyperion/MultiColorAdjustment.h +++ b/include/hyperion/MultiColorAdjustment.h @@ -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 diff --git a/include/hyperion/PriorityMuxer.h b/include/hyperion/PriorityMuxer.h index e750efa8..fb444628 100644 --- a/include/hyperion/PriorityMuxer.h +++ b/include/hyperion/PriorityMuxer.h @@ -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; diff --git a/include/jsonserver/JsonServer.h b/include/jsonserver/JsonServer.h index d6d15b5b..21407d6a 100644 --- a/include/jsonserver/JsonServer.h +++ b/include/jsonserver/JsonServer.h @@ -29,7 +29,7 @@ public: /// @param The configuration /// JsonServer(const QJsonDocument& config); - ~JsonServer(); + ~JsonServer() override; /// /// @return the port number on which this TCP listens for incoming connections diff --git a/include/leddevice/LedDeviceFactory.h b/include/leddevice/LedDeviceFactory.h index ea7be292..43dc5987 100644 --- a/include/leddevice/LedDeviceFactory.h +++ b/include/leddevice/LedDeviceFactory.h @@ -1,8 +1,8 @@ #ifndef LEDEVICEFACTORY_H #define LEDEVICEFACTORY_H -// LedDevice includes -#include +class LedDevice; +class QJsonObject; /// /// The LedDeviceFactory is responsible for constructing 'LedDevices' @@ -10,7 +10,6 @@ class LedDeviceFactory { public: - /// /// Constructs a LedDevice based on the given configuration /// diff --git a/include/leddevice/LedDeviceWrapper.h b/include/leddevice/LedDeviceWrapper.h index c326fb37..0413d03e 100644 --- a/include/leddevice/LedDeviceWrapper.h +++ b/include/leddevice/LedDeviceWrapper.h @@ -33,7 +33,7 @@ public: /// @brief Get all available device schemas /// @return device schemas /// - static const QJsonObject getLedDeviceSchemas(); + static QJsonObject getLedDeviceSchemas(); /// /// @brief add all device constructors to the map @@ -50,22 +50,22 @@ public: /// @brief Get the current latch time of the ledDevice /// @ return latch time in ms /// - int getLatchTime(); + int getLatchTime() const; /// /// @brief Get the current active ledDevice type /// - QString getActiveDeviceType(); + QString getActiveDeviceType() const; /// /// @brief Return the last enable state /// - bool enabled(); + bool enabled() const; /// /// @brief Get the current colorOrder from device /// - QString getColorOrder(); + QString getColorOrder() const; /// /// @brief Get the number of LEDs from device diff --git a/include/python/PythonInit.h b/include/python/PythonInit.h index 97b0cb16..d3d5ce47 100644 --- a/include/python/PythonInit.h +++ b/include/python/PythonInit.h @@ -7,7 +7,7 @@ class PythonInit { private: friend class HyperionDaemon; - + PythonInit(); ~PythonInit(); }; diff --git a/include/ssdp/SSDPDiscover.h b/include/ssdp/SSDPDiscover.h index 875bf211..f4ad94de 100644 --- a/include/ssdp/SSDPDiscover.h +++ b/include/ssdp/SSDPDiscover.h @@ -58,7 +58,7 @@ public: /// @param timeout_ms The timeout in ms /// @return The address+port of web-server or empty if timed out /// - const QString getFirstService(const searchType &type = searchType::STY_WEBSERVER,const QString &st = "urn:hyperion-project.org:device:basic:1", int timeout_ms = 3000); + QString getFirstService(const searchType &type = searchType::STY_WEBSERVER,const QString &st = "urn:hyperion-project.org:device:basic:1", int timeout_ms = 3000); /// /// @brief Discover services via ssdp. @@ -115,7 +115,7 @@ public: /// /// @return Discovered services as JSON-document /// - QJsonArray getServicesDiscoveredJson(); + QJsonArray getServicesDiscoveredJson() const; /// /// @brief Set the ssdp discovery address (HOST) diff --git a/include/ssdp/SSDPHandler.h b/include/ssdp/SSDPHandler.h index b0bf5407..dc20bd29 100644 --- a/include/ssdp/SSDPHandler.h +++ b/include/ssdp/SSDPHandler.h @@ -16,11 +16,12 @@ class QNetworkConfigurationManager; /// UPnP 1.0: spec: http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.0.pdf /// -class SSDPHandler : public SSDPServer{ +class SSDPHandler : public SSDPServer +{ Q_OBJECT public: SSDPHandler(WebServer* webserver, quint16 flatBufPort, quint16 jsonServerPort, const QString &name, QObject * parent = nullptr); - ~SSDPHandler(); + ~SSDPHandler() override; /// /// @brief Sends BYE BYE and stop server diff --git a/include/ssdp/SSDPServer.h b/include/ssdp/SSDPServer.h index 7b7f0512..9cff55d4 100644 --- a/include/ssdp/SSDPServer.h +++ b/include/ssdp/SSDPServer.h @@ -7,7 +7,8 @@ class QUdpSocket; /// /// @brief The SSDP Server sends and receives (parses) SSDP requests /// -class SSDPServer : public QObject { +class SSDPServer : public QObject +{ Q_OBJECT public: @@ -17,7 +18,7 @@ public: /// @param parent The parent object /// SSDPServer(QObject* parent = nullptr); - virtual ~SSDPServer(); + ~SSDPServer() override; /// /// @brief Prepare server after thread start @@ -81,7 +82,7 @@ public: /// /// @brief Get current flatbuffer server port /// - quint16 getFlatBufPort() { return _fbsPort.toInt(); }; + quint16 getFlatBufPort() const { return _fbsPort.toInt(); }; /// /// @brief set new jsonserver server port @@ -91,7 +92,7 @@ public: /// /// @brief get new jsonserver server port /// - quint16 getJsonServerPort() { return _jssPort.toInt(); }; + quint16 getJsonServerPort() const { return _jssPort.toInt(); }; /// /// @brief set new hyperion name @@ -101,7 +102,7 @@ public: /// /// @brief get hyperion name /// - QString getHyperionName() { return _name; }; + QString getHyperionName() const { return _name; }; signals: diff --git a/include/utils/Components.h b/include/utils/Components.h index ca70a2d6..9910d7e8 100644 --- a/include/utils/Components.h +++ b/include/utils/Components.h @@ -67,22 +67,22 @@ inline const char* componentToIdString(Components c) } } -inline Components stringToComponent(QString component) +inline Components stringToComponent(const QString& component) { - component = component.toUpper(); - if (component == "ALL") return COMP_ALL; - if (component == "SMOOTHING") return COMP_SMOOTHING; - if (component == "BLACKBORDER") return COMP_BLACKBORDER; - if (component == "FORWARDER") return COMP_FORWARDER; - if (component == "BOBLIGHTSERVER")return COMP_BOBLIGHTSERVER; - if (component == "GRABBER") return COMP_GRABBER; - if (component == "V4L") return COMP_V4L; - if (component == "COLOR") return COMP_COLOR; - if (component == "EFFECT") return COMP_EFFECT; - if (component == "IMAGE") return COMP_IMAGE; - if (component == "LEDDEVICE") return COMP_LEDDEVICE; - if (component == "FLATBUFSERVER") return COMP_FLATBUFSERVER; - if (component == "PROTOSERVER") return COMP_PROTOSERVER; + const QString cmp = component.toUpper(); + if (cmp == "ALL") return COMP_ALL; + if (cmp == "SMOOTHING") return COMP_SMOOTHING; + if (cmp == "BLACKBORDER") return COMP_BLACKBORDER; + if (cmp == "FORWARDER") return COMP_FORWARDER; + if (cmp == "BOBLIGHTSERVER")return COMP_BOBLIGHTSERVER; + if (cmp == "GRABBER") return COMP_GRABBER; + if (cmp == "V4L") return COMP_V4L; + if (cmp == "COLOR") return COMP_COLOR; + if (cmp == "EFFECT") return COMP_EFFECT; + if (cmp == "IMAGE") return COMP_IMAGE; + if (cmp == "LEDDEVICE") return COMP_LEDDEVICE; + if (cmp == "FLATBUFSERVER") return COMP_FLATBUFSERVER; + if (cmp == "PROTOSERVER") return COMP_PROTOSERVER; return COMP_INVALID; } diff --git a/include/utils/FileUtils.h b/include/utils/FileUtils.h index ee26f3d2..7bf5db8b 100644 --- a/include/utils/FileUtils.h +++ b/include/utils/FileUtils.h @@ -10,8 +10,8 @@ namespace FileUtils { - QString getBaseName(QString sourceFile); - QString getDirName(QString sourceFile); + QString getBaseName(const QString& sourceFile); + QString getDirName(const QString& sourceFile); /// /// @brief remove directory recursive given by path diff --git a/include/utils/Logger.h b/include/utils/Logger.h index c6b60670..21d6e764 100644 --- a/include/utils/Logger.h +++ b/include/utils/Logger.h @@ -67,7 +67,7 @@ public: void Message(LogLevel level, const char* sourceFile, const char* func, unsigned int line, const char* fmt, ...); void setMinLevel(LogLevel level) { _minLevel = static_cast(level); } - LogLevel getMinLevel() { return static_cast(int(_minLevel)); } + LogLevel getMinLevel() const { return static_cast(int(_minLevel)); } QString getName() const { return _name; } QString getAppName() const { return _appname; } @@ -76,7 +76,7 @@ signals: protected: Logger(const QString & name="", LogLevel minLevel = INFO); - ~Logger(); + ~Logger() override; private: void write(const Logger::T_LOG_MESSAGE & message); diff --git a/include/utils/NetOrigin.h b/include/utils/NetOrigin.h index f3fb3ebd..b82238fd 100644 --- a/include/utils/NetOrigin.h +++ b/include/utils/NetOrigin.h @@ -25,13 +25,13 @@ public: /// @param local The local address of the socket (Differs based on NetworkAdapter IP or localhost) /// @return True when allowed, else false /// - bool accessAllowed(const QHostAddress& address, const QHostAddress& local); + bool accessAllowed(const QHostAddress& address, const QHostAddress& local) const; /// /// @brief Check if address is in subnet of local /// @return True or false /// - bool isLocalAddress(const QHostAddress& address, const QHostAddress& local); + bool isLocalAddress(const QHostAddress& address, const QHostAddress& local) const; static NetOrigin* getInstance(){ return instance; }; static NetOrigin* instance; diff --git a/include/utils/PixelFormat.h b/include/utils/PixelFormat.h index eecd4464..a60a20f4 100644 --- a/include/utils/PixelFormat.h +++ b/include/utils/PixelFormat.h @@ -18,37 +18,37 @@ enum class PixelFormat { NO_CHANGE }; -inline PixelFormat parsePixelFormat(QString pixelFormat) +inline PixelFormat parsePixelFormat(const QString& pixelFormat) { // convert to lower case - pixelFormat = pixelFormat.toLower(); + QString format = pixelFormat.toLower(); - if (pixelFormat.compare("yuyv") ) + if (format.compare("yuyv") ) { return PixelFormat::YUYV; } - else if (pixelFormat.compare("uyvy") ) + else if (format.compare("uyvy") ) { return PixelFormat::UYVY; } - else if (pixelFormat.compare("bgr16") ) + else if (format.compare("bgr16") ) { return PixelFormat::BGR16; } - else if (pixelFormat.compare("bgr24") ) + else if (format.compare("bgr24") ) { return PixelFormat::BGR24; } - else if (pixelFormat.compare("rgb32") ) + else if (format.compare("rgb32") ) { return PixelFormat::RGB32; } - else if (pixelFormat.compare("bgr32") ) + else if (format.compare("bgr32") ) { return PixelFormat::BGR32; } #ifdef HAVE_JPEG_DECODER - else if (pixelFormat.compare("mjpeg") ) + else if (format.compare("mjpeg") ) { return PixelFormat::MJPEG; } diff --git a/include/utils/Process.h b/include/utils/Process.h index 61c15351..9bdbd0e6 100644 --- a/include/utils/Process.h +++ b/include/utils/Process.h @@ -6,6 +6,6 @@ namespace Process { void restartHyperion(bool asNewProcess=false); -QByteArray command_exec(QString cmd, QByteArray data=""); +QByteArray command_exec(const QString& cmd, const QByteArray& data=""); } diff --git a/include/utils/Profiler.h b/include/utils/Profiler.h index 236dad7b..e478385f 100644 --- a/include/utils/Profiler.h +++ b/include/utils/Profiler.h @@ -36,8 +36,8 @@ public: Profiler(const char* sourceFile, const char* func, unsigned int line); ~Profiler(); - static void TimerStart(const QString stopWatchName, const char* sourceFile, const char* func, unsigned int line); - static void TimerGetTime(const QString stopWatchName, const char* sourceFile, const char* func, unsigned int line); + static void TimerStart(const QString& stopWatchName, const char* sourceFile, const char* func, unsigned int line); + static void TimerGetTime(const QString& stopWatchName, const char* sourceFile, const char* func, unsigned int line); private: static void initLogger(); diff --git a/include/utils/RgbToRgbw.h b/include/utils/RgbToRgbw.h index ecfa78af..0bcd6f46 100644 --- a/include/utils/RgbToRgbw.h +++ b/include/utils/RgbToRgbw.h @@ -14,7 +14,6 @@ namespace RGBW { WHITE_OFF }; - WhiteAlgorithm stringToWhiteAlgorithm(QString str); + WhiteAlgorithm stringToWhiteAlgorithm(const QString& str); void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, WhiteAlgorithm algorithm); - } diff --git a/include/utils/VideoMode.h b/include/utils/VideoMode.h index b4500dfc..e9359d99 100644 --- a/include/utils/VideoMode.h +++ b/include/utils/VideoMode.h @@ -12,16 +12,16 @@ enum class VideoMode VIDEO_3DTAB }; -inline VideoMode parse3DMode(QString videoMode) +inline VideoMode parse3DMode(const QString& videoMode) { // convert to upper case - videoMode = videoMode.toUpper(); + const QString vm = videoMode.toUpper(); - if (videoMode == "3DTAB") + if (vm == "3DTAB") { return VideoMode::VIDEO_3DTAB; } - else if (videoMode == "3DSBS") + else if (vm == "3DSBS") { return VideoMode::VIDEO_3DSBS; } diff --git a/include/utils/jsonschema/QJsonSchemaChecker.h b/include/utils/jsonschema/QJsonSchemaChecker.h index d7fa5cbf..60525997 100644 --- a/include/utils/jsonschema/QJsonSchemaChecker.h +++ b/include/utils/jsonschema/QJsonSchemaChecker.h @@ -57,7 +57,7 @@ public: /// /// @return A list of error messages /// - const QStringList & getMessages() const; + QStringList getMessages() const; private: /// diff --git a/include/utils/jsonschema/QJsonUtils.h b/include/utils/jsonschema/QJsonUtils.h index 6c4f56bd..1cd74a8a 100644 --- a/include/utils/jsonschema/QJsonUtils.h +++ b/include/utils/jsonschema/QJsonUtils.h @@ -19,14 +19,14 @@ public: { if (path.first() == "[root]") path.removeFirst(); - + for (QStringList::iterator it = path.begin(); it != path.end(); ++it) { QString current = *it; if (current.left(1) == ".") *it = current.mid(1, current.size()-1); } - + if (!value.isEmpty()) modifyValue(value, result, path, newValue, propertyName); else if (newValue != QJsonValue::Null && !propertyName.isEmpty()) @@ -78,17 +78,17 @@ private: { QJsonObject result; QJsonObject obj = schema.toObject(); - + if (obj.find("type") != obj.end() && obj.find("type").value().isString()) { QJsonValue ret = QJsonValue::Null; - + if (obj.find("type").value().toString() == "object" && ( obj.find("required").value().toBool() || ignoreRequired ) ) ret = createValue(obj["properties"], ignoreRequired); else if (obj.find("type").value().toString() == "array" && ( obj.find("required").value().toBool() || ignoreRequired ) ) { QJsonArray array; - + if (obj.find("default") != obj.end()) ret = obj.find("default").value(); else @@ -103,7 +103,7 @@ private: else if ( obj.find("required").value().toBool() || ignoreRequired ) if (obj.find("default") != obj.end()) ret = obj.find("default").value(); - + return ret; } else @@ -133,7 +133,7 @@ private: { QJsonValue retEmpty; retEmpty = createValue(attributeValue.toObject()["items"], ignoreRequired); - + if (!retEmpty.toObject().isEmpty()) array.append(retEmpty); result[attribute] = array; @@ -234,7 +234,7 @@ private: subValue = newValue; else continue; - + if (!subValue.toObject().isEmpty()) json_array.append(subValue); else if (newValue != QJsonValue::Null && arrayLevel != -1) diff --git a/include/utils/settings.h b/include/utils/settings.h index d8e25678..175a2df1 100644 --- a/include/utils/settings.h +++ b/include/utils/settings.h @@ -37,7 +37,7 @@ namespace settings { /// @param type The settings::type from enum /// @return The settings type as string /// - inline QString typeToString(const type& type) + inline QString typeToString(type type) { switch (type) { diff --git a/include/webserver/WebServer.h b/include/webserver/WebServer.h index bbee090c..abcf0409 100644 --- a/include/webserver/WebServer.h +++ b/include/webserver/WebServer.h @@ -28,7 +28,8 @@ openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes \ -subj /CN=hyperion-project.org */ -class WebServer : public QObject { +class WebServer : public QObject +{ Q_OBJECT public: diff --git a/libsrc/api/JsonAPI.cpp b/libsrc/api/JsonAPI.cpp index a61b0bd4..ce54731a 100644 --- a/libsrc/api/JsonAPI.cpp +++ b/libsrc/api/JsonAPI.cpp @@ -494,7 +494,7 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString #if defined(ENABLE_V4L2) QJsonArray availableV4L2devices; - for (auto devicePath : GrabberWrapper::getInstance()->getV4L2devices()) + for (const auto& devicePath : GrabberWrapper::getInstance()->getV4L2devices()) { QJsonObject device; device["device"] = devicePath; diff --git a/libsrc/blackborder/BlackBorderProcessor.cpp b/libsrc/blackborder/BlackBorderProcessor.cpp index 10f60bc4..feeff7d6 100644 --- a/libsrc/blackborder/BlackBorderProcessor.cpp +++ b/libsrc/blackborder/BlackBorderProcessor.cpp @@ -89,8 +89,8 @@ void BlackBorderProcessor::handleCompStateChangeRequest(hyperion::Components com } } -void BlackBorderProcessor::setHardDisable(bool disable) { - +void BlackBorderProcessor::setHardDisable(bool disable) +{ if (disable) { _enabled = false; diff --git a/libsrc/boblightserver/BoblightServer.cpp b/libsrc/boblightserver/BoblightServer.cpp index 784cd10c..3495671e 100644 --- a/libsrc/boblightserver/BoblightServer.cpp +++ b/libsrc/boblightserver/BoblightServer.cpp @@ -67,7 +67,7 @@ void BoblightServer::stop() _hyperion->setNewComponentState(COMP_BOBLIGHTSERVER, _server->isListening()); } -bool BoblightServer::active() +bool BoblightServer::active() const { return _server->isListening(); } diff --git a/libsrc/bonjour/bonjourserviceregister.cpp b/libsrc/bonjour/bonjourserviceregister.cpp index 603ccb41..b10c7ec3 100644 --- a/libsrc/bonjour/bonjourserviceregister.cpp +++ b/libsrc/bonjour/bonjourserviceregister.cpp @@ -65,7 +65,7 @@ void BonjourServiceRegister::registerService(const QString& service, int port) ); } -void BonjourServiceRegister::registerService(const BonjourRecord &record, quint16 servicePort, std::vector> txt) +void BonjourServiceRegister::registerService(const BonjourRecord &record, quint16 servicePort, const std::vector>& txt) { if (dnssref) { diff --git a/libsrc/commandline/Option.cpp b/libsrc/commandline/Option.cpp index 4b25ad9d..21a191a9 100644 --- a/libsrc/commandline/Option.cpp +++ b/libsrc/commandline/Option.cpp @@ -11,7 +11,6 @@ Option::Option(const QStringList &names, const QString &description, const QStri : QCommandLineOption(names, description, valueName, defaultValue) {} - bool Option::validate(Parser & parser, QString &value) { /* By default everything is accepted */ @@ -22,22 +21,22 @@ Option::Option(const QCommandLineOption &other) : QCommandLineOption(other) {} -QString Option::value(Parser &parser) +QString Option::value(Parser &parser) const { return parser.value(*this); } -QString Option::name() +QString Option::name() const { return this->names().last(); } -QString Option::getError() +QString Option::getError() const { return this->_error; } -const char* Option::getCString(Parser &parser) +const char* Option::getCString(Parser &parser) const { return value(parser).toLocal8Bit().constData(); } diff --git a/libsrc/effectengine/EffectEngine.cpp b/libsrc/effectengine/EffectEngine.cpp index f8f839bb..ea404903 100644 --- a/libsrc/effectengine/EffectEngine.cpp +++ b/libsrc/effectengine/EffectEngine.cpp @@ -61,9 +61,9 @@ QString EffectEngine::deleteEffect(const QString& effectName) return _effectFileHandler->deleteEffect(effectName); } -const std::list &EffectEngine::getActiveEffects() +std::list EffectEngine::getActiveEffects() const { - _availableActiveEffects.clear(); + std::list availableActiveEffects; for (Effect * effect : _activeEffects) { @@ -73,13 +73,13 @@ const std::list &EffectEngine::getActiveEffects() activeEffectDefinition.priority = effect->getPriority(); activeEffectDefinition.timeout = effect->getTimeout(); activeEffectDefinition.args = effect->getArgs(); - _availableActiveEffects.push_back(activeEffectDefinition); + availableActiveEffects.push_back(activeEffectDefinition); } - return _availableActiveEffects; + return availableActiveEffects; } -const std::list & EffectEngine::getEffectSchemas() +std::list EffectEngine::getEffectSchemas() const { return _effectFileHandler->getEffectSchemas(); } diff --git a/libsrc/grabber/amlogic/IonBuffer.h b/libsrc/grabber/amlogic/IonBuffer.h index 9764fa4c..362d0ed7 100644 --- a/libsrc/grabber/amlogic/IonBuffer.h +++ b/libsrc/grabber/amlogic/IonBuffer.h @@ -65,8 +65,6 @@ public: return physicalAddress; } - - IonBuffer(size_t bufferSize) : bufferSize(bufferSize) { diff --git a/libsrc/grabber/dispmanx/DispmanxFrameGrabberMock.cpp b/libsrc/grabber/dispmanx/DispmanxFrameGrabberMock.cpp index f30d161a..87c7f143 100644 --- a/libsrc/grabber/dispmanx/DispmanxFrameGrabberMock.cpp +++ b/libsrc/grabber/dispmanx/DispmanxFrameGrabberMock.cpp @@ -30,7 +30,7 @@ int vc_dispmanx_display_get_info(int, DISPMANX_MODEINFO_T *vc_info) return 0; } -DISPMANX_RESOURCE_HANDLE_T vc_dispmanx_resource_create(int,int width,int height, uint32_t *) +DISPMANX_RESOURCE_HANDLE_T vc_dispmanx_resource_create(int, int width, int height, uint32_t *) { return new DISPMANX_RESOURCE(width,height); } @@ -61,12 +61,12 @@ int vc_dispmanx_snapshot(int, DISPMANX_RESOURCE_HANDLE_T resource, int vc_flags) { __bcm_frame_counter = 0; } - + ColorRgba color[4] = {ColorRgba::RED, ColorRgba::BLUE, ColorRgba::GREEN, ColorRgba::WHITE}; if (__bcm_frame_counter < 25) { color[0] = ColorRgba::WHITE; - color[1] = ColorRgba::RED; +0 color[1] = ColorRgba::RED; color[2] = ColorRgba::BLUE; color[3] = ColorRgba::GREEN; } @@ -95,7 +95,7 @@ int vc_dispmanx_snapshot(int, DISPMANX_RESOURCE_HANDLE_T resource, int vc_flags) if (x < w/2 && y < h/2) id = 1; if (x < w/2 && y >= h/2) id = 2; if (x >= w/2 && y < h/2) id = 3; - + resource->memptr()[y*w + x] = color[id]; } } diff --git a/libsrc/grabber/osx/OsxFrameGrabberMock.cpp b/libsrc/grabber/osx/OsxFrameGrabberMock.cpp index 501bcefc..5de645ec 100644 --- a/libsrc/grabber/osx/OsxFrameGrabberMock.cpp +++ b/libsrc/grabber/osx/OsxFrameGrabberMock.cpp @@ -30,7 +30,7 @@ CGImageRef CGImageGetDataProvider(CGImageRef image) { __osx_frame_counter = 0; } - + ColorRgb color[4] = {ColorRgb::RED, ColorRgb::BLUE, ColorRgb::GREEN, ColorRgb::WHITE}; if (__osx_frame_counter < 25) { @@ -55,7 +55,7 @@ CGImageRef CGImageGetDataProvider(CGImageRef image) } unsigned w = image->width(); unsigned h = image->height(); - + for (unsigned y=0; y= h/2) id = 2; if (x >= w/2 && y < h/2) id = 3; - + image->memptr()[y*w + x] = color[id]; } } - + return image; } diff --git a/libsrc/grabber/v4l2/V4L2Grabber.cpp b/libsrc/grabber/v4l2/V4L2Grabber.cpp index e1536fff..fce3f348 100644 --- a/libsrc/grabber/v4l2/V4L2Grabber.cpp +++ b/libsrc/grabber/v4l2/V4L2Grabber.cpp @@ -31,10 +31,10 @@ #endif V4L2Grabber::V4L2Grabber(const QString & device - , const unsigned width - , const unsigned height - , const unsigned fps - , const unsigned input + , unsigned width + , unsigned height + , unsigned fps + , unsigned input , VideoStandard videoStandard , PixelFormat pixelFormat , int pixelDecimation @@ -1368,7 +1368,7 @@ bool V4L2Grabber::setFramerate(int fps) return false; } -QStringList V4L2Grabber::getV4L2devices() +QStringList V4L2Grabber::getV4L2devices() const { QStringList result = QStringList(); for (auto it = _deviceProperties.begin(); it != _deviceProperties.end(); ++it) @@ -1378,22 +1378,22 @@ QStringList V4L2Grabber::getV4L2devices() return result; } -QString V4L2Grabber::getV4L2deviceName(QString devicePath) +QString V4L2Grabber::getV4L2deviceName(const QString& devicePath) const { return _deviceProperties.value(devicePath).name; } -QMultiMap V4L2Grabber::getV4L2deviceInputs(QString devicePath) +QMultiMap V4L2Grabber::getV4L2deviceInputs(const QString& devicePath) const { return _deviceProperties.value(devicePath).inputs; } -QStringList V4L2Grabber::getResolutions(QString devicePath) +QStringList V4L2Grabber::getResolutions(const QString& devicePath) const { return _deviceProperties.value(devicePath).resolutions; } -QStringList V4L2Grabber::getFramerates(QString devicePath) +QStringList V4L2Grabber::getFramerates(const QString& devicePath) const { return _deviceProperties.value(devicePath).framerates; } diff --git a/libsrc/grabber/v4l2/V4L2Wrapper.cpp b/libsrc/grabber/v4l2/V4L2Wrapper.cpp index 4942ba1b..98207df0 100644 --- a/libsrc/grabber/v4l2/V4L2Wrapper.cpp +++ b/libsrc/grabber/v4l2/V4L2Wrapper.cpp @@ -6,10 +6,10 @@ #include V4L2Wrapper::V4L2Wrapper(const QString &device, - const unsigned grabWidth, - const unsigned grabHeight, - const unsigned fps, - const unsigned input, + unsigned grabWidth, + unsigned grabHeight, + unsigned fps, + unsigned input, VideoStandard videoStandard, PixelFormat pixelFormat, int pixelDecimation ) @@ -85,7 +85,7 @@ void V4L2Wrapper::setSignalDetectionEnable(bool enable) _grabber.setSignalDetectionEnable(enable); } -bool V4L2Wrapper::getSignalDetectionEnable() +bool V4L2Wrapper::getSignalDetectionEnable() const { return _grabber.getSignalDetectionEnabled(); } @@ -95,12 +95,12 @@ void V4L2Wrapper::setCecDetectionEnable(bool enable) _grabber.setCecDetectionEnable(enable); } -bool V4L2Wrapper::getCecDetectionEnable() +bool V4L2Wrapper::getCecDetectionEnable() const { return _grabber.getCecDetectionEnabled(); } -void V4L2Wrapper::setDeviceVideoStandard(QString device, VideoStandard videoStandard) +void V4L2Wrapper::setDeviceVideoStandard(const QString& device, VideoStandard videoStandard) { _grabber.setDeviceVideoStandard(device, videoStandard); } diff --git a/libsrc/hyperion/AuthManager.cpp b/libsrc/hyperion/AuthManager.cpp index 2f89f396..996291d0 100644 --- a/libsrc/hyperion/AuthManager.cpp +++ b/libsrc/hyperion/AuthManager.cpp @@ -61,7 +61,7 @@ AuthManager::AuthDefinition AuthManager::createToken(const QString &comment) return def; } -QVector AuthManager::getTokenList() +QVector AuthManager::getTokenList() const { QVector vector = _authTable->getTokenList(); QVector finalVec; @@ -79,7 +79,7 @@ QVector 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::getPendingRequests() +QVector AuthManager::getPendingRequests() const { QVector finalVec; for (const auto &entry : _pendingRequests) diff --git a/libsrc/hyperion/Grabber.cpp b/libsrc/hyperion/Grabber.cpp index c0954043..85633ff1 100644 --- a/libsrc/hyperion/Grabber.cpp +++ b/libsrc/hyperion/Grabber.cpp @@ -1,7 +1,6 @@ #include - -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) diff --git a/libsrc/hyperion/GrabberWrapper.cpp b/libsrc/hyperion/GrabberWrapper.cpp index 6462240d..c91cf1bd 100644 --- a/libsrc/hyperion/GrabberWrapper.cpp +++ b/libsrc/hyperion/GrabberWrapper.cpp @@ -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 GrabberWrapper::getV4L2deviceInputs(QString devicePath) +QMultiMap GrabberWrapper::getV4L2deviceInputs(const QString& devicePath) const { if(_grabberName.startsWith("V4L")) return _ggrabber->getV4L2deviceInputs(devicePath); @@ -225,7 +225,7 @@ QMultiMap GrabberWrapper::getV4L2deviceInputs(QString devicePath) return QMultiMap(); } -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); diff --git a/libsrc/hyperion/Hyperion.cpp b/libsrc/hyperion/Hyperion.cpp index 9474022e..90de57c5 100644 --- a/libsrc/hyperion/Hyperion.cpp +++ b/libsrc/hyperion/Hyperion.cpp @@ -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::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 & Hyperion::getEffects() const +std::list Hyperion::getEffects() const { return _effectEngine->getEffects(); } -const std::list & Hyperion::getActiveEffects() const +std::list Hyperion::getActiveEffects() const { return _effectEngine->getActiveEffects(); } -const std::list & Hyperion::getEffectSchemas() const +std::list Hyperion::getEffectSchemas() const { return _effectEngine->getEffectSchemas(); } -const QJsonObject& Hyperion::getQJsonConfig() const +QJsonObject Hyperion::getQJsonConfig() const { return _settingsManager->getSettings(); } diff --git a/libsrc/hyperion/HyperionIManager.cpp b/libsrc/hyperion/HyperionIManager.cpp index a30edd96..255055e8 100644 --- a/libsrc/hyperion/HyperionIManager.cpp +++ b/libsrc/hyperion/HyperionIManager.cpp @@ -28,7 +28,7 @@ Hyperion* HyperionIManager::getHyperionInstance(quint8 instance) return _runningInstances.value(0); } -const QVector HyperionIManager::getInstanceData() +QVector HyperionIManager::getInstanceData() const { QVector instances = _instanceTable->getAllInstances(); for( auto & entry : instances) diff --git a/libsrc/hyperion/ImageProcessor.cpp b/libsrc/hyperion/ImageProcessor.cpp index 49b6c929..cf47425c 100644 --- a/libsrc/hyperion/ImageProcessor.cpp +++ b/libsrc/hyperion/ImageProcessor.cpp @@ -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(); } diff --git a/libsrc/hyperion/MessageForwarder.cpp b/libsrc/hyperion/MessageForwarder.cpp index df60dac2..5dc2385c 100644 --- a/libsrc/hyperion/MessageForwarder.cpp +++ b/libsrc/hyperion/MessageForwarder.cpp @@ -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) diff --git a/libsrc/hyperion/MultiColorAdjustment.cpp b/libsrc/hyperion/MultiColorAdjustment.cpp index 8e19fdc6..2ceb370e 100644 --- a/libsrc/hyperion/MultiColorAdjustment.cpp +++ b/libsrc/hyperion/MultiColorAdjustment.cpp @@ -67,7 +67,7 @@ bool MultiColorAdjustment::verifyAdjustments() const return ok; } -const QStringList & MultiColorAdjustment::getAdjustmentIds() +QStringList MultiColorAdjustment::getAdjustmentIds() const { return _adjustmentIds; } diff --git a/libsrc/hyperion/PriorityMuxer.cpp b/libsrc/hyperion/PriorityMuxer.cpp index a2754b6e..b029434c 100644 --- a/libsrc/hyperion/PriorityMuxer.cpp +++ b/libsrc/hyperion/PriorityMuxer.cpp @@ -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; } diff --git a/libsrc/hyperion/SettingsManager.cpp b/libsrc/hyperion/SettingsManager.cpp index a5416382..2f4bcc8e 100644 --- a/libsrc/hyperion/SettingsManager.cpp +++ b/libsrc/hyperion/SettingsManager.cpp @@ -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)); } diff --git a/libsrc/leddevice/LedDeviceTemplate.h b/libsrc/leddevice/LedDeviceTemplate.h index 6096c30c..de4c5614 100644 --- a/libsrc/leddevice/LedDeviceTemplate.h +++ b/libsrc/leddevice/LedDeviceTemplate.h @@ -35,21 +35,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -57,7 +57,7 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; private: diff --git a/libsrc/leddevice/LedDeviceWrapper.cpp b/libsrc/leddevice/LedDeviceWrapper.cpp index 6ec673f1..f03dce46 100644 --- a/libsrc/leddevice/LedDeviceWrapper.cpp +++ b/libsrc/leddevice/LedDeviceWrapper.cpp @@ -67,7 +67,7 @@ void LedDeviceWrapper::createLedDevice(const QJsonObject& config) thread->start(); } -const QJsonObject LedDeviceWrapper::getLedDeviceSchemas() +QJsonObject LedDeviceWrapper::getLedDeviceSchemas() { // make sure the resources are loaded (they may be left out after static linking) Q_INIT_RESOURCE(LedDeviceSchemas); @@ -118,21 +118,21 @@ const LedDeviceRegistry& LedDeviceWrapper::getDeviceMap() return _ledDeviceMap; } -int LedDeviceWrapper::getLatchTime() +int LedDeviceWrapper::getLatchTime() const { int value = 0; QMetaObject::invokeMethod(_ledDevice, "getLatchTime", Qt::BlockingQueuedConnection, Q_RETURN_ARG(int, value)); return value; } -QString LedDeviceWrapper::getActiveDeviceType() +QString LedDeviceWrapper::getActiveDeviceType() const { QString value = 0; QMetaObject::invokeMethod(_ledDevice, "getActiveDeviceType", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QString, value)); return value; } -QString LedDeviceWrapper::getColorOrder() +QString LedDeviceWrapper::getColorOrder() const { QString value; QMetaObject::invokeMethod(_ledDevice, "getColorOrder", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QString, value)); @@ -146,7 +146,7 @@ unsigned int LedDeviceWrapper::getLedCount() const return value; } -bool LedDeviceWrapper::enabled() +bool LedDeviceWrapper::enabled() const { return _enabled; } diff --git a/libsrc/leddevice/dev_hid/LedDeviceHyperionUsbasp.h b/libsrc/leddevice/dev_hid/LedDeviceHyperionUsbasp.h index 83010098..769c0d46 100644 --- a/libsrc/leddevice/dev_hid/LedDeviceHyperionUsbasp.h +++ b/libsrc/leddevice/dev_hid/LedDeviceHyperionUsbasp.h @@ -43,14 +43,14 @@ public: /// /// Destructor of the LedDevice; closes the output device if it is open /// - virtual ~LedDeviceHyperionUsbasp() override; + ~LedDeviceHyperionUsbasp() override; public slots: /// /// Closes the output device. /// Includes switching-off the device and stopping refreshes /// - virtual int close() override; + int close() override; protected: /// @@ -67,7 +67,7 @@ protected: /// /// @return Zero on success else negative /// - virtual int write(const std::vector& ledValues) override; + int write(const std::vector& ledValues) override; /// /// Test if the device is a Hyperion Usbasp device diff --git a/libsrc/leddevice/dev_hid/LedDeviceLightpack.h b/libsrc/leddevice/dev_hid/LedDeviceLightpack.h index bf197bda..1e6a03f5 100644 --- a/libsrc/leddevice/dev_hid/LedDeviceLightpack.h +++ b/libsrc/leddevice/dev_hid/LedDeviceLightpack.h @@ -34,7 +34,7 @@ public: /// /// @brief Destructor of the LedDevice /// - virtual ~LedDeviceLightpack() override; + ~LedDeviceLightpack() override; /// /// @brief Constructs the LED-device @@ -50,28 +50,28 @@ public: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Power-/turn off the Nanoleaf device. /// /// @return True if success /// - virtual bool powerOff() override; + bool powerOff() override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -100,7 +100,7 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; private: diff --git a/libsrc/leddevice/dev_hid/LedDeviceMultiLightpack.h b/libsrc/leddevice/dev_hid/LedDeviceMultiLightpack.h index 256c3d7b..6ad69d56 100644 --- a/libsrc/leddevice/dev_hid/LedDeviceMultiLightpack.h +++ b/libsrc/leddevice/dev_hid/LedDeviceMultiLightpack.h @@ -31,7 +31,7 @@ public: /// /// @brief Destructor of the LedDevice /// - virtual ~LedDeviceMultiLightpack() override; + ~LedDeviceMultiLightpack() override; /// /// @brief Constructs the LED-device @@ -49,28 +49,28 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Power-/turn off the Nanoleaf device. /// /// @return True if success /// - virtual bool powerOff() override; + bool powerOff() override; /// /// @brief Writes the RGB-Color values to the LEDs. diff --git a/libsrc/leddevice/dev_hid/LedDevicePaintpack.h b/libsrc/leddevice/dev_hid/LedDevicePaintpack.h index 95c7cc99..09b4735a 100644 --- a/libsrc/leddevice/dev_hid/LedDevicePaintpack.h +++ b/libsrc/leddevice/dev_hid/LedDevicePaintpack.h @@ -34,7 +34,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -42,7 +42,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; }; #endif // LEDEVICEPAINTTPACK_H diff --git a/libsrc/leddevice/dev_hid/LedDeviceRawHID.h b/libsrc/leddevice/dev_hid/LedDeviceRawHID.h index df409b75..1891a6fe 100644 --- a/libsrc/leddevice/dev_hid/LedDeviceRawHID.h +++ b/libsrc/leddevice/dev_hid/LedDeviceRawHID.h @@ -37,7 +37,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -45,7 +45,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; }; #endif // LEDEVICERAWHID_H diff --git a/libsrc/leddevice/dev_hid/ProviderHID.cpp b/libsrc/leddevice/dev_hid/ProviderHID.cpp index 376522b3..84314be5 100644 --- a/libsrc/leddevice/dev_hid/ProviderHID.cpp +++ b/libsrc/leddevice/dev_hid/ProviderHID.cpp @@ -156,28 +156,30 @@ int ProviderHID::writeBytes(unsigned size, const uint8_t * data) else{ ret = hid_write(_deviceHandle, ledData, size + 1); } - + // Handle first error - if(ret < 0){ + if(ret < 0) + { Error(_log,"Failed to write to HID device."); // Try again - if(_useFeature){ + if(_useFeature) + { ret = hid_send_feature_report(_deviceHandle, ledData, size + 1); } - else{ + else + { ret = hid_write(_deviceHandle, ledData, size + 1); } // Writing failed again, device might have disconnected if(ret < 0){ Error(_log,"Failed to write to HID device."); - + hid_close(_deviceHandle); _deviceHandle = nullptr; } } - return ret; } diff --git a/libsrc/leddevice/dev_hid/ProviderHID.h b/libsrc/leddevice/dev_hid/ProviderHID.h index b779f912..d2629ddf 100644 --- a/libsrc/leddevice/dev_hid/ProviderHID.h +++ b/libsrc/leddevice/dev_hid/ProviderHID.h @@ -26,14 +26,14 @@ public: /// /// @brief Destructor of the LedDevice /// - virtual ~ProviderHID() override; + ~ProviderHID() override; /// /// @brief Discover HIB (USB) devices available (for configuration). /// /// @return A JSON structure holding a list of devices found /// - virtual QJsonObject discover() override; + QJsonObject discover() override; protected: @@ -43,21 +43,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Write the given bytes to the HID-device diff --git a/libsrc/leddevice/dev_net/LedDeviceAtmoOrb.h b/libsrc/leddevice/dev_net/LedDeviceAtmoOrb.h index 7fdd199f..95ce49d4 100644 --- a/libsrc/leddevice/dev_net/LedDeviceAtmoOrb.h +++ b/libsrc/leddevice/dev_net/LedDeviceAtmoOrb.h @@ -33,7 +33,7 @@ public: /// /// @brief Destructor of the LedDevice /// - virtual ~LedDeviceAtmoOrb() override; + ~LedDeviceAtmoOrb() override; /// /// @brief Constructs the LED-device @@ -51,21 +51,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -73,7 +73,7 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; private: diff --git a/libsrc/leddevice/dev_net/LedDeviceFadeCandy.cpp b/libsrc/leddevice/dev_net/LedDeviceFadeCandy.cpp index 15de0b5b..fb8160c9 100644 --- a/libsrc/leddevice/dev_net/LedDeviceFadeCandy.cpp +++ b/libsrc/leddevice/dev_net/LedDeviceFadeCandy.cpp @@ -151,7 +151,7 @@ int LedDeviceFadeCandy::close() return retval; } -bool LedDeviceFadeCandy::isConnected() +bool LedDeviceFadeCandy::isConnected() const { bool connected = false; if ( _client != nullptr ) @@ -204,7 +204,7 @@ int LedDeviceFadeCandy::transferData() return -2; } -int LedDeviceFadeCandy::sendSysEx(uint8_t systemId, uint8_t commandId, QByteArray msg) +int LedDeviceFadeCandy::sendSysEx(uint8_t systemId, uint8_t commandId, const QByteArray& msg) { if ( isConnected() ) { diff --git a/libsrc/leddevice/dev_net/LedDeviceFadeCandy.h b/libsrc/leddevice/dev_net/LedDeviceFadeCandy.h index 274b6b6c..1abe4b94 100644 --- a/libsrc/leddevice/dev_net/LedDeviceFadeCandy.h +++ b/libsrc/leddevice/dev_net/LedDeviceFadeCandy.h @@ -62,21 +62,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -84,7 +84,7 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; private: @@ -106,7 +106,7 @@ private: /// /// @return True, if connection established /// - bool isConnected(); + bool isConnected() const; /// /// @brief Transfer current opc_data buffer to opc server @@ -114,7 +114,7 @@ private: /// @return amount of transferred bytes. -1 error while transferring, -2 error while connecting /// int transferData(); - + /// /// @brief Send system exclusive commands /// @@ -122,7 +122,7 @@ private: /// @param[in] commandId id of command /// @param[in] msg the sysEx message /// @return amount bytes written, -1 if failed - int sendSysEx(uint8_t systemId, uint8_t commandId, QByteArray msg); + int sendSysEx(uint8_t systemId, uint8_t commandId, const QByteArray& msg); /// /// @brief Sends the configuration to fadecandy cserver diff --git a/libsrc/leddevice/dev_net/LedDeviceNanoleaf.cpp b/libsrc/leddevice/dev_net/LedDeviceNanoleaf.cpp index d5477e99..09c2b8f1 100644 --- a/libsrc/leddevice/dev_net/LedDeviceNanoleaf.cpp +++ b/libsrc/leddevice/dev_net/LedDeviceNanoleaf.cpp @@ -513,7 +513,7 @@ bool LedDeviceNanoleaf::powerOff() return true; } -QString LedDeviceNanoleaf::getOnOffRequest (bool isOn ) const +QString LedDeviceNanoleaf::getOnOffRequest(bool isOn) const { QString state = isOn ? STATE_VALUE_TRUE : STATE_VALUE_FALSE; return QString( "{\"%1\":{\"%2\":%3}}" ).arg(STATE_ON, STATE_ONOFF_VALUE, state); @@ -614,7 +614,7 @@ int LedDeviceNanoleaf::write(const std::vector & ledValues) return retVal; } -std::string LedDeviceNanoleaf:: uint8_vector_to_hex_string( const std::vector& buffer ) const +std::string LedDeviceNanoleaf::uint8_vector_to_hex_string(const std::vector& buffer) const { std::stringstream ss; ss << std::hex << std::setfill('0'); diff --git a/libsrc/leddevice/dev_net/LedDeviceNanoleaf.h b/libsrc/leddevice/dev_net/LedDeviceNanoleaf.h index dc1d066a..7386c96e 100644 --- a/libsrc/leddevice/dev_net/LedDeviceNanoleaf.h +++ b/libsrc/leddevice/dev_net/LedDeviceNanoleaf.h @@ -37,7 +37,7 @@ public: /// /// @brief Destructor of the LED-device /// - virtual ~LedDeviceNanoleaf() override; + ~LedDeviceNanoleaf() override; /// /// @brief Constructs the LED-device @@ -51,7 +51,7 @@ public: /// /// @return A JSON structure holding a list of devices found /// - virtual QJsonObject discover() override; + QJsonObject discover() override; /// /// @brief Get the Nanoleaf device's resource properties @@ -68,7 +68,7 @@ public: /// @param[in] params Parameters to query device /// @return A JSON structure holding the device's properties /// - virtual QJsonObject getProperties(const QJsonObject& params) override; + QJsonObject getProperties(const QJsonObject& params) override; /// /// @brief Send an update to the Nanoleaf device to identify it. @@ -83,7 +83,7 @@ public: /// /// @param[in] params Parameters to address device /// - virtual void identify(const QJsonObject& params) override; + void identify(const QJsonObject& params) override; protected: @@ -100,7 +100,7 @@ protected: /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -108,21 +108,21 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative ////// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; /// /// @brief Power-/turn on the Nanoleaf device. /// /// @brief Store the device's original state. /// - virtual bool powerOn() override; + bool powerOn() override; /// /// @brief Power-/turn off the Nanoleaf device. /// /// @return True if success /// - virtual bool powerOff() override; + bool powerOff() override; private: diff --git a/libsrc/leddevice/dev_net/LedDevicePhilipsHue.cpp b/libsrc/leddevice/dev_net/LedDevicePhilipsHue.cpp index db537a87..f38d1181 100644 --- a/libsrc/leddevice/dev_net/LedDevicePhilipsHue.cpp +++ b/libsrc/leddevice/dev_net/LedDevicePhilipsHue.cpp @@ -347,7 +347,7 @@ bool LedDevicePhilipsHueBridge::init(const QJsonObject &deviceConfig) return isInitOK; } -bool LedDevicePhilipsHueBridge::initRestAPI(const QString &hostname, int port, const QString &token ) +bool LedDevicePhilipsHueBridge::initRestAPI(const QString &hostname, int port, const QString &token) { bool isInitOK = false; @@ -403,12 +403,12 @@ int LedDevicePhilipsHueBridge::close() return retval; } -const int *LedDevicePhilipsHueBridge::getCiphersuites() +const int *LedDevicePhilipsHueBridge::getCiphersuites() const { return SSL_CIPHERSUITES; } -void LedDevicePhilipsHueBridge::log(const char* msg, const char* type, ...) +void LedDevicePhilipsHueBridge::log(const char* msg, const char* type, ...) const { const size_t max_val_length = 1024; char val[max_val_length]; @@ -544,17 +544,17 @@ void LedDevicePhilipsHueBridge::setGroupMap(const QJsonDocument &doc) } } -const QMap& LedDevicePhilipsHueBridge::getLightMap() +QMap LedDevicePhilipsHueBridge::getLightMap() const { return _lightsMap; } -const QMap& LedDevicePhilipsHueBridge::getGroupMap() +QMap LedDevicePhilipsHueBridge::getGroupMap() const { return _groupsMap; } -QString LedDevicePhilipsHueBridge::getGroupName(quint16 groupId) +QString LedDevicePhilipsHueBridge::getGroupName(quint16 groupId) const { QString groupName; if( _groupsMap.contains( groupId ) ) @@ -569,7 +569,7 @@ QString LedDevicePhilipsHueBridge::getGroupName(quint16 groupId) return groupName; } -QJsonArray LedDevicePhilipsHueBridge::getGroupLights(quint16 groupId) +QJsonArray LedDevicePhilipsHueBridge::getGroupLights(quint16 groupId) const { QJsonArray groupLights; // search user groupid inside _groupsMap and create light if found @@ -599,13 +599,13 @@ QJsonArray LedDevicePhilipsHueBridge::getGroupLights(quint16 groupId) return groupLights; } -bool LedDevicePhilipsHueBridge::checkApiError(const QJsonDocument &response ) +bool LedDevicePhilipsHueBridge::checkApiError(const QJsonDocument &response) { bool apiError = false; QString errorReason; QString strJson(response.toJson(QJsonDocument::Compact)); - DebugIf(verbose, _log, "Reply: [%s]", strJson.toUtf8().constData() ); + DebugIf(verbose, _log, "Reply: [%s]", strJson.toUtf8().constData()); QVariantList rspList = response.toVariant().toList(); if ( !rspList.isEmpty() ) @@ -662,7 +662,7 @@ QJsonDocument LedDevicePhilipsHueBridge::setGroupState(unsigned int groupId, boo return post( QString("%1/%2").arg( API_GROUPS ).arg( groupId ), QString("{\"%1\":{\"%2\":%3}}").arg( API_STREAM, API_STREAM_ACTIVE, active ) ); } -bool LedDevicePhilipsHueBridge::isStreamOwner(const QString &streamOwner) +bool LedDevicePhilipsHueBridge::isStreamOwner(const QString &streamOwner) const { return ( streamOwner != "" && streamOwner == _username ); } @@ -1254,13 +1254,13 @@ bool LedDevicePhilipsHue::setStreamGroupState(bool state) return false; } -QByteArray LedDevicePhilipsHue::prepareStreamData() +QByteArray LedDevicePhilipsHue::prepareStreamData() const { QByteArray msg; msg.reserve(static_cast(sizeof(HEADER) + sizeof(PAYLOAD_PER_LIGHT) * _lights.size())); msg.append((const char*)HEADER, sizeof(HEADER)); - for (PhilipsHueLight& light : _lights) + for (const PhilipsHueLight& light : _lights) { CiColor lightC = light.getColor(); quint64 R = lightC.x * 0xffff; diff --git a/libsrc/leddevice/dev_net/LedDevicePhilipsHue.h b/libsrc/leddevice/dev_net/LedDevicePhilipsHue.h index ef1b5355..baac3cdd 100644 --- a/libsrc/leddevice/dev_net/LedDevicePhilipsHue.h +++ b/libsrc/leddevice/dev_net/LedDevicePhilipsHue.h @@ -208,13 +208,13 @@ public: void setLightState(unsigned int lightId = 0, const QString &state = ""); - const QMap& getLightMap(); + QMap getLightMap() const; - const QMap& getGroupMap(); + QMap getGroupMap() const; - QString getGroupName(quint16 groupId = 0); + QString getGroupName(quint16 groupId = 0) const; - QJsonArray getGroupLights(quint16 groupId = 0); + QJsonArray getGroupLights(quint16 groupId = 0) const; @@ -226,21 +226,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the Hue-Bridge device and its SSL-connection /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the Hue-Bridge device and its SSL-connection /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Check, if Hue API response indicate error @@ -264,12 +264,12 @@ protected: QJsonDocument getGroupState( unsigned int groupId ); QJsonDocument setGroupState( unsigned int groupId, bool state); - bool isStreamOwner(const QString &streamOwner); + bool isStreamOwner(const QString &streamOwner) const; bool initMaps(); - void log(const char* msg, const char* type, ...); + void log(const char* msg, const char* type, ...) const; - const int * getCiphersuites() override; + const int * getCiphersuites() const override; private: @@ -316,7 +316,7 @@ public: /// /// @brief Destructor of the LED-device /// - virtual ~LedDevicePhilipsHue(); + ~LedDevicePhilipsHue(); /// /// @brief Constructs the LED-device @@ -331,7 +331,7 @@ public: /// /// @return A JSON structure holding a list of devices found /// - virtual QJsonObject discover() override; + QJsonObject discover() override; /// /// @brief Get the Hue Bridge device's resource properties @@ -348,7 +348,7 @@ public: /// @param[in] params Parameters to query device /// @return A JSON structure holding the device's properties /// - virtual QJsonObject getProperties(const QJsonObject& params) override; + QJsonObject getProperties(const QJsonObject& params) override; /// /// @brief Send an update to the device to identify it. @@ -357,7 +357,7 @@ public: /// /// @param[in] params Parameters to address device /// - virtual void identify(const QJsonObject& params) override; + void identify(const QJsonObject& params) override; /// /// @brief Get the number of LEDs supported by the device. @@ -378,7 +378,7 @@ public slots: /// /// Includes switching-off the device and stopping refreshes. /// - virtual void stop() override; + void stop() override; protected: @@ -388,21 +388,21 @@ protected: /// @param deviceConfig Device's configuration in JSON /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -410,7 +410,7 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector& ledValues) override; + int write(const std::vector& ledValues) override; /// /// @brief Switch the LEDs on. @@ -421,7 +421,7 @@ protected: /// /// @return True if success /// - //virtual bool switchOn() override; + //bool switchOn() override; /// /// @brief Switch the LEDs off. @@ -432,7 +432,7 @@ protected: /// /// @return True, if success /// - virtual bool switchOff() override; + bool switchOff() override; /// /// @brief Power-/turn on the LED-device. @@ -441,7 +441,7 @@ protected: /// /// @return True, if success /// - virtual bool powerOn() override; + bool powerOn() override; /// /// @brief Power-/turn off the LED-device. @@ -451,7 +451,7 @@ protected: /// /// @return True, if success /// - virtual bool powerOff() override; + bool powerOff() override; /// /// @brief Store the device's original state. @@ -460,7 +460,7 @@ protected: /// /// @return True if success /// - virtual bool storeState() override; + bool storeState() override; /// /// @brief Restore the device's original state. @@ -470,7 +470,7 @@ protected: /// /// @return True, if success /// - virtual bool restoreState() override; + bool restoreState() override; private slots: @@ -515,7 +515,7 @@ private: void stopBlackTimeoutTimer(); - QByteArray prepareStreamData(); + QByteArray prepareStreamData() const; /// bool _switchOffOnBlack; diff --git a/libsrc/leddevice/dev_net/LedDeviceTpm2net.h b/libsrc/leddevice/dev_net/LedDeviceTpm2net.h index 70338f7c..3d07ee17 100644 --- a/libsrc/leddevice/dev_net/LedDeviceTpm2net.h +++ b/libsrc/leddevice/dev_net/LedDeviceTpm2net.h @@ -34,7 +34,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -42,7 +42,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; int _tpm2_max; int _tpm2ByteCount; diff --git a/libsrc/leddevice/dev_net/LedDeviceUdpArtNet.h b/libsrc/leddevice/dev_net/LedDeviceUdpArtNet.h index 79fd359a..6687a916 100644 --- a/libsrc/leddevice/dev_net/LedDeviceUdpArtNet.h +++ b/libsrc/leddevice/dev_net/LedDeviceUdpArtNet.h @@ -67,7 +67,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -75,7 +75,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; /// /// @brief Generate Art-Net communication header diff --git a/libsrc/leddevice/dev_net/LedDeviceUdpE131.h b/libsrc/leddevice/dev_net/LedDeviceUdpE131.h index 1e0b2632..13c3c6ea 100644 --- a/libsrc/leddevice/dev_net/LedDeviceUdpE131.h +++ b/libsrc/leddevice/dev_net/LedDeviceUdpE131.h @@ -112,7 +112,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -120,7 +120,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; /// /// @brief Generate E1.31 communication header diff --git a/libsrc/leddevice/dev_net/LedDeviceUdpH801.h b/libsrc/leddevice/dev_net/LedDeviceUdpH801.h index 9a106e01..c0897a73 100644 --- a/libsrc/leddevice/dev_net/LedDeviceUdpH801.h +++ b/libsrc/leddevice/dev_net/LedDeviceUdpH801.h @@ -35,7 +35,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -43,7 +43,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; QList _ids; QByteArray _message; diff --git a/libsrc/leddevice/dev_net/LedDeviceUdpRaw.h b/libsrc/leddevice/dev_net/LedDeviceUdpRaw.h index 7cdb8595..5fe89d46 100644 --- a/libsrc/leddevice/dev_net/LedDeviceUdpRaw.h +++ b/libsrc/leddevice/dev_net/LedDeviceUdpRaw.h @@ -34,7 +34,7 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -42,7 +42,7 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; }; #endif // LEDEVICEUDPRAW_H diff --git a/libsrc/leddevice/dev_net/LedDeviceWled.cpp b/libsrc/leddevice/dev_net/LedDeviceWled.cpp index 085bd0d6..565cc091 100644 --- a/libsrc/leddevice/dev_net/LedDeviceWled.cpp +++ b/libsrc/leddevice/dev_net/LedDeviceWled.cpp @@ -111,7 +111,7 @@ bool LedDeviceWled::init(const QJsonObject &deviceConfig) return isInitOK; } -bool LedDeviceWled::initRestAPI(const QString &hostname, int port ) +bool LedDeviceWled::initRestAPI(const QString &hostname, int port) { Debug(_log, ""); bool isInitOK = false; @@ -128,7 +128,7 @@ bool LedDeviceWled::initRestAPI(const QString &hostname, int port ) return isInitOK; } -QString LedDeviceWled::getOnOffRequest (bool isOn ) const +QString LedDeviceWled::getOnOffRequest(bool isOn) const { QString state = isOn ? STATE_VALUE_TRUE : STATE_VALUE_FALSE; return QString( "{\"%1\":%2}" ).arg( STATE_ON, state); diff --git a/libsrc/leddevice/dev_net/LedDeviceWled.h b/libsrc/leddevice/dev_net/LedDeviceWled.h index 4ab56668..bc195ff8 100644 --- a/libsrc/leddevice/dev_net/LedDeviceWled.h +++ b/libsrc/leddevice/dev_net/LedDeviceWled.h @@ -25,7 +25,7 @@ public: /// /// @brief Destructor of the WLED-device /// - virtual ~LedDeviceWled() override; + ~LedDeviceWled() override; /// /// @brief Constructs the WLED-device @@ -39,7 +39,7 @@ public: /// /// @return A JSON structure holding a list of devices found /// - virtual QJsonObject discover() override; + QJsonObject discover() override; /// /// @brief Get the WLED device's resource properties @@ -55,7 +55,7 @@ public: /// @param[in] params Parameters to query device /// @return A JSON structure holding the device's properties /// - virtual QJsonObject getProperties(const QJsonObject& params) override; + QJsonObject getProperties(const QJsonObject& params) override; /// /// @brief Send an update to the WLED device to identify it. @@ -69,7 +69,7 @@ public: /// /// @param[in] params Parameters to address device /// - virtual void identify(const QJsonObject& params) override; + void identify(const QJsonObject& params) override; protected: @@ -79,7 +79,7 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -87,21 +87,21 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; /// /// @brief Power-/turn on the WLED device. /// /// @brief Store the device's original state. /// - virtual bool powerOn() override; + bool powerOn() override; /// /// @brief Power-/turn off the WLED device. /// /// @return True if success /// - virtual bool powerOff() override; + bool powerOff() override; private: diff --git a/libsrc/leddevice/dev_net/LedDeviceYeelight.cpp b/libsrc/leddevice/dev_net/LedDeviceYeelight.cpp index 977bb555..796b66a1 100644 --- a/libsrc/leddevice/dev_net/LedDeviceYeelight.cpp +++ b/libsrc/leddevice/dev_net/LedDeviceYeelight.cpp @@ -575,7 +575,7 @@ bool YeelightLight::identify() return rc; } -bool YeelightLight::isInMusicMode( bool deviceCheck) +bool YeelightLight::isInMusicMode(bool deviceCheck) { bool inMusicMode = false; @@ -899,7 +899,7 @@ bool YeelightLight::setColorHSV(const ColorRgb &colorRGB) } -void YeelightLight::setTransitionEffect ( YeelightLight::API_EFFECT effect ,int duration ) +void YeelightLight::setTransitionEffect(YeelightLight::API_EFFECT effect, int duration) { if( effect != _transitionEffect ) { @@ -914,7 +914,7 @@ void YeelightLight::setTransitionEffect ( YeelightLight::API_EFFECT effect ,int } -void YeelightLight::setBrightnessConfig (int min, int max, bool switchoff, int extraTime, double factor ) +void YeelightLight::setBrightnessConfig(int min, int max, bool switchoff, int extraTime, double factor) { _brightnessMin = min; _isBrightnessSwitchOffMinimum = switchoff; diff --git a/libsrc/leddevice/dev_net/LedDeviceYeelight.h b/libsrc/leddevice/dev_net/LedDeviceYeelight.h index 39359cb1..850f3a65 100644 --- a/libsrc/leddevice/dev_net/LedDeviceYeelight.h +++ b/libsrc/leddevice/dev_net/LedDeviceYeelight.h @@ -49,8 +49,6 @@ public: API_NOTIFICATION, }; - explicit YeelightResponse() {} - API_REPLY error() const { return _error;} void setError(const YeelightResponse::API_REPLY replyType) { _error = replyType; } @@ -79,7 +77,6 @@ class YeelightLight { public: - enum API_EFFECT{ API_EFFECT_SMOOTH, API_EFFECT_SUDDEN @@ -281,7 +278,7 @@ public: /// /// @return True, if success /// - virtual bool restoreState(); + bool restoreState(); /// /// @brief Check, if light was originally powered on before hyperion color streaming started.. @@ -428,7 +425,7 @@ public: /// /// @brief Destructor of the LedDevice /// - virtual ~LedDeviceYeelight() override; + ~LedDeviceYeelight() override; /// /// @brief Constructs the LED-device @@ -443,7 +440,7 @@ public: /// /// @return A JSON structure holding a list of devices found /// - virtual QJsonObject discover() override; + QJsonObject discover() override; /// /// @brief Get a Yeelight device's resource properties @@ -459,7 +456,7 @@ public: /// @param[in] params Parameters to query device /// @return A JSON structure holding the device's properties /// - virtual QJsonObject getProperties(const QJsonObject& params) override; + QJsonObject getProperties(const QJsonObject& params) override; /// /// @brief Send an update to the Yeelight device to identify it. @@ -474,7 +471,7 @@ public: /// /// @param[in] params Parameters to address device /// - virtual void identify(const QJsonObject& params) override; + void identify(const QJsonObject& params) override; protected: @@ -484,21 +481,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -506,21 +503,21 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; /// /// @brief Power-/turn on the Nanoleaf device. /// /// @brief Store the device's original state. /// - virtual bool powerOn() override; + bool powerOn() override; /// /// @brief Power-/turn off the Nanoleaf device. /// /// @return True if success /// - virtual bool powerOff() override; + bool powerOff() override; /// /// @brief Store the device's original state. @@ -529,7 +526,7 @@ protected: /// /// @return True if success /// - virtual bool storeState() override; + bool storeState() override; /// /// @brief Restore the device's original state. @@ -539,7 +536,7 @@ protected: /// /// @return True, if success /// - virtual bool restoreState() override; + bool restoreState() override; private: diff --git a/libsrc/leddevice/dev_net/ProviderRestApi.h b/libsrc/leddevice/dev_net/ProviderRestApi.h index b0090a37..a4397b89 100644 --- a/libsrc/leddevice/dev_net/ProviderRestApi.h +++ b/libsrc/leddevice/dev_net/ProviderRestApi.h @@ -16,8 +16,7 @@ class httpResponse { public: - - explicit httpResponse() {} + httpResponse() {} bool error() const { return _hasError;} void setError(bool hasError) { _hasError = hasError; } diff --git a/libsrc/leddevice/dev_net/ProviderUdp.h b/libsrc/leddevice/dev_net/ProviderUdp.h index 16a94b0a..571a00ad 100644 --- a/libsrc/leddevice/dev_net/ProviderUdp.h +++ b/libsrc/leddevice/dev_net/ProviderUdp.h @@ -26,7 +26,7 @@ public: /// /// @brief Destructor of the UDP LED-device /// - virtual ~ProviderUdp() override; + ~ProviderUdp() override; protected: @@ -36,21 +36,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the UDP device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Writes the given bytes/bits to the UDP-device and sleeps the latch time to ensure that the diff --git a/libsrc/leddevice/dev_net/ProviderUdpSSL.cpp b/libsrc/leddevice/dev_net/ProviderUdpSSL.cpp index 0c4d8859..a1ba38c9 100644 --- a/libsrc/leddevice/dev_net/ProviderUdpSSL.cpp +++ b/libsrc/leddevice/dev_net/ProviderUdpSSL.cpp @@ -182,7 +182,7 @@ void ProviderUdpSSL::closeSSLConnection() } } -const int *ProviderUdpSSL::getCiphersuites() +const int *ProviderUdpSSL::getCiphersuites() const { return mbedtls_ssl_list_ciphersuites(); } diff --git a/libsrc/leddevice/dev_net/ProviderUdpSSL.h b/libsrc/leddevice/dev_net/ProviderUdpSSL.h index 4536db9e..99df9f15 100644 --- a/libsrc/leddevice/dev_net/ProviderUdpSSL.h +++ b/libsrc/leddevice/dev_net/ProviderUdpSSL.h @@ -66,7 +66,7 @@ public: /// /// @brief Destructor of the LED-device /// - virtual ~ProviderUdpSSL() override; + ~ProviderUdpSSL() override; protected: @@ -76,21 +76,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success#endif // PROVIDERUDP_H /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Initialise device's network details @@ -113,7 +113,7 @@ protected: /// /// @return const int * array /// - virtual const int * getCiphersuites(); + virtual const int * getCiphersuites() const; void sslLog(const QString &msg, const char* errorType = "debug"); void sslLog(const char* msg, const char* errorType = "debug"); diff --git a/libsrc/leddevice/dev_other/LedDeviceFile.h b/libsrc/leddevice/dev_other/LedDeviceFile.h index d5a6ae22..95017007 100644 --- a/libsrc/leddevice/dev_other/LedDeviceFile.h +++ b/libsrc/leddevice/dev_other/LedDeviceFile.h @@ -26,7 +26,7 @@ public: /// /// @brief Destructor of the LedDevice /// - virtual ~LedDeviceFile() override; + ~LedDeviceFile() override; /// /// @brief Constructs the LED-device @@ -43,21 +43,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -65,7 +65,7 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; /// The outputstream QFile* _file; diff --git a/libsrc/leddevice/dev_other/LedDevicePiBlaster.h b/libsrc/leddevice/dev_other/LedDevicePiBlaster.h index 5ece8737..4d6b0732 100644 --- a/libsrc/leddevice/dev_other/LedDevicePiBlaster.h +++ b/libsrc/leddevice/dev_other/LedDevicePiBlaster.h @@ -20,7 +20,7 @@ public: /// /// @brief Destructor of the LedDevice /// - virtual ~LedDevicePiBlaster() override; + ~LedDevicePiBlaster() override; /// /// @brief Constructs the LED-device @@ -43,14 +43,14 @@ protected: /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; private: diff --git a/libsrc/leddevice/dev_rpi_pwm/LedDeviceWS281x.cpp b/libsrc/leddevice/dev_rpi_pwm/LedDeviceWS281x.cpp index 284a1e68..c90869d5 100644 --- a/libsrc/leddevice/dev_rpi_pwm/LedDeviceWS281x.cpp +++ b/libsrc/leddevice/dev_rpi_pwm/LedDeviceWS281x.cpp @@ -131,7 +131,7 @@ int LedDeviceWS281x::write(const std::vector &ledValues) Rgb_to_Rgbw(color, &_temp_rgbw, _whiteAlgorithm); } - _led_string.channel[_channel].leds[idx++] = + _led_string.channel[_channel].leds[idx++] = ((uint32_t)_temp_rgbw.white << 24) + ((uint32_t)_temp_rgbw.red << 16) + ((uint32_t)_temp_rgbw.green << 8) + _temp_rgbw.blue; } @@ -139,6 +139,6 @@ int LedDeviceWS281x::write(const std::vector &ledValues) { _led_string.channel[_channel].leds[idx++] = 0; } - + return ws2811_render(&_led_string) ? -1 : 0; } diff --git a/libsrc/leddevice/dev_rpi_pwm/LedDeviceWS281x.h b/libsrc/leddevice/dev_rpi_pwm/LedDeviceWS281x.h index 5ac4b76f..033005d8 100644 --- a/libsrc/leddevice/dev_rpi_pwm/LedDeviceWS281x.h +++ b/libsrc/leddevice/dev_rpi_pwm/LedDeviceWS281x.h @@ -22,7 +22,7 @@ public: /// /// @brief Destructor of the LedDevice /// - virtual ~LedDeviceWS281x() override; + ~LedDeviceWS281x() override; /// /// @brief Destructor of the LedDevice @@ -37,21 +37,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -59,7 +59,7 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; private: diff --git a/libsrc/leddevice/dev_serial/LedDeviceAdalight.h b/libsrc/leddevice/dev_serial/LedDeviceAdalight.h index 38a522b1..f7df1601 100644 --- a/libsrc/leddevice/dev_serial/LedDeviceAdalight.h +++ b/libsrc/leddevice/dev_serial/LedDeviceAdalight.h @@ -35,7 +35,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -43,7 +43,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; const short _headerSize; bool _ligthBerryAPA102Mode; diff --git a/libsrc/leddevice/dev_serial/LedDeviceAtmo.h b/libsrc/leddevice/dev_serial/LedDeviceAtmo.h index 9aa13e94..0bb316d9 100644 --- a/libsrc/leddevice/dev_serial/LedDeviceAtmo.h +++ b/libsrc/leddevice/dev_serial/LedDeviceAtmo.h @@ -30,7 +30,7 @@ private: /// /// @param[in] deviceConfig the JSON device configuration /// @return True, if success - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -38,7 +38,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector &ledValues) override; + int write(const std::vector &ledValues) override; }; #endif // LEDEVICEATMO_H diff --git a/libsrc/leddevice/dev_serial/LedDeviceDMX.h b/libsrc/leddevice/dev_serial/LedDeviceDMX.h index 717432f6..ee7050f0 100644 --- a/libsrc/leddevice/dev_serial/LedDeviceDMX.h +++ b/libsrc/leddevice/dev_serial/LedDeviceDMX.h @@ -24,7 +24,7 @@ public: /// @param[in] deviceConfig Device's configuration as JSON-Object /// @return LedDevice constructed static LedDevice* construct(const QJsonObject &deviceConfig); - + private: /// @@ -33,7 +33,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -41,7 +41,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector &ledValues) override; + int write(const std::vector &ledValues) override; int _dmxDeviceType = 0; int _dmxStart = 1; diff --git a/libsrc/leddevice/dev_serial/LedDeviceKarate.h b/libsrc/leddevice/dev_serial/LedDeviceKarate.h index b09d892d..f0b4329c 100644 --- a/libsrc/leddevice/dev_serial/LedDeviceKarate.h +++ b/libsrc/leddevice/dev_serial/LedDeviceKarate.h @@ -34,14 +34,14 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// @brief Writes the RGB-Color values to the LEDs. /// /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector &ledValues) override; + int write(const std::vector &ledValues) override; }; #endif // LEDEVICEKARATE_H diff --git a/libsrc/leddevice/dev_serial/LedDeviceSedu.h b/libsrc/leddevice/dev_serial/LedDeviceSedu.h index f59da2f2..9853c558 100644 --- a/libsrc/leddevice/dev_serial/LedDeviceSedu.h +++ b/libsrc/leddevice/dev_serial/LedDeviceSedu.h @@ -33,7 +33,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -41,7 +41,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector &ledValues) override; + int write(const std::vector &ledValues) override; }; #endif // LEDEVICESEDU_H diff --git a/libsrc/leddevice/dev_serial/LedDeviceTpm2.h b/libsrc/leddevice/dev_serial/LedDeviceTpm2.h index a53b0a66..179b97e5 100644 --- a/libsrc/leddevice/dev_serial/LedDeviceTpm2.h +++ b/libsrc/leddevice/dev_serial/LedDeviceTpm2.h @@ -33,7 +33,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -41,7 +41,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector &ledValues) override; + int write(const std::vector &ledValues) override; }; #endif // LEDEVICETPM2_H diff --git a/libsrc/leddevice/dev_serial/ProviderRs232.h b/libsrc/leddevice/dev_serial/ProviderRs232.h index 069c274f..1c2f4eea 100644 --- a/libsrc/leddevice/dev_serial/ProviderRs232.h +++ b/libsrc/leddevice/dev_serial/ProviderRs232.h @@ -24,7 +24,7 @@ public: /// /// @brief Destructor of the UDP LED-device /// - virtual ~ProviderRs232() override; + ~ProviderRs232() override; protected: @@ -34,21 +34,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the UDP device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Power-/turn off a RS232-device @@ -57,21 +57,21 @@ protected: /// /// @return True, if success /// - virtual bool powerOff() override; + bool powerOff() override; /// /// @brief Discover first devices of a serial device available (for configuration) /// /// @return A string of the device found /// - virtual QString discoverFirst() override; + QString discoverFirst() override; /// /// @brief Discover RS232 serial devices available (for configuration). /// /// @return A JSON structure holding a list of devices found /// - virtual QJsonObject discover() override; + QJsonObject discover() override; /// /// @brief Write the given bytes to the RS232-device @@ -96,7 +96,7 @@ protected slots: /// /// @param errorMsg The error message to be logged /// - virtual void setInError( const QString& errorMsg) override; + void setInError( const QString& errorMsg) override; private: @@ -105,7 +105,7 @@ private: /// /// @return True,if on success /// - bool tryOpen(const int delayAfterConnect_ms); + bool tryOpen(int delayAfterConnect_ms); /// Try to auto-discover device name? bool _isAutoDeviceName; diff --git a/libsrc/leddevice/dev_spi/LedDeviceAPA102.h b/libsrc/leddevice/dev_spi/LedDeviceAPA102.h index 527a2114..712ed75d 100644 --- a/libsrc/leddevice/dev_spi/LedDeviceAPA102.h +++ b/libsrc/leddevice/dev_spi/LedDeviceAPA102.h @@ -34,7 +34,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -42,7 +42,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; }; #endif // LEDEVICEAPA102_H diff --git a/libsrc/leddevice/dev_spi/LedDeviceAPA104.h b/libsrc/leddevice/dev_spi/LedDeviceAPA104.h index 2c70494b..cca986f7 100644 --- a/libsrc/leddevice/dev_spi/LedDeviceAPA104.h +++ b/libsrc/leddevice/dev_spi/LedDeviceAPA104.h @@ -33,7 +33,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -41,7 +41,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; const int SPI_BYTES_PER_COLOUR; const int SPI_FRAME_END_LATCH_BYTES; diff --git a/libsrc/leddevice/dev_spi/LedDeviceLpd6803.h b/libsrc/leddevice/dev_spi/LedDeviceLpd6803.h index 65a11741..0e04d506 100644 --- a/libsrc/leddevice/dev_spi/LedDeviceLpd6803.h +++ b/libsrc/leddevice/dev_spi/LedDeviceLpd6803.h @@ -41,7 +41,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -49,7 +49,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; }; #endif // LEDEVICELPD6803_H diff --git a/libsrc/leddevice/dev_spi/LedDeviceLpd8806.h b/libsrc/leddevice/dev_spi/LedDeviceLpd8806.h index 5460759f..c81668ee 100644 --- a/libsrc/leddevice/dev_spi/LedDeviceLpd8806.h +++ b/libsrc/leddevice/dev_spi/LedDeviceLpd8806.h @@ -103,7 +103,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -111,7 +111,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; }; #endif // LEDEVICELPD8806_H diff --git a/libsrc/leddevice/dev_spi/LedDeviceP9813.h b/libsrc/leddevice/dev_spi/LedDeviceP9813.h index 675d2505..d8c794d9 100644 --- a/libsrc/leddevice/dev_spi/LedDeviceP9813.h +++ b/libsrc/leddevice/dev_spi/LedDeviceP9813.h @@ -32,7 +32,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -40,7 +40,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; /// /// Calculates the required checksum for one LED diff --git a/libsrc/leddevice/dev_spi/LedDeviceSk6812SPI.h b/libsrc/leddevice/dev_spi/LedDeviceSk6812SPI.h index c1aac7d5..095163a0 100644 --- a/libsrc/leddevice/dev_spi/LedDeviceSk6812SPI.h +++ b/libsrc/leddevice/dev_spi/LedDeviceSk6812SPI.h @@ -33,7 +33,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -41,7 +41,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; RGBW::WhiteAlgorithm _whiteAlgorithm; diff --git a/libsrc/leddevice/dev_spi/LedDeviceSk6822SPI.h b/libsrc/leddevice/dev_spi/LedDeviceSk6822SPI.h index 480a4dbb..5c63e160 100644 --- a/libsrc/leddevice/dev_spi/LedDeviceSk6822SPI.h +++ b/libsrc/leddevice/dev_spi/LedDeviceSk6822SPI.h @@ -33,7 +33,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -41,7 +41,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; const int SPI_BYTES_PER_COLOUR; const int SPI_BYTES_WAIT_TIME; diff --git a/libsrc/leddevice/dev_spi/LedDeviceWs2801.h b/libsrc/leddevice/dev_spi/LedDeviceWs2801.h index f8398c71..a8bc31d8 100644 --- a/libsrc/leddevice/dev_spi/LedDeviceWs2801.h +++ b/libsrc/leddevice/dev_spi/LedDeviceWs2801.h @@ -33,7 +33,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -41,7 +41,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; }; #endif // LEDEVICEWS2801_H diff --git a/libsrc/leddevice/dev_spi/LedDeviceWs2812SPI.h b/libsrc/leddevice/dev_spi/LedDeviceWs2812SPI.h index ae03039a..5fe039ac 100644 --- a/libsrc/leddevice/dev_spi/LedDeviceWs2812SPI.h +++ b/libsrc/leddevice/dev_spi/LedDeviceWs2812SPI.h @@ -33,7 +33,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -41,7 +41,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; const int SPI_BYTES_PER_COLOUR; const int SPI_FRAME_END_LATCH_BYTES; diff --git a/libsrc/leddevice/dev_spi/ProviderSpi.h b/libsrc/leddevice/dev_spi/ProviderSpi.h index 8577d7e5..08ad8f19 100644 --- a/libsrc/leddevice/dev_spi/ProviderSpi.h +++ b/libsrc/leddevice/dev_spi/ProviderSpi.h @@ -22,26 +22,26 @@ public: /// /// @param deviceConfig the json device config /// @return true if success - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// Destructor of the LedDevice; closes the output device if it is open /// - virtual ~ProviderSpi() override; + ~ProviderSpi() override; /// /// Opens and configures the output device /// /// @return Zero on succes else negative /// - int open() override; + int open() override; public slots: /// /// Closes the output device. /// Includes switching-off the device and stopping refreshes /// - virtual int close() override; + int close() override; protected: /// diff --git a/libsrc/leddevice/dev_tinker/LedDeviceTinkerforge.h b/libsrc/leddevice/dev_tinker/LedDeviceTinkerforge.h index a6f42118..a7c05a2f 100644 --- a/libsrc/leddevice/dev_tinker/LedDeviceTinkerforge.h +++ b/libsrc/leddevice/dev_tinker/LedDeviceTinkerforge.h @@ -23,7 +23,7 @@ public: /// explicit LedDeviceTinkerforge(const QJsonObject &deviceConfig); - virtual ~LedDeviceTinkerforge() override; + ~LedDeviceTinkerforge() override; /// /// @brief Constructs the LED-device @@ -40,14 +40,14 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens a connection to the master bricklet and the led strip bricklet. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -55,7 +55,7 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; private: diff --git a/libsrc/ssdp/SSDPDiscover.cpp b/libsrc/ssdp/SSDPDiscover.cpp index 139e9212..712e2f32 100644 --- a/libsrc/ssdp/SSDPDiscover.cpp +++ b/libsrc/ssdp/SSDPDiscover.cpp @@ -49,7 +49,7 @@ void SSDPDiscover::searchForService(const QString& st) sendSearch(st); } -const QString SSDPDiscover::getFirstService(const searchType& type, const QString& st, int timeout_ms) +QString SSDPDiscover::getFirstService(const searchType& type, const QString& st, int timeout_ms) { _searchTarget = st; _services.clear(); @@ -296,11 +296,11 @@ int SSDPDiscover::discoverServices(const QString& searchTarget, const QString& k return rc; } -QJsonArray SSDPDiscover::getServicesDiscoveredJson() +QJsonArray SSDPDiscover::getServicesDiscoveredJson() const { QJsonArray result; - QMap::iterator i; + QMap::const_iterator i; for (i = _services.begin(); i != _services.end(); ++i) { //Debug(_log, "Device discovered at [%s]", QSTRING_CSTR( i.key() )); @@ -338,7 +338,7 @@ QJsonArray SSDPDiscover::getServicesDiscoveredJson() } QJsonObject objOther; - QMap ::iterator o; + QMap ::const_iterator o; for (o = i.value().otherHeaders.begin(); o != i.value().otherHeaders.end(); ++o) { objOther.insert(o.key().toLower(), o.value()); diff --git a/libsrc/utils/FileUtils.cpp b/libsrc/utils/FileUtils.cpp index 5ee8bb2a..faf5e67f 100644 --- a/libsrc/utils/FileUtils.cpp +++ b/libsrc/utils/FileUtils.cpp @@ -10,13 +10,13 @@ namespace FileUtils { - QString getBaseName(QString sourceFile) + QString getBaseName(const QString& sourceFile) { QFileInfo fi(sourceFile); return fi.fileName(); } - QString getDirName(QString sourceFile) + QString getDirName(const QString& sourceFile) { QFileInfo fi(sourceFile); return fi.path(); diff --git a/libsrc/utils/Logger.cpp b/libsrc/utils/Logger.cpp index cd68c7e2..04d2f3fb 100644 --- a/libsrc/utils/Logger.cpp +++ b/libsrc/utils/Logger.cpp @@ -114,7 +114,7 @@ Logger::LogLevel Logger::getLogLevel(const QString & name) return static_cast(int(GLOBAL_MIN_LOG_LEVEL)); } - Logger* log = Logger::getInstance(name); + const Logger* log = Logger::getInstance(name); return log->getMinLevel(); } diff --git a/libsrc/utils/NetOrigin.cpp b/libsrc/utils/NetOrigin.cpp index 44b873ba..d5a486e6 100644 --- a/libsrc/utils/NetOrigin.cpp +++ b/libsrc/utils/NetOrigin.cpp @@ -13,7 +13,7 @@ NetOrigin::NetOrigin(QObject* parent, Logger* log) NetOrigin::instance = this; } -bool NetOrigin::accessAllowed(const QHostAddress& address, const QHostAddress& local) +bool NetOrigin::accessAllowed(const QHostAddress& address, const QHostAddress& local) const { if(_internetAccessAllowed) return true; @@ -29,7 +29,7 @@ bool NetOrigin::accessAllowed(const QHostAddress& address, const QHostAddress& l return true; } -bool NetOrigin::isLocalAddress(const QHostAddress& address, const QHostAddress& local) +bool NetOrigin::isLocalAddress(const QHostAddress& address, const QHostAddress& local) const { if(address.protocol() == QAbstractSocket::IPv4Protocol) { diff --git a/libsrc/utils/Process.cpp b/libsrc/utils/Process.cpp index 3403398d..61743bbd 100644 --- a/libsrc/utils/Process.cpp +++ b/libsrc/utils/Process.cpp @@ -6,7 +6,7 @@ namespace Process { void restartHyperion(bool asNewProcess){} -QByteArray command_exec(QString /*cmd*/, QByteArray /*data*/) +QByteArray command_exec(const QString& /*cmd*/, const QByteArray& /*data*/) { return QSTRING_CSTR(QString()); } @@ -48,7 +48,7 @@ void restartHyperion(bool asNewProcess) QCoreApplication::quit(); } -QByteArray command_exec(QString cmd, QByteArray data) +QByteArray command_exec(const QString& cmd, const QByteArray& data) { char buffer[128]; QString result; diff --git a/libsrc/utils/Profiler.cpp b/libsrc/utils/Profiler.cpp index 3643da6f..bab62213 100644 --- a/libsrc/utils/Profiler.cpp +++ b/libsrc/utils/Profiler.cpp @@ -43,7 +43,7 @@ void Profiler::initLogger() _logger = Logger::getInstance("PROFILER", Logger::DEBUG); } -void Profiler::TimerStart(const QString timerName, const char* sourceFile, const char* func, unsigned int line) +void Profiler::TimerStart(const QString& timerName, const char* sourceFile, const char* func, unsigned int line) { std::pair::iterator,bool> ret; Profiler::initLogger(); @@ -71,7 +71,7 @@ void Profiler::TimerStart(const QString timerName, const char* sourceFile, const } -void Profiler::TimerGetTime(const QString timerName, const char* sourceFile, const char* func, unsigned int line) +void Profiler::TimerGetTime(const QString& timerName, const char* sourceFile, const char* func, unsigned int line) { std::map::iterator ret = GlobalProfilerMap.find(timerName); Profiler::initLogger(); diff --git a/libsrc/utils/RgbToRgbw.cpp b/libsrc/utils/RgbToRgbw.cpp index a329439e..7c9430af 100644 --- a/libsrc/utils/RgbToRgbw.cpp +++ b/libsrc/utils/RgbToRgbw.cpp @@ -5,7 +5,7 @@ namespace RGBW { -WhiteAlgorithm stringToWhiteAlgorithm(QString str) +WhiteAlgorithm stringToWhiteAlgorithm(const QString& str) { if (str == "subtract_minimum") return WhiteAlgorithm::SUBTRACT_MINIMUM; if (str == "sub_min_warm_adjust") return WhiteAlgorithm::SUB_MIN_WARM_ADJUST; diff --git a/libsrc/utils/jsonschema/QJsonSchemaChecker.cpp b/libsrc/utils/jsonschema/QJsonSchemaChecker.cpp index 1ee0e6d7..99eae0d6 100644 --- a/libsrc/utils/jsonschema/QJsonSchemaChecker.cpp +++ b/libsrc/utils/jsonschema/QJsonSchemaChecker.cpp @@ -166,7 +166,7 @@ void QJsonSchemaChecker::setMessage(const QString & message) _messages.append(_currentPath.join("") +": "+message); } -const QStringList & QJsonSchemaChecker::getMessages() const +QStringList QJsonSchemaChecker::getMessages() const { return _messages; } diff --git a/libsrc/webserver/CgiHandler.h b/libsrc/webserver/CgiHandler.h index d096a700..3c38de43 100644 --- a/libsrc/webserver/CgiHandler.h +++ b/libsrc/webserver/CgiHandler.h @@ -10,19 +10,20 @@ #include "QtHttpReply.h" #include "QtHttpRequest.h" -class CgiHandler : public QObject { +class CgiHandler : public QObject +{ Q_OBJECT public: - CgiHandler (QObject * parent = NULL); + CgiHandler(QObject * parent = nullptr); void setBaseUrl(const QString& url); - void exec(const QStringList & args,QtHttpRequest * request, QtHttpReply * reply); + void exec(const QStringList & args, QtHttpRequest * request, QtHttpReply * reply); private: // CGI commands void cmd_cfg_jsonserver(); - void cmd_runscript (); + void cmd_runscript(); QtHttpReply * _reply; QtHttpRequest * _request; diff --git a/libsrc/webserver/QtHttpServer.h b/libsrc/webserver/QtHttpServer.h index ca8a9f02..4e09c6d7 100644 --- a/libsrc/webserver/QtHttpServer.h +++ b/libsrc/webserver/QtHttpServer.h @@ -24,7 +24,7 @@ class QtHttpServerWrapper : public QTcpServer public: explicit QtHttpServerWrapper (QObject * parent = Q_NULLPTR); - virtual ~QtHttpServerWrapper (void); + ~QtHttpServerWrapper() override; void setUseSecure (const bool ssl = true); diff --git a/libsrc/webserver/StaticFileServing.h b/libsrc/webserver/StaticFileServing.h index 4ef991bf..c1ec6395 100644 --- a/libsrc/webserver/StaticFileServing.h +++ b/libsrc/webserver/StaticFileServing.h @@ -11,12 +11,13 @@ #include -class StaticFileServing : public QObject { +class StaticFileServing : public QObject +{ Q_OBJECT public: - explicit StaticFileServing (QObject * parent = nullptr); - virtual ~StaticFileServing (); + explicit StaticFileServing (QObject * parent = nullptr); + ~StaticFileServing() override; /// /// @brief Overwrite current base url @@ -29,7 +30,7 @@ public: void setSSDPDescription(const QString& desc); public slots: - void onRequestNeedsReply (QtHttpRequest * request, QtHttpReply * reply); + void onRequestNeedsReply (QtHttpRequest * request, QtHttpReply * reply); private: QString _baseUrl; diff --git a/libsrc/webserver/WebSocketClient.h b/libsrc/webserver/WebSocketClient.h index dc579b96..5c90f8cb 100644 --- a/libsrc/webserver/WebSocketClient.h +++ b/libsrc/webserver/WebSocketClient.h @@ -9,7 +9,8 @@ class QtHttpRequest; class Hyperion; class JsonAPI; -class WebSocketClient : public QObject { +class WebSocketClient : public QObject +{ Q_OBJECT public: WebSocketClient(QtHttpRequest* request, QTcpSocket* sock, bool localConnection, QObject* parent);