~smartboyhw/ubuntu/raring/calligra/2.6.0-0ubuntu1

« back to all changes in this revision

Viewing changes to krita/plugins/extensions/dockers/defaultdockers/kis_birdeye_box.cc

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2012-10-23 21:09:16 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20121023210916-m82w6zxnxhaxz7va
Tags: 1:2.5.90-0ubuntu1
* New upstream alpha release (LP: #1070436)
  - Add libkactivities-dev and libopenimageio-dev to build-depends
  - Add kubuntu_build_calligraactive.diff to build calligraactive by default
  - Add package for calligraauthor and move files that are shared between
    calligrawords and calligraauthor to calligrawords-common
* Document the patches
* Remove numbers from patches so they follow the same naming scheme as
  the rest of our patches.
* calligra-data breaks replaces krita-data (<< 1:2.5.3) (LP: #1071686)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
3
 
 *
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.
8
 
 *
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.
13
 
 *
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.
17
 
 */
18
 
 
19
 
#include "kis_birdeye_box.h"
20
 
 
21
 
#include <QLayout>
22
 
#include <QLabel>
23
 
#include <QPixmap>
24
 
#include <QPainter>
25
 
#include <QImage>
26
 
#include <QVBoxLayout>
27
 
#include <QHBoxLayout>
28
 
 
29
 
#include <klocale.h>
30
 
 
31
 
#include <KoColorSpace.h>
32
 
 
33
 
#include <kis_view2.h>
34
 
#include <kis_doc2.h>
35
 
 
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>
40
 
 
41
 
 
42
 
KisBirdEyeBox::KisBirdEyeBox()
43
 
        : QDockWidget(i18n("Overview"))
44
 
        , m_canvas(0)
45
 
{
46
 
    setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
47
 
 
48
 
    QWidget * w = new QWidget(this);
49
 
    setWidget(w);
50
 
 
51
 
    QVBoxLayout * l = new QVBoxLayout(w);
52
 
 
53
 
    QHBoxLayout * hl = new QHBoxLayout();
54
 
    l->addLayout(hl);
55
 
 
56
 
    m_exposureLabel = new QLabel(i18n("Exposure:"), w);
57
 
    hl->addWidget(m_exposureLabel);
58
 
 
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);
63
 
 
64
 
    l->addItem(new QSpacerItem(0, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding));
65
 
 
66
 
    m_exposureDoubleWidget->setPrecision(1);
67
 
    m_exposureDoubleWidget->setValue(0);
68
 
    m_exposureDoubleWidget->setSingleStep(0.1);
69
 
    m_exposureDoubleWidget->setPageStep(1);
70
 
 
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()));
74
 
 
75
 
    m_draggingExposureSlider = false;
76
 
}
77
 
 
78
 
KisBirdEyeBox::~KisBirdEyeBox()
79
 
{
80
 
}
81
 
 
82
 
void KisBirdEyeBox::setCanvas(KoCanvasBase* _canvas)
83
 
{
84
 
    if (KisCanvas2* canvas = dynamic_cast<KisCanvas2*>(_canvas)) {
85
 
        m_canvas = canvas;
86
 
    }
87
 
}
88
 
 
89
 
void KisBirdEyeBox::slotImageColorSpaceChanged(const KoColorSpace *cs)
90
 
{
91
 
    if (cs->hasHighDynamicRange()) {
92
 
        m_exposureDoubleWidget->show();
93
 
        m_exposureLabel->show();
94
 
    } else {
95
 
        m_exposureDoubleWidget->hide();
96
 
        m_exposureLabel->hide();
97
 
    }
98
 
}
99
 
 
100
 
void KisBirdEyeBox::exposureValueChanged(double exposure)
101
 
{
102
 
    if (m_canvas && (!m_draggingExposureSlider || m_canvas->usingHDRExposureProgram())) {
103
 
        m_canvas->view()->resourceProvider()->setHDRExposure(exposure);
104
 
    }
105
 
}
106
 
 
107
 
void KisBirdEyeBox::exposureSliderPressed()
108
 
{
109
 
    m_draggingExposureSlider = true;
110
 
}
111
 
 
112
 
void KisBirdEyeBox::exposureSliderReleased()
113
 
{
114
 
    m_draggingExposureSlider = false;
115
 
    exposureValueChanged(m_exposureDoubleWidget->value());
116
 
}
117
 
 
118
 
#include "kis_birdeye_box.moc"