Various Cleanups (#1075)

* LedDevice - Address clang findings

* Fix Windows Warnings

* Ensure newInput is initialised

* Clean-up unused elements for Plaform Capture

* Fix initialization problem and spellings

* Address clang findings and spelling corrections

* LedDevice clean-ups

* Cleanups

* Align that getLedCount is int

* Have "display" as default for Grabbers

* Fix config during start-up for missing elements

* Framegrabber Clean-up - Remove non supported grabbers from selection, filter valid options

* Typo

* Framegrabber.json - Fix property numbering

* Preselect active Grabbertype

* Sort Grabbernames

* Align options with selected element

* Fix deletion of pointer to incomplete type 'BonjourBrowserWrapper'

* Address macOS compile warnings

* Have default layout = 1 LED only to avoid errors as in #673

* Address lgtm findings

* Address finding that params passed to LedDevice discovery were not considered

* Cleanups after merging with latest master

* Update Changelog

* Address lgtm findings

* Fix comment

* Test Fix

* Fix Python Warning

* Handle Dummy Device assignment correctly

* Address delete called on non-final 'commandline::Option' that has virtual functions but non-virtual destructor

* Correct that QTimer.start accepts only int

* Have Release Python GIL & reset threat state chnage downward compatible

* Correct format specifier

* LedDevice - add assertions

* Readonly DB - Fix merge issue

* Smoothing - Fix wrong defaults

* LedDevice - correct assertion

* Show smoothing config set# in debug and related values.

* Suppress error on windows, if default file is "/dev/null"

* CMAKE - Allow to define QT_BASE_DIR dynamically via environment-variable

* Ignore Visual Studio specific files

Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com>
This commit is contained in:
LordGrey
2020-11-14 17:58:56 +01:00
committed by GitHub
parent d28540a7fe
commit efc2046ab5
93 changed files with 1140 additions and 1172 deletions

View File

@@ -21,7 +21,7 @@ class AuthManager : public QObject
private:
friend class HyperionDaemon;
/// constructor is private, can be called from HyperionDaemon
AuthManager(QObject *parent = 0, bool readonlyMode = false);
AuthManager(QObject *parent = nullptr, bool readonlyMode = false);
public:
struct AuthDefinition

View File

@@ -19,14 +19,14 @@ public:
// listen for config changes
connect(_hyperion, &Hyperion::settingsChanged, this, &BGEffectHandler::handleSettingsUpdate);
// init
// initialization
handleSettingsUpdate(settings::BGEFFECT, _hyperion->getSetting(settings::BGEFFECT));
};
}
private slots:
///
/// @brief Handle settings update from Hyperion Settingsmanager emit or this constructor
/// @param type settingyType from enum
/// @param type settingType from enum
/// @param config configuration object
///
void handleSettingsUpdate(settings::type type, const QJsonDocument& config)
@@ -36,7 +36,7 @@ private slots:
const QJsonObject& BGEffectConfig = config.object();
#define BGCONFIG_ARRAY bgColorConfig.toArray()
// clear bg prioritiy
// clear background priority
_hyperion->clear(254);
// initial background effect/color
if (BGEffectConfig["enable"].toBool(true))
@@ -48,24 +48,24 @@ private slots:
{
std::vector<ColorRgb> bg_color = {
ColorRgb {
(uint8_t)BGCONFIG_ARRAY.at(0).toInt(0),
(uint8_t)BGCONFIG_ARRAY.at(1).toInt(0),
(uint8_t)BGCONFIG_ARRAY.at(2).toInt(0)
static_cast<uint8_t>(BGCONFIG_ARRAY.at(0).toInt(0)),
static_cast<uint8_t>(BGCONFIG_ARRAY.at(1).toInt(0)),
static_cast<uint8_t>(BGCONFIG_ARRAY.at(2).toInt(0))
}
};
_hyperion->setColor(254, bg_color);
Info(Logger::getInstance("HYPERION"),"Inital background color set (%d %d %d)",bg_color.at(0).red, bg_color.at(0).green, bg_color.at(0).blue);
Info(Logger::getInstance("HYPERION"),"Initial background color set (%d %d %d)",bg_color.at(0).red, bg_color.at(0).green, bg_color.at(0).blue);
}
else
{
int result = _hyperion->setEffect(bgEffectConfig, 254);
Info(Logger::getInstance("HYPERION"),"Inital background effect '%s' %s", QSTRING_CSTR(bgEffectConfig), ((result == 0) ? "started" : "failed"));
Info(Logger::getInstance("HYPERION"),"Initial background effect '%s' %s", QSTRING_CSTR(bgEffectConfig), ((result == 0) ? "started" : "failed"));
}
}
#undef BGCONFIG_ARRAY
}
};
}
private:
/// Hyperion instance pointer

View File

@@ -111,7 +111,7 @@ public slots:
///
/// Returns the number of attached leds
///
unsigned getLedCount() const;
int getLedCount() const;
///
/// @brief Register a new input by priority, the priority is not active (timeout -100 isn't muxer recognized) until you start to update the data with setInput()
@@ -298,7 +298,7 @@ public slots:
///
/// @return The information of the given, a not found priority will return lowest priority as fallback
///
InputInfo getPriorityInfo(int priority) const;
PriorityMuxer::InputInfo getPriorityInfo(int priority) const;
/// #############
/// SETTINGSMANAGER
@@ -527,7 +527,7 @@ private:
Logger * _log;
/// count of hardware leds
unsigned _hwLedCount;
int _hwLedCount;
QSize _ledGridSize;

View File

@@ -19,9 +19,9 @@
class Hyperion;
///
/// The ImageProcessor translates an RGB-image to RGB-values for the leds. The processing is
/// The ImageProcessor translates an RGB-image to RGB-values for the LEDs. The processing is
/// performed in two steps. First the average color per led-region is computed. Second a
/// color-tranform is applied based on a gamma-correction.
/// color-transform is applied based on a gamma-correction.
///
class ImageProcessor : public QObject
{
@@ -39,7 +39,7 @@ public:
~ImageProcessor() override;
///
/// Specifies the width and height of 'incomming' images. This will resize the buffer-image to
/// Specifies the width and height of 'incoming' images. This will resize the buffer-image to
/// match the given size.
/// NB All earlier obtained references will be invalid.
///
@@ -53,7 +53,7 @@ public:
///
void setLedString(const LedString& ledString);
/// Returns starte of black border detector
/// Returns state of black border detector
bool blackBorderDetectorEnabled() const;
/// Returns the current _userMappingType, this may not be the current applied type!
@@ -66,7 +66,7 @@ public:
static QString mappingTypeToStr(int mappingType);
///
/// @brief Set the Hyperion::update() requestes led mapping type. This type is used in favour of type set with setLedMappingType.
/// @brief Set the Hyperion::update() request LED mapping type. This type is used in favour of type set with setLedMappingType.
/// If you don't want to force a mapType set this to -1 (user choice will be set)
/// @param mapType The new mapping type
///
@@ -85,7 +85,7 @@ public slots:
public:
///
/// Specifies the width and height of 'incomming' images. This will resize the buffer-image to
/// Specifies the width and height of 'incoming' images. This will resize the buffer-image to
/// match the given size.
/// NB All earlier obtained references will be invalid.
///
@@ -117,7 +117,7 @@ public:
// Check black border detection
verifyBorder(image);
// Create a result vector and call the 'in place' functionl
// Create a result vector and call the 'in place' function
switch (_mappingType)
{
case 1: colors = _imageToLeds->getUniLedColor(image); break;
@@ -225,7 +225,7 @@ private:
/// The processor for black border detection
hyperion::BlackBorderProcessor * _borderProcessor;
/// The mapping of image-pixels to leds
/// The mapping of image-pixels to LEDs
hyperion::ImageToLedsMap* _imageToLeds;
/// Type of image 2 led mapping

View File

@@ -175,7 +175,7 @@ namespace hyperion
return ColorRgb::BLACK;
}
// Accumulate the sum of each seperate color channel
// Accumulate the sum of each separate color channel
uint_fast32_t cummRed = 0;
uint_fast32_t cummGreen = 0;
uint_fast32_t cummBlue = 0;
@@ -209,7 +209,7 @@ namespace hyperion
template <typename Pixel_T>
ColorRgb calcMeanColor(const Image<Pixel_T> & image) const
{
// Accumulate the sum of each seperate color channel
// Accumulate the sum of each separate color channel
uint_fast32_t cummRed = 0;
uint_fast32_t cummGreen = 0;
uint_fast32_t cummBlue = 0;

View File

@@ -107,16 +107,6 @@ struct Led
class LedString
{
public:
///
/// Constructs the LedString with no leds
///
LedString();
///
/// Destructor of this LedString
///
~LedString();
///
/// Returns the led specifications
///

View File

@@ -11,22 +11,22 @@
///
/// The LedColorTransform is responsible for performing color transformation from 'raw' colors
/// received as input to colors mapped to match the color-properties of the leds.
/// received as input to colors mapped to match the color-properties of the LEDs.
///
class MultiColorAdjustment
{
public:
MultiColorAdjustment(unsigned ledCnt);
MultiColorAdjustment(int ledCnt);
~MultiColorAdjustment();
/**
* Adds a new ColorAdjustment to this MultiColorTransform
*
* @param adjustment The new ColorAdjustment (ownership is transfered)
* @param adjustment The new ColorAdjustment (ownership is transferred)
*/
void addAdjustment(ColorAdjustment * adjustment);
void setAdjustmentForLed(const QString& id, unsigned startLed, unsigned endLed);
void setAdjustmentForLed(const QString& id, int startLed, int endLed);
bool verifyAdjustments() const;

View File

@@ -58,10 +58,10 @@ public:
const static int LOWEST_PRIORITY;
///
/// Constructs the PriorityMuxer for the given number of leds (used to switch to black when
/// Constructs the PriorityMuxer for the given number of LEDs (used to switch to black when
/// there are no priority channels
///
/// @param ledCount The number of leds
/// @param ledCount The number of LEDs
///
PriorityMuxer(int ledCount, QObject * parent);
@@ -87,18 +87,18 @@ public:
/// @brief Get the state of source auto selection
/// @return True if enabled, else false
///
bool isSourceAutoSelectEnabled() const { return _sourceAutoSelectEnabled; };
bool isSourceAutoSelectEnabled() const { return _sourceAutoSelectEnabled; }
///
/// @brief Overwrite current lowest piority with manual selection; On success disables aito selection
/// @brief Overwrite current lowest priority with manual selection; On success disables auto selection
/// @param priority The
/// @return True on success, false if priority not found
///
bool setPriority(uint8_t priority);
bool setPriority(int priority);
///
/// @brief Update all ledColos with min length of >= 1 to fit the new led length
/// @param[in] ledCount The count of leds
/// @brief Update all LED-Colors with min length of >= 1 to fit the new led length
/// @param[in] ledCount The count of LEDs
///
void updateLedColorsLength(int ledCount);
@@ -146,13 +146,13 @@ public:
/// @param[in] priority The priority of the channel
/// @param[in] component The component of the channel
/// @param[in] origin Who set the channel (CustomString@IP)
/// @param[in] owner Speicifc owner string, might be empty
/// @param[in] owner Specific owner string, might be empty
/// @param[in] smooth_cfg The smooth id to use
///
void registerInput(int priority, hyperion::Components component, const QString& origin = "System", const QString& owner = "", unsigned smooth_cfg = SMOOTHING_MODE_DEFAULT);
///
/// @brief Update the current color of a priority (prev registered with registerInput())
/// @brief Update the current color of a priority (previous registered with registerInput())
/// @param priority The priority to update
/// @param ledColors The colors
/// @param timeout_ms The new timeout (defaults to -1 endless)
@@ -174,7 +174,7 @@ public:
/// @param priority The priority
/// @return True on success false if not found
///
bool setInputInactive(quint8 priority);
bool setInputInactive(int priority);
///
/// Clears the specified priority channel and update _currentPriority on success
@@ -182,7 +182,7 @@ public:
/// @param[in] priority The priority of the channel to clear
/// @return True if priority has been cleared else false (not found)
///
bool clearInput(uint8_t priority);
bool clearInput(int priority);
///
/// Clears all priority channels
@@ -190,7 +190,7 @@ public:
void clearAll(bool forceClearAll=false);
///
/// @brief Queue a manual push where muxer doesn't recognize them (e.g. continous single color pushes)
/// @brief Queue a manual push where muxer doesn't recognize them (e.g. continuous single color pushes)
///
void queuePush() { emit timeRunner(); }

View File

@@ -3,14 +3,14 @@
#include <utils/Logger.h>
#include <utils/settings.h>
// qt incl
// qt includes
#include <QJsonObject>
class Hyperion;
class SettingsTable;
///
/// @brief Manage the settings read write from/to config file, on settings changed will emit a signal to update components accordingly
/// @brief Manage the settings read write from/to configuration file, on settings changed will emit a signal to update components accordingly
///
class SettingsManager : public QObject
{
@@ -24,7 +24,7 @@ public:
SettingsManager(quint8 instance, QObject* parent = nullptr, bool readonlyMode = false);
///
/// @brief Save a complete json config
/// @brief Save a complete json configuration
/// @param config The entire config object
/// @param correct If true will correct json against schema before save
/// @return True on success else false
@@ -32,7 +32,7 @@ public:
bool saveSettings(QJsonObject config, bool correct = false);
///
/// @brief get a single setting json from config
/// @brief get a single setting json from configuration
/// @param type The settings::type from enum
/// @return The requested json data as QJsonDocument
///
@@ -42,11 +42,11 @@ public:
/// @brief get the full settings object of this instance (with global settings)
/// @return The requested json
///
const QJsonObject & getSettings() const { return _qconfig; };
const QJsonObject & getSettings() const { return _qconfig; }
signals:
///
/// @brief Emits whenever a config part changed.
/// @brief Emits whenever a configuration part changed.
/// @param type The settings type from enum
/// @param data The data as QJsonDocument
///
@@ -54,7 +54,7 @@ signals:
private:
///
/// @brief Add possile migrations steps for config here
/// @brief Add possible migrations steps for configuration here
/// @param config The configuration object
/// @return True when a migration has been triggered
///
@@ -73,7 +73,7 @@ private:
/// the schema
static QJsonObject schemaJson;
/// the current config of this instance
/// the current configuration of this instance
QJsonObject _qconfig;
bool _readonlyMode;