1 /*
2 * Copyright (C) 2021 Damir Porobic <damir.porobic@gmx.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 3 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 Lesser General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 #include "AnnotationImageSettings.h"
21
22 namespace kImageAnnotator {
23
AnnotationImageSettings()24 AnnotationImageSettings::AnnotationImageSettings() :
25 mMainLayout(new QBoxLayout(QBoxLayout::LeftToRight)),
26 mEffectPicker(new ImageEffectPicker(this))
27 {
28 initGui();
29 }
30
~AnnotationImageSettings()31 AnnotationImageSettings::~AnnotationImageSettings()
32 {
33 delete mEffectPicker;
34 }
35
effect() const36 ImageEffects AnnotationImageSettings::effect() const
37 {
38 return mEffectPicker->effect();
39 }
40
setEffect(ImageEffects effect)41 void AnnotationImageSettings::setEffect(ImageEffects effect)
42 {
43 mEffectPicker->setEffect(effect);
44 }
45
name() const46 QString AnnotationImageSettings::name() const
47 {
48 return tr("Image Settings");
49 }
50
initGui()51 void AnnotationImageSettings::initGui()
52 {
53 mMainLayout->addWidget(mEffectPicker);
54 mMainLayout->setContentsMargins(3, 0, 3, 0);
55
56 addExpandingWidget(mEffectPicker);
57
58 setLayout(mMainLayout);
59
60 setFocusPolicy(Qt::ClickFocus);
61
62 connect(mEffectPicker, &ImageEffectPicker::effectSelected, this, &AnnotationImageSettings::effectChanged);
63 }
64
65 } // namespace kImageAnnotator