Example #1
0
  void Pipeline::dumpSettings() {
    QList<Module*> modules;
    this->listModules(modules);
    foreach(Module *module, modules) {
      qDebug() << "---------------------------" << module->getModuleName() << ":" << module->getInstanceName();

      QHash<QString, Setting*> *settings = module->getSettings();
      QList<QString> keys = settings->keys();
      foreach(QString key, keys) {
        Setting *setting = module->setting(key);
        qDebug() << "   - setting: " << setting->getName() << ", type: " << setting->getType();

        switch(setting->getType()) {
        case Setting::NONE:
          qDebug() << "     - value: " << "none"; break;
        case Setting::BOOLEAN:
          qDebug() << "     - value: " << setting->asBool(); break;
        case Setting::STRING:
          qDebug() << "     - value: " << setting->asString(); break;
        case Setting::INTEGER:
          qDebug() << "     - value: " << setting->asInteger(); break;
        case Setting::DOUBLE:
          qDebug() << "     - value: " << setting->asDouble(); break;
        case Setting::POINTLIST:
          qDebug() << "     - value: " << "pointlist"; break;
        case Setting::FRAME:
          qDebug() << "     - value: " << setting->getFrameName();
          qDebug() << "     - module pointer: " << setting->getModule();
          break;
        }
      }
Example #2
0
void DisplayTileConfig::parseConfig(const Setting& sTile, DisplayConfig& cfg)
{
    settingData = &sTile;

    DisplayTileConfig* tc = this;

    tc->name = sTile.getName();

    String sm = Config::getStringValue("stereoMode", sTile, "default");
    StringUtils::toLowerCase(sm);
    if(sm == "default") tc->stereoMode = DisplayTileConfig::Default;
    else if(sm == "mono") tc->stereoMode = DisplayTileConfig::Mono;
        // 'interleaved' defaults to row interleaved
    else if(sm == "interleaved") tc->stereoMode = DisplayTileConfig::LineInterleaved;
    else if(sm == "rowinterleaved") tc->stereoMode = DisplayTileConfig::LineInterleaved;
    else if(sm == "columninterleaved") tc->stereoMode = DisplayTileConfig::ColumnInterleaved;
    else if(sm == "sidebyside") tc->stereoMode = DisplayTileConfig::SideBySide;
                
    tc->invertStereo = Config::getBoolValue("invertStereo", sTile);
    tc->enabled = Config::getBoolValue("enabled", sTile);
                
    //tc.index = index;
    //tc.interleaved = Config::getBoolValue("interleaved", sTile);
    tc->device = Config::getIntValue("device", sTile);

    tc->center = Config::getVector3fValue("center", sTile, Vector3f::Zero());
    tc->yaw = Config::getFloatValue("yaw", sTile, 0);
    tc->pitch = Config::getFloatValue("pitch", sTile, 0);

    tc->position = Config::getVector2iValue("position", sTile);
    tc->disableScene = Config::getBoolValue("disableScene", sTile);

    tc->offscreen = Config::getBoolValue("offscreen", sTile, false);
    tc->borderless = Config::getBoolValue("borderless", sTile, cfg.borderless);

    tc->disableMouse = Config::getBoolValue("disableMouse", sTile, false);

    tc->isHMD = Config::getBoolValue("isHMD", sTile, false);

    //tc->viewport = Config::getVector4fValue("viewport", sTile, tc->viewport);

    // If the tile config contains a size entry use it, oterwise use the default tile and bezel size data
    if(sTile.exists("size"))
    {
        tc->size = Config::getVector2fValue("size", sTile);
    }
    else
    {
        tc->size = cfg.tileSize - cfg.bezelSize;
    }

    if(sTile.exists("resolution"))
    {
        tc->pixelSize = Config::getVector2iValue("resolution", sTile);
    }
    else
    {
        tc->pixelSize = cfg.tileResolution;
    }

    if(sTile.exists("offset"))
    {
        tc->offset = Config::getVector2iValue("offset", sTile);
    }
    else
    {
        std::vector<std::string> args = StringUtils::split(String(sTile.getName()), "xt");
        Vector2i index = Vector2i(atoi(args[0].c_str()), atoi(args[1].c_str()));
        tc->offset = index.cwiseProduct(tc->pixelSize);
        cfg.tileGrid[index[0]][index[1]] = tc;
    }

    // Parse custom grid options
    tc->isInGrid = Config::getBoolValue("isInGrid", sTile, false);
    if(tc->isInGrid)
    {
        tc->gridX = Config::getIntValue("gridX", sTile, 0);
        tc->gridY = Config::getIntValue("gridY", sTile, 0);
        cfg.tileGrid[tc->gridX][tc->gridY] = tc;
    }

    // Custom camera
    tc->cameraName = Config::getStringValue("cameraName", sTile, "");

    // Compute default values for this tile corners. These values may be overwritted by display config generators applied later on.
    computeTileCorners();
}
Example #3
0
    void _apply(Setting& root, Setting& source, LockList* lockList)
    {
        Setting* s = nullptr;

        if (!source.isRoot()) {
            const char* name = source.getName();
            if (name != nullptr) {
                if (root.exists(name)) {
                    s = &root[name];

                    if (_isLocked(*s, true, lockList)) {
                        LogWarn("Ignored updating configuration '%s' to value "
                                "'%s'. Setting locked to value '%s'.",
                                s->getPath().c_str(),
                                settingToString(source).c_str(),
                                settingToString(*s).c_str());

                        return;
                    }

                    if (!s->isGroup()) {
                        root.remove(s->getIndex());
                        s = &root.add(name, source.getType());
                    }
                } else {
                    s = &root.add(name, source.getType());

                    if (_isLocked(*s, false, lockList)) {
                        LogWarn("Ignored creating configuration '%s' with "
                                "value '%s'. Setting locked.",
                                s->getPath().c_str(),
                                settingToString(*s).c_str());

                        root.remove(s->getIndex());
                        return;
                    }
                }
            } else {
                // List or array elements
                s = &root.add(source.getType());
            }
        } else {
            s = &root;
        }

        switch (source.getType())
        {
            case Setting::Type::TypeInt: {
                *s = (int)source;
                break;
            }

            case Setting::Type::TypeInt64: {
                *s = (long long)source;
                break;
            }

            case Setting::Type::TypeString: {
                *s = (const char*)source;
                break;
            }

            case Setting::Type::TypeBoolean: {
                *s = (bool)source;
                break;
            }

            case Setting::Type::TypeArray:
            case Setting::Type::TypeList:
            case Setting::Type::TypeGroup: {
                for (int i = 0; i < source.getLength(); ++i) {
                    _apply(*s, source[i], lockList);
                }
                break;
            }

            default: {
                assert(false);
                break;
            }
        }
    }