#include <dpl/wrt-dao-ro/feature_dao_read_only.h>
#include <dpl/wrt-dao-ro/global_config.h>
-namespace {
-const char *STANDARD_FEATURES_LIST_FILE = "standard-features-list";
-}
-
-using namespace WrtDB;
+ using namespace WrtDB;
#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
PluginContainerSupport::PluginContainerSupport() : m_initialized(false)
{
- // Reading standard features list from file
- readStandardFeaturesList();
-
- // Reading root plugins list from so files
+ // Reading root plugins list from so files
readRootPluginsList();
}
// Remove all feature models
m_featureModels.clear();
-
- // Clear standard features list
- m_standardFeatureList.clear();
-}
+ }
void PluginContainerSupport::Initialize(int widgetHandle)
{
void PluginContainerSupport::readAllowedPlugins(int widgetHandle)
{
- std::list<std::string> allowedFeatures(m_standardFeatureList);
+ std::list<std::string> allowedFeatures;
auto requested = getAllowedFeatures(widgetHandle);
FOREACH(f, requested)
{
m_pluginModels.insert(model);
}
-void PluginContainerSupport::readStandardFeaturesList()
-{
- LogDebug("Reading standard features list from file...");
-
- std::string path = GlobalConfig::GetDevicePluginPath();
- path += "/";
- path += STANDARD_FEATURES_LIST_FILE;
-
- std::ifstream standardFeatureFile;
- standardFeatureFile.open(path.c_str(), std::ifstream::in);
-
- if (!standardFeatureFile.is_open()) {
- LogError("Reading standard features list from file FAILED.");
- return;
- }
-
- char buffer[1024];
-
- while (!standardFeatureFile.eof()) {
- standardFeatureFile.getline(buffer, sizeof(buffer));
-
- if (buffer[0] == '\0') {
- break;
- }
-
- LogDebug("Standard Feature: <" << buffer << ">");
- m_standardFeatureList.push_back(std::string(buffer));
- }
-
- standardFeatureFile.close();
-}
-
-void PluginContainerSupport::readRootPluginsList()
+ void PluginContainerSupport::readRootPluginsList()
{
LogDebug("Reading root plugins list from so files...");
return getPluginModelById(feature->PHandle.Get());
}
-PluginContainerSupport::FeaturesList
-PluginContainerSupport::getStandardFeatures() const
-{
- //TODO use move
- FeaturesList standardFeatures;
-
- FOREACH(it, m_standardFeatureList)
- {
- FeatureModelPtr feature = getFeatureModel(*it);
- if (!feature) {
- LogWarning("Feature does not exist in DB " << *it);
- continue;
- }
-
- //TODO maybe it should be sorted
- standardFeatures.push_back(feature);
- }
-
- return standardFeatures;
-}
-
-PluginContainerSupport::PluginsList
-PluginContainerSupport::getStandardPlugins() const
-{
- PluginsList plugins;
-
- auto features = getStandardFeatures();
-
- FOREACH(it, features)
- {
- auto plugin = getPluginModel(*it);
- if (!plugin) {
- LogError("PluginModel not found");
- continue;
- }
-
- plugins.push_back(plugin);
- }
-
- return plugins;
-}
-
-PluginContainerSupport::PluginsList
+ PluginContainerSupport::PluginsList
PluginContainerSupport::getRootPlugins() const
{
PluginsList plugins;