diff --git a/include/api/JsonAPI.h b/include/api/JsonAPI.h index cb5127b54..9524d0c2d 100644 --- a/include/api/JsonAPI.h +++ b/include/api/JsonAPI.h @@ -85,7 +85,7 @@ private slots: /// @param instance The index of instance /// @param name The name of the instance, just available with H_CREATED /// - void handleInstanceStateChange(const instanceState &state, const quint8 &instance, const QString &name = QString()); + void handleInstanceStateChange(const InstanceState &state, const quint8 &instance, const QString &name = QString()); signals: /// diff --git a/include/grabber/AmlogicGrabber.h b/include/grabber/AmlogicGrabber.h index a2f4b78b9..fee7bc37c 100644 --- a/include/grabber/AmlogicGrabber.h +++ b/include/grabber/AmlogicGrabber.h @@ -18,7 +18,7 @@ class AmlogicGrabber : public Grabber /// @param[in] height The heigth of the captured screenshot /// AmlogicGrabber(const unsigned width, const unsigned height); - ~AmlogicGrabber(); + ~AmlogicGrabber() override; /// /// Captures a single snapshot of the display and writes the data to the given image. The diff --git a/include/grabber/AmlogicWrapper.h b/include/grabber/AmlogicWrapper.h index 5df6c95a5..31d9d4c91 100644 --- a/include/grabber/AmlogicWrapper.h +++ b/include/grabber/AmlogicWrapper.h @@ -20,11 +20,6 @@ class AmlogicWrapper : public GrabberWrapper /// AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight); - /// - /// Destructor of this dispmanx frame grabber. Releases any claimed resources. - /// - virtual ~AmlogicWrapper() {}; - public slots: /// /// Performs a single frame grab and computes the led-colors diff --git a/include/grabber/DispmanxFrameGrabber.h b/include/grabber/DispmanxFrameGrabber.h index 82b14b357..1aea2e010 100644 --- a/include/grabber/DispmanxFrameGrabber.h +++ b/include/grabber/DispmanxFrameGrabber.h @@ -27,7 +27,7 @@ class DispmanxFrameGrabber : public Grabber /// @param[in] height The heigth of the captured screenshot /// DispmanxFrameGrabber(const unsigned width, const unsigned height); - ~DispmanxFrameGrabber(); + ~DispmanxFrameGrabber() override; /// diff --git a/include/grabber/DispmanxFrameGrabberMock.h b/include/grabber/DispmanxFrameGrabberMock.h index 477909e89..6e76078a8 100644 --- a/include/grabber/DispmanxFrameGrabberMock.h +++ b/include/grabber/DispmanxFrameGrabberMock.h @@ -36,5 +36,4 @@ int vc_dispmanx_resource_read_data(DISPMANX_RESOURCE_HANDLE_T vc_resource, VC_R void vc_dispmanx_rect_set(VC_RECT_T *rectangle, int left, int top, int width, int height); int vc_dispmanx_snapshot(int, DISPMANX_RESOURCE_HANDLE_T resource, int vc_flags); - #endif diff --git a/include/grabber/DispmanxWrapper.h b/include/grabber/DispmanxWrapper.h index e231c8091..f62e6002b 100644 --- a/include/grabber/DispmanxWrapper.h +++ b/include/grabber/DispmanxWrapper.h @@ -22,11 +22,6 @@ class DispmanxWrapper: public GrabberWrapper /// DispmanxWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz); - /// - /// Destructor of this dispmanx frame grabber. Releases any claimed resources. - /// - virtual ~DispmanxWrapper() {}; - public slots: /// /// Performs a single frame grab and computes the led-colors diff --git a/include/grabber/FramebufferFrameGrabber.h b/include/grabber/FramebufferFrameGrabber.h index 6296755f6..0ba5b6b8a 100644 --- a/include/grabber/FramebufferFrameGrabber.h +++ b/include/grabber/FramebufferFrameGrabber.h @@ -18,7 +18,6 @@ class FramebufferFrameGrabber : public Grabber /// @param[in] height The heigth of the captured screenshot /// FramebufferFrameGrabber(const QString & device, const unsigned width, const unsigned height); - ~FramebufferFrameGrabber(); /// /// Captures a single snapshot of the display and writes the data to the given image. The @@ -36,12 +35,6 @@ class FramebufferFrameGrabber : public Grabber virtual void setDevicePath(const QString& path); private: - /// Framebuffer file descriptor - int _fbfd; - - /// Pointer to framebuffer - unsigned char * _fbp; - /// Framebuffer device e.g. /dev/fb0 QString _fbDevice; }; diff --git a/include/grabber/FramebufferWrapper.h b/include/grabber/FramebufferWrapper.h index a7c9243cb..a782d10a0 100644 --- a/include/grabber/FramebufferWrapper.h +++ b/include/grabber/FramebufferWrapper.h @@ -22,11 +22,6 @@ class FramebufferWrapper: public GrabberWrapper /// FramebufferWrapper(const QString & device, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz); - /// - /// Destructor of this framebuffer frame grabber. Releases any claimed resources. - /// - virtual ~FramebufferWrapper() {}; - public slots: /// /// Performs a single frame grab and computes the led-colors diff --git a/include/grabber/OsxFrameGrabber.h b/include/grabber/OsxFrameGrabber.h index 59e39930b..5d6923969 100644 --- a/include/grabber/OsxFrameGrabber.h +++ b/include/grabber/OsxFrameGrabber.h @@ -25,7 +25,7 @@ class OsxFrameGrabber : public Grabber /// @param[in] height The heigth of the captured screenshot /// OsxFrameGrabber(const unsigned display, const unsigned width, const unsigned height); - ~OsxFrameGrabber(); + ~OsxFrameGrabber() override; /// /// Captures a single snapshot of the display and writes the data to the given image. The diff --git a/include/grabber/OsxWrapper.h b/include/grabber/OsxWrapper.h index 65ce70ab3..093fa1627 100644 --- a/include/grabber/OsxWrapper.h +++ b/include/grabber/OsxWrapper.h @@ -22,11 +22,6 @@ class OsxWrapper: public GrabberWrapper /// OsxWrapper(const unsigned display, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz); - /// - /// Destructor of this osx frame grabber. Releases any claimed resources. - /// - virtual ~OsxWrapper() {}; - public slots: /// /// Performs a single frame grab and computes the led-colors diff --git a/include/grabber/QtGrabber.h b/include/grabber/QtGrabber.h index 5ba1cc502..3460a0383 100644 --- a/include/grabber/QtGrabber.h +++ b/include/grabber/QtGrabber.h @@ -17,7 +17,7 @@ class QtGrabber : public Grabber QtGrabber(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, int display); - virtual ~QtGrabber(); + ~QtGrabber() override; /// /// Captures a single snapshot of the display and writes the data to the given image. The diff --git a/include/grabber/QtWrapper.h b/include/grabber/QtWrapper.h index 3c4b7d289..67135ed77 100644 --- a/include/grabber/QtWrapper.h +++ b/include/grabber/QtWrapper.h @@ -21,11 +21,6 @@ class QtWrapper: public GrabberWrapper /// QtWrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, int display, const unsigned updateRate_Hz); - /// - /// Destructor of this qt frame grabber. Releases any claimed resources. - /// - virtual ~QtWrapper() {}; - public slots: /// /// Performs a single frame grab and computes the led-colors diff --git a/include/grabber/V4L2Wrapper.h b/include/grabber/V4L2Wrapper.h index 0476b96e9..fc9596a6d 100644 --- a/include/grabber/V4L2Wrapper.h +++ b/include/grabber/V4L2Wrapper.h @@ -16,7 +16,6 @@ class V4L2Wrapper : public GrabberWrapper VideoStandard videoStandard, PixelFormat pixelFormat, int pixelDecimation ); - virtual ~V4L2Wrapper() {}; bool getSignalDetectionEnable(); diff --git a/include/grabber/X11Grabber.h b/include/grabber/X11Grabber.h index ab7adf456..fabc26124 100644 --- a/include/grabber/X11Grabber.h +++ b/include/grabber/X11Grabber.h @@ -19,7 +19,7 @@ class X11Grabber : public Grabber X11Grabber(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation); - virtual ~X11Grabber(); + ~X11Grabber() override; bool Setup(); diff --git a/include/grabber/X11Wrapper.h b/include/grabber/X11Wrapper.h index 51f2c77cb..9271d9cd7 100644 --- a/include/grabber/X11Wrapper.h +++ b/include/grabber/X11Wrapper.h @@ -26,11 +26,6 @@ class X11Wrapper: public GrabberWrapper /// X11Wrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, const unsigned updateRate_Hz); - /// - /// Destructor of this framebuffer frame grabber. Releases any claimed resources. - /// - virtual ~X11Wrapper() {}; - public slots: /// /// Performs a single frame grab and computes the led-colors diff --git a/include/hyperion/CaptureCont.h b/include/hyperion/CaptureCont.h index 55693b913..139f4295b 100644 --- a/include/hyperion/CaptureCont.h +++ b/include/hyperion/CaptureCont.h @@ -17,7 +17,6 @@ class CaptureCont : public QObject Q_OBJECT public: CaptureCont(Hyperion* hyperion); - ~CaptureCont(); void setSystemCaptureEnable(const bool& enable); void setV4LCaptureEnable(const bool& enable); diff --git a/include/hyperion/Grabber.h b/include/hyperion/Grabber.h index 3570e7436..7ec8026bc 100644 --- a/include/hyperion/Grabber.h +++ b/include/hyperion/Grabber.h @@ -23,7 +23,6 @@ class Grabber : public QObject public: Grabber(QString grabberName = "", int width=0, int height=0, int cropLeft=0, int cropRight=0, int cropTop=0, int cropBottom=0); - virtual ~Grabber(); /// /// Set the video mode (2D/3D) diff --git a/include/hyperion/Hyperion.h b/include/hyperion/Hyperion.h index 091fe9b9d..3218fb039 100644 --- a/include/hyperion/Hyperion.h +++ b/include/hyperion/Hyperion.h @@ -2,7 +2,6 @@ // stl includes #include -#include // QT includes #include @@ -11,6 +10,7 @@ #include #include #include +#include #include // hyperion-utils includes @@ -59,32 +59,25 @@ class Hyperion : public QObject Q_OBJECT public: /// Type definition of the info structure used by the priority muxer - typedef PriorityMuxer::InputInfo InputInfo; - /// - /// RGB-Color channel enumeration - /// - enum RgbChannel - { - BLACK, WHITE, RED, GREEN, BLUE, CYAN, MAGENTA, YELLOW, INVALID - }; + using InputInfo = PriorityMuxer::InputInfo; /// /// Destructor; cleans up resources /// - virtual ~Hyperion(); + ~Hyperion() override; /// /// free all alocated objects, should be called only from constructor or before restarting hyperion /// void freeObjects(bool emitCloseSignal=false); - ImageProcessor* getImageProcessor() { return _imageProcessor; }; + ImageProcessor* getImageProcessor() { return _imageProcessor; } /// /// @brief Get instance index of this instance /// @return The index of this instance /// - const quint8 & getInstanceIndex() { return _instIndex; }; + const quint8 & getInstanceIndex() { return _instIndex; } /// /// Returns the number of attached leds @@ -94,7 +87,7 @@ class Hyperion : public QObject /// /// @brief Return the size of led grid /// - QSize getLedGridSize() const { return _ledGridSize; }; + QSize getLedGridSize() const { return _ledGridSize; } /// gets the methode how image is maped to leds const int & getLedMappingType(); @@ -110,8 +103,8 @@ class Hyperion : public QObject /// /// @brief Get the current active led device - /// @return The device nam - /// e + /// @return The device name + /// const QString & getActiveDeviceType(); /// @@ -206,7 +199,7 @@ public slots: /// @return EffectEngine instance pointer /// - EffectEngine* getEffectEngineInstance() { return _effectEngine; }; + EffectEngine* getEffectEngineInstance() { return _effectEngine; } /// /// @brief Save an effect /// @param obj The effect args @@ -259,7 +252,7 @@ public slots: /// @brief Get a pointer to the priorityMuxer instance /// @return PriorityMuxer instance pointer /// - PriorityMuxer* getMuxerInstance() { return &_muxer; }; + PriorityMuxer* getMuxerInstance() { return &_muxer; } /// /// @brief enable/disable automatic/priorized source selection @@ -335,7 +328,7 @@ public slots: /// @brief Get the component Register /// return Component register pointer /// - ComponentRegister& getComponentRegister() { return _componentRegister; }; + ComponentRegister& getComponentRegister() { return _componentRegister; } /// /// @brief Called from components to update their current state. DO NOT CALL FROM USERS @@ -489,7 +482,7 @@ private slots: /// /// @brief Apply new videoMode from Daemon to _currVideoMode /// - void handleNewVideoMode(const VideoMode& mode) { _currVideoMode = mode; }; + void handleNewVideoMode(const VideoMode& mode) { _currVideoMode = mode; } private: friend class HyperionDaemon; diff --git a/include/hyperion/HyperionIManager.h b/include/hyperion/HyperionIManager.h index d5e83ee96..4943ca73c 100644 --- a/include/hyperion/HyperionIManager.h +++ b/include/hyperion/HyperionIManager.h @@ -12,7 +12,7 @@ class Hyperion; class InstanceTable; -enum instanceState{ +enum class InstanceState{ H_STARTED, H_ON_STOP, H_STOPPED, @@ -29,7 +29,7 @@ class HyperionIManager : public QObject public: // global instance pointer - static HyperionIManager* getInstance() { return HIMinstance; }; + static HyperionIManager* getInstance() { return HIMinstance; } static HyperionIManager* HIMinstance; public slots: @@ -38,7 +38,7 @@ public slots: /// @param inst The instance to check /// @return True when running else false /// - bool IsInstanceRunning(const quint8& inst) { return _runningInstances.contains(inst); }; + bool IsInstanceRunning(const quint8& inst) { return _runningInstances.contains(inst); } /// /// @brief Get a Hyperion instance by index @@ -103,7 +103,7 @@ public slots: /// @param instance The index of instance /// @param name The name of the instance, just available with H_CREATED /// - void instanceStateChanged(const instanceState& state, const quint8& instance, const QString& name = QString()); + void instanceStateChanged(const InstanceState& state, const quint8& instance, const QString& name = QString()); /// /// @brief Emits whenever something changes, the lazy version of instanceStateChanged (- H_ON_STOP) + saveName() emit @@ -172,7 +172,7 @@ private slots: /// @brief check if a instance is allowed for management. Instance 0 represents the root instance /// @apram inst The instance to check /// - bool isInstAllowed(const quint8& inst) { return (inst > 0); }; + bool isInstAllowed(const quint8& inst) { return (inst > 0); } private: Logger* _log; diff --git a/include/hyperion/LedString.h b/include/hyperion/LedString.h index ed981df04..4756bee31 100644 --- a/include/hyperion/LedString.h +++ b/include/hyperion/LedString.h @@ -40,6 +40,7 @@ inline QString colorOrderToString(const ColorOrder colorOrder) return "not-a-colororder"; } } + inline ColorOrder stringToColorOrder(const QString & order) { if (order == "rgb") diff --git a/include/leddevice/LedDevice.h b/include/leddevice/LedDevice.h index 5f7512154..fdc027361 100644 --- a/include/leddevice/LedDevice.h +++ b/include/leddevice/LedDevice.h @@ -36,7 +36,7 @@ class LedDevice : public QObject public: LedDevice(const QJsonObject& config = QJsonObject(), QObject* parent = nullptr); - virtual ~LedDevice(); + ~LedDevice() override; /// /// @brief Get color order of device @@ -92,7 +92,7 @@ public slots: /// /// Is called on thread start, all construction tasks and init should run here /// - virtual void start() { _deviceReady = (open() == 0 ? true : false);} + virtual void start() { _deviceReady = (open() == 0); } /// /// Update the RGB-Color values to the leds. @@ -186,7 +186,6 @@ public slots: /// Time a device requires mandatorily between two writes int _latchTime_ms; - protected slots: /// Write the last data to the leds again diff --git a/include/leddevice/LedDeviceWrapper.h b/include/leddevice/LedDeviceWrapper.h index 347146cb2..ec3743b62 100644 --- a/include/leddevice/LedDeviceWrapper.h +++ b/include/leddevice/LedDeviceWrapper.h @@ -19,7 +19,7 @@ class LedDeviceWrapper : public QObject Q_OBJECT public: explicit LedDeviceWrapper(Hyperion* hyperion); - ~LedDeviceWrapper(); + ~LedDeviceWrapper() override; /// /// @brief Contructs a new LedDevice, moves to thread and starts /// @param config With the given config @@ -106,7 +106,7 @@ private slots: private: /// /// @brief switchOff() the device and Stops the device thread - /// + /// void stopDeviceThread(); private: diff --git a/include/protoserver/ProtoServer.h b/include/protoserver/ProtoServer.h index 179bebab9..0e18181ef 100644 --- a/include/protoserver/ProtoServer.h +++ b/include/protoserver/ProtoServer.h @@ -22,7 +22,7 @@ class ProtoServer : public QObject public: ProtoServer(const QJsonDocument& config, QObject* parent = nullptr); - ~ProtoServer(); + ~ProtoServer() override; public slots: /// diff --git a/include/ssdp/SSDPHandler.h b/include/ssdp/SSDPHandler.h index 9eacaccc1..99fdbdfe5 100644 --- a/include/ssdp/SSDPHandler.h +++ b/include/ssdp/SSDPHandler.h @@ -24,7 +24,7 @@ class SSDPHandler : public SSDPServer{ /// /// @brief Sends BYE BYE and stop server - /// + /// void stopServer(); public slots: @@ -50,23 +50,23 @@ public slots: /// /// @brief Build http url for current ip:port/desc.xml /// - const QString getDescAddress(); + QString getDescAddress() const; /// /// @brief Get the base address /// - const QString getBaseAddress(); + QString getBaseAddress() const; /// /// @brief Build the ssdp description (description.xml) /// - const QString buildDesc(); + QString buildDesc() const; /// /// @brief Get the local address of interface /// @return the address, might be empty /// - const QString getLocalAddress(); + QString getLocalAddress() const; /// /// @brief Send alive/byebye message based on _deviceList diff --git a/include/utils/ColorArgb.h b/include/utils/ColorArgb.h index 9b5bc3643..43c32a9e6 100644 --- a/include/utils/ColorArgb.h +++ b/include/utils/ColorArgb.h @@ -4,8 +4,6 @@ #include #include -struct ColorArgb; - struct ColorArgb { @@ -49,4 +47,3 @@ inline std::ostream& operator<<(std::ostream& os, const ColorArgb& color) os << "{" << unsigned(color.alpha) << "," << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}"; return os; } - diff --git a/include/utils/ColorBgr.h b/include/utils/ColorBgr.h index bfe55ec5f..5cc19bb71 100644 --- a/include/utils/ColorBgr.h +++ b/include/utils/ColorBgr.h @@ -4,8 +4,6 @@ #include #include -struct ColorBgr; - /// /// Plain-Old-Data structure containing the red-green-blue color specification. Size of the /// structure is exactly 3-bytes for easy writing to led-device diff --git a/include/utils/ColorRgb.h b/include/utils/ColorRgb.h index 8de27f2d9..0ec41c71b 100644 --- a/include/utils/ColorRgb.h +++ b/include/utils/ColorRgb.h @@ -6,8 +6,6 @@ #include -struct ColorRgb; - /// /// Plain-Old-Data structure containing the red-green-blue color specification. Size of the /// structure is exactly 3-bytes for easy writing to led-device @@ -87,4 +85,3 @@ inline bool operator>=(const ColorRgb & lhs, const ColorRgb & rhs) { return (lhs.red >= rhs.red) && (lhs.green >= rhs.green) && (lhs.blue >= rhs.blue); } - diff --git a/include/utils/ColorRgba.h b/include/utils/ColorRgba.h index 67be78a84..e02cc7962 100644 --- a/include/utils/ColorRgba.h +++ b/include/utils/ColorRgba.h @@ -4,8 +4,6 @@ #include #include -struct ColorRgba; - struct ColorRgba { @@ -49,4 +47,3 @@ inline std::ostream& operator<<(std::ostream& os, const ColorRgba& color) os << "{" << unsigned(color.alpha) << "," << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}"; return os; } - diff --git a/include/utils/ColorRgbw.h b/include/utils/ColorRgbw.h index a06c6d244..9316f94f8 100644 --- a/include/utils/ColorRgbw.h +++ b/include/utils/ColorRgbw.h @@ -4,8 +4,6 @@ #include #include -struct ColorRgbw; - /// /// Plain-Old-Data structure containing the red-green-blue color specification. Size of the /// structure is exactly 3-bytes for easy writing to led-device diff --git a/include/utils/Components.h b/include/utils/Components.h index 8de20ac87..ca70a2d62 100644 --- a/include/utils/Components.h +++ b/include/utils/Components.h @@ -67,7 +67,7 @@ inline const char* componentToIdString(Components c) } } -inline Components stringToComponent(QString component) +inline Components stringToComponent(QString component) { component = component.toUpper(); if (component == "ALL") return COMP_ALL; diff --git a/include/utils/FileUtils.h b/include/utils/FileUtils.h index d1e87f576..ee26f3d2f 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(QString sourceFile); + QString getDirName(QString sourceFile); /// /// @brief remove directory recursive given by path diff --git a/include/utils/GlobalSignals.h b/include/utils/GlobalSignals.h index f89eaaf6f..b5525c215 100644 --- a/include/utils/GlobalSignals.h +++ b/include/utils/GlobalSignals.h @@ -21,7 +21,7 @@ class GlobalSignals : public QObject return & instance; } private: - GlobalSignals() {} + GlobalSignals() = default; public: GlobalSignals(GlobalSignals const&) = delete; diff --git a/include/utils/Profiler.h b/include/utils/Profiler.h index 118c9aa69..96aec7257 100644 --- a/include/utils/Profiler.h +++ b/include/utils/Profiler.h @@ -21,7 +21,7 @@ For more profiler function see the macros listed below */ #ifndef ENABLE_PROFILER - #error "Profiler is not for productive code, enable it via cmake or remove header include" + #error "Profiler is not for production code, enable it via cmake or remove header include" #endif // profiler @@ -50,4 +50,3 @@ class Profiler unsigned int _blockId; clock_t _startTime; }; - diff --git a/include/utils/RgbTransform.h b/include/utils/RgbTransform.h index 078a1cd2f..d4e4bfd1e 100644 --- a/include/utils/RgbTransform.h +++ b/include/utils/RgbTransform.h @@ -26,11 +26,6 @@ class RgbTransform /// RgbTransform(double gammaR, double gammaG, double gammaB, double backlightThreshold, bool backlightColored, uint8_t brightness, uint8_t brightnessCompensation); - /// - /// Destructor - /// - ~RgbTransform(); - /// @return The current red gamma value double getGammaR() const; diff --git a/include/utils/SysInfo.h b/include/utils/SysInfo.h index a4693fc9d..eb632e690 100644 --- a/include/utils/SysInfo.h +++ b/include/utils/SysInfo.h @@ -20,7 +20,6 @@ class SysInfo : public QObject QString domainName; }; - ~SysInfo(); static HyperionSysInfo get(); private: diff --git a/include/webserver/WebServer.h b/include/webserver/WebServer.h index 98ef7a5ec..3ad0d1173 100644 --- a/include/webserver/WebServer.h +++ b/include/webserver/WebServer.h @@ -34,15 +34,15 @@ class WebServer : public QObject { public: WebServer (const QJsonDocument& config, const bool& useSsl, QObject * parent = 0); - virtual ~WebServer (void); + ~WebServer () override; void start(); void stop(); - quint16 getPort() { return _port; }; + quint16 getPort() const { return _port; } /// check if server has been inited - bool isInited() { return _inited; }; + bool isInited() const { return _inited; } /// /// @brief Set a new description, if empty the description is NotFound for clients diff --git a/libsrc/api/JsonAPI.cpp b/libsrc/api/JsonAPI.cpp index e314b208d..c9861aa69 100644 --- a/libsrc/api/JsonAPI.cpp +++ b/libsrc/api/JsonAPI.cpp @@ -1526,11 +1526,11 @@ void JsonAPI::handleTokenResponse(const bool &success, const QString &token, con sendErrorReply("Token request timeout or denied", cmd, 5); } -void JsonAPI::handleInstanceStateChange(const instanceState &state, const quint8 &instance, const QString &name) +void JsonAPI::handleInstanceStateChange(const InstanceState &state, const quint8 &instance, const QString &name) { switch (state) { - case H_ON_STOP: + case InstanceState::H_ON_STOP: if (_hyperion->getInstanceIndex() == instance) { handleInstanceSwitch(); diff --git a/libsrc/api/JsonCB.cpp b/libsrc/api/JsonCB.cpp index 47b01c324..5289b6c48 100644 --- a/libsrc/api/JsonCB.cpp +++ b/libsrc/api/JsonCB.cpp @@ -223,7 +223,7 @@ void JsonCB::handlePriorityUpdate() activePriorities.removeAll(255); int currentPriority = _prioMuxer->getCurrentPriority(); - foreach (int priority, activePriorities) { + for (int priority : activePriorities) { const Hyperion::InputInfo priorityInfo = _prioMuxer->getInputInfo(priority); QJsonObject item; item["priority"] = priority; diff --git a/libsrc/boblightserver/BoblightClientConnection.h b/libsrc/boblightserver/BoblightClientConnection.h index a2ab4cc06..6b6d8cd93 100644 --- a/libsrc/boblightserver/BoblightClientConnection.h +++ b/libsrc/boblightserver/BoblightClientConnection.h @@ -30,7 +30,7 @@ class BoblightClientConnection : public QObject /// /// Destructor /// - ~BoblightClientConnection(); + ~BoblightClientConnection() override; signals: /// diff --git a/libsrc/boblightserver/BoblightServer.cpp b/libsrc/boblightserver/BoblightServer.cpp index bd7a65eda..1db0036c1 100644 --- a/libsrc/boblightserver/BoblightServer.cpp +++ b/libsrc/boblightserver/BoblightServer.cpp @@ -59,9 +59,8 @@ void BoblightServer::stop() if ( ! _server->isListening() ) return; - foreach (BoblightClientConnection * connection, _openConnections) { - delete connection; - } + qDeleteAll(_openConnections); + _server->close(); Info(_log, "Stopped"); diff --git a/libsrc/bonjour/bonjourbrowserwrapper.cpp b/libsrc/bonjour/bonjourbrowserwrapper.cpp index 8b8c8a67a..df13b950c 100644 --- a/libsrc/bonjour/bonjourbrowserwrapper.cpp +++ b/libsrc/bonjour/bonjourbrowserwrapper.cpp @@ -12,7 +12,7 @@ BonjourBrowserWrapper* BonjourBrowserWrapper::instance = nullptr; BonjourBrowserWrapper::BonjourBrowserWrapper(QObject * parent) : QObject(parent) , _bonjourResolver(new BonjourServiceResolver(this)) - , _timerBonjourResolver( new QTimer(this)) + , _timerBonjourResolver(new QTimer(this)) { // register meta qRegisterMetaType>("QMap"); diff --git a/libsrc/commandline/ColorsOption.cpp b/libsrc/commandline/ColorsOption.cpp index f32cfed8a..7caa5f28d 100644 --- a/libsrc/commandline/ColorsOption.cpp +++ b/libsrc/commandline/ColorsOption.cpp @@ -22,7 +22,7 @@ bool ColorsOption::validate(Parser & parser, QString & value) QRegularExpressionMatch match = hexRe.match(value); if(match.hasMatch()) { - Q_FOREACH(const QString m, match.capturedTexts()) + for(const QString m : match.capturedTexts()) { _colors.push_back(QColor(QString("#%1").arg(m))); } diff --git a/libsrc/commandline/Parser.cpp b/libsrc/commandline/Parser.cpp index e90fd429e..71a62d635 100644 --- a/libsrc/commandline/Parser.cpp +++ b/libsrc/commandline/Parser.cpp @@ -11,7 +11,7 @@ bool Parser::parse(const QStringList &arguments) return false; } - Q_FOREACH(Option * option, _options) + for(Option * option : _options) { QString value = this->value(*option); if (!option->validate(*this, value)) { diff --git a/libsrc/effectengine/EffectEngine.cpp b/libsrc/effectengine/EffectEngine.cpp index d7b10b6e8..0ce5c8392 100644 --- a/libsrc/effectengine/EffectEngine.cpp +++ b/libsrc/effectengine/EffectEngine.cpp @@ -28,7 +28,6 @@ EffectEngine::EffectEngine(Hyperion * hyperion) , _log(Logger::getInstance("EFFECTENGINE")) , _effectFileHandler(EffectFileHandler::getInstance()) { - Q_INIT_RESOURCE(EffectEngine); qRegisterMetaType("hyperion::Components"); diff --git a/libsrc/grabber/framebuffer/FramebufferFrameGrabber.cpp b/libsrc/grabber/framebuffer/FramebufferFrameGrabber.cpp index e5c1ab46e..26fea04c2 100644 --- a/libsrc/grabber/framebuffer/FramebufferFrameGrabber.cpp +++ b/libsrc/grabber/framebuffer/FramebufferFrameGrabber.cpp @@ -5,6 +5,7 @@ #include #include #include +#include // STL includes #include @@ -14,17 +15,11 @@ FramebufferFrameGrabber::FramebufferFrameGrabber(const QString & device, const unsigned width, const unsigned height) : Grabber("FRAMEBUFFERGRABBER", width, height) - , _fbfd(0) - , _fbp(0) , _fbDevice() { setDevicePath(device); } -FramebufferFrameGrabber::~FramebufferFrameGrabber() -{ -} - int FramebufferFrameGrabber::grabFrame(Image & image) { if (!_enabled) return 0; @@ -34,10 +29,15 @@ int FramebufferFrameGrabber::grabFrame(Image & image) PixelFormat pixelFormat; /* Open the framebuffer device */ - _fbfd = open(QSTRING_CSTR(_fbDevice), O_RDONLY); + int fbfd = open(QSTRING_CSTR(_fbDevice), O_RDONLY); + if (fbfd == -1) + { + Error(_log, "Error opening %s, %s : ", QSTRING_CSTR(_fbDevice), std::strerror(errno)); + return -1; + } /* get variable screen information */ - ioctl (_fbfd, FBIOGET_VSCREENINFO, &vinfo); + ioctl (fbfd, FBIOGET_VSCREENINFO, &vinfo); bytesPerPixel = vinfo.bits_per_pixel / 8; capSize = vinfo.xres * vinfo.yres * bytesPerPixel; @@ -53,24 +53,28 @@ int FramebufferFrameGrabber::grabFrame(Image & image) #endif default: Error(_log, "Unknown pixel format: %d bits per pixel", vinfo.bits_per_pixel); - close(_fbfd); + close(fbfd); return -1; } /* map the device to memory */ - _fbp = (unsigned char*)mmap(0, capSize, PROT_READ, MAP_PRIVATE | MAP_NORESERVE, _fbfd, 0); + unsigned char * fbp = (unsigned char*)mmap(0, capSize, PROT_READ, MAP_PRIVATE | MAP_NORESERVE, fbfd, 0); + if (fbp == MAP_FAILED) { + Error(_log, "Error mapping %s, %s : ", QSTRING_CSTR(_fbDevice), std::strerror(errno)); + return -1; + } _imageResampler.setHorizontalPixelDecimation(vinfo.xres/_width); _imageResampler.setVerticalPixelDecimation(vinfo.yres/_height); - _imageResampler.processImage(_fbp, + _imageResampler.processImage(fbp, vinfo.xres, vinfo.yres, vinfo.xres * bytesPerPixel, pixelFormat, image); - munmap(_fbp, capSize); - close(_fbfd); + munmap(fbp, capSize); + close(fbfd); return 0; } @@ -84,25 +88,24 @@ void FramebufferFrameGrabber::setDevicePath(const QString& path) struct fb_var_screeninfo vinfo; // Check if the framebuffer device can be opened and display the current resolution - _fbfd = open(QSTRING_CSTR(_fbDevice), O_RDONLY); - if (_fbfd == 0) + int fbfd = open(QSTRING_CSTR(_fbDevice), O_RDONLY); + if (fbfd == -1) { - Error(_log, "Error openning %s", QSTRING_CSTR(_fbDevice)); + Error(_log, "Error opening %s, %s : ", QSTRING_CSTR(_fbDevice), std::strerror(errno)); } else { // get variable screen information - result = ioctl (_fbfd, FBIOGET_VSCREENINFO, &vinfo); + result = ioctl (fbfd, FBIOGET_VSCREENINFO, &vinfo); if (result != 0) { - Error(_log, "Could not get screen information"); + Error(_log, "Could not get screen information, %s", std::strerror(errno)); } else { Info(_log, "Display opened with resolution: %dx%d@%dbit", vinfo.xres, vinfo.yres, vinfo.bits_per_pixel); } - close(_fbfd); + close(fbfd); } - } } diff --git a/libsrc/grabber/v4l2/V4L2Grabber.cpp b/libsrc/grabber/v4l2/V4L2Grabber.cpp index 164e71736..6168f8246 100644 --- a/libsrc/grabber/v4l2/V4L2Grabber.cpp +++ b/libsrc/grabber/v4l2/V4L2Grabber.cpp @@ -95,7 +95,7 @@ bool V4L2Grabber::init() QString v4lDevices_str; // show list only once - if (!QString(QSTRING_CSTR(_deviceName)).startsWith("/dev/")) + if (!_deviceName.startsWith("/dev/")) { for (auto& dev: _v4lDevices) { @@ -369,11 +369,8 @@ void V4L2Grabber::close_device() _fileDescriptor = -1; - if (_streamNotifier != nullptr) - { - delete _streamNotifier; - _streamNotifier = nullptr; - } + delete _streamNotifier; + _streamNotifier = nullptr; } void V4L2Grabber::init_read(unsigned int buffer_size) diff --git a/libsrc/hyperion/CaptureCont.cpp b/libsrc/hyperion/CaptureCont.cpp index f97c04cba..9f12a485b 100644 --- a/libsrc/hyperion/CaptureCont.cpp +++ b/libsrc/hyperion/CaptureCont.cpp @@ -41,10 +41,6 @@ CaptureCont::CaptureCont(Hyperion* hyperion) handleSettingsUpdate(settings::INSTCAPTURE, _hyperion->getSetting(settings::INSTCAPTURE)); } -CaptureCont::~CaptureCont() -{ -} - void CaptureCont::handleV4lImage(const QString& name, const Image & image) { if(_v4lCaptName != name) diff --git a/libsrc/hyperion/Grabber.cpp b/libsrc/hyperion/Grabber.cpp index 8a57722f0..bf6527ed4 100644 --- a/libsrc/hyperion/Grabber.cpp +++ b/libsrc/hyperion/Grabber.cpp @@ -20,10 +20,6 @@ Grabber::Grabber(QString grabberName, int width, int height, int cropLeft, int c Grabber::setCropping(cropLeft, cropRight, cropTop, cropBottom); } -Grabber::~Grabber() -{ -} - void Grabber::setEnabled(bool enable) { Info(_log,"Capture interface is now %s", enable ? "enabled" : "disabled"); diff --git a/libsrc/hyperion/Hyperion.cpp b/libsrc/hyperion/Hyperion.cpp index 6940d4700..32cd10e6e 100644 --- a/libsrc/hyperion/Hyperion.cpp +++ b/libsrc/hyperion/Hyperion.cpp @@ -380,7 +380,7 @@ void Hyperion::setColor(const int priority, const std::vector &ledColo _effectEngine->channelCleared(priority); // create full led vector from single/multiple colors - unsigned int size = _ledString.leds().size(); + size_t size = _ledString.leds().size(); std::vector newLedColors; while (true) { diff --git a/libsrc/hyperion/HyperionIManager.cpp b/libsrc/hyperion/HyperionIManager.cpp index e1cc54be9..658496432 100644 --- a/libsrc/hyperion/HyperionIManager.cpp +++ b/libsrc/hyperion/HyperionIManager.cpp @@ -16,7 +16,7 @@ HyperionIManager::HyperionIManager(const QString& rootPath, QObject* parent) , _rootPath( rootPath ) { HIMinstance = this; - qRegisterMetaType("instanceState"); + qRegisterMetaType("InstanceState"); } Hyperion* HyperionIManager::getHyperionInstance(const quint8& instance) @@ -124,7 +124,7 @@ bool HyperionIManager::stopInstance(const quint8& inst) if(_runningInstances.contains(inst)) { // notify a ON_STOP rather sooner than later, queued signal listener should have some time to drop the pointer before it's deleted - emit instanceStateChanged(H_ON_STOP, inst); + emit instanceStateChanged(InstanceState::H_ON_STOP, inst); Hyperion* hyperion = _runningInstances.value(inst); hyperion->stop(); @@ -146,7 +146,7 @@ bool HyperionIManager::createInstance(const QString& name, const bool& start) if(_instanceTable->createInstance(name, inst)) { Info(_log,"New Hyperion instance created with name '%s'",QSTRING_CSTR(name)); - emit instanceStateChanged(H_CREATED, inst, name); + emit instanceStateChanged(InstanceState::H_CREATED, inst, name); emit change(); if(start) @@ -168,7 +168,7 @@ bool HyperionIManager::deleteInstance(const quint8& inst) if(_instanceTable->deleteInstance(inst)) { Info(_log,"Hyperion instance with index '%d' has been deleted", inst); - emit instanceStateChanged(H_DELETED, inst); + emit instanceStateChanged(InstanceState::H_DELETED, inst); emit change(); return true; @@ -195,7 +195,7 @@ void HyperionIManager::handleFinished() _runningInstances.remove(instance); hyperion->deleteLater(); - emit instanceStateChanged(H_STOPPED, instance); + emit instanceStateChanged(InstanceState::H_STOPPED, instance); emit change(); } @@ -208,6 +208,6 @@ void HyperionIManager::handleStarted() _startQueue.removeAll(instance); _runningInstances.insert(instance, hyperion); - emit instanceStateChanged(H_STARTED, instance); + emit instanceStateChanged(InstanceState::H_STARTED, instance); emit change(); } diff --git a/libsrc/hyperion/ImageProcessor.cpp b/libsrc/hyperion/ImageProcessor.cpp index 73935938f..82a85a2de 100644 --- a/libsrc/hyperion/ImageProcessor.cpp +++ b/libsrc/hyperion/ImageProcessor.cpp @@ -69,11 +69,8 @@ void ImageProcessor::setSize(const unsigned width, const unsigned height) return; } - if ( _imageToLeds != nullptr) - { - // Clean up the old buffer and mapping - delete _imageToLeds; - } + // Clean up the old buffer and mapping + delete _imageToLeds; // Construct a new buffer and mapping _imageToLeds = (width>0 && height>0) ? (new ImageToLedsMap(width, height, 0, 0, _ledString.leds())) : nullptr; diff --git a/libsrc/hyperion/LedString.cpp b/libsrc/hyperion/LedString.cpp index b43727fa8..6ad66cf7b 100644 --- a/libsrc/hyperion/LedString.cpp +++ b/libsrc/hyperion/LedString.cpp @@ -5,7 +5,6 @@ // hyperion includes #include - LedString::LedString() { // empty diff --git a/libsrc/hyperion/LinearColorSmoothing.cpp b/libsrc/hyperion/LinearColorSmoothing.cpp index c145ed279..97096ff51 100644 --- a/libsrc/hyperion/LinearColorSmoothing.cpp +++ b/libsrc/hyperion/LinearColorSmoothing.cpp @@ -43,11 +43,6 @@ LinearColorSmoothing::LinearColorSmoothing(const QJsonDocument& config, Hyperion connect(_timer, &QTimer::timeout, this, &LinearColorSmoothing::updateLeds); } -LinearColorSmoothing::~LinearColorSmoothing() -{ - -} - void LinearColorSmoothing::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config) { if(type == settings::SMOOTHING) @@ -224,7 +219,6 @@ void LinearColorSmoothing::componentStateChange(const hyperion::Components compo { setEnable(state); } - } void LinearColorSmoothing::setEnable(bool enable) diff --git a/libsrc/hyperion/LinearColorSmoothing.h b/libsrc/hyperion/LinearColorSmoothing.h index e7d40d62b..ed0990ce4 100644 --- a/libsrc/hyperion/LinearColorSmoothing.h +++ b/libsrc/hyperion/LinearColorSmoothing.h @@ -32,9 +32,6 @@ class LinearColorSmoothing : public QObject /// LinearColorSmoothing(const QJsonDocument& config, Hyperion* hyperion); - /// Destructor - virtual ~LinearColorSmoothing(); - /// LED values as input for the smoothing filter /// /// @param ledValues The color-value per led diff --git a/libsrc/hyperion/SettingsManager.cpp b/libsrc/hyperion/SettingsManager.cpp index 034b01677..3f9425b7c 100644 --- a/libsrc/hyperion/SettingsManager.cpp +++ b/libsrc/hyperion/SettingsManager.cpp @@ -88,7 +88,7 @@ SettingsManager::SettingsManager(const quint8& instance, QObject* parent) // check if our main schema syntax is IO if (!valid.second) { - foreach (auto & schemaError, schemaChecker.getMessages()) + for (auto & schemaError : schemaChecker.getMessages()) Error(_log, "Schema Syntax Error: %s", QSTRING_CSTR(schemaError)); throw std::runtime_error("The config schema has invalid syntax. This should never happen! Go fix it!"); } @@ -97,7 +97,7 @@ SettingsManager::SettingsManager(const quint8& instance, QObject* parent) Info(_log,"Table upgrade required..."); dbConfig = schemaChecker.getAutoCorrectedConfig(dbConfig); - foreach (auto & schemaError, schemaChecker.getMessages()) + for (auto & schemaError : schemaChecker.getMessages()) Warning(_log, "Config Fix: %s", QSTRING_CSTR(schemaError)); saveSettings(dbConfig); @@ -131,7 +131,7 @@ bool SettingsManager::saveSettings(QJsonObject config, const bool& correct) Warning(_log,"Fixing json data!"); config = schemaChecker.getAutoCorrectedConfig(config); - foreach (auto & schemaError, schemaChecker.getMessages()) + for (auto & schemaError : schemaChecker.getMessages()) Warning(_log, "Config Fix: %s", QSTRING_CSTR(schemaError)); } diff --git a/libsrc/jsonserver/JsonServer.cpp b/libsrc/jsonserver/JsonServer.cpp index 4abae32be..4618b9aea 100644 --- a/libsrc/jsonserver/JsonServer.cpp +++ b/libsrc/jsonserver/JsonServer.cpp @@ -35,9 +35,7 @@ JsonServer::JsonServer(const QJsonDocument& config) JsonServer::~JsonServer() { - foreach (JsonClientConnection * connection, _openConnections) { - delete connection; - } + qDeleteAll(_openConnections); } void JsonServer::start() diff --git a/libsrc/leddevice/LedDeviceTemplate.cpp b/libsrc/leddevice/LedDeviceTemplate.cpp index b9128ae5b..3d6567e11 100644 --- a/libsrc/leddevice/LedDeviceTemplate.cpp +++ b/libsrc/leddevice/LedDeviceTemplate.cpp @@ -7,10 +7,6 @@ LedDeviceTemplate::LedDeviceTemplate(const QJsonObject &deviceConfig) _deviceReady = false; } -LedDeviceTemplate::~LedDeviceTemplate() -{ -} - LedDevice* LedDeviceTemplate::construct(const QJsonObject &deviceConfig) { return new LedDeviceTemplate(deviceConfig); @@ -83,5 +79,3 @@ int LedDeviceTemplate::write(const std::vector & ledValues) return retval; } - - diff --git a/libsrc/leddevice/LedDeviceTemplate.h b/libsrc/leddevice/LedDeviceTemplate.h index d548f8bef..65954a804 100644 --- a/libsrc/leddevice/LedDeviceTemplate.h +++ b/libsrc/leddevice/LedDeviceTemplate.h @@ -17,11 +17,6 @@ class LedDeviceTemplate : public LedDevice /// explicit LedDeviceTemplate(const QJsonObject &deviceConfig); - /// - /// Destructor of this LedDevice - /// - virtual ~LedDeviceTemplate() override; - /// constructs leddevice static LedDevice* construct(const QJsonObject &deviceConfig); @@ -38,7 +33,7 @@ public slots: /// Includes switching-off the device and stopping refreshes /// virtual void close() override; - + protected: /// /// Opens and initiatialises the output device diff --git a/libsrc/leddevice/dev_hid/LedDeviceMultiLightpack.cpp b/libsrc/leddevice/dev_hid/LedDeviceMultiLightpack.cpp index d2a5b1ddb..97cd8ca69 100644 --- a/libsrc/leddevice/dev_hid/LedDeviceMultiLightpack.cpp +++ b/libsrc/leddevice/dev_hid/LedDeviceMultiLightpack.cpp @@ -54,7 +54,7 @@ int LedDeviceMultiLightpack::open() std::sort(_lightpacks.begin(), _lightpacks.end(), compareLightpacks); // open each lightpack device - foreach (auto serial , serialList) + for (auto serial : serialList) { LedDeviceLightpack * device = new LedDeviceLightpack(serial); int error = device->open(); diff --git a/libsrc/leddevice/dev_net/LedDeviceAtmoOrb.cpp b/libsrc/leddevice/dev_net/LedDeviceAtmoOrb.cpp index d3c7b4adb..b23d5aec6 100644 --- a/libsrc/leddevice/dev_net/LedDeviceAtmoOrb.cpp +++ b/libsrc/leddevice/dev_net/LedDeviceAtmoOrb.cpp @@ -57,7 +57,7 @@ bool LedDeviceAtmoOrb::init(const QJsonObject &deviceConfig) _orbIds.clear(); - foreach(auto & id_str, orbIds) + for(auto & id_str : orbIds) { bool ok; int id = id_str.toInt(&ok); diff --git a/libsrc/leddevice/dev_net/LedDeviceNanoleaf.cpp b/libsrc/leddevice/dev_net/LedDeviceNanoleaf.cpp index 350413fab..a5d79cb18 100644 --- a/libsrc/leddevice/dev_net/LedDeviceNanoleaf.cpp +++ b/libsrc/leddevice/dev_net/LedDeviceNanoleaf.cpp @@ -205,7 +205,7 @@ bool LedDeviceNanoleaf::initLeds() std::map> panelMap; // Loop over all children. - foreach (const QJsonValue & value, positionData) + for (const QJsonValue & value : positionData) { QJsonObject panelObj = value.toObject(); diff --git a/libsrc/protoserver/ProtoClientConnection.cpp b/libsrc/protoserver/ProtoClientConnection.cpp index 9338db103..e148d07ff 100644 --- a/libsrc/protoserver/ProtoClientConnection.cpp +++ b/libsrc/protoserver/ProtoClientConnection.cpp @@ -7,7 +7,7 @@ #include #include -// TODO Remove this class if third-party apps have been migrated (eg. Hyperion Android Gabber, Windows Screen grabber etc.) +// TODO Remove this class if third-party apps have been migrated (eg. Hyperion Android Grabber, Windows Screen grabber etc.) ProtoClientConnection::ProtoClientConnection(QTcpSocket* socket, const int &timeout, QObject *parent) : QObject(parent) diff --git a/libsrc/python/PythonInit.cpp b/libsrc/python/PythonInit.cpp index 10b982975..686195264 100644 --- a/libsrc/python/PythonInit.cpp +++ b/libsrc/python/PythonInit.cpp @@ -27,11 +27,12 @@ PythonInit::PythonInit() EffectModule::registerHyperionExtensionModule(); // set Python module path when exists - wchar_t *pythonPath = Py_DecodeLocale((QDir::cleanPath(qApp->applicationDirPath() + "/../lib/python")).toLatin1().data(), nullptr); + wchar_t *pythonPath = nullptr; #ifdef _WIN32 pythonPath = Py_DecodeLocale((QDir::cleanPath(qApp->applicationDirPath()) + "/python" + STRINGIFY(PYTHON_VERSION_MAJOR_MINOR) + ".zip").toLatin1().data(), nullptr); if(QFile(QString::fromWCharArray(pythonPath)).exists()) #else + pythonPath = Py_DecodeLocale((QDir::cleanPath(qApp->applicationDirPath() + "/../lib/python")).toLatin1().data(), nullptr); if(QDir(QString::fromWCharArray(pythonPath)).exists()) #endif diff --git a/libsrc/ssdp/SSDPHandler.cpp b/libsrc/ssdp/SSDPHandler.cpp index a72d455ec..4ee6dfb0e 100644 --- a/libsrc/ssdp/SSDPHandler.cpp +++ b/libsrc/ssdp/SSDPHandler.cpp @@ -68,9 +68,10 @@ void SSDPHandler::stopServer() void SSDPHandler::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config) { + const QJsonObject& obj = config.object(); + if(type == settings::FLATBUFSERVER) { - const QJsonObject& obj = config.object(); if(obj["port"].toInt() != SSDPServer::getFlatBufPort()) { SSDPServer::setFlatBufPort(obj["port"].toInt()); @@ -79,7 +80,6 @@ void SSDPHandler::handleSettingsUpdate(const settings::type& type, const QJsonDo if(type == settings::JSONSERVER) { - const QJsonObject& obj = config.object(); if(obj["port"].toInt() != SSDPServer::getJsonServerPort()) { SSDPServer::setJsonServerPort(obj["port"].toInt()); @@ -88,7 +88,6 @@ void SSDPHandler::handleSettingsUpdate(const settings::type& type, const QJsonDo if (type == settings::GENERAL) { - const QJsonObject &obj = config.object(); if (obj["name"].toString() != SSDPServer::getHyperionName()) { SSDPServer::setHyperionName(obj["name"].toString()); @@ -134,13 +133,13 @@ void SSDPHandler::handleNetworkConfigurationChanged(const QNetworkConfiguration } } -const QString SSDPHandler::getLocalAddress() +QString SSDPHandler::getLocalAddress() const { // get the first valid IPv4 address. This is probably not that one we actually want to announce - for( const auto & address : QNetworkInterface::allAddresses()) + for(const auto & address : QNetworkInterface::allAddresses()) { // is valid when, no loopback, IPv4 - if (!address.isLoopback() && address.protocol() == QAbstractSocket::IPv4Protocol ) + if (!address.isLoopback() && address.protocol() == QAbstractSocket::IPv4Protocol) { return address.toString(); } @@ -174,26 +173,27 @@ void SSDPHandler::handleMSearchRequest(const QString& target, const QString& mx, } } -const QString SSDPHandler::getDescAddress() +QString SSDPHandler::getDescAddress() const { return getBaseAddress()+"description.xml"; } -const QString SSDPHandler::getBaseAddress() +QString SSDPHandler::getBaseAddress() const { - return "http://"+_localAddress+":"+QString::number(_webserver->getPort())+"/"; + return QString("http://%1:%2/").arg(_localAddress).arg(_webserver->getPort()); } -const QString SSDPHandler::buildDesc() +QString SSDPHandler::buildDesc() const { /// %1 base url http://192.168.0.177:80/ /// %2 friendly name Hyperion 2.0.0 (192.168.0.177) /// %3 modelNumber 2.0.0 /// %4 serialNumber / UDN (H ID) Fjsa723dD0.... - return SSDP_DESCRIPTION.arg(getBaseAddress(), QString("Hyperion (%2)").arg(_localAddress), QString(HYPERION_VERSION), _uuid); + return SSDP_DESCRIPTION.arg(getBaseAddress(), QString("Hyperion (%1)").arg(_localAddress), QString(HYPERION_VERSION), _uuid); } -void SSDPHandler::sendAnnounceList(const bool alive){ +void SSDPHandler::sendAnnounceList(const bool alive) +{ for(const auto & entry : _deviceList){ alive ? SSDPServer::sendAlive(entry) : SSDPServer::sendByeBye(entry); } diff --git a/libsrc/utils/Profiler.cpp b/libsrc/utils/Profiler.cpp index e5975a55b..3643da6f6 100644 --- a/libsrc/utils/Profiler.cpp +++ b/libsrc/utils/Profiler.cpp @@ -32,7 +32,6 @@ Profiler::Profiler(const char* sourceFile, const char* func, unsigned int line) _logger->Message(Logger::DEBUG,_file,_func,_line,">>> enter block %d", _blockId); } - Profiler::~Profiler() { _logger->Message( Logger::DEBUG, _file,_func, _line, "<<< exit block %d, executed for %f s", _blockId, getClockDelta(_startTime)); @@ -86,4 +85,3 @@ void Profiler::TimerGetTime(const QString timerName, const char* sourceFile, con _logger->Message(Logger::DEBUG, sourceFile, func, line, "ERROR timer '%s' not started", QSTRING_CSTR(timerName)); } } - diff --git a/libsrc/utils/RgbTransform.cpp b/libsrc/utils/RgbTransform.cpp index 0c2ae63b0..3fb9fc88c 100644 --- a/libsrc/utils/RgbTransform.cpp +++ b/libsrc/utils/RgbTransform.cpp @@ -22,10 +22,6 @@ void RgbTransform::init(double gammaR, double gammaG, double gammaB, double back initializeMapping(); } -RgbTransform::~RgbTransform() -{ -} - double RgbTransform::getGammaR() const { return _gammaR; @@ -175,4 +171,3 @@ void RgbTransform::transform(uint8_t & red, uint8_t & green, uint8_t & blue) } } } - diff --git a/libsrc/utils/SysInfo.cpp b/libsrc/utils/SysInfo.cpp index 88c03b497..7898ecde2 100644 --- a/libsrc/utils/SysInfo.cpp +++ b/libsrc/utils/SysInfo.cpp @@ -19,10 +19,6 @@ SysInfo::SysInfo() _sysinfo.domainName = QHostInfo::localDomainName(); } -SysInfo::~SysInfo() -{ -} - SysInfo::HyperionSysInfo SysInfo::get() { if (SysInfo::_instance == nullptr) diff --git a/libsrc/webserver/CgiHandler.cpp b/libsrc/webserver/CgiHandler.cpp index f078c5071..cdf9cbd72 100644 --- a/libsrc/webserver/CgiHandler.cpp +++ b/libsrc/webserver/CgiHandler.cpp @@ -21,10 +21,6 @@ CgiHandler::CgiHandler (QObject * parent) { } -CgiHandler::~CgiHandler() -{ -} - void CgiHandler::setBaseUrl(const QString& url) { _baseUrl = url; diff --git a/libsrc/webserver/CgiHandler.h b/libsrc/webserver/CgiHandler.h index e48d95778..3751d1076 100644 --- a/libsrc/webserver/CgiHandler.h +++ b/libsrc/webserver/CgiHandler.h @@ -15,7 +15,6 @@ class CgiHandler : public QObject { public: CgiHandler (QObject * parent = NULL); - virtual ~CgiHandler (void); void setBaseUrl(const QString& url); void exec(const QStringList & args,QtHttpRequest * request, QtHttpReply * reply); diff --git a/libsrc/webserver/WebServer.cpp b/libsrc/webserver/WebServer.cpp index 5440aed77..b7a8d5a0c 100644 --- a/libsrc/webserver/WebServer.cpp +++ b/libsrc/webserver/WebServer.cpp @@ -54,7 +54,7 @@ void WebServer::initServer() void WebServer::onServerStarted (quint16 port) { - _inited= true; + _inited = true; Info(_log, "Started on port %d name '%s'", port ,_server->getServerName().toStdString().c_str()); #ifdef ENABLE_AVAHI diff --git a/src/hyperiond/main.cpp b/src/hyperiond/main.cpp index 99c099e6a..a63790f3a 100644 --- a/src/hyperiond/main.cpp +++ b/src/hyperiond/main.cpp @@ -246,7 +246,7 @@ int main(int argc, char** argv) std::cout << "extract to folder: " << std::endl; QStringList filenames = directory.entryList(QStringList() << "*", QDir::Files, QDir::Name | QDir::IgnoreCase); QString destFileName; - foreach (const QString & filename, filenames) + for (const QString & filename : filenames) { destFileName = destDir.dirName()+"/"+filename; if (QFile::exists(destFileName)) diff --git a/src/hyperiond/systray.cpp b/src/hyperiond/systray.cpp index 46ee556fc..bd9621563 100644 --- a/src/hyperiond/systray.cpp +++ b/src/hyperiond/systray.cpp @@ -169,10 +169,10 @@ void SysTray::clearEfxColor() _hyperion->clear(1); } -void SysTray::handleInstanceStateChange(const instanceState& state, const quint8& instance, const QString& name) +void SysTray::handleInstanceStateChange(const InstanceState& state, const quint8& instance, const QString& name) { switch(state){ - case H_STARTED: + case InstanceState::H_STARTED: if(instance == 0) { _hyperion = _instanceManager->getHyperionInstance(0); diff --git a/src/hyperiond/systray.h b/src/hyperiond/systray.h index e055fb34f..e66015e51 100644 --- a/src/hyperiond/systray.h +++ b/src/hyperiond/systray.h @@ -39,7 +39,7 @@ private slots: /// /// @brief is called whenever a hyperion isntance state changes /// - void handleInstanceStateChange(const instanceState& state, const quint8& instance, const QString& name); + void handleInstanceStateChange(const InstanceState& state, const quint8& instance, const QString& name); private: void createTrayIcon(); diff --git a/test/TestConfigFile.cpp b/test/TestConfigFile.cpp index 3baae4d57..b1c29e02e 100644 --- a/test/TestConfigFile.cpp +++ b/test/TestConfigFile.cpp @@ -43,7 +43,7 @@ bool loadConfig(const QString & configFile, bool correct, bool ignore) if (!schemaChecker.validate(jsonConfig).first) { QStringList schemaErrors = schemaChecker.getMessages(); - foreach (auto & schemaError, schemaErrors) + for (auto & schemaError : schemaErrors) { qDebug() << "config write validation: " << schemaError; }