Skip to content

Commit

Permalink
refactor: Address (Windows) compile warnings (#840)
Browse files Browse the repository at this point in the history
* Windows compile errors and (Qt 5.15 deprecation) warnings

* Usability - Enable/Disable Instance button

Co-authored-by: brindosch <edeltraud70@gmx.de>
  • Loading branch information
Lord-Grey and brindosch authored Jun 28, 2020
1 parent e365a28 commit bfb50b8
Show file tree
Hide file tree
Showing 61 changed files with 532 additions and 367 deletions.
4 changes: 2 additions & 2 deletions assets/webconfig/i18n/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"dashboard_infobox_message_updatesuccess": "Spusťte nejnovější verzi Hyperionu.",
"dashboard_infobox_label_statush": "Stav Hyperionu:",
"dashboard_infobox_label_smartacc": "Inteligentní přístup",
"dashboard_infobox_label_enableh": "Zapnout Hyperion",
"dashboard_infobox_label_disableh": "Vypnout Hyperion",
"dashboard_infobox_label_enableh": "Povolit Instance: $1",
"dashboard_infobox_label_disableh": "Vypnout Instance $1",
"dashboard_componentbox_label_title": "Stav komponent",
"dashboard_componentbox_label_comp": "Komponenty",
"dashboard_componentbox_label_status": "Status",
Expand Down
4 changes: 2 additions & 2 deletions assets/webconfig/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
"dashboard_infobox_message_updatesuccess": "Du nutzt die aktuellste Version von Hyperion.",
"dashboard_infobox_label_statush": "Hyperion Status:",
"dashboard_infobox_label_smartacc": "Schnellzugriff",
"dashboard_infobox_label_enableh": "Aktiviere Hyperion",
"dashboard_infobox_label_disableh": "Deaktiviere Hyperion",
"dashboard_infobox_label_enableh" : "Aktiviere Instanz: $1",
"dashboard_infobox_label_disableh" : "Deaktiviere Instanz: $1",
"dashboard_componentbox_label_title": "Komponenten Status",
"dashboard_componentbox_label_comp": "Komponente",
"dashboard_componentbox_label_status": "Status",
Expand Down
4 changes: 2 additions & 2 deletions assets/webconfig/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
"dashboard_infobox_message_updatesuccess" : "You run the latest version of Hyperion.",
"dashboard_infobox_label_statush" : "Hyperion status:",
"dashboard_infobox_label_smartacc" : "Smart Access",
"dashboard_infobox_label_enableh" : "Enable Hyperion",
"dashboard_infobox_label_disableh" : "Disable Hyperion",
"dashboard_infobox_label_enableh" : "Enable Instance: $1",
"dashboard_infobox_label_disableh" : "Disable Instance: $1",
"dashboard_componentbox_label_title" : "Components status",
"dashboard_componentbox_label_comp" : "Component",
"dashboard_componentbox_label_status" : "Status",
Expand Down
4 changes: 2 additions & 2 deletions assets/webconfig/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"dashboard_infobox_message_updatesuccess": "Ejecutas la última versión de Hyperion.",
"dashboard_infobox_label_statush": "Estado de Hyperion:",
"dashboard_infobox_label_smartacc": "Acceso Inteligente",
"dashboard_infobox_label_enableh": "Habilitar Hyperion",
"dashboard_infobox_label_disableh": "Deshabilitar Hyperion",
"dashboard_infobox_label_enableh": "Habilitar Instancia: $1",
"dashboard_infobox_label_disableh": "Deshabilitar Instancia: $1",
"dashboard_componentbox_label_title": "Estado de los componentes",
"dashboard_componentbox_label_comp": "Estado de los componentes",
"dashboard_componentbox_label_status": "Estado",
Expand Down
4 changes: 2 additions & 2 deletions assets/webconfig/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"dashboard_infobox_message_updatesuccess": "Stai eseguendo l'ultima versione di Hyperion.",
"dashboard_infobox_label_statush": "Status Hyperion:",
"dashboard_infobox_label_smartacc": "Accesso Smart",
"dashboard_infobox_label_enableh": "Abilita Hyperion",
"dashboard_infobox_label_disableh": "Disabilita Hyperion",
"dashboard_infobox_label_enableh": "Abilita Istanza: $1",
"dashboard_infobox_label_disableh": "Disabilita Istanza: $1",
"dashboard_componentbox_label_title": "Status componenti",
"dashboard_componentbox_label_comp": "Componente",
"dashboard_componentbox_label_status": "Status",
Expand Down
4 changes: 2 additions & 2 deletions assets/webconfig/i18n/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"dashboard_infobox_message_updatesuccess": "Je draait de laatste versie van Hyperion",
"dashboard_infobox_label_statush": "Hyperion status:",
"dashboard_infobox_label_smartacc": "Slimme toegang",
"dashboard_infobox_label_enableh": "Schakel Hyperion in",
"dashboard_infobox_label_disableh": "Schakel Hyperion uit",
"dashboard_infobox_label_enableh": "Schakel Instantie $1 in",
"dashboard_infobox_label_disableh": "Schakel Instantie $1 uit",
"dashboard_componentbox_label_title": "Componenten status",
"dashboard_componentbox_label_comp": "Component",
"dashboard_componentbox_label_status": "Status",
Expand Down
4 changes: 2 additions & 2 deletions assets/webconfig/i18n/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"dashboard_infobox_message_updatesuccess": "Du använder den senaste versionen av Hyperion.",
"dashboard_infobox_label_statush": "Hyperion-status:",
"dashboard_infobox_label_smartacc": "Smart Åtkomst",
"dashboard_infobox_label_enableh": "Aktivera Hyperion",
"dashboard_infobox_label_disableh": "Inaktivera Hyperion",
"dashboard_infobox_label_enableh": "Aktivera Instans: $1",
"dashboard_infobox_label_disableh": "Inaktivera Instans: $1",
"dashboard_componentbox_label_title": "Komponentstatus",
"dashboard_componentbox_label_comp": "Komponent",
"dashboard_componentbox_label_status": "Status",
Expand Down
5 changes: 4 additions & 1 deletion assets/webconfig/js/content_dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ $(document).ready( function() {
}
});

var instancename = window.currentHyperionInstanceName;
console.log ("instancename: ",instancename);

$('#dash_statush').html(hyperion_enabled ? '<span style="color:green">'+$.i18n('general_btn_on')+'</span>' : '<span style="color:red">'+$.i18n('general_btn_off')+'</span>');
$('#btn_hsc').html(hyperion_enabled ? '<button class="btn btn-sm btn-danger" onClick="requestSetComponentState(\'ALL\',false)">'+$.i18n('dashboard_infobox_label_disableh')+'</button>' : '<button class="btn btn-sm btn-success" onClick="requestSetComponentState(\'ALL\',true)">'+$.i18n('dashboard_infobox_label_enableh')+'</button>');
$('#btn_hsc').html(hyperion_enabled ? '<button class="btn btn-sm btn-danger" onClick="requestSetComponentState(\'ALL\',false)">'+$.i18n('dashboard_infobox_label_disableh', instancename)+'</button>' : '<button class="btn btn-sm btn-success" onClick="requestSetComponentState(\'ALL\',true)">'+$.i18n('dashboard_infobox_label_enableh', instancename)+'</button>');
}

// add more info
Expand Down
18 changes: 9 additions & 9 deletions include/grabber/VideoStandard.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
}
2 changes: 1 addition & 1 deletion include/hyperion/Hyperion.h
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ private slots:
/// buffer for leds (with adjustment)
std::vector<ColorRgb> _ledBuffer;

VideoMode _currVideoMode = VIDEO_2D;
VideoMode _currVideoMode = VideoMode::VIDEO_2D;

/// Boblight instance
BoblightServer* _boblightServer;
Expand Down
28 changes: 14 additions & 14 deletions include/hyperion/LedString.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand All @@ -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";
Expand All @@ -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;
}

///
Expand Down
5 changes: 3 additions & 2 deletions include/leddevice/LedDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <QJsonArray>
#include <QJsonDocument>
#include <QTimer>
#include <QDateTime>

// STL includes
#include <vector>
Expand Down Expand Up @@ -179,8 +180,8 @@ public slots:
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;
Expand Down
30 changes: 19 additions & 11 deletions include/ssdp/SSDPDiscover.h
Original file line number Diff line number Diff line change
Expand Up @@ -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()
///
/// @param webServer The address+port of web-server "192.168.0.10:8090"
///
void newService(const QString webServer);
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;
Expand Down
15 changes: 15 additions & 0 deletions include/utils/ColorRgb.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <cstdint>
#include <iostream>

#include <QTextStream>

struct ColorRgb;

///
Expand Down Expand Up @@ -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)
{
Expand Down
Loading

0 comments on commit bfb50b8

Please sign in to comment.