Esempio n. 1
0
/* delete the property in the given device, including widgets and data structs.
 * when last property is deleted, delete the device too.
 * if no property name attribute at all, delete the whole device regardless.
 * return 0 if ok, else -1 with reason in errmsg[].
 */
int INDI::BaseClientQt::delPropertyCmd (XMLEle * root, char * errmsg)
{
    XMLAtt * ap;
    INDI::BaseDevice * dp;

    /* dig out device and optional property name */
    dp = findDev (root, 0, errmsg);
    if (!dp)
        return INDI_DEVICE_NOT_FOUND;

    dp->checkMessage(root);

    ap = findXMLAtt (root, "name");

    /* Delete property if it exists, otherwise, delete the whole device */
    if (ap)
    {
        INDI::Property * rProp = dp->getProperty(valuXMLAtt(ap));
        removeProperty(rProp);
        int errCode = dp->removeProperty(valuXMLAtt(ap), errmsg);

        return errCode;
    }
    // delete the whole device
    else
        return deleteDevice(dp->getDeviceName(), errmsg);
}
/**
 * Synchronize properties with scatterer members
 *
 * This method synchronizes the properties of CompositeBraggScatterer with the
 * properties of the contained BraggScatterer instances. It adds new properties
 * if required and removed properties that are no longer used (for example
 * because the member that introduced the property has been removed).
 */
void CompositeBraggScatterer::redeclareProperties() {
  std::map<std::string, size_t> propertyUseCount = getPropertyCountMap();

  for (auto &scatterer : m_scatterers) {
    // Check if any of the declared properties is in this scatterer (and set
    // value if that's the case)
    for (auto &prop : propertyUseCount) {
      if (scatterer->existsProperty(prop.first)) {
        prop.second += 1;

        propagatePropertyToScatterer(scatterer, prop.first,
                                     getPropertyValue(prop.first));
      }
    }

    // Use the properties of this scatterer which have been marked as exposed to
    // composite
    std::vector<Property *> properties =
        scatterer->getPropertiesInGroup(getPropagatingGroupName());
    for (auto &property : properties) {
      const std::string &propertyName = property->name();
      if (!existsProperty(propertyName)) {
        declareProperty(std::unique_ptr<Property>(property->clone()));
      }
    }
  }

  // Remove unused properties
  for (auto &property : propertyUseCount) {
    if (property.second == 0) {
      removeProperty(property.first);
    }
  }
}
Esempio n. 3
0
String CSSStyleDeclaration::removeProperty(const String& propertyName, ExceptionCode& ec)
{
    int propID = cssPropertyID(propertyName);
    if (!propID)
        return String();
    return removeProperty(propID, ec);
}
Esempio n. 4
0
void ToDo::setClass(iCalProperty& p) {
    set(&classEvent, p);
    removeProperty(TEXT("CLASS"));
    if(classEvent) {
        insertProperty(getVPropertyFromiCalProperty(TEXT("CLASS"), classEvent));
    }
}
Esempio n. 5
0
void ToDo::setDtStart(iCalProperty& p) {
    set(&dtStart, p);
    removeProperty(TEXT("DTSTART"));
    if(dtStart) {
        insertProperty(getVPropertyFromiCalProperty(TEXT("DTSTART"), dtStart));
    }
}
Esempio n. 6
0
void ToDo::setDescription(iCalProperty& p) {
    set(&description, p);
    removeProperty(TEXT("DESCRIPTION"));
    if(description) {
        insertProperty(getVPropertyFromiCalProperty(TEXT("DESCRIPTION"), description));
    }
}
void ContextPaneWidgetImage::onFileNameChanged()
{
    if (m_fileWidget->fileName().isNull())
        emit removeProperty(QLatin1String("source"));
    else
        emit propertyChanged(QLatin1String("source"), QString(QLatin1Char('\"') + m_fileWidget->fileName() + QLatin1Char('\"')));
}
void ContextPaneTextWidget::onStyleComboBoxChanged(const QString &style)
{
    if (style == QLatin1String("Normal"))
        emit removeProperty(QLatin1String("style"));
    else
        emit propertyChanged(QLatin1String("style"), QVariant(QLatin1String("Text.") + style));
}
Esempio n. 9
0
void PoldiTruncateData::exec()
{
    MatrixWorkspace_sptr inputWorkspace = getProperty("InputWorkspace");

    setChopperFromWorkspace(inputWorkspace);
    setTimeBinWidthFromWorkspace(inputWorkspace);

    try {
        MatrixWorkspace_sptr cropped = getCroppedWorkspace(inputWorkspace);
        setProperty("OutputWorkspace", cropped);

        if(!getPointerToProperty("ExtraCountsWorkspaceName")->isDefault()) {
            try {
                MatrixWorkspace_sptr extraCounts = getExtraCountsWorkspace(inputWorkspace);

                std::string extraCountsWorkspaceName = getProperty("ExtraCountsWorkspaceName");
                declareProperty(new WorkspaceProperty<MatrixWorkspace>("ExtraCountsWorkspace", extraCountsWorkspaceName, Direction::Output));
                setProperty("ExtraCountsWorkspace", extraCounts);
            } catch(std::invalid_argument) {
                m_log.warning() << "Extra count information was requested, but there are no extra bins." << std::endl;
            }
        }
    } catch(std::invalid_argument) {
        m_log.error() << "Cannot crop workspace. Please check the timing information." << std::endl;
        m_log.error() << "  Calculated bin count: " << getCalculatedBinCount() << std::endl;
        m_log.error() << "  Bin count in the workspace: " << getActualBinCount() << std::endl;

        removeProperty("OutputWorkspace");
    }
}
void ContextPaneTextWidget::onUnderlineCheckedChanged(bool value)
{
    if (value)
        emit propertyChanged(QLatin1String("font.underline"), value);
    else
        emit removeProperty(QLatin1String("font.underline"));
}
void ContextPaneTextWidget::onStrikeoutCheckedChanged(bool value)
{
    if (value)
        emit propertyChanged(QLatin1String("font.strikeout"), value);
    else
        emit removeProperty(QLatin1String("font.strikeout"));
}
Esempio n. 12
0
void ToDo::setCreated(iCalProperty& p) {
    set(&created, p);
    removeProperty(TEXT("CREATED"));
    if(created) {
        insertProperty(getVPropertyFromiCalProperty(TEXT("CREATED"), created));
    }
}
Esempio n. 13
0
Uint32Edit::Uint32Edit(Uint32Property* property, Model& model,QWidget* parent):QWidget(parent),property_(property),model_(model),entity_(property->owner()){
	QPalette palette;
	palette.setColor(QPalette::Base,QColor(170, 170,0));
	setAutoFillBackground(true);
	setPalette(palette);

	QFont font;
	font.setPointSize(7);

	toplayout_ = new QHBoxLayout(this);
	label_ = new QLabel(this);
	nameEdit_ = new QLineEdit(this);
	valEdit_ = new QLineEdit(this);
	del_ = new QPushButton(this);
	del_->setText("X");
	del_->setMaximumSize(QSize(20,20));
	del_->setStyleSheet("background-color: #EE6666;");

	label_->setText("unsigned int");
	nameEdit_->setPlaceholderText("Name");
	valEdit_->setPlaceholderText("Value");
	valEdit_->setValidator( new QRegExpValidator(QRegExp("[0-9]{,10}"), this));

	nameEdit_->setText(property_->name.c_str());
	valEdit_->setText(std::to_string(property_->value).c_str());

	toplayout_->addWidget(label_);
	toplayout_->addWidget(nameEdit_);
	toplayout_->addWidget(valEdit_);
	toplayout_->addWidget(del_);

	connect(nameEdit_, SIGNAL(textChanged(const QString&)), this, SLOT(changeName(const QString&)));
	connect(valEdit_, SIGNAL(textChanged(const QString&)), this, SLOT(changeValue(const QString&)));
	connect(del_, SIGNAL(clicked()), this, SLOT(removeProperty()));
}
Esempio n. 14
0
/**
 * Update the browser when minimizer changes.
 */
void FitOptionsBrowser::updateMinimizer() {
  int i = m_enumManager->value(m_minimizer);
  QString minimizerName = m_enumManager->enumNames(m_minimizer)[i];
  m_minimizerGroup->setPropertyName("Minimizer " + minimizerName);

  // Remove properties of the old minimizer
  auto subProperties = m_minimizerGroup->subProperties();
  foreach (QtProperty *prop, subProperties) {
    if (prop != m_minimizer) {
      m_minimizerGroup->removeSubProperty(prop);
      removeProperty(prop->propertyName());
    }
  }

  // Check if the new minimizer has its own properties
  auto minimizer =
      Mantid::API::FuncMinimizerFactory::Instance().createMinimizer(
          minimizerName.toStdString());

  // Create and add properties to the minimizer group
  auto minimizerProperties = minimizer->getProperties();
  for (auto property = minimizerProperties.begin();
       property != minimizerProperties.end(); ++property) {
    auto prop = createPropertyProperty(*property);
    if (!*property)
      continue;
    m_minimizerGroup->addSubProperty(prop);
  }
}
void ContextPaneTextWidget::onWarpModeComboBoxChanged(const QString &warpMode)
{
    if (warpMode == QLatin1String("NoWrap"))
        emit removeProperty(QLatin1String("wrapMode"));
    else
        emit propertyChanged(QLatin1String("wrapMode"), QVariant(QLatin1String("Text.") + warpMode));
}
Esempio n. 16
0
void OpenInNewTabAction::actionTriggered(QAction *sender, bool)
{
	auto action = qobject_cast<Action *>(sender);
	if (!action)
		return;

	auto chat = action->context()->chat();
	if (!chat)
		return;

	auto chatWidget = m_chatWidgetRepository->widgetForChat(chat);
	if (!chatWidget)
	{
		if (m_configuration->deprecatedApi()->readBoolEntry("Chat", "DefaultTabs"))
		{
			chat.addProperty("tabs:tmp-detached", true, CustomProperties::NonStorable);
		}
		else
		{
			chat.addProperty("tabs:tmp-attached", true, CustomProperties::NonStorable);
		}
	}

	m_chatWidgetManager->openChat(chat, OpenChatActivation::Activate);

	chat.removeProperty("tabs:tmp-attached");
	chat.removeProperty("tabs:tmp-detached");
}
Esempio n. 17
0
void PropertyOwner::deserialize(Deserializer& d) {
    // This is for finding renamed composites, and moving old properties to new composites.
    NodeVersionConverter tvc(this, &PropertyOwner::findPropsForComposites);
    d.convertVersion(&tvc);

    
    std::vector<std::string> ownedIdentifiers;
    d.deserialize("OwnedPropertyIdentifiers", ownedIdentifiers, "PropertyIdentifier");

    auto des = util::IdentifiedDeserializer<std::string, Property*>("Properties", "Property")
                   .setGetId([](Property* const& p) { return p->getIdentifier(); })
                   .setMakeNew([]() { return nullptr; })
                   .setNewFilter([&](const std::string& id, size_t ind) {
                       return util::contains(ownedIdentifiers, id);
                   })
                   .onNew([&](Property*& p) { addProperty(p, true); })
                   .onRemove([&](const std::string& id) {
                       if (util::contains_if(ownedProperties_, [&](std::unique_ptr<Property>& op) {
                               return op->getIdentifier() == id;
                           })) {
                           delete removeProperty(id);
                       }
                   });

    des(d, properties_);
}
void ContextPaneWidgetImage::onTopMarginsChanged()
{
    if (previewDialog()->previewLabel()->topMarging())
        propertyChanged(QLatin1String("border.top"), previewDialog()->previewLabel()->topMarging());
    else
        emit removeProperty(QLatin1String("border.top"));
}
Esempio n. 19
0
File: tabs.cpp Progetto: vogel/kadu
void TabsManager::attachChat(ChatWidget *chatWidget)
{
    auto chat = chatWidget->chat();
    chat.removeProperty("tabs:detached");
    chat.addProperty("tabs:attached", true, CustomProperties::Storable);

    emit chatAcceptanceChanged(chat);
}
Esempio n. 20
0
void Style::unsetLooseness()
{
    if (propertySet(s_looseness)) {
        ConfigTransaction transaction(this);
        removeProperty(s_looseness);
        d->looseness = 1.0;
    }
}
Esempio n. 21
0
void Style::unsetRadiusY()
{
    if (propertySet(s_radiusY)) {
        ConfigTransaction transaction(this);
        removeProperty(s_radiusY);
        d->radiusY = 0.0_cm;
    }
}
Esempio n. 22
0
void Style::unsetFillColor()
{
    if (propertySet(s_fillColor)) {
        ConfigTransaction transaction(this);
        removeProperty(s_fillColor);
        d->fillColor = Qt::transparent;
    }
}
Esempio n. 23
0
void Style::unsetRotation()
{
    if (propertySet(s_rotation)) {
        ConfigTransaction transaction(this);
        removeProperty(s_rotation);
        d->rotation = 0.0;
    }
}
Esempio n. 24
0
void Style::unsetBendAngle()
{
    if (propertySet(s_bendAngle)) {
        ConfigTransaction transaction(this);
        removeProperty(s_bendAngle);
        d->bendAngle = 0.0;
    }
}
Esempio n. 25
0
void VObject::removeAllProperies(WCHAR* propName) {
    for(int i = 0, m = propertiesCount(); i < m ; i++)
        if(!wcscmp(getProperty(i)->getName(), propName)) {
            removeProperty(i);
            --i;
            --m;
        }
}
Esempio n. 26
0
void Style::unsetPenColor()
{
    if (propertySet(s_penColor)) {
        ConfigTransaction transaction(this);
        removeProperty(s_penColor);
        d->penColor = Qt::black;
    }
}
bool CSSMutableStyleDeclaration::setProperty(int propertyID, int value, bool important, bool notifyChanged)
{
    removeProperty(propertyID);
    m_values.append(CSSProperty(propertyID, CSSPrimitiveValue::createIdentifier(value), important));
    if (notifyChanged)
        setChanged();
    return true;
}
Esempio n. 28
0
void Style::unsetInnerLineColor()
{
    if (propertySet(s_innerLineColor)) {
        ConfigTransaction transaction(this);
        removeProperty(s_innerLineColor);
        d->innerLineColor = Qt::white;
    }
}
Esempio n. 29
0
void AIMContact::userOffline( const QString& userId )
{
	if ( Oscar::normalize( userId ) == Oscar::normalize( contactId() ) )
	{
		setOnlineStatus( mProtocol->statusOffline );
		removeProperty( mProtocol->awayMessage );
	}
}
Esempio n. 30
0
void Style::unsetFillOpacity()
{
    if (propertySet(s_fillOpacity)) {
        ConfigTransaction transaction(this);
        removeProperty(s_fillOpacity);
        d->fillOpacity = 1.0;
    }
}