1 /**
2 * This file is a part of Luminance HDR package.
3 * ----------------------------------------------------------------------
4 * Copyright (C) 2009 Franco Comida
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 * ----------------------------------------------------------------------
20 *
21 * @author Franco Comida <fcomida@users.sourceforge.net>
22 */
23
24 #ifndef PREVIEWLABEL_IMPL_H
25 #define PREVIEWLABEL_IMPL_H
26
27 #include <QImage>
28 #include <QLabel>
29 #include <QMouseEvent>
30
31 #include "Core/TonemappingOptions.h"
32
33 class PreviewLabel : public QLabel {
34 Q_OBJECT
35
36 public:
37 PreviewLabel(QWidget *parent = 0, TMOperator tm_operator = mantiuk06);
38 PreviewLabel(QWidget *parent = 0,
39 TonemappingOptions *tonemappingOptions = 0, int index = -1);
40 ~PreviewLabel();
41
42 void setTonemappingOptions(TonemappingOptions *);
43 TonemappingOptions *getTonemappingOptions();
44 void setComment(QString);
45 QString getComment();
46 void setIndex(int);
47
48 public Q_SLOTS:
49 void assignNewQImage(QSharedPointer<QImage> new_qimage);
50
51 protected:
52 void mousePressEvent(QMouseEvent *event);
53 void mouseDoubleClickEvent(QMouseEvent *event);
54
55 signals:
56 void clicked(TonemappingOptions *);
57 void clicked(int);
58
59 private:
60 TonemappingOptions *m_TMOptions;
61 int m_index;
62 QString m_comment;
63 bool m_isFromPanel;
64 };
65
getTonemappingOptions()66 inline TonemappingOptions *PreviewLabel::getTonemappingOptions() {
67 return m_TMOptions;
68 }
69
setTonemappingOptions(TonemappingOptions * tmopts)70 inline void PreviewLabel::setTonemappingOptions(TonemappingOptions *tmopts) {
71 if (m_TMOptions) delete m_TMOptions;
72 m_TMOptions = new TonemappingOptions(*tmopts);
73 }
74 #endif
75