mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
fix/refactor backlight stuff (#394)
* fix/refactor backlight stuff: - fix colors dont turn of when backlight 0 and black is set - add option to use not colored backlight - fix colored backlight not colored on very low color values - various code style tunings * apply needed change to wizard * backlight disabled on static color and efects * fix warnings * try fix udp compiler warnings
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#ifndef HYPERION_DOUBLECOMMANDLINEOPTION_H
|
||||
#define HYPERION_DOUBLECOMMANDLINEOPTION_H
|
||||
#pragma once
|
||||
|
||||
#include <QtCore>
|
||||
#include "ValidatorOption.h"
|
||||
@@ -9,32 +8,38 @@ namespace commandline
|
||||
|
||||
class DoubleOption: public ValidatorOption
|
||||
{
|
||||
protected:
|
||||
double _double;
|
||||
public:
|
||||
DoubleOption(const QString &name,
|
||||
const QString &description = QString(),
|
||||
const QString &valueName = QString(),
|
||||
const QString &defaultValue = QString(),
|
||||
double minimum = -INFINITY, double maximum = INFINITY, int decimals = 1000)
|
||||
: ValidatorOption(name, description, valueName, defaultValue)
|
||||
{ setValidator(new QDoubleValidator(minimum, maximum, decimals)); }
|
||||
DoubleOption(const QStringList &names,
|
||||
const QString &description = QString(),
|
||||
const QString &valueName = QString(),
|
||||
const QString &defaultValue = QString(),
|
||||
double minimum = -INFINITY, double maximum = INFINITY, int decimals = 1000)
|
||||
: ValidatorOption(names, description, valueName, defaultValue)
|
||||
{ setValidator(new QDoubleValidator(minimum, maximum, decimals)); }
|
||||
DoubleOption(const QCommandLineOption &other,
|
||||
double minimum = -INFINITY, double maximum = INFINITY, int decimals = 1000)
|
||||
: ValidatorOption(other)
|
||||
{ setValidator(new QDoubleValidator(minimum, maximum, decimals)); }
|
||||
DoubleOption(const QString &name,
|
||||
const QString &description = QString(),
|
||||
const QString &valueName = QString(),
|
||||
const QString &defaultValue = QString(),
|
||||
double minimum = -INFINITY, double maximum = INFINITY, int decimals = 1000)
|
||||
: ValidatorOption(name, description, valueName, defaultValue)
|
||||
{
|
||||
setValidator(new QDoubleValidator(minimum, maximum, decimals));
|
||||
}
|
||||
|
||||
double getDouble(Parser &parser, bool *ok = 0);
|
||||
double *getDoublePtr(Parser &parser, bool *ok = 0);
|
||||
DoubleOption(const QStringList &names,
|
||||
const QString &description = QString(),
|
||||
const QString &valueName = QString(),
|
||||
const QString &defaultValue = QString(),
|
||||
double minimum = -INFINITY, double maximum = INFINITY, int decimals = 1000)
|
||||
: ValidatorOption(names, description, valueName, defaultValue)
|
||||
{
|
||||
setValidator(new QDoubleValidator(minimum, maximum, decimals));
|
||||
}
|
||||
|
||||
DoubleOption(const QCommandLineOption &other, double minimum = -INFINITY, double maximum = INFINITY, int decimals = 1000)
|
||||
: ValidatorOption(other)
|
||||
{
|
||||
setValidator(new QDoubleValidator(minimum, maximum, decimals));
|
||||
}
|
||||
|
||||
double getDouble(Parser &parser, bool *ok = 0);
|
||||
double *getDoublePtr(Parser &parser, bool *ok = 0);
|
||||
|
||||
protected:
|
||||
double _double;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //HYPERION_DOUBLECOMMANDLINEOPTION_H
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#ifndef HYPERION_SWITCHCOMMANDLINEOPTION_H
|
||||
#define HYPERION_SWITCHCOMMANDLINEOPTION_H
|
||||
#pragma once
|
||||
|
||||
#include <QtCore>
|
||||
#include "Option.h"
|
||||
@@ -10,10 +9,8 @@ namespace commandline
|
||||
template <class T>
|
||||
class SwitchOption: public Option
|
||||
{
|
||||
protected:
|
||||
QMap<QString, T> _switches;
|
||||
public:
|
||||
SwitchOption(const QString &name,
|
||||
SwitchOption(const QString &name,
|
||||
const QString &description = QString(),
|
||||
const QString &valueName = QString(),
|
||||
const QString &defaultValue = QString(),
|
||||
@@ -38,8 +35,9 @@ public:
|
||||
void addSwitch(const QString &switch_, T value=T()){_switches[switch_.toLower()] = value;}
|
||||
void removeSwitch(const QString &switch_){_switches.remove(switch_.toLower());}
|
||||
T & switchValue(Parser & parser){return _switches[value(parser).toLower()];}
|
||||
|
||||
protected:
|
||||
QMap<QString, T> _switches;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //HYPERION_SWITCHCOMMANDLINEOPTION_H
|
||||
|
@@ -368,4 +368,6 @@ private:
|
||||
int _ledMAppingType;
|
||||
|
||||
int _configVersionId;
|
||||
|
||||
hyperion::Components _prevCompId;
|
||||
};
|
||||
|
@@ -20,10 +20,11 @@ public:
|
||||
/// @param gammaR The used red gamma
|
||||
/// @param gammaG The used green gamma
|
||||
/// @param gammab The used blue gamma
|
||||
/// @param brightnessLow The used lower brightness
|
||||
/// @param backlightThreshold The used lower brightness
|
||||
/// @param backlightColored use color in backlight
|
||||
/// @param brightnessHigh The used higher brightness
|
||||
///
|
||||
RgbTransform(double gammaR, double gammaG, double gammaB, double brightnessLow, double brightnessHigh);
|
||||
RgbTransform(double gammaR, double gammaG, double gammaB, double backlightThreshold, bool backlightColored, double brightnessHigh);
|
||||
|
||||
///
|
||||
/// Destructor
|
||||
@@ -39,19 +40,34 @@ public:
|
||||
/// @return The current blue gamma value
|
||||
double getGammaB() const;
|
||||
|
||||
/// @param gamma New gamma value
|
||||
/// @param gammaR New red gamma value
|
||||
/// @param gammaG New green gamma value
|
||||
/// @param gammaB New blue gamma value
|
||||
void setGamma(double gammaR,double gammaG=-1, double gammaB=-1);
|
||||
|
||||
/// @return The current lower brightness
|
||||
double getBrightnessMin() const;
|
||||
double getBacklightThreshold() const;
|
||||
|
||||
/// @param gamma New lower brightness
|
||||
void setBrightnessMin(double brightness);
|
||||
/// @param backlightThreshold New lower brightness
|
||||
void setBacklightThreshold(double backlightThreshold);
|
||||
|
||||
/// @return The current lower brightness
|
||||
/// @return The current state
|
||||
bool getBacklightColored() const;
|
||||
|
||||
/// @param backlightColored en/disable colored backlight
|
||||
void setBacklightColored(bool backlightColored);
|
||||
|
||||
/// @return return state of backlight
|
||||
bool getBackLightEnabled() const;
|
||||
|
||||
/// @param enable en/disable backlight
|
||||
void setBackLightEnabled(bool enable);
|
||||
|
||||
|
||||
/// @return The current brightness
|
||||
double getBrightness() const;
|
||||
|
||||
/// @param gamma New lower brightness
|
||||
/// @param brightness New brightness
|
||||
void setBrightness(double brightness);
|
||||
|
||||
///
|
||||
@@ -72,15 +88,17 @@ private:
|
||||
/// @param gammaR The used red gamma
|
||||
/// @param gammaG The used green gamma
|
||||
/// @param gammab The used blue gamma
|
||||
/// @param brightnessLow The used lower brightness
|
||||
/// @param backlightThreshold The used lower brightness
|
||||
/// @param backlightColored en/disable color in backlight
|
||||
/// @param brightnessHigh The used higher brightness
|
||||
///
|
||||
void init(double gammaR, double gammaG, double gammaB, double brightnessLow, double brightnessHigh);
|
||||
void init(double gammaR, double gammaG, double gammaB, double backlightThreshold, bool backlightColored, double brightnessHigh);
|
||||
|
||||
/// (re)-initilize the color mapping
|
||||
void initializeMapping(); /// The saturation gain
|
||||
|
||||
double _brightnessLow;
|
||||
double _backlightThreshold;
|
||||
bool _backlightColored;
|
||||
double _brightnessHigh;
|
||||
double _sumBrightnessLow;
|
||||
double _sumBrightnessHigh;
|
||||
@@ -93,4 +111,6 @@ private:
|
||||
uint8_t _mappingR[256];
|
||||
uint8_t _mappingG[256];
|
||||
uint8_t _mappingB[256];
|
||||
|
||||
bool _backLightEnabled;
|
||||
};
|
||||
|
Reference in New Issue
Block a user