Commit 64470d96 authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

Apply patch #90932 from MAik Qualmann to fix values storage from BQM tools workflow

BUGS: 318726
FIXED-IN: 4.8.0
parent c4956b73
......@@ -9,4 +9,5 @@ BUGFIXES FROM KDE BUGZILLA (https://www.digikam.org/changelog):
001 ==> 343031 - Digikam won't start: *** Error in `digikam': realloc(): invalid pointer: 0x0000000000c14260 ***
002 ==> 343548 - Tag Manager crashes when adding a new tag.
003 ==> 337011 - Image Quality Sorter doesn't apply labels [patch].
004 ==>
004 ==> 318726 - Some BQM tools in a workflow don't restore (all) parameters properly [patch].
005 ==>
......@@ -47,6 +47,7 @@ Convert2JPEG::Convert2JPEG(QObject* const parent)
: BatchTool("Convert2JPEG", ConvertTool, parent)
{
m_settings = 0;
m_changeSettings = true;
setToolTitle(i18n("Convert To JPEG"));
setToolDescription(i18n("Convert images to JPEG format."));
......@@ -82,16 +83,21 @@ BatchToolSettings Convert2JPEG::defaultSettings()
void Convert2JPEG::slotAssignSettings2Widget()
{
m_changeSettings = false;
m_settings->setCompressionValue(settings()["Quality"].toInt());
m_settings->setSubSamplingValue(settings()["SubSampling"].toInt());
m_changeSettings = true;
}
void Convert2JPEG::slotSettingsChanged()
{
BatchToolSettings settings;
settings.insert("Quality", m_settings->getCompressionValue());
settings.insert("SubSampling", m_settings->getSubSamplingValue());
BatchTool::slotSettingsChanged(settings);
if (m_changeSettings)
{
BatchToolSettings settings;
settings.insert("Quality", m_settings->getCompressionValue());
settings.insert("SubSampling", m_settings->getSubSamplingValue());
BatchTool::slotSettingsChanged(settings);
}
}
QString Convert2JPEG::outputSuffix() const
......
......@@ -61,6 +61,7 @@ private:
private:
JPEGSettings* m_settings;
bool m_changeSettings;
};
} // namespace Digikam
......
......@@ -94,7 +94,8 @@ public:
backgroundOpacity(0),
xMarginInput(0),
yMarginInput(0),
waterMarkSizePercent(0)
waterMarkSizePercent(0),
changeSettings(true)
{
}
......@@ -118,6 +119,8 @@ public:
KIntNumInput* xMarginInput;
KIntNumInput* yMarginInput;
KIntNumInput* waterMarkSizePercent;
bool changeSettings;
};
WaterMark::WaterMark(QObject* const parent)
......@@ -353,6 +356,7 @@ BatchToolSettings WaterMark::defaultSettings()
void WaterMark::slotAssignSettings2Widget()
{
d->changeSettings = false;
d->useImageRadioButton->setChecked(settings()["Use image"].toBool());
d->useTextRadioButton->setChecked(!settings()["Use image"].toBool());
d->imageFileUrlRequester->setText(settings()["Watermark image"].toString());
......@@ -367,39 +371,41 @@ void WaterMark::slotAssignSettings2Widget()
d->waterMarkSizePercent->setValue(settings()["Watermark size"].toInt());
d->xMarginInput->setValue(settings()["X margin"].toInt());
d->yMarginInput->setValue(settings()["Y margin"].toInt());
d->changeSettings = true;
}
void WaterMark::slotSettingsChanged()
{
BatchToolSettings settings;
if (d->useImageRadioButton->isChecked())
{
settings.insert("Use image", true);
d->textSettingsGroupBox->setVisible(false);
d->imageSettingsGroupBox->setVisible(true);
}
else if (d->useTextRadioButton->isChecked())
{
settings.insert("Use image", false);
d->imageSettingsGroupBox->setVisible(false);
d->textSettingsGroupBox->setVisible(true);
}
settings.insert("Text", d->textEdit->text());
settings.insert("Font", d->fontChooserWidget->currentFont());
settings.insert("Color", d->fontColorButton->color());
settings.insert("Text opacity", d->textOpacity->value());
settings.insert("Use background", d->useBackgroundCheckBox->isChecked());
settings.insert("Background color", d->backgroundColorButton->color());
settings.insert("Background opacity", d->backgroundOpacity->value());
settings.insert("Watermark image", d->imageFileUrlRequester->text());
settings.insert("Placement", (int)d->comboBox->currentIndex());
settings.insert("Watermark size", (int)d->waterMarkSizePercent->value());
settings.insert("X margin", (int)d->xMarginInput->value());
settings.insert("Y margin", (int)d->yMarginInput->value());
BatchTool::slotSettingsChanged(settings);
if (d->changeSettings)
{
BatchToolSettings settings;
settings.insert("Use image", d->useImageRadioButton->isChecked());
settings.insert("Watermark image", d->imageFileUrlRequester->text());
settings.insert("Text", d->textEdit->text());
settings.insert("Font", d->fontChooserWidget->currentFont());
settings.insert("Color", d->fontColorButton->color());
settings.insert("Text opacity", d->textOpacity->value());
settings.insert("Use background", d->useBackgroundCheckBox->isChecked());
settings.insert("Background color", d->backgroundColorButton->color());
settings.insert("Background opacity", d->backgroundOpacity->value());
settings.insert("Placement", (int)d->comboBox->currentIndex());
settings.insert("Watermark size", (int)d->waterMarkSizePercent->value());
settings.insert("X margin", (int)d->xMarginInput->value());
settings.insert("Y margin", (int)d->yMarginInput->value());
BatchTool::slotSettingsChanged(settings);
}
}
bool WaterMark::toolOperations()
......
......@@ -101,6 +101,7 @@ void AssignTemplate::slotAssignSettings2Widget()
}
m_templateSelector->setTemplate(t);
m_templateViewer->setTemplate(t);
}
void AssignTemplate::slotSettingsChanged()
......
......@@ -66,7 +66,8 @@ public:
labelPreset(0),
useCustom(0),
customLength(0),
comboBox(0)
comboBox(0),
changeSettings(true)
{
}
......@@ -81,6 +82,8 @@ public:
KIntNumInput* customLength;
KComboBox* comboBox;
bool changeSettings;
};
int Resize::Private::presetLengthValue(WidthPreset preset)
......@@ -178,9 +181,11 @@ BatchToolSettings Resize::defaultSettings()
void Resize::slotAssignSettings2Widget()
{
d->changeSettings = false;
d->comboBox->setCurrentIndex(settings()["LengthPreset"].toInt());
d->useCustom->setChecked(settings()["UseCustom"].toBool());
d->customLength->setValue(settings()["LengthCustom"].toInt());
d->changeSettings = true;
}
void Resize::slotSettingsChanged()
......@@ -189,11 +194,14 @@ void Resize::slotSettingsChanged()
d->labelPreset->setEnabled(!d->useCustom->isChecked());
d->comboBox->setEnabled(!d->useCustom->isChecked());
BatchToolSettings settings;
settings.insert("LengthPreset", d->comboBox->currentIndex());
settings.insert("UseCustom", d->useCustom->isChecked());
settings.insert("LengthCustom", d->customLength->value());
BatchTool::slotSettingsChanged(settings);
if (d->changeSettings)
{
BatchToolSettings settings;
settings.insert("LengthPreset", d->comboBox->currentIndex());
settings.insert("UseCustom", d->useCustom->isChecked());
settings.insert("LengthCustom", d->customLength->value());
BatchTool::slotSettingsChanged(settings);
}
}
bool Resize::toolOperations()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment