mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
refactor: Resolve some clang warnings (#915)
This commit is contained in:
parent
031b9a6b7c
commit
d183c630c8
1
.gitignore
vendored
1
.gitignore
vendored
@ -17,3 +17,4 @@ CMakeCache.txt
|
|||||||
/lib
|
/lib
|
||||||
.directory
|
.directory
|
||||||
*.pyc
|
*.pyc
|
||||||
|
compile_commands.json
|
||||||
|
@ -26,6 +26,7 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
Option(const QCommandLineOption &other);
|
Option(const QCommandLineOption &other);
|
||||||
|
virtual ~Option() = default;
|
||||||
|
|
||||||
virtual bool validate(Parser &parser, QString &value);
|
virtual bool validate(Parser &parser, QString &value);
|
||||||
QString name();
|
QString name();
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
namespace hyperionnet
|
namespace hyperionnet
|
||||||
{
|
{
|
||||||
class Reply;
|
struct Reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -24,7 +24,7 @@ public slots:
|
|||||||
///
|
///
|
||||||
/// Performs a single frame grab and computes the led-colors
|
/// Performs a single frame grab and computes the led-colors
|
||||||
///
|
///
|
||||||
virtual void action();
|
void action() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// The actual grabber
|
/// The actual grabber
|
||||||
|
@ -42,7 +42,7 @@ public:
|
|||||||
|
|
||||||
///
|
///
|
||||||
///@brief Set new width and height for dispmanx, overwrite Grabber.h impl
|
///@brief Set new width and height for dispmanx, overwrite Grabber.h impl
|
||||||
virtual bool setWidthHeight(int width, int height);
|
bool setWidthHeight(int width, int height) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
|
@ -26,7 +26,7 @@ public slots:
|
|||||||
///
|
///
|
||||||
/// Performs a single frame grab and computes the led-colors
|
/// Performs a single frame grab and computes the led-colors
|
||||||
///
|
///
|
||||||
virtual void action();
|
void action() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// The actual grabber
|
/// The actual grabber
|
||||||
|
@ -32,7 +32,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// @brief Overwrite Grabber.h implememtation
|
/// @brief Overwrite Grabber.h implememtation
|
||||||
///
|
///
|
||||||
virtual void setDevicePath(const QString& path);
|
void setDevicePath(const QString& path) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Framebuffer device e.g. /dev/fb0
|
/// Framebuffer device e.g. /dev/fb0
|
||||||
|
@ -26,7 +26,7 @@ public slots:
|
|||||||
///
|
///
|
||||||
/// Performs a single frame grab and computes the led-colors
|
/// Performs a single frame grab and computes the led-colors
|
||||||
///
|
///
|
||||||
virtual void action();
|
void action() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// The actual grabber
|
/// The actual grabber
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// @brief Overwrite Grabber.h implementation
|
/// @brief Overwrite Grabber.h implementation
|
||||||
///
|
///
|
||||||
virtual void setDisplayIndex(int index);
|
void setDisplayIndex(int index) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// display
|
/// display
|
||||||
|
@ -26,7 +26,7 @@ public slots:
|
|||||||
///
|
///
|
||||||
/// Performs a single frame grab and computes the led-colors
|
/// Performs a single frame grab and computes the led-colors
|
||||||
///
|
///
|
||||||
virtual void action();
|
void action() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// The actual grabber
|
/// The actual grabber
|
||||||
|
@ -27,22 +27,22 @@ public:
|
|||||||
/// @param[out] image The snapped screenshot (should be initialized with correct width and
|
/// @param[out] image The snapped screenshot (should be initialized with correct width and
|
||||||
/// height)
|
/// height)
|
||||||
///
|
///
|
||||||
virtual int grabFrame(Image<ColorRgb> & image);
|
int grabFrame(Image<ColorRgb> & image);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// @brief Set a new video mode
|
/// @brief Set a new video mode
|
||||||
///
|
///
|
||||||
virtual void setVideoMode(VideoMode mode);
|
void setVideoMode(VideoMode mode) override;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// @brief Apply new width/height values, overwrite Grabber.h implementation as qt doesn't use width/height, just pixelDecimation to calc dimensions
|
/// @brief Apply new width/height values, overwrite Grabber.h implementation as qt doesn't use width/height, just pixelDecimation to calc dimensions
|
||||||
///
|
///
|
||||||
virtual bool setWidthHeight(int width, int height) { return true; };
|
bool setWidthHeight(int width, int height) override { return true; };
|
||||||
|
|
||||||
///
|
///
|
||||||
/// @brief Apply new pixelDecimation
|
/// @brief Apply new pixelDecimation
|
||||||
///
|
///
|
||||||
virtual void setPixelDecimation(int pixelDecimation);
|
void setPixelDecimation(int pixelDecimation) override;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Set the crop values
|
/// Set the crop values
|
||||||
@ -51,12 +51,12 @@ public:
|
|||||||
/// @param cropTop Top pixel crop
|
/// @param cropTop Top pixel crop
|
||||||
/// @param cropBottom Bottom pixel crop
|
/// @param cropBottom Bottom pixel crop
|
||||||
///
|
///
|
||||||
virtual void setCropping(unsigned cropLeft, unsigned cropRight, unsigned cropTop, unsigned cropBottom);
|
void setCropping(unsigned cropLeft, unsigned cropRight, unsigned cropTop, unsigned cropBottom) override;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// @brief Apply display index
|
/// @brief Apply display index
|
||||||
///
|
///
|
||||||
virtual void setDisplayIndex(int index);
|
void setDisplayIndex(int index) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
///
|
///
|
||||||
|
@ -25,7 +25,7 @@ public slots:
|
|||||||
///
|
///
|
||||||
/// Performs a single frame grab and computes the led-colors
|
/// Performs a single frame grab and computes the led-colors
|
||||||
///
|
///
|
||||||
virtual void action();
|
void action() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// The actual grabber
|
/// The actual grabber
|
||||||
|
@ -22,11 +22,11 @@ public:
|
|||||||
bool getCecDetectionEnable();
|
bool getCecDetectionEnable();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
bool start();
|
bool start() override;
|
||||||
void stop();
|
void stop() override;
|
||||||
|
|
||||||
void setSignalThreshold(double redSignalThreshold, double greenSignalThreshold, double blueSignalThreshold);
|
void setSignalThreshold(double redSignalThreshold, double greenSignalThreshold, double blueSignalThreshold);
|
||||||
void setCropping(unsigned cropLeft, unsigned cropRight, unsigned cropTop, unsigned cropBottom);
|
void setCropping(unsigned cropLeft, unsigned cropRight, unsigned cropTop, unsigned cropBottom) override;
|
||||||
void setSignalDetectionOffset(double verticalMin, double horizontalMin, double verticalMax, double horizontalMax);
|
void setSignalDetectionOffset(double verticalMin, double horizontalMin, double verticalMax, double horizontalMax);
|
||||||
void setSignalDetectionEnable(bool enable);
|
void setSignalDetectionEnable(bool enable);
|
||||||
void setCecDetectionEnable(bool enable);
|
void setCecDetectionEnable(bool enable);
|
||||||
@ -38,7 +38,7 @@ private slots:
|
|||||||
void newFrame(const Image<ColorRgb> & image);
|
void newFrame(const Image<ColorRgb> & image);
|
||||||
void readError(const char* err);
|
void readError(const char* err);
|
||||||
|
|
||||||
virtual void action();
|
void action() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// The V4L2 grabber
|
/// The V4L2 grabber
|
||||||
|
@ -34,23 +34,23 @@ public:
|
|||||||
/// @param[out] image The snapped screenshot (should be initialized with correct width and
|
/// @param[out] image The snapped screenshot (should be initialized with correct width and
|
||||||
/// height)
|
/// height)
|
||||||
///
|
///
|
||||||
virtual int grabFrame(Image<ColorRgb> & image, bool forceUpdate=false);
|
int grabFrame(Image<ColorRgb> & image, bool forceUpdate=false);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// update dimension according current screen
|
/// update dimension according current screen
|
||||||
int updateScreenDimensions(bool force=false);
|
int updateScreenDimensions(bool force=false);
|
||||||
|
|
||||||
virtual void setVideoMode(VideoMode mode);
|
void setVideoMode(VideoMode mode) override;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// @brief Apply new width/height values, overwrite Grabber.h implementation as X11 doesn't use width/height, just pixelDecimation to calc dimensions
|
/// @brief Apply new width/height values, overwrite Grabber.h implementation as X11 doesn't use width/height, just pixelDecimation to calc dimensions
|
||||||
///
|
///
|
||||||
virtual bool setWidthHeight(int width, int height) { return true; };
|
bool setWidthHeight(int width, int height) override { return true; };
|
||||||
|
|
||||||
///
|
///
|
||||||
/// @brief Apply new pixelDecimation
|
/// @brief Apply new pixelDecimation
|
||||||
///
|
///
|
||||||
virtual void setPixelDecimation(int pixelDecimation);
|
void setPixelDecimation(int pixelDecimation) override;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Set the crop values
|
/// Set the crop values
|
||||||
@ -59,7 +59,7 @@ public:
|
|||||||
/// @param cropTop Top pixel crop
|
/// @param cropTop Top pixel crop
|
||||||
/// @param cropBottom Bottom pixel crop
|
/// @param cropBottom Bottom pixel crop
|
||||||
///
|
///
|
||||||
virtual void setCropping(unsigned cropLeft, unsigned cropRight, unsigned cropTop, unsigned cropBottom);
|
void setCropping(unsigned cropLeft, unsigned cropRight, unsigned cropTop, unsigned cropBottom) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool nativeEventFilter(const QByteArray & eventType, void * message, long int * result) override;
|
bool nativeEventFilter(const QByteArray & eventType, void * message, long int * result) override;
|
||||||
|
@ -35,7 +35,7 @@ public slots:
|
|||||||
///
|
///
|
||||||
/// Performs a single frame grab and computes the led-colors
|
/// Performs a single frame grab and computes the led-colors
|
||||||
///
|
///
|
||||||
virtual void action();
|
void action() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// The actual grabber
|
/// The actual grabber
|
||||||
|
@ -22,7 +22,7 @@ bool ColorsOption::validate(Parser & parser, QString & value)
|
|||||||
QRegularExpressionMatch match = hexRe.match(value);
|
QRegularExpressionMatch match = hexRe.match(value);
|
||||||
if(match.hasMatch())
|
if(match.hasMatch())
|
||||||
{
|
{
|
||||||
for(const QString m : match.capturedTexts())
|
for(const QString & m : match.capturedTexts())
|
||||||
{
|
{
|
||||||
_colors.push_back(QColor(QString("#%1").arg(m)));
|
_colors.push_back(QColor(QString("#%1").arg(m)));
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ const QVector<QVariantMap> HyperionIManager::getInstanceData()
|
|||||||
|
|
||||||
void HyperionIManager::startAll()
|
void HyperionIManager::startAll()
|
||||||
{
|
{
|
||||||
for(const auto entry : _instanceTable->getAllInstances(true))
|
for(const auto & entry : _instanceTable->getAllInstances(true))
|
||||||
{
|
{
|
||||||
startInstance(entry["instance"].toInt());
|
startInstance(entry["instance"].toInt());
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ SettingsManager::SettingsManager(const quint8& instance, QObject* parent)
|
|||||||
// transform json to string lists
|
// transform json to string lists
|
||||||
QStringList keyList = defaultConfig.keys();
|
QStringList keyList = defaultConfig.keys();
|
||||||
QStringList defValueList;
|
QStringList defValueList;
|
||||||
for(const auto key : keyList)
|
for(const auto & key : keyList)
|
||||||
{
|
{
|
||||||
if(defaultConfig[key].isObject())
|
if(defaultConfig[key].isObject())
|
||||||
{
|
{
|
||||||
@ -54,7 +54,7 @@ SettingsManager::SettingsManager(const quint8& instance, QObject* parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// fill database with default data if required
|
// fill database with default data if required
|
||||||
for(const auto key : keyList)
|
for(const auto & key : keyList)
|
||||||
{
|
{
|
||||||
QString val = defValueList.takeFirst();
|
QString val = defValueList.takeFirst();
|
||||||
// prevent overwrite
|
// prevent overwrite
|
||||||
@ -65,7 +65,7 @@ SettingsManager::SettingsManager(const quint8& instance, QObject* parent)
|
|||||||
// need to validate all data in database constuct the entire data object
|
// need to validate all data in database constuct the entire data object
|
||||||
// TODO refactor schemaChecker to accept QJsonArray in validate(); QJsonDocument container? To validate them per entry...
|
// TODO refactor schemaChecker to accept QJsonArray in validate(); QJsonDocument container? To validate them per entry...
|
||||||
QJsonObject dbConfig;
|
QJsonObject dbConfig;
|
||||||
for(const auto key : keyList)
|
for(const auto & key : keyList)
|
||||||
{
|
{
|
||||||
QJsonDocument doc = _sTable->getSettingsRecord(key);
|
QJsonDocument doc = _sTable->getSettingsRecord(key);
|
||||||
if(doc.isArray())
|
if(doc.isArray())
|
||||||
@ -140,7 +140,7 @@ bool SettingsManager::saveSettings(QJsonObject config, const bool& correct)
|
|||||||
// extract keys and data
|
// extract keys and data
|
||||||
QStringList keyList = config.keys();
|
QStringList keyList = config.keys();
|
||||||
QStringList newValueList;
|
QStringList newValueList;
|
||||||
for(const auto key : keyList)
|
for(const auto & key : keyList)
|
||||||
{
|
{
|
||||||
if(config[key].isObject())
|
if(config[key].isObject())
|
||||||
{
|
{
|
||||||
@ -153,7 +153,7 @@ bool SettingsManager::saveSettings(QJsonObject config, const bool& correct)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// compare database data with new data to emit/save changes accordingly
|
// compare database data with new data to emit/save changes accordingly
|
||||||
for(const auto key : keyList)
|
for(const auto & key : keyList)
|
||||||
{
|
{
|
||||||
QString data = newValueList.takeFirst();
|
QString data = newValueList.takeFirst();
|
||||||
if(_sTable->getSettingsRecordString(key) != data)
|
if(_sTable->getSettingsRecordString(key) != data)
|
||||||
|
Loading…
Reference in New Issue
Block a user