refactor: Address (Windows) compile warnings (#840)

* Windows compile errors and (Qt 5.15 deprecation) warnings

* Usability - Enable/Disable Instance button

Co-authored-by: brindosch <edeltraud70@gmx.de>
This commit is contained in:
LordGrey
2020-06-28 23:05:32 +02:00
committed by GitHub
parent e365a2839d
commit bfb50b8d91
61 changed files with 530 additions and 365 deletions

View File

@@ -4,6 +4,8 @@
#include <cstdint>
#include <iostream>
#include <QTextStream>
struct ColorRgb;
///
@@ -49,6 +51,19 @@ inline std::ostream& operator<<(std::ostream& os, const ColorRgb& color)
return os;
}
///
/// Stream operator to write ColorRgb to a QTextStream (format "'{'[red]','[green]','[blue]'}'")
///
/// @param os The output stream
/// @param color The color to write
/// @return The output stream (with the color written to it)
///
inline QTextStream& operator<<(QTextStream &os, const ColorRgb& color)
{
os << "{" << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}";
return os;
}
/// Compare operator to check if a color is 'smaller' than another color
inline bool operator<(const ColorRgb & lhs, const ColorRgb & rhs)
{

View File

@@ -5,17 +5,17 @@
/**
* Enumeration of the possible pixel formats the grabber can be set to
*/
enum PixelFormat {
PIXELFORMAT_YUYV,
PIXELFORMAT_UYVY,
PIXELFORMAT_BGR16,
PIXELFORMAT_BGR24,
PIXELFORMAT_RGB32,
PIXELFORMAT_BGR32,
enum class PixelFormat {
YUYV,
UYVY,
BGR16,
BGR24,
RGB32,
BGR32,
#ifdef HAVE_JPEG_DECODER
PIXELFORMAT_MJPEG,
MJPEG,
#endif
PIXELFORMAT_NO_CHANGE
NO_CHANGE
};
inline PixelFormat parsePixelFormat(QString pixelFormat)
@@ -23,37 +23,37 @@ inline PixelFormat parsePixelFormat(QString pixelFormat)
// convert to lower case
pixelFormat = pixelFormat.toLower();
if (pixelFormat == "yuyv")
if (pixelFormat.compare("yuyv") )
{
return PIXELFORMAT_YUYV;
return PixelFormat::YUYV;
}
else if (pixelFormat == "uyvy")
else if (pixelFormat.compare("uyvy") )
{
return PIXELFORMAT_UYVY;
return PixelFormat::UYVY;
}
else if (pixelFormat == "bgr16")
else if (pixelFormat.compare("bgr16") )
{
return PIXELFORMAT_BGR16;
return PixelFormat::BGR16;
}
else if (pixelFormat == "bgr24")
else if (pixelFormat.compare("bgr24") )
{
return PIXELFORMAT_BGR24;
return PixelFormat::BGR24;
}
else if (pixelFormat == "rgb32")
else if (pixelFormat.compare("rgb32") )
{
return PIXELFORMAT_RGB32;
return PixelFormat::RGB32;
}
else if (pixelFormat == "bgr32")
else if (pixelFormat.compare("bgr32") )
{
return PIXELFORMAT_BGR32;
return PixelFormat::BGR32;
}
#ifdef HAVE_JPEG_DECODER
else if (pixelFormat == "mjpeg")
else if (pixelFormat.compare("mjpeg") )
{
return PIXELFORMAT_MJPEG;
return PixelFormat::MJPEG;
}
#endif
// return the default NO_CHANGE
return PIXELFORMAT_NO_CHANGE;
return PixelFormat::NO_CHANGE;
}

View File

@@ -6,7 +6,7 @@
namespace RGBW {
enum WhiteAlgorithm {
enum class WhiteAlgorithm {
INVALID,
SUBTRACT_MINIMUM,
SUB_MIN_WARM_ADJUST,

View File

@@ -5,7 +5,7 @@
/**
* Enumeration of the possible modes in which video can be playing (2D, 3D)
*/
enum VideoMode
enum class VideoMode
{
VIDEO_2D,
VIDEO_3DSBS,
@@ -19,24 +19,24 @@ inline VideoMode parse3DMode(QString videoMode)
if (videoMode == "3DTAB")
{
return VIDEO_3DTAB;
return VideoMode::VIDEO_3DTAB;
}
else if (videoMode == "3DSBS")
{
return VIDEO_3DSBS;
return VideoMode::VIDEO_3DSBS;
}
// return the default 2D
return VIDEO_2D;
return VideoMode::VIDEO_2D;
}
inline QString videoMode2String(VideoMode mode)
{
switch(mode)
{
case VIDEO_3DTAB: return "3DTAB";
case VIDEO_3DSBS: return "3DSBS";
case VIDEO_2D: return "2D";
case VideoMode::VIDEO_3DTAB: return "3DTAB";
case VideoMode::VIDEO_3DSBS: return "3DSBS";
case VideoMode::VIDEO_2D: return "2D";
default: return "INVALID";
}
}