Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_wdg_blur.cpp
Go to the documentation of this file.
1/*
2 * This file is part of Krita
3 *
4 * SPDX-FileCopyrightText: 2006 Cyrille Berger <cberger@cberger.net>
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9#include "kis_wdg_blur.h"
10#include <QLayout>
11
12#include <filter/kis_filter.h>
14#include <kis_selection.h>
15#include <kis_paint_device.h>
18
19#include "ui_wdgblur.h"
20
21KisWdgBlur::KisWdgBlur(QWidget * parent) : KisConfigWidget(parent)
22{
23 m_halfSizeLink = true;
24 m_widget = new Ui_WdgBlur();
25 m_widget->setupUi(this);
27
28 widget()->angleSelector->setDecimals(0);
29
30 connect(widget()->aspectButton, SIGNAL(keepAspectRatioChanged(bool)), this, SLOT(linkSpacingToggled(bool)));
31 connect(widget()->intHalfWidth, SIGNAL(valueChanged(int)), this, SLOT(sldHalfWidthChanged(int)));
32 connect(widget()->intHalfHeight, SIGNAL(valueChanged(int)), this, SLOT(sldHalfHeightChanged(int)));
33
34 widget()->aspectButton->setKeepAspectRatio(m_halfSizeLink);
35
36 connect(widget()->intStrength, SIGNAL(valueChanged(int)), SIGNAL(sigConfigurationItemChanged()));
37 connect(widget()->angleSelector, SIGNAL(angleChanged(qreal)), SIGNAL(sigConfigurationItemChanged()));
38 connect(widget()->cbShape, SIGNAL(activated(int)), SIGNAL(sigConfigurationItemChanged()));
39}
40
42{
43 delete m_widget;
44}
45
47{
49 config->setProperty("lockAspect", widget()->aspectButton->keepAspectRatio());
50 config->setProperty("halfWidth", widget()->intHalfWidth->value());
51 config->setProperty("halfHeight", widget()->intHalfHeight->value());
52 config->setProperty("rotate", static_cast<int>(widget()->angleSelector->angle()));
53 config->setProperty("strength", widget()->intStrength->value());
54 config->setProperty("shape", widget()->cbShape->currentIndex());
55 return config;
56}
57
59{
60 QVariant value;
61 if (config->getProperty("lockAspect", value)) {
62 m_widget->aspectButton->setKeepAspectRatio(value.toBool());
63 }
64 if (config->getProperty("shape", value)) {
65 widget()->cbShape->setCurrentIndex(value.toUInt());
66 }
67 if (config->getProperty("halfWidth", value)) {
68 widget()->intHalfWidth->setValue(value.toUInt());
69 }
70 if (config->getProperty("halfHeight", value)) {
71 widget()->intHalfHeight->setValue(value.toUInt());
72 }
73 if (config->getProperty("rotate", value)) {
74 widget()->angleSelector->setAngle(static_cast<qreal>(value.toUInt()));
75 }
76 if (config->getProperty("strength", value)) {
77 widget()->intStrength->setValue(value.toUInt());
78 }
79}
80
82{
84 widget()->intHalfHeight->setValue(widget()->intHalfWidth->value());
85}
86
88{
89 if (m_halfSizeLink) {
90 widget()->intHalfHeight->blockSignals(true);
91 widget()->intHalfHeight->setValue(v);
92 widget()->intHalfHeight->blockSignals(false);
93 }
94 /* if( widget()->intHalfHeight->value() == v && widget()->cbShape->currentItem() != 1)
95 widget()->intAngle->setEnabled(false);
96 else
97 widget()->intAngle->setEnabled(true);*/
99}
100
102{
103 if (m_halfSizeLink) {
104 widget()->intHalfWidth->blockSignals(true);
105 widget()->intHalfWidth->setValue(v);
106 widget()->intHalfWidth->blockSignals(false);
107 }
108 /* if( widget()->intHalfWidth->value() == v && widget()->cbShape->currentItem() != 1)
109 widget()->intAngle->setEnabled(false);
110 else
111 widget()->intAngle->setEnabled(true);*/
113}
114
float value(const T *src, size_t ch)
qreal v
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void sigConfigurationItemChanged()
static KisResourcesInterfaceSP instance()
KisPropertiesConfigurationSP configuration() const override
void sldHalfWidthChanged(int)
Ui_WdgBlur * m_widget
const Ui_WdgBlur * widget() const
void setConfiguration(const KisPropertiesConfigurationSP) override
~KisWdgBlur() override
KisWdgBlur(QWidget *parent)
bool m_halfSizeLink
void sldHalfHeightChanged(int)
void linkSpacingToggled(bool)