mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Fixed build warnings and undo changes
- Build problems:
- Qt 5.13 obsoleted some calls that were used in our Qt library.
- The PhilipsHueLight and PhilipsHueBridge classes did not use the private logger class
- Undo changes:
- In Commit e6c2e7e
, I made changes that were not covered. An apology goes to @b1rdhous3
Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com>
This commit is contained in:
parent
ff93dd3b25
commit
bea8345e4b
@ -75,10 +75,10 @@ $(document).ready( function() {
|
||||
|
||||
// add more info
|
||||
$('#dash_leddevice').html(window.serverInfo.ledDevices.active);
|
||||
$('#dash_currv').html(window.currentVersion);
|
||||
$('#dash_currv').html(window.currentChannel+' '+window.currentVersion);
|
||||
$('#dash_instance').html(window.serverConfig.general.name);
|
||||
$('#dash_ports').html(window.serverConfig.flatbufServer.port+' | '+window.serverConfig.protoServer.port);
|
||||
$('#dash_versionbranch').html(window.currentChannel);
|
||||
$('#dash_versionbranch').html(window.serverConfig.general.versionBranch);
|
||||
|
||||
getReleases(function(callback){
|
||||
if(callback)
|
||||
|
@ -6,10 +6,12 @@
|
||||
{
|
||||
/// general Settings
|
||||
/// * 'name' : The user friendly name of the hyperion instance (used for network things)
|
||||
/// * 'versionBranch' : Which branch should be used for hyperion version
|
||||
/// * 'showOptHelp' : Show option expanations at the webui. Highly recommended for beginners.
|
||||
"general" :
|
||||
{
|
||||
"name" : "MyHyperionConfig",
|
||||
"versionBranch" : "Stable",
|
||||
"showOptHelp" : true
|
||||
},
|
||||
/// set log level: silent warn verbose debug
|
||||
|
@ -2,6 +2,7 @@
|
||||
"general" :
|
||||
{
|
||||
"name" : "My Hyperion Config",
|
||||
"versionBranch" : "Stable",
|
||||
"showOptHelp" : true
|
||||
},
|
||||
"logger" :
|
||||
|
@ -15,13 +15,13 @@ class Option: public QCommandLineOption
|
||||
public:
|
||||
Option(const QString &name,
|
||||
const QString &description = QString(),
|
||||
const QString &valueName = QString::null,
|
||||
const QString &valueName = QString(),
|
||||
const QString &defaultValue = QString()
|
||||
);
|
||||
|
||||
Option(const QStringList &names,
|
||||
const QString &description = QString(),
|
||||
const QString &valueName = QString::null,
|
||||
const QString &valueName = QString(),
|
||||
const QString &defaultValue = QString()
|
||||
);
|
||||
|
||||
|
@ -246,7 +246,7 @@ void EffectFileHandler::updateEffects()
|
||||
|
||||
// collect effect schemas
|
||||
efxCount = 0;
|
||||
directory = path.endsWith("/") ? (path + "schema/") : (path + "/schema/");
|
||||
directory.setPath(path.endsWith("/") ? (path + "schema/") : (path + "/schema/"));
|
||||
QStringList pynames = directory.entryList(QStringList() << "*.json", QDir::Files, QDir::Name | QDir::IgnoreCase);
|
||||
for (const QString & pyname : pynames)
|
||||
{
|
||||
|
@ -14,6 +14,19 @@
|
||||
"required" : true,
|
||||
"propertyOrder" : 1
|
||||
},
|
||||
"versionBranch" :
|
||||
{
|
||||
"type" : "string",
|
||||
"title" : "edt_conf_gen_versionBranch_title",
|
||||
"enum" : ["Stable", "Beta"],
|
||||
"required" : true,
|
||||
"access" : "expert",
|
||||
"default" : "Stable",
|
||||
"options" : {
|
||||
"enum_titles" : ["Stable", "Beta"]
|
||||
},
|
||||
"propertyOrder" : 2
|
||||
},
|
||||
"showOptHelp" :
|
||||
{
|
||||
"type" : "boolean",
|
||||
|
@ -125,7 +125,7 @@ float CiColor::getDistanceBetweenTwoPoints(CiColor p1, CiColor p2)
|
||||
|
||||
PhilipsHueBridge::PhilipsHueBridge(Logger* log, QString host, QString username)
|
||||
: QObject()
|
||||
, log(log)
|
||||
, _log(log)
|
||||
, host(host)
|
||||
, username(username)
|
||||
{
|
||||
@ -141,12 +141,12 @@ void PhilipsHueBridge::bConnect(void)
|
||||
{
|
||||
if(username.isEmpty() || host.isEmpty())
|
||||
{
|
||||
Error(log,"Username or IP Address is empty!");
|
||||
Error(_log,"Username or IP Address is empty!");
|
||||
}
|
||||
else
|
||||
{
|
||||
QString url = QString("http://%1/api/%2").arg(host).arg(username);
|
||||
Debug(log, "Connect to bridge %s", QSTRING_CSTR(url));
|
||||
Debug(_log, "Connect to bridge %s", QSTRING_CSTR(url));
|
||||
|
||||
QNetworkRequest request(url);
|
||||
manager.get(request);
|
||||
@ -164,13 +164,13 @@ void PhilipsHueBridge::resolveReply(QNetworkReply* reply)
|
||||
QJsonDocument doc = QJsonDocument::fromJson(response, &error);
|
||||
if (error.error != QJsonParseError::NoError)
|
||||
{
|
||||
Error(log, "Got invalid response from bridge");
|
||||
Error(_log, "Got invalid response from bridge");
|
||||
return;
|
||||
}
|
||||
// check for authorization
|
||||
if(doc.isArray())
|
||||
{
|
||||
Error(log, "Authorization failed, username invalid");
|
||||
Error(_log, "Authorization failed, username invalid");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ void PhilipsHueBridge::resolveReply(QNetworkReply* reply)
|
||||
|
||||
if(obj.isEmpty())
|
||||
{
|
||||
Error(log, "Bridge has no registered bulbs/stripes");
|
||||
Error(_log, "Bridge has no registered bulbs/stripes");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ void PhilipsHueBridge::resolveReply(QNetworkReply* reply)
|
||||
}
|
||||
else
|
||||
{
|
||||
Error(log,"Network Error: %s", QSTRING_CSTR(reply->errorString()));
|
||||
Error(_log,"Network Error: %s", QSTRING_CSTR(reply->errorString()));
|
||||
bTimer.start();
|
||||
}
|
||||
}
|
||||
@ -202,7 +202,7 @@ void PhilipsHueBridge::resolveReply(QNetworkReply* reply)
|
||||
|
||||
void PhilipsHueBridge::post(QString route, QString content)
|
||||
{
|
||||
//Debug(log, "Post %s: %s", QSTRING_CSTR(QString("http://IP/api/USR/%1").arg(route)), QSTRING_CSTR(content));
|
||||
//Debug(_log, "Post %s: %s", QSTRING_CSTR(QString("http://IP/api/USR/%1").arg(route)), QSTRING_CSTR(content));
|
||||
|
||||
QNetworkRequest request(QString("http://%1/api/%2/%3").arg(host).arg(username).arg(route));
|
||||
manager.put(request, content.toLatin1());
|
||||
@ -216,14 +216,14 @@ const std::set<QString> PhilipsHueLight::GAMUT_C_MODEL_IDS =
|
||||
{ "LLC020", "LST002", "LCT011", "LCT012", "LCT010", "LCT014", "LCT015", "LCT016", "LCT024" };
|
||||
|
||||
PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned int id, QJsonObject values)
|
||||
: log(log)
|
||||
: _log(log)
|
||||
, bridge(bridge)
|
||||
, id(id)
|
||||
{
|
||||
// Get state object values which are subject to change.
|
||||
if (!values["state"].toObject().contains("on"))
|
||||
{
|
||||
Error(log, "Got invalid state object from light ID %d", id);
|
||||
Error(_log, "Got invalid state object from light ID %d", id);
|
||||
}
|
||||
QJsonObject state;
|
||||
state["on"] = values["state"].toObject()["on"];
|
||||
@ -248,7 +248,7 @@ PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned
|
||||
// Find id in the sets and set the appropriate color space.
|
||||
if (GAMUT_A_MODEL_IDS.find(modelId) != GAMUT_A_MODEL_IDS.end())
|
||||
{
|
||||
Debug(log, "Recognized model id %s of light ID %d as gamut A", modelId.toStdString().c_str(), id);
|
||||
Debug(_log, "Recognized model id %s of light ID %d as gamut A", modelId.toStdString().c_str(), id);
|
||||
colorSpace.red =
|
||||
{ 0.704f, 0.296f};
|
||||
colorSpace.green =
|
||||
@ -258,7 +258,7 @@ PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned
|
||||
}
|
||||
else if (GAMUT_B_MODEL_IDS.find(modelId) != GAMUT_B_MODEL_IDS.end())
|
||||
{
|
||||
Debug(log, "Recognized model id %s of light ID %d as gamut B", modelId.toStdString().c_str(), id);
|
||||
Debug(_log, "Recognized model id %s of light ID %d as gamut B", modelId.toStdString().c_str(), id);
|
||||
colorSpace.red =
|
||||
{ 0.675f, 0.322f};
|
||||
colorSpace.green =
|
||||
@ -268,7 +268,7 @@ PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned
|
||||
}
|
||||
else if (GAMUT_C_MODEL_IDS.find(modelId) != GAMUT_C_MODEL_IDS.end())
|
||||
{
|
||||
Debug(log, "Recognized model id %s of light ID %d as gamut C", modelId.toStdString().c_str(), id);
|
||||
Debug(_log, "Recognized model id %s of light ID %d as gamut C", modelId.toStdString().c_str(), id);
|
||||
colorSpace.red =
|
||||
{ 0.6915f, 0.3083f};
|
||||
colorSpace.green =
|
||||
@ -278,7 +278,7 @@ PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned
|
||||
}
|
||||
else
|
||||
{
|
||||
Warning(log, "Did not recognize model id %s of light ID %d", modelId.toStdString().c_str(), id);
|
||||
Warning(_log, "Did not recognize model id %s of light ID %d", modelId.toStdString().c_str(), id);
|
||||
colorSpace.red =
|
||||
{ 1.0f, 0.0f};
|
||||
colorSpace.green =
|
||||
@ -287,7 +287,7 @@ PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned
|
||||
{ 0.0f, 0.0f};
|
||||
}
|
||||
|
||||
Info(log,"Light ID %d created", id);
|
||||
Info(_log,"Light ID %d created", id);
|
||||
}
|
||||
|
||||
PhilipsHueLight::~PhilipsHueLight()
|
||||
|
@ -92,7 +92,7 @@ class PhilipsHueBridge : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
Logger* log;
|
||||
Logger* _log;
|
||||
/// QNetworkAccessManager for sending requests.
|
||||
QNetworkAccessManager manager;
|
||||
/// Ip address of the bridge
|
||||
@ -138,7 +138,7 @@ public:
|
||||
class PhilipsHueLight
|
||||
{
|
||||
private:
|
||||
Logger* log;
|
||||
Logger* _log;
|
||||
PhilipsHueBridge* bridge;
|
||||
/// light id
|
||||
unsigned int id;
|
||||
|
@ -19,10 +19,10 @@
|
||||
void createScreenshot(const int cropHorizontal, const int cropVertical, const int decimation, Image<ColorRgb> & image)
|
||||
{
|
||||
// Create the full size screenshot
|
||||
const QRect screenSize = QApplication::desktop()->screenGeometry();
|
||||
QScreen *screen = QApplication::primaryScreen();
|
||||
const QRect screenSize = screen->availableGeometry();
|
||||
const int croppedWidth = screenSize.width() - 2*cropVertical;
|
||||
const int croppedHeight = screenSize.height() - 2*cropHorizontal;
|
||||
QScreen *screen = QApplication::primaryScreen();
|
||||
const QPixmap fullSizeScreenshot = screen->grabWindow(QApplication::desktop()->winId(), cropVertical, cropHorizontal, croppedWidth, croppedHeight);
|
||||
|
||||
// Scale the screenshot to the required size
|
||||
|
Loading…
Reference in New Issue
Block a user