Ejemplo n.º 1
0
/*!
    Loads widgets.
*/
bool HsPage::load()
{
    if (HSCONFIGURATION_GET(sceneType) == HsConfiguration::PageWallpapers) {
        mWallpaper = new HsPageWallpaper(this);
    }

    HsWidgetHost *widget = new HsWidgetHost(-1);
    mWidgets.append(widget);
    connectWidget(widget);
    widget->setPage(this);
    widget->visual()->setParentItem(this->visual());
    widget->startWidget();
    return true;
}
Ejemplo n.º 2
0
/*!
    Add given existing \a widgetHost to a page. Returns true if successful
*/
bool HsPage::addExistingWidget(HsWidgetHost *widgetHost)
{
    if (!widgetHost) {
        return false;
    }

    if (mWidgets.contains(widgetHost)) {
        return true;
    }

    if (!widgetHost->setPage(this)) {
        return false;
    }

    connectWidget(widgetHost);
    mWidgets << widgetHost;
    widgetHost->visual()->setParentItem(this->visual());

    return true;
 }
Ejemplo n.º 3
0
void ParameterExtractor::setParameters(const FileModule* module)
{
  if (!module) return;

  ModuleContext ctx;

  ParameterPos.clear();
  for (auto &assignment : module->scope.assignments) {
    const Annotation *param = assignment.annotation("Parameter");
    if (!param) continue;

    const ValuePtr defaultValue = assignment.expr->evaluate(&ctx);
    if (defaultValue->type() == Value::UNDEFINED) continue;

    ParameterObject *entryObject = new ParameterObject();
    entryObject->setAssignment(&ctx, &assignment, defaultValue);

    //check whether object exist or not previously
    if (entries.find(assignment.name) == entries.end() || resetPara) {

      //if object doen't exist
      //or we have reset Parameters then add new entry
      entries[assignment.name] = entryObject;
    } else {
      //if entry object is already exist we check if its modified
      //or not
      if (*entryObject == *entries[assignment.name]) {
        //if entry is not modified then we don't add new entry
        entryObject = entries[assignment.name];
      } else {
        //if entry is modified then we add new entry
        entries[assignment.name] = entryObject;
      }
    }
    entryObject->set = true;
    ParameterPos.push_back(assignment.name);
  }
  connectWidget();
  this->resetPara = false;
}