mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
multi bugfix pr ... (#348)
* move name to general add a version for config file * start impl. config migrator * fix typo amd set access level * fix schemaa name * fix schema * add structure for config migrator * add more structural things for config migrator * fix not all grabber provide live video * add schema for trails
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
|
||||
add_executable(hyperiond
|
||||
configMigratorBase.cpp
|
||||
configMigratorBase.h
|
||||
configMigrator.cpp
|
||||
configMigrator.h
|
||||
hyperiond.cpp
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
|
||||
ConfigMigrator::ConfigMigrator()
|
||||
: _log(Logger::getInstance("ConfigMigrator"))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -13,7 +12,23 @@ ConfigMigrator::~ConfigMigrator()
|
||||
bool ConfigMigrator::migrate(QString configFile, int fromVersion,int toVersion)
|
||||
{
|
||||
Debug(_log, "migrate config %s from version %d to %d.", configFile.toLocal8Bit().constData(), fromVersion, toVersion);
|
||||
throw std::runtime_error("ERROR: config migration not implemented");
|
||||
|
||||
for (int v=fromVersion; v<toVersion; v++)
|
||||
{
|
||||
switch(v)
|
||||
{
|
||||
case 1: migrateFrom1(); break;
|
||||
|
||||
default:
|
||||
throw std::runtime_error("ERROR: config migration - unknown version");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ConfigMigrator::migrateFrom1()
|
||||
{
|
||||
throw std::runtime_error("ERROR: config migration not implemented");
|
||||
}
|
||||
|
||||
|
@@ -1,10 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <utils/Logger.h>
|
||||
|
||||
#include "configMigratorBase.h"
|
||||
#include <QString>
|
||||
|
||||
class ConfigMigrator
|
||||
///
|
||||
/// class that contains migration code
|
||||
/// helper code goeas to base class
|
||||
class ConfigMigrator : public ConfigMigratorBase
|
||||
|
||||
{
|
||||
|
||||
public:
|
||||
@@ -12,6 +15,7 @@ public:
|
||||
~ConfigMigrator();
|
||||
|
||||
bool migrate(QString configFile, int fromVersion,int toVersion);
|
||||
|
||||
private:
|
||||
Logger * _log;
|
||||
void migrateFrom1();
|
||||
};
|
11
src/hyperiond/configMigratorBase.cpp
Normal file
11
src/hyperiond/configMigratorBase.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "configMigratorBase.h"
|
||||
|
||||
ConfigMigratorBase::ConfigMigratorBase()
|
||||
: _log(Logger::getInstance("ConfigMigrator"))
|
||||
{
|
||||
}
|
||||
|
||||
ConfigMigratorBase::~ConfigMigratorBase()
|
||||
{
|
||||
}
|
||||
|
16
src/hyperiond/configMigratorBase.h
Normal file
16
src/hyperiond/configMigratorBase.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <utils/Logger.h>
|
||||
|
||||
#include <QString>
|
||||
|
||||
class ConfigMigratorBase
|
||||
{
|
||||
|
||||
public:
|
||||
ConfigMigratorBase();
|
||||
~ConfigMigratorBase();
|
||||
|
||||
protected:
|
||||
Logger * _log;
|
||||
};
|
@@ -414,7 +414,7 @@ void HyperionDaemon::createSystemFrameGrabber()
|
||||
if (_qconfig.contains("framegrabber"))
|
||||
{
|
||||
const QJsonObject & grabberConfig = _qconfig["framegrabber"].toObject();
|
||||
if (grabberConfig["enable"].toBool(true))
|
||||
// if (grabberConfig["enable"].toBool(true))
|
||||
{
|
||||
_grabber_width = grabberConfig["width"].toInt(96);
|
||||
_grabber_height = grabberConfig["height"].toInt(96);
|
||||
@@ -464,7 +464,7 @@ void HyperionDaemon::createSystemFrameGrabber()
|
||||
Info( _log, "set screen capture device to '%s'", type.toUtf8().constData());
|
||||
}
|
||||
|
||||
bool grabberCompState = true;
|
||||
bool grabberCompState = grabberConfig["enable"].toBool(true);
|
||||
if (type == "") { Info( _log, "screen capture device disabled"); grabberCompState = false; }
|
||||
else if (type == "framebuffer") createGrabberFramebuffer(grabberConfig);
|
||||
else if (type == "dispmanx") createGrabberDispmanx();
|
||||
@@ -474,6 +474,7 @@ void HyperionDaemon::createSystemFrameGrabber()
|
||||
else { Warning( _log, "unknown framegrabber type '%s'", type.toUtf8().constData()); grabberCompState = false; }
|
||||
|
||||
_hyperion->getComponentRegister().componentStateChanged(hyperion::COMP_GRABBER, grabberCompState);
|
||||
_hyperion->setComponentState(hyperion::COMP_GRABBER, grabberCompState );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
const int CURRENT_CONFIG_VERSION = 2;
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#ifdef ENABLE_DISPMANX
|
||||
|
Reference in New Issue
Block a user