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:
redPanther
2016-12-24 10:02:12 +01:00
committed by GitHub
parent 8ed8823033
commit 3746f643af
20 changed files with 153 additions and 49 deletions

View File

@@ -1,5 +1,7 @@
add_executable(hyperiond
configMigratorBase.cpp
configMigratorBase.h
configMigrator.cpp
configMigrator.h
hyperiond.cpp

View File

@@ -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");
}

View File

@@ -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();
};

View File

@@ -0,0 +1,11 @@
#include "configMigratorBase.h"
ConfigMigratorBase::ConfigMigratorBase()
: _log(Logger::getInstance("ConfigMigrator"))
{
}
ConfigMigratorBase::~ConfigMigratorBase()
{
}

View File

@@ -0,0 +1,16 @@
#pragma once
#include <utils/Logger.h>
#include <QString>
class ConfigMigratorBase
{
public:
ConfigMigratorBase();
~ConfigMigratorBase();
protected:
Logger * _log;
};

View File

@@ -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 );
}
}
}

View File

@@ -1,7 +1,5 @@
#pragma once
const int CURRENT_CONFIG_VERSION = 2;
#include <QObject>
#ifdef ENABLE_DISPMANX