2
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
#include "kis_birdeye_box.h"
26
#include <QVBoxLayout>
27
#include <QHBoxLayout>
31
#include <KoColorSpace.h>
33
#include <kis_view2.h>
36
#include <widgets/kis_double_widget.h>
37
#include <canvas/kis_canvas2.h>
38
#include <kis_image.h>
39
#include <kis_canvas_resource_provider.h>
42
KisBirdEyeBox::KisBirdEyeBox()
43
: QDockWidget(i18n("Overview"))
46
setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
48
QWidget * w = new QWidget(this);
51
QVBoxLayout * l = new QVBoxLayout(w);
53
QHBoxLayout * hl = new QHBoxLayout();
56
m_exposureLabel = new QLabel(i18n("Exposure:"), w);
57
hl->addWidget(m_exposureLabel);
59
m_exposureDoubleWidget = new KisDoubleWidget(-10, 10, w);
60
m_exposureDoubleWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
61
m_exposureDoubleWidget->setToolTip(i18n("Select the exposure (stops) for HDR images"));
62
hl->addWidget(m_exposureDoubleWidget);
64
l->addItem(new QSpacerItem(0, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding));
66
m_exposureDoubleWidget->setPrecision(1);
67
m_exposureDoubleWidget->setValue(0);
68
m_exposureDoubleWidget->setSingleStep(0.1);
69
m_exposureDoubleWidget->setPageStep(1);
71
connect(m_exposureDoubleWidget, SIGNAL(valueChanged(double)), SLOT(exposureValueChanged(double)));
72
connect(m_exposureDoubleWidget, SIGNAL(sliderPressed()), SLOT(exposureSliderPressed()));
73
connect(m_exposureDoubleWidget, SIGNAL(sliderReleased()), SLOT(exposureSliderReleased()));
75
m_draggingExposureSlider = false;
78
KisBirdEyeBox::~KisBirdEyeBox()
82
void KisBirdEyeBox::setCanvas(KoCanvasBase* _canvas)
84
if (KisCanvas2* canvas = dynamic_cast<KisCanvas2*>(_canvas)) {
89
void KisBirdEyeBox::slotImageColorSpaceChanged(const KoColorSpace *cs)
91
if (cs->hasHighDynamicRange()) {
92
m_exposureDoubleWidget->show();
93
m_exposureLabel->show();
95
m_exposureDoubleWidget->hide();
96
m_exposureLabel->hide();
100
void KisBirdEyeBox::exposureValueChanged(double exposure)
102
if (m_canvas && (!m_draggingExposureSlider || m_canvas->usingHDRExposureProgram())) {
103
m_canvas->view()->resourceProvider()->setHDRExposure(exposure);
107
void KisBirdEyeBox::exposureSliderPressed()
109
m_draggingExposureSlider = true;
112
void KisBirdEyeBox::exposureSliderReleased()
114
m_draggingExposureSlider = false;
115
exposureValueChanged(m_exposureDoubleWidget->value());
118
#include "kis_birdeye_box.moc"