mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
197af35de0
* start ledclone * led cloning: clone scan areas from original led main: show exceptions, better exit * tune json schema for new option. somwe cleanup * fix warnings and bug for framebuffer selection. thx to clang brought by new osx buikld on travis * make ledclone feature work flawlessly for effects too. Effect sees the ledstring without cloned leds. cloned leds will be inserted just before sending to leddevice additional: remove warnings and fix code style * fix warning
52 lines
1.0 KiB
C++
52 lines
1.0 KiB
C++
#include "webconfig/WebConfig.h"
|
|
#include "StaticFileServing.h"
|
|
|
|
|
|
WebConfig::WebConfig(QObject * parent)
|
|
: QObject(parent)
|
|
, _server(nullptr)
|
|
{
|
|
_port = WEBCONFIG_DEFAULT_PORT;
|
|
_hyperion = Hyperion::getInstance();
|
|
const Json::Value &config = _hyperion->getJsonConfig();
|
|
_baseUrl = QString::fromStdString(WEBCONFIG_DEFAULT_PATH);
|
|
_port = WEBCONFIG_DEFAULT_PORT;
|
|
|
|
bool webconfigEnable = true;
|
|
|
|
if (config.isMember("webConfig"))
|
|
{
|
|
const Json::Value & webconfigConfig = config["webConfig"];
|
|
webconfigEnable = webconfigConfig.get("enable", true).asBool();
|
|
_port = webconfigConfig.get("port", WEBCONFIG_DEFAULT_PORT).asUInt();
|
|
_baseUrl = QString::fromStdString( webconfigConfig.get("document_root", WEBCONFIG_DEFAULT_PATH).asString() );
|
|
}
|
|
|
|
if ( webconfigEnable )
|
|
start();
|
|
}
|
|
|
|
|
|
WebConfig::~WebConfig()
|
|
{
|
|
stop();
|
|
}
|
|
|
|
|
|
void WebConfig::start()
|
|
{
|
|
if ( _server == nullptr )
|
|
_server = new StaticFileServing (_hyperion, _baseUrl, _port, this);
|
|
}
|
|
|
|
void WebConfig::stop()
|
|
{
|
|
if ( _server != nullptr )
|
|
{
|
|
delete _server;
|
|
_server = nullptr;
|
|
}
|
|
}
|
|
|
|
|