void ChangeDialog::action(QAbstractButton * button)
{
    if (ui->buttonBox->buttonRole(button)==QDialogButtonBox::ActionRole)
        return;
    joinConsChanges = 0;
    ui->buttonBox->button(QDialogButtonBox::Yes)->setEnabled(false);
    ui->buttonBox->button(QDialogButtonBox::YesToAll)->setEnabled(false);
    ui->buttonBox->button(QDialogButtonBox::No)->setEnabled(false);
    //ui->buttonBox->button(QDialogButtonBox::NoToAll)->setEnabled(false);
    QDialogButtonBox::StandardButton stdbutton = ui->buttonBox->standardButton(button);
    if (stdbutton==QDialogButtonBox::Abort) {
        reject();
        done(result());
        return;
    }
    setResult(QDialog::Accepted);
    if (stdbutton==QDialogButtonBox::YesToAll) {
        autoAccept = true;
        commitChange();
        return;
    } else if (stdbutton==QDialogButtonBox::Yes) {
        commitChange();
    } else if (stdbutton==QDialogButtonBox::No) {
        rejectChange();
    }
    if (nextChangeNum<changeList.size())
        nextChange();
    else
        done(result());
    /*else {
    accept();
    return;
  }*/
}
示例#2
0
void SVGNumberTearOff::setValue(float f, ExceptionState& exceptionState) {
  if (isImmutable()) {
    throwReadOnly(exceptionState);
    return;
  }
  target()->setValue(f);
  commitChange();
}
示例#3
0
void SVGAngleTearOff::setValueInSpecifiedUnits(float value,
                                               ExceptionState& exceptionState) {
  if (isImmutable()) {
    throwReadOnly(exceptionState);
    return;
  }
  target()->setValueInSpecifiedUnits(value);
  commitChange();
}
void SVGLengthTearOff::setValueInSpecifiedUnits(float value, ExceptionState& es)
{
    if (isImmutable()) {
        es.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
        return;
    }
    target()->setValueInSpecifiedUnits(value);
    commitChange();
}
void SVGTransformTearOff::setMatrix(SVGMatrixTearOff* matrix, ExceptionState& exceptionState)
{
    if (isImmutable()) {
        exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
        return;
    }

    target()->setMatrix(matrix->value());
    commitChange();
}
示例#6
0
void SVGPointTearOff::setY(float f, ExceptionState& exceptionState)
{
    if (isImmutable()) {
        exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
        return;
    }

    target()->setY(f);
    commitChange();
}
void SVGTransformTearOff::setRotate(float angle, float cx, float cy, ExceptionState& exceptionState)
{
    if (isImmutable()) {
        exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
        return;
    }

    target()->setRotate(angle, cx, cy);
    commitChange();
}
void SVGLengthTearOff::setValueAsString(const String& str, ExceptionState& es)
{
    if (isImmutable()) {
        es.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
        return;
    }

    target()->setValueAsString(str, es);
    commitChange();
}
void SVGLengthTearOff::setValue(float value, ExceptionState& es)
{
    if (isImmutable()) {
        es.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
        return;
    }

    SVGLengthContext lengthContext(contextElement());
    target()->setValue(value, lengthContext, es);
    commitChange();
}
示例#10
0
void
brightUp(void)
{
    unsigned int current = getCurrent();
    unsigned int newValue = (current+1 < MAXVALUE) ? current+1 : MAXVALUE;
#ifdef VERBOSE
    printf("New brightness: %d\n", newValue);
#endif
    if (newValue != current) {
        commitChange(newValue);
    }
}
示例#11
0
void
brightSet(const char *value)
{
    unsigned int setValue = atoi(++value);
    if ((setValue < 0) || (setValue > MAXVALUE)) {
        error("Invalid value");
    }
#ifdef VERBOSE
    printf("New brightness: %u\n", setValue);
#endif
    commitChange(setValue);
}
示例#12
0
void SVGLengthTearOff::setValueInSpecifiedUnits(
    float value,
    ExceptionState& exceptionState) {
  if (isImmutable()) {
    throwReadOnly(exceptionState);
    return;
  }
  if (target()->isCalculated())
    target()->setValueAsNumber(value);
  else
    target()->setValueInSpecifiedUnits(value);
  commitChange();
}
void SVGLengthTearOff::newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits, ExceptionState& exceptionState)
{
    if (isImmutable()) {
        exceptionState.throwDOMException(NoModificationAllowedError, "The object is read-only.");
        return;
    }

    if (unitType == LengthTypeUnknown || unitType > LengthTypePC) {
        exceptionState.throwDOMException(NotSupportedError, "Cannot set value with unknown or invalid units (" + String::number(unitType) + ").");
        return;
    }

    target()->newValueSpecifiedUnits(toSVGLengthType(unitType), valueInSpecifiedUnits);
    commitChange();
}
void SVGAngleTearOff::newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits, ExceptionState& exceptionState)
{
    if (isImmutable()) {
        exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
        return;
    }

    if (unitType == SVGAngle::SVG_ANGLETYPE_UNKNOWN || unitType > SVGAngle::SVG_ANGLETYPE_GRAD) {
        exceptionState.throwDOMException(NotSupportedError, "Cannot set value with unknown or invalid units (" + String::number(unitType) + ").");
        return;
    }

    target()->newValueSpecifiedUnits(static_cast<SVGAngle::SVGAngleType>(unitType), valueInSpecifiedUnits);
    commitChange();
}
void SVGLengthTearOff::convertToSpecifiedUnits(unsigned short unitType, ExceptionState& exceptionState)
{
    if (isImmutable()) {
        exceptionState.throwDOMException(NoModificationAllowedError, "The object is read-only.");
        return;
    }

    if (unitType == LengthTypeUnknown || unitType > LengthTypePC) {
        exceptionState.throwDOMException(NotSupportedError, "Cannot convert to unknown or invalid units (" + String::number(unitType) + ").");
        return;
    }

    SVGLengthContext lengthContext(contextElement());
    target()->convertToSpecifiedUnits(toSVGLengthType(unitType), lengthContext, exceptionState);
    commitChange();
}
void SVGLengthTearOff::setValue(float value, ExceptionState& exceptionState)
{
if (isImmutable()) {
    exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
    return;
}

if (target()->isRelative() && !canResolveRelativeUnits(contextElement())) {
    exceptionState.throwDOMException(NotSupportedError, "Could not resolve relative length.");
    return;
}

SVGLengthContext lengthContext(contextElement());
target()->setValue(value, lengthContext);
commitChange();
}
示例#17
0
void SVGLengthTearOff::newValueSpecifiedUnits(unsigned short unitType,
                                              float valueInSpecifiedUnits,
                                              ExceptionState& exceptionState) {
  if (isImmutable()) {
    throwReadOnly(exceptionState);
    return;
  }
  if (!isValidLengthUnit(unitType)) {
    exceptionState.throwDOMException(
        NotSupportedError, "Cannot set value with unknown or invalid units (" +
                               String::number(unitType) + ").");
    return;
  }
  target()->newValueSpecifiedUnits(toCSSUnitType(unitType),
                                   valueInSpecifiedUnits);
  commitChange();
}
示例#18
0
void
brightDown(void)
{
    unsigned int current, newValue;
    current = getCurrent();
    if (current > MAXVALUE) {
        return;  /* error in getCurrent */
    }
    newValue = (current > 1) ? current-1 : 0;
#ifdef VERBOSE
    printf("New brightness: %u\n", newValue);
#endif

    if (newValue != current) {
        commitChange(newValue);
    }
}
示例#19
0
void SVGLengthTearOff::setValue(float value, ExceptionState& exceptionState) {
  if (isImmutable()) {
    throwReadOnly(exceptionState);
    return;
  }
  if (target()->isRelative() && !canResolveRelativeUnits(contextElement())) {
    exceptionState.throwDOMException(NotSupportedError,
                                     "Could not resolve relative length.");
    return;
  }
  SVGLengthContext lengthContext(contextElement());
  if (target()->isCalculated())
    target()->setValueAsNumber(value);
  else
    target()->setValue(value, lengthContext);
  commitChange();
}
示例#20
0
void SVGAngleTearOff::newValueSpecifiedUnits(unsigned short unitType,
                                             float valueInSpecifiedUnits,
                                             ExceptionState& exceptionState) {
  if (isImmutable()) {
    throwReadOnly(exceptionState);
    return;
  }
  if (unitType == SVGAngle::kSvgAngletypeUnknown ||
      unitType > SVGAngle::kSvgAngletypeGrad) {
    exceptionState.throwDOMException(
        NotSupportedError, "Cannot set value with unknown or invalid units (" +
                               String::number(unitType) + ").");
    return;
  }
  target()->newValueSpecifiedUnits(
      static_cast<SVGAngle::SVGAngleType>(unitType), valueInSpecifiedUnits);
  commitChange();
}
示例#21
0
void SVGLengthTearOff::setValueAsString(const String& str,
                                        ExceptionState& exceptionState) {
  if (isImmutable()) {
    throwReadOnly(exceptionState);
    return;
  }
  String oldValue = target()->valueAsString();
  SVGParsingError status = target()->setValueAsString(str);
  if (status == SVGParseStatus::NoError && !hasExposedLengthUnit()) {
    target()->setValueAsString(oldValue);  // rollback to old value
    status = SVGParseStatus::ParsingFailed;
  }
  if (status != SVGParseStatus::NoError) {
    exceptionState.throwDOMException(
        SyntaxError, "The value provided ('" + str + "') is invalid.");
    return;
  }
  commitChange();
}
void SVGAngleTearOff::convertToSpecifiedUnits(unsigned short unitType, ExceptionState& exceptionState)
{
    if (isImmutable()) {
        exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
        return;
    }

    if (unitType == SVGAngle::SVG_ANGLETYPE_UNKNOWN || unitType > SVGAngle::SVG_ANGLETYPE_GRAD) {
        exceptionState.throwDOMException(NotSupportedError, "Cannot convert to unknown or invalid units (" + String::number(unitType) + ").");
        return;
    }

    if (target()->unitType() == SVGAngle::SVG_ANGLETYPE_UNKNOWN) {
        exceptionState.throwDOMException(NotSupportedError, "Cannot convert from unknown or invalid units.");
        return;
    }

    target()->convertToSpecifiedUnits(static_cast<SVGAngle::SVGAngleType>(unitType));
    commitChange();
}
示例#23
0
void SVGAngleTearOff::convertToSpecifiedUnits(unsigned short unitType,
                                              ExceptionState& exceptionState) {
  if (isImmutable()) {
    throwReadOnly(exceptionState);
    return;
  }
  if (unitType == SVGAngle::kSvgAngletypeUnknown ||
      unitType > SVGAngle::kSvgAngletypeGrad) {
    exceptionState.throwDOMException(
        NotSupportedError, "Cannot convert to unknown or invalid units (" +
                               String::number(unitType) + ").");
    return;
  }
  if (target()->unitType() == SVGAngle::kSvgAngletypeUnknown) {
    exceptionState.throwDOMException(
        NotSupportedError, "Cannot convert from unknown or invalid units.");
    return;
  }
  target()->convertToSpecifiedUnits(
      static_cast<SVGAngle::SVGAngleType>(unitType));
  commitChange();
}
void SVGLengthTearOff::setValueAsString(const String& str, ExceptionState& exceptionState)
{
if (isImmutable()) {
    exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
    return;
}

String oldValue = target()->valueAsString();

SVGParsingError status = target()->setValueAsString(str);

if (status == NoError && !hasExposedLengthUnit()) {
    target()->setValueAsString(oldValue); // rollback to old value
    status = ParsingAttributeFailedError;
}
if (status != NoError) {
    exceptionState.throwDOMException(SyntaxError, "The value provided ('" + str + "') is invalid.");
    return;
}

commitChange();
}
void SVGLengthTearOff::convertToSpecifiedUnits(unsigned short unitType, ExceptionState& exceptionState)
{
if (isImmutable()) {
    exceptionState.throwDOMException(NoModificationAllowedError, "The object is read-only.");
    return;
}

if (!isValidLengthUnit(unitType)) {
    exceptionState.throwDOMException(NotSupportedError, "Cannot convert to unknown or invalid units (" + String::number(unitType) + ").");
    return;
}

if ((target()->isRelative() || SVGLength::isRelativeUnit(toCSSUnitType(unitType)))
        && !canResolveRelativeUnits(contextElement())) {
    exceptionState.throwDOMException(NotSupportedError, "Could not resolve relative length.");
    return;
}

SVGLengthContext lengthContext(contextElement());
target()->convertToSpecifiedUnits(toCSSUnitType(unitType), lengthContext);
commitChange();
}
void SVGAngleTearOff::setValueAsString(const String& value, ExceptionState& exceptionState)
{
    if (isImmutable()) {
        exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
        return;
    }

    String oldValue = target()->valueAsString();

    SVGParsingError status = target()->setValueAsString(value);

    if (status == SVGParseStatus::NoError && !hasExposedAngleUnit()) {
        target()->setValueAsString(oldValue); // rollback to old value
        status = SVGParseStatus::ParsingFailed;
    }
    if (status != SVGParseStatus::NoError) {
        exceptionState.throwDOMException(SyntaxError, "The value provided ('" + value + "') is invalid.");
        return;
    }

    commitChange();
}