mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
migrate std::string to qstring + add sysinfo via json (#412)
* std::string -> qstring part 1 * more string migration * more string migration ... * ... * more qstring mogrations add sysinfo via json * remove unneccessary includes * integrate sysinfo into webui
This commit is contained in:
@@ -73,7 +73,7 @@ void CgiHandler::cmd_cfg_get()
|
||||
{
|
||||
if ( _args.at(0) == "cfg_get" )
|
||||
{
|
||||
QFile file ( _hyperion->getConfigFileName().c_str() );
|
||||
QFile file ( _hyperion->getConfigFileName() );
|
||||
if (file.exists ())
|
||||
{
|
||||
if (file.open (QFile::ReadOnly)) {
|
||||
@@ -110,17 +110,18 @@ void CgiHandler::cmd_cfg_set()
|
||||
schemaChecker.setSchema(schemaJson);
|
||||
if ( schemaChecker.validate(hyperionConfigJsonObj) )
|
||||
{
|
||||
QJsonFactory::writeJson(QString::fromStdString(_hyperion->getConfigFileName()), hyperionConfigJsonObj);
|
||||
QJsonFactory::writeJson(_hyperion->getConfigFileName(), hyperionConfigJsonObj);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string errorMsg = "ERROR: Json validation failed: \n";
|
||||
for (std::list<std::string>::const_iterator i = schemaChecker.getMessages().begin(); i != schemaChecker.getMessages().end(); ++i)
|
||||
QString errorMsg = "ERROR: Json validation failed: \n";
|
||||
QStringList schemaErrors = schemaChecker.getMessages();
|
||||
foreach (auto & schemaError, schemaErrors)
|
||||
{
|
||||
Error(_log, "config write validation: %s", (*i).c_str());
|
||||
errorMsg += *i + "\n";
|
||||
Error(_log, "config write validation: %s", QSTRING_CSTR(schemaError));
|
||||
errorMsg += schemaError + "\n";
|
||||
}
|
||||
throw std::runtime_error(errorMsg.c_str());
|
||||
throw std::runtime_error(errorMsg.toStdString());
|
||||
}
|
||||
}
|
||||
catch(const std::runtime_error& validate_error)
|
||||
|
@@ -45,11 +45,11 @@ void StaticFileServing::onServerStarted (quint16 port)
|
||||
{
|
||||
Info(_log, "started on port %d name \"%s\"", port ,_server->getServerName().toStdString().c_str());
|
||||
|
||||
const std::string mDNSDescr = (_server->getServerName().toStdString() + "@" + QHostInfo::localHostName().toStdString());
|
||||
const QString mDNSDescr = _server->getServerName() + "@" + QHostInfo::localHostName();
|
||||
|
||||
BonjourServiceRegister *bonjourRegister_http = new BonjourServiceRegister();
|
||||
bonjourRegister_http->registerService(
|
||||
BonjourRecord(mDNSDescr.c_str(), "_hyperiond-http._tcp", QString()),
|
||||
BonjourRecord(mDNSDescr, "_hyperiond-http._tcp", QString()),
|
||||
port
|
||||
);
|
||||
Debug(_log, "Web Config mDNS responder started");
|
||||
|
Reference in New Issue
Block a user