Commit 5e206298 authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

backport commit #64470d96 from git/master to framework branch

CCBUGS: 318726
parent 65aa6459
......@@ -46,6 +46,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."));
......@@ -81,16 +82,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
......
......@@ -46,7 +46,6 @@
// KDE includes
#include <kcolorbutton.h>
#include <kurlrequester.h>
#include <klocalizedstring.h>
// Libkdcraw includes
......@@ -98,7 +97,8 @@ public:
backgroundOpacity(0),
xMarginInput(0),
yMarginInput(0),
waterMarkSizePercent(0)
waterMarkSizePercent(0),
changeSettings(true)
{
}
......@@ -122,6 +122,8 @@ public:
RIntNumInput* xMarginInput;
RIntNumInput* yMarginInput;
RIntNumInput* waterMarkSizePercent;
bool changeSettings;
};
WaterMark::WaterMark(QObject* const parent)
......@@ -351,6 +353,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->lineEdit()->setText(settings()["Watermark image"].toString());
......@@ -365,39 +368,40 @@ 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->lineEdit()->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->lineEdit()->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()
......
......@@ -99,6 +99,7 @@ void AssignTemplate::slotAssignSettings2Widget()
}
m_templateSelector->setTemplate(t);
m_templateViewer->setTemplate(t);
}
void AssignTemplate::slotSettingsChanged()
......
......@@ -70,7 +70,8 @@ public:
labelPreset(0),
useCustom(0),
customLength(0),
comboBox(0)
comboBox(0),
changeSettings(true)
{
}
......@@ -85,6 +86,8 @@ public:
RIntNumInput* customLength;
QComboBox* comboBox;
bool changeSettings;
};
int Resize::Private::presetLengthValue(WidthPreset preset)
......@@ -182,9 +185,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()
......@@ -193,11 +198,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