mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Const correctness, override keyword, a bunch of stuff..
This commit is contained in:
@@ -67,22 +67,22 @@ inline const char* componentToIdString(Components c)
|
||||
}
|
||||
}
|
||||
|
||||
inline Components stringToComponent(QString component)
|
||||
inline Components stringToComponent(const QString& component)
|
||||
{
|
||||
component = component.toUpper();
|
||||
if (component == "ALL") return COMP_ALL;
|
||||
if (component == "SMOOTHING") return COMP_SMOOTHING;
|
||||
if (component == "BLACKBORDER") return COMP_BLACKBORDER;
|
||||
if (component == "FORWARDER") return COMP_FORWARDER;
|
||||
if (component == "BOBLIGHTSERVER")return COMP_BOBLIGHTSERVER;
|
||||
if (component == "GRABBER") return COMP_GRABBER;
|
||||
if (component == "V4L") return COMP_V4L;
|
||||
if (component == "COLOR") return COMP_COLOR;
|
||||
if (component == "EFFECT") return COMP_EFFECT;
|
||||
if (component == "IMAGE") return COMP_IMAGE;
|
||||
if (component == "LEDDEVICE") return COMP_LEDDEVICE;
|
||||
if (component == "FLATBUFSERVER") return COMP_FLATBUFSERVER;
|
||||
if (component == "PROTOSERVER") return COMP_PROTOSERVER;
|
||||
const QString cmp = component.toUpper();
|
||||
if (cmp == "ALL") return COMP_ALL;
|
||||
if (cmp == "SMOOTHING") return COMP_SMOOTHING;
|
||||
if (cmp == "BLACKBORDER") return COMP_BLACKBORDER;
|
||||
if (cmp == "FORWARDER") return COMP_FORWARDER;
|
||||
if (cmp == "BOBLIGHTSERVER")return COMP_BOBLIGHTSERVER;
|
||||
if (cmp == "GRABBER") return COMP_GRABBER;
|
||||
if (cmp == "V4L") return COMP_V4L;
|
||||
if (cmp == "COLOR") return COMP_COLOR;
|
||||
if (cmp == "EFFECT") return COMP_EFFECT;
|
||||
if (cmp == "IMAGE") return COMP_IMAGE;
|
||||
if (cmp == "LEDDEVICE") return COMP_LEDDEVICE;
|
||||
if (cmp == "FLATBUFSERVER") return COMP_FLATBUFSERVER;
|
||||
if (cmp == "PROTOSERVER") return COMP_PROTOSERVER;
|
||||
return COMP_INVALID;
|
||||
}
|
||||
|
||||
|
@@ -10,8 +10,8 @@
|
||||
|
||||
namespace FileUtils {
|
||||
|
||||
QString getBaseName(QString sourceFile);
|
||||
QString getDirName(QString sourceFile);
|
||||
QString getBaseName(const QString& sourceFile);
|
||||
QString getDirName(const QString& sourceFile);
|
||||
|
||||
///
|
||||
/// @brief remove directory recursive given by path
|
||||
|
@@ -67,7 +67,7 @@ public:
|
||||
|
||||
void Message(LogLevel level, const char* sourceFile, const char* func, unsigned int line, const char* fmt, ...);
|
||||
void setMinLevel(LogLevel level) { _minLevel = static_cast<int>(level); }
|
||||
LogLevel getMinLevel() { return static_cast<LogLevel>(int(_minLevel)); }
|
||||
LogLevel getMinLevel() const { return static_cast<LogLevel>(int(_minLevel)); }
|
||||
QString getName() const { return _name; }
|
||||
QString getAppName() const { return _appname; }
|
||||
|
||||
@@ -76,7 +76,7 @@ signals:
|
||||
|
||||
protected:
|
||||
Logger(const QString & name="", LogLevel minLevel = INFO);
|
||||
~Logger();
|
||||
~Logger() override;
|
||||
|
||||
private:
|
||||
void write(const Logger::T_LOG_MESSAGE & message);
|
||||
|
@@ -25,13 +25,13 @@ public:
|
||||
/// @param local The local address of the socket (Differs based on NetworkAdapter IP or localhost)
|
||||
/// @return True when allowed, else false
|
||||
///
|
||||
bool accessAllowed(const QHostAddress& address, const QHostAddress& local);
|
||||
bool accessAllowed(const QHostAddress& address, const QHostAddress& local) const;
|
||||
|
||||
///
|
||||
/// @brief Check if address is in subnet of local
|
||||
/// @return True or false
|
||||
///
|
||||
bool isLocalAddress(const QHostAddress& address, const QHostAddress& local);
|
||||
bool isLocalAddress(const QHostAddress& address, const QHostAddress& local) const;
|
||||
|
||||
static NetOrigin* getInstance(){ return instance; };
|
||||
static NetOrigin* instance;
|
||||
|
@@ -18,37 +18,37 @@ enum class PixelFormat {
|
||||
NO_CHANGE
|
||||
};
|
||||
|
||||
inline PixelFormat parsePixelFormat(QString pixelFormat)
|
||||
inline PixelFormat parsePixelFormat(const QString& pixelFormat)
|
||||
{
|
||||
// convert to lower case
|
||||
pixelFormat = pixelFormat.toLower();
|
||||
QString format = pixelFormat.toLower();
|
||||
|
||||
if (pixelFormat.compare("yuyv") )
|
||||
if (format.compare("yuyv") )
|
||||
{
|
||||
return PixelFormat::YUYV;
|
||||
}
|
||||
else if (pixelFormat.compare("uyvy") )
|
||||
else if (format.compare("uyvy") )
|
||||
{
|
||||
return PixelFormat::UYVY;
|
||||
}
|
||||
else if (pixelFormat.compare("bgr16") )
|
||||
else if (format.compare("bgr16") )
|
||||
{
|
||||
return PixelFormat::BGR16;
|
||||
}
|
||||
else if (pixelFormat.compare("bgr24") )
|
||||
else if (format.compare("bgr24") )
|
||||
{
|
||||
return PixelFormat::BGR24;
|
||||
}
|
||||
else if (pixelFormat.compare("rgb32") )
|
||||
else if (format.compare("rgb32") )
|
||||
{
|
||||
return PixelFormat::RGB32;
|
||||
}
|
||||
else if (pixelFormat.compare("bgr32") )
|
||||
else if (format.compare("bgr32") )
|
||||
{
|
||||
return PixelFormat::BGR32;
|
||||
}
|
||||
#ifdef HAVE_JPEG_DECODER
|
||||
else if (pixelFormat.compare("mjpeg") )
|
||||
else if (format.compare("mjpeg") )
|
||||
{
|
||||
return PixelFormat::MJPEG;
|
||||
}
|
||||
|
@@ -6,6 +6,6 @@
|
||||
namespace Process {
|
||||
|
||||
void restartHyperion(bool asNewProcess=false);
|
||||
QByteArray command_exec(QString cmd, QByteArray data="");
|
||||
QByteArray command_exec(const QString& cmd, const QByteArray& data="");
|
||||
|
||||
}
|
||||
|
@@ -36,8 +36,8 @@ public:
|
||||
Profiler(const char* sourceFile, const char* func, unsigned int line);
|
||||
~Profiler();
|
||||
|
||||
static void TimerStart(const QString stopWatchName, const char* sourceFile, const char* func, unsigned int line);
|
||||
static void TimerGetTime(const QString stopWatchName, const char* sourceFile, const char* func, unsigned int line);
|
||||
static void TimerStart(const QString& stopWatchName, const char* sourceFile, const char* func, unsigned int line);
|
||||
static void TimerGetTime(const QString& stopWatchName, const char* sourceFile, const char* func, unsigned int line);
|
||||
|
||||
private:
|
||||
static void initLogger();
|
||||
|
@@ -14,7 +14,6 @@ namespace RGBW {
|
||||
WHITE_OFF
|
||||
};
|
||||
|
||||
WhiteAlgorithm stringToWhiteAlgorithm(QString str);
|
||||
WhiteAlgorithm stringToWhiteAlgorithm(const QString& str);
|
||||
void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, WhiteAlgorithm algorithm);
|
||||
|
||||
}
|
||||
|
@@ -12,16 +12,16 @@ enum class VideoMode
|
||||
VIDEO_3DTAB
|
||||
};
|
||||
|
||||
inline VideoMode parse3DMode(QString videoMode)
|
||||
inline VideoMode parse3DMode(const QString& videoMode)
|
||||
{
|
||||
// convert to upper case
|
||||
videoMode = videoMode.toUpper();
|
||||
const QString vm = videoMode.toUpper();
|
||||
|
||||
if (videoMode == "3DTAB")
|
||||
if (vm == "3DTAB")
|
||||
{
|
||||
return VideoMode::VIDEO_3DTAB;
|
||||
}
|
||||
else if (videoMode == "3DSBS")
|
||||
else if (vm == "3DSBS")
|
||||
{
|
||||
return VideoMode::VIDEO_3DSBS;
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@ public:
|
||||
///
|
||||
/// @return A list of error messages
|
||||
///
|
||||
const QStringList & getMessages() const;
|
||||
QStringList getMessages() const;
|
||||
|
||||
private:
|
||||
///
|
||||
|
@@ -19,14 +19,14 @@ public:
|
||||
{
|
||||
if (path.first() == "[root]")
|
||||
path.removeFirst();
|
||||
|
||||
|
||||
for (QStringList::iterator it = path.begin(); it != path.end(); ++it)
|
||||
{
|
||||
QString current = *it;
|
||||
if (current.left(1) == ".")
|
||||
*it = current.mid(1, current.size()-1);
|
||||
}
|
||||
|
||||
|
||||
if (!value.isEmpty())
|
||||
modifyValue(value, result, path, newValue, propertyName);
|
||||
else if (newValue != QJsonValue::Null && !propertyName.isEmpty())
|
||||
@@ -78,17 +78,17 @@ private:
|
||||
{
|
||||
QJsonObject result;
|
||||
QJsonObject obj = schema.toObject();
|
||||
|
||||
|
||||
if (obj.find("type") != obj.end() && obj.find("type").value().isString())
|
||||
{
|
||||
QJsonValue ret = QJsonValue::Null;
|
||||
|
||||
|
||||
if (obj.find("type").value().toString() == "object" && ( obj.find("required").value().toBool() || ignoreRequired ) )
|
||||
ret = createValue(obj["properties"], ignoreRequired);
|
||||
else if (obj.find("type").value().toString() == "array" && ( obj.find("required").value().toBool() || ignoreRequired ) )
|
||||
{
|
||||
QJsonArray array;
|
||||
|
||||
|
||||
if (obj.find("default") != obj.end())
|
||||
ret = obj.find("default").value();
|
||||
else
|
||||
@@ -103,7 +103,7 @@ private:
|
||||
else if ( obj.find("required").value().toBool() || ignoreRequired )
|
||||
if (obj.find("default") != obj.end())
|
||||
ret = obj.find("default").value();
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
@@ -133,7 +133,7 @@ private:
|
||||
{
|
||||
QJsonValue retEmpty;
|
||||
retEmpty = createValue(attributeValue.toObject()["items"], ignoreRequired);
|
||||
|
||||
|
||||
if (!retEmpty.toObject().isEmpty())
|
||||
array.append(retEmpty);
|
||||
result[attribute] = array;
|
||||
@@ -234,7 +234,7 @@ private:
|
||||
subValue = newValue;
|
||||
else
|
||||
continue;
|
||||
|
||||
|
||||
if (!subValue.toObject().isEmpty())
|
||||
json_array.append(subValue);
|
||||
else if (newValue != QJsonValue::Null && arrayLevel != -1)
|
||||
|
@@ -37,7 +37,7 @@ namespace settings {
|
||||
/// @param type The settings::type from enum
|
||||
/// @return The settings type as string
|
||||
///
|
||||
inline QString typeToString(const type& type)
|
||||
inline QString typeToString(type type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
|
Reference in New Issue
Block a user