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

@@ -3,11 +3,11 @@
/**
* Enumeration of the possible video standards the grabber can be set to
*/
enum VideoStandard {
VIDEOSTANDARD_PAL,
VIDEOSTANDARD_NTSC,
VIDEOSTANDARD_SECAM,
VIDEOSTANDARD_NO_CHANGE
enum class VideoStandard {
PAL,
NTSC,
SECAM,
NO_CHANGE
};
inline VideoStandard parseVideoStandard(QString videoStandard)
@@ -17,17 +17,17 @@ inline VideoStandard parseVideoStandard(QString videoStandard)
if (videoStandard == "pal")
{
return VIDEOSTANDARD_PAL;
return VideoStandard::PAL;
}
else if (videoStandard == "ntsc")
{
return VIDEOSTANDARD_NTSC;
return VideoStandard::NTSC;
}
else if (videoStandard == "secam")
{
return VIDEOSTANDARD_SECAM;
return VideoStandard::SECAM;
}
// return the default NO_CHANGE
return VIDEOSTANDARD_NO_CHANGE;
return VideoStandard::NO_CHANGE;
}

View File

@@ -552,7 +552,7 @@ private:
/// buffer for leds (with adjustment)
std::vector<ColorRgb> _ledBuffer;
VideoMode _currVideoMode = VIDEO_2D;
VideoMode _currVideoMode = VideoMode::VIDEO_2D;
/// Boblight instance
BoblightServer* _boblightServer;

View File

@@ -15,7 +15,7 @@
namespace Json { class Value; }
/// Enumeration containing the possible orders of device color byte data
enum ColorOrder
enum class ColorOrder
{
ORDER_RGB, ORDER_RBG, ORDER_GRB, ORDER_BRG, ORDER_GBR, ORDER_BGR
};
@@ -24,17 +24,17 @@ inline QString colorOrderToString(const ColorOrder colorOrder)
{
switch (colorOrder)
{
case ORDER_RGB:
case ColorOrder::ORDER_RGB:
return "rgb";
case ORDER_RBG:
case ColorOrder::ORDER_RBG:
return "rbg";
case ORDER_GRB:
case ColorOrder::ORDER_GRB:
return "grb";
case ORDER_BRG:
case ColorOrder::ORDER_BRG:
return "brg";
case ORDER_GBR:
case ColorOrder::ORDER_GBR:
return "gbr";
case ORDER_BGR:
case ColorOrder::ORDER_BGR:
return "bgr";
default:
return "not-a-colororder";
@@ -44,31 +44,31 @@ inline ColorOrder stringToColorOrder(const QString & order)
{
if (order == "rgb")
{
return ORDER_RGB;
return ColorOrder::ORDER_RGB;
}
else if (order == "bgr")
{
return ORDER_BGR;
return ColorOrder::ORDER_BGR;
}
else if (order == "rbg")
{
return ORDER_RBG;
return ColorOrder::ORDER_RBG;
}
else if (order == "brg")
{
return ORDER_BRG;
return ColorOrder::ORDER_BRG;
}
else if (order == "gbr")
{
return ORDER_GBR;
return ColorOrder::ORDER_GBR;
}
else if (order == "grb")
{
return ORDER_GRB;
return ColorOrder::ORDER_GRB;
}
std::cout << "Unknown color order defined (" << order.toStdString() << "). Using RGB." << std::endl;
return ORDER_RGB;
return ColorOrder::ORDER_RGB;
}
///

View File

@@ -7,6 +7,7 @@
#include <QJsonArray>
#include <QJsonDocument>
#include <QTimer>
#include <QDateTime>
// STL includes
#include <vector>
@@ -179,8 +180,8 @@ protected:
QTimer* _refresh_timer;
int _refresh_timer_interval;
/// timestamp of last write
qint64 _last_write_time;
/// Timestamp of last write
QDateTime _lastWriteTime;
/// Time a device requires mandatorily between two writes
int _latchTime_ms;

View File

@@ -5,51 +5,59 @@
class QUdpSocket;
enum searchType{
enum class searchType{
STY_WEBSERVER,
STY_FLATBUFSERVER,
STY_JSONSERVER
};
///
/// @brief Search for SSDP sessions, used by standalone capture binaries
/// @brief Search for SSDP sessions, used by stand-alone capture binaries
///
class SSDPDiscover : public QObject
{
Q_OBJECT
public:
SSDPDiscover(QObject* parent = nullptr);
///
/// @brief Search for specified service, results will be returned by signal newService(). Calling this method again will reset all found usns and search again
/// @brief Search for specified service, results will be returned by signal newService(). Calling this method again will reset all found urns and search again
/// @param st The service to search for
///
void searchForService(const QString& st = "urn:hyperion-project.org:device:basic:1");
void searchForService(const QString &st = "urn:hyperion-project.org:device:basic:1");
///
/// @brief Search for specified searchTarget, the method will block until a server has been found or a timeout happend
/// @brief Search for specified searchTarget, the method will block until a server has been found or a timeout happened
/// @param type The address type one of struct searchType
/// @param st The service to search for
/// @param timeout_ms The timeout in ms
/// @return The address+port of webserver or empty if timed out
/// @return The address+port of web-server or empty if timed out
///
const QString getFirstService(const searchType& type = STY_WEBSERVER,const QString& st = "urn:hyperion-project.org:device:basic:1", const int& timeout_ms = 3000);
const QString getFirstService(const searchType &type = searchType::STY_WEBSERVER,const QString &st = "urn:hyperion-project.org:device:basic:1", const int &timeout_ms = 3000);
signals:
///
/// @brief Emits whenever a new service has ben found, search started with searchForService()
/// @param webServer The address+port of webserver "192.168.0.10:8090"
/// @brief Emits whenever a new service has been found, search started with searchForService()
///
void newService(const QString webServer);
/// @param webServer The address+port of web-server "192.168.0.10:8090"
///
void newService(const QString &webServer);
private slots:
void readPendingDatagrams();
private:
void sendSearch(const QString& st);
///
/// @brief Execute ssdp discovery request
///
/// @param[in] st Search Target
///
void sendSearch(const QString &st);
private:
Logger* _log;
QUdpSocket* _udpSocket;
QString _searchTarget;

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";
}
}