Random cleanup (#861)

Co-authored-by: Seker <murat.seker@barco.com>
This commit is contained in:
Murat Seker 2020-07-12 09:19:59 +02:00 committed by GitHub
parent de9ece5139
commit 138b7d9c94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
74 changed files with 115 additions and 234 deletions

View File

@ -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:
///

View File

@ -18,7 +18,7 @@ public:
/// @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

View File

@ -20,11 +20,6 @@ public:
///
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

View File

@ -27,7 +27,7 @@ public:
/// @param[in] height The heigth of the captured screenshot
///
DispmanxFrameGrabber(const unsigned width, const unsigned height);
~DispmanxFrameGrabber();
~DispmanxFrameGrabber() override;
///

View File

@ -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

View File

@ -22,11 +22,6 @@ public:
///
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

View File

@ -18,7 +18,6 @@ public:
/// @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 @@ public:
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;
};

View File

@ -22,11 +22,6 @@ public:
///
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

View File

@ -25,7 +25,7 @@ public:
/// @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

View File

@ -22,11 +22,6 @@ public:
///
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

View File

@ -17,7 +17,7 @@ public:
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

View File

@ -21,11 +21,6 @@ public:
///
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

View File

@ -16,7 +16,6 @@ public:
VideoStandard videoStandard,
PixelFormat pixelFormat,
int pixelDecimation );
virtual ~V4L2Wrapper() {};
bool getSignalDetectionEnable();

View File

@ -19,7 +19,7 @@ public:
X11Grabber(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation);
virtual ~X11Grabber();
~X11Grabber() override;
bool Setup();

View File

@ -26,11 +26,6 @@ public:
///
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

View File

@ -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);

View File

@ -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)

View File

@ -2,7 +2,6 @@
// stl includes
#include <list>
#include <QMap>
// QT includes
#include <QString>
@ -11,6 +10,7 @@
#include <QJsonObject>
#include <QJsonValue>
#include <QJsonArray>
#include <QMap>
#include <QMutex>
// 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 @@ public:
///
/// @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 @@ public:
///
/// @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;

View File

@ -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 @@ signals:
/// @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:
/// @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;

View File

@ -40,6 +40,7 @@ inline QString colorOrderToString(const ColorOrder colorOrder)
return "not-a-colororder";
}
}
inline ColorOrder stringToColorOrder(const QString & order)
{
if (order == "rgb")

View File

@ -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 @@ protected:
/// Time a device requires mandatorily between two writes
int _latchTime_ms;
protected slots:
/// Write the last data to the leds again

View File

@ -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 @@ protected:
private:
///
/// @brief switchOff() the device and Stops the device thread
///
///
void stopDeviceThread();
private:

View File

@ -22,7 +22,7 @@ class ProtoServer : public QObject
public:
ProtoServer(const QJsonDocument& config, QObject* parent = nullptr);
~ProtoServer();
~ProtoServer() override;
public slots:
///

View File

@ -24,7 +24,7 @@ public:
///
/// @brief Sends BYE BYE and stop server
///
///
void stopServer();
public slots:
@ -50,23 +50,23 @@ private:
///
/// @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

View File

@ -4,8 +4,6 @@
#include <cstdint>
#include <ostream>
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;
}

View File

@ -4,8 +4,6 @@
#include <cstdint>
#include <iostream>
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

View File

@ -6,8 +6,6 @@
#include <QTextStream>
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);
}

View File

@ -4,8 +4,6 @@
#include <cstdint>
#include <ostream>
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;
}

View File

@ -4,8 +4,6 @@
#include <cstdint>
#include <iostream>
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

View File

@ -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;

View File

@ -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

View File

@ -21,7 +21,7 @@ public:
return & instance;
}
private:
GlobalSignals() {}
GlobalSignals() = default;
public:
GlobalSignals(GlobalSignals const&) = delete;

View File

@ -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 @@ private:
unsigned int _blockId;
clock_t _startTime;
};

View File

@ -26,11 +26,6 @@ public:
///
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;

View File

@ -20,7 +20,6 @@ public:
QString domainName;
};
~SysInfo();
static HyperionSysInfo get();
private:

View File

@ -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

View File

@ -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();

View File

@ -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;

View File

@ -30,7 +30,7 @@ public:
///
/// Destructor
///
~BoblightClientConnection();
~BoblightClientConnection() override;
signals:
///

View File

@ -59,9 +59,8 @@ void BoblightServer::stop()
if ( ! _server->isListening() )
return;
foreach (BoblightClientConnection * connection, _openConnections) {
delete connection;
}
qDeleteAll(_openConnections);
_server->close();
Info(_log, "Stopped");

View File

@ -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<QString,BonjourRecord>>("QMap<QString,BonjourRecord>");

View File

@ -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)));
}

View File

@ -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)) {

View File

@ -28,7 +28,6 @@ EffectEngine::EffectEngine(Hyperion * hyperion)
, _log(Logger::getInstance("EFFECTENGINE"))
, _effectFileHandler(EffectFileHandler::getInstance())
{
Q_INIT_RESOURCE(EffectEngine);
qRegisterMetaType<hyperion::Components>("hyperion::Components");

View File

@ -5,6 +5,7 @@
#include <linux/fb.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <cstring>
// STL includes
#include <iostream>
@ -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<ColorRgb> & image)
{
if (!_enabled) return 0;
@ -34,10 +29,15 @@ int FramebufferFrameGrabber::grabFrame(Image<ColorRgb> & 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<ColorRgb> & 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);
}
}
}

View File

@ -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)

View File

@ -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<ColorRgb> & image)
{
if(_v4lCaptName != name)

View File

@ -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");

View File

@ -380,7 +380,7 @@ void Hyperion::setColor(const int priority, const std::vector<ColorRgb> &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<ColorRgb> newLedColors;
while (true)
{

View File

@ -16,7 +16,7 @@ HyperionIManager::HyperionIManager(const QString& rootPath, QObject* parent)
, _rootPath( rootPath )
{
HIMinstance = this;
qRegisterMetaType<instanceState>("instanceState");
qRegisterMetaType<InstanceState>("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();
}

View File

@ -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;

View File

@ -5,7 +5,6 @@
// hyperion includes
#include <hyperion/LedString.h>
LedString::LedString()
{
// empty

View File

@ -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)

View File

@ -32,9 +32,6 @@ public:
///
LinearColorSmoothing(const QJsonDocument& config, Hyperion* hyperion);
/// Destructor
virtual ~LinearColorSmoothing();
/// LED values as input for the smoothing filter
///
/// @param ledValues The color-value per led

View File

@ -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));
}

View File

@ -35,9 +35,7 @@ JsonServer::JsonServer(const QJsonDocument& config)
JsonServer::~JsonServer()
{
foreach (JsonClientConnection * connection, _openConnections) {
delete connection;
}
qDeleteAll(_openConnections);
}
void JsonServer::start()

View File

@ -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<ColorRgb> & ledValues)
return retval;
}

View File

@ -17,11 +17,6 @@ public:
///
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

View File

@ -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();

View File

@ -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);

View File

@ -205,7 +205,7 @@ bool LedDeviceNanoleaf::initLeds()
std::map<uint, std::map<uint, uint>> panelMap;
// Loop over all children.
foreach (const QJsonValue & value, positionData)
for (const QJsonValue & value : positionData)
{
QJsonObject panelObj = value.toObject();

View File

@ -7,7 +7,7 @@
#include <QTimer>
#include <QRgb>
// 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)

View File

@ -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

View File

@ -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);
}

View File

@ -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));
}
}

View File

@ -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)
}
}
}

View File

@ -19,10 +19,6 @@ SysInfo::SysInfo()
_sysinfo.domainName = QHostInfo::localDomainName();
}
SysInfo::~SysInfo()
{
}
SysInfo::HyperionSysInfo SysInfo::get()
{
if (SysInfo::_instance == nullptr)

View File

@ -21,10 +21,6 @@ CgiHandler::CgiHandler (QObject * parent)
{
}
CgiHandler::~CgiHandler()
{
}
void CgiHandler::setBaseUrl(const QString& url)
{
_baseUrl = url;

View File

@ -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);

View File

@ -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

View File

@ -252,7 +252,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))

View File

@ -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);

View File

@ -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();

View File

@ -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;
}