Commit 8ca5abd4 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Add a reset button to the per-channel filter

And make the curves widget stretchable.

BUG:379519
CCMAIL:22shubh22@gmail.com

Patch by Shubham Goyal. Thanks!
parent 9dd5c1a6
......@@ -158,6 +158,11 @@ void KisCurveWidget::reset(void)
emit pointSelectedChanged();
d->m_guideVisible = false;
//remove total - 2 points.
while (d->m_curve.points().count() - 2 ) {
d->m_curve.removePoint(d->m_curve.points().count() - 2);
}
d->setCurveModified();
}
......
......@@ -111,7 +111,7 @@ KisPerChannelConfigWidget::KisPerChannelConfigWidget(QWidget * parent, KisPaintD
connect(m_page->cmbChannel, SIGNAL(activated(int)), this, SLOT(setActiveChannel(int)));
connect((QObject*)(m_page->chkLogarithmic), SIGNAL(toggled(bool)), this, SLOT(logHistView()));
connect((QObject*)(m_page->resetButton), SIGNAL(clicked()), this, SLOT(resetCurve()));
// create the horizontal and vertical gradient labels
m_page->hgradient->setPixmap(createGradient(Qt::Horizontal));
......@@ -193,11 +193,13 @@ inline QPixmap KisPerChannelConfigWidget::getHistogram()
const VirtualChannelInfo &info = m_virtualChannels[m_activeVChannel];
if (m_histogram && info.type() == VirtualChannelInfo::REAL)
{
m_histogram->setChannel(info.pixelIndex());
double highest = (double)m_histogram->calculations().getHighest();
qint32 bins = m_histogram->producer()->numberOfBins();
if (m_histogram->getHistogramType() == LINEAR) {
......@@ -629,3 +631,8 @@ void KisPerChannelConfigWidget::logHistView()
{
m_page->curveWidget->setPixmap(getHistogram());
}
void KisPerChannelConfigWidget::resetCurve()
{
m_page->curveWidget->reset();
}
......@@ -111,6 +111,8 @@ public:
private Q_SLOTS:
virtual void setActiveChannel(int ch);
void logHistView();
void resetCurve();
private:
......@@ -131,6 +133,7 @@ private:
// scales for displaying color numbers
double m_scale;
double m_shift;
bool checkReset;
};
#endif
......@@ -6,10 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
<width>317</width>
<height>396</height>
<width>376</width>
<height>384</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>BrightnessCon</string>
</property>
......@@ -33,23 +39,148 @@
<number>6</number>
</property>
<item row="3" column="1" colspan="2">
<layout class="QGridLayout" name="gridLayout" columnstretch="1,2,1">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelIn">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string> Input:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="KisIntParseSpinBox" name="intOut">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelOut">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string> Output:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="KisIntParseSpinBox" name="intIn">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="4" column="1" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>9</width>
<height>9</height>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="3">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1" colspan="2">
<layout class="QGridLayout" name="grid2">
<layout class="QGridLayout" name="grid2" rowstretch="0,0" columnstretch="0,0">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
......@@ -59,7 +190,7 @@
<item row="0" column="1">
<widget class="QFrame" name="frame3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -72,8 +203,8 @@
</property>
<property name="maximumSize">
<size>
<width>256</width>
<height>256</height>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="frameShape">
......@@ -101,8 +232,8 @@
<item>
<widget class="KisCurveWidget" name="curveWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
......@@ -114,8 +245,8 @@
</property>
<property name="maximumSize">
<size>
<width>256</width>
<height>256</height>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
</widget>
......@@ -126,8 +257,8 @@
<item row="1" column="1">
<widget class="QLabel" name="hgradient">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
......@@ -139,7 +270,7 @@
</property>
<property name="maximumSize">
<size>
<width>256</width>
<width>16777215</width>
<height>20</height>
</size>
</property>
......@@ -157,7 +288,7 @@
<item row="0" column="0">
<widget class="QLabel" name="vgradient">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Fixed" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -171,7 +302,7 @@
<property name="maximumSize">
<size>
<width>20</width>
<height>256</height>
<height>16777215</height>
</size>
</property>
<property name="frameShape">
......@@ -188,7 +319,10 @@
</layout>
</item>
<item row="0" column="1" colspan="2">
<layout class="QHBoxLayout">
<layout class="QHBoxLayout" stretch="1,2,2,1,0">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="textLabel1">
<property name="sizePolicy">
......@@ -228,112 +362,21 @@
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1" colspan="2">
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="1">
<widget class="KisIntParseSpinBox" name="intOut">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="2">
<spacer name="horizontalSpacer_2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelOut">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Output:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KisIntParseSpinBox" name="intIn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="labelIn">
<item>
<widget class="QPushButton" name="resetButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Input:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<string>Reset</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="3">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
......
Markdown is supported
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