1 /*
2  * Copyright (C) 2019 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 #ifndef KIMAGEANNOTATOR_ANNOTATIONITEMSETTINGS_H
21 #define KIMAGEANNOTATOR_ANNOTATIONITEMSETTINGS_H
22 
23 #include "ItemSettingsWidgetConfigurator.h"
24 #include "src/backend/Config.h"
25 #include "src/widgets/settingsPicker/ColorPicker.h"
26 #include "src/widgets/settingsPicker/NumberPicker.h"
27 #include "src/widgets/settingsPicker/FillModePicker.h"
28 #include "src/widgets/settingsPicker/StickerPicker.h"
29 #include "src/widgets/settingsPicker/BoolPicker.h"
30 #include "src/widgets/settingsPicker/FontPicker.h"
31 #include "src/widgets/misc/AttachedSeparator.h"
32 #include "src/gui/annotator/docks/AbstractAnnotationDockWidgetContent.h"
33 #include "src/annotations/properties/AnnotationTextProperties.h"
34 #include "src/annotations/properties/AnnotationObfuscateProperties.h"
35 #include "src/annotations/items/AbstractAnnotationItem.h"
36 
37 namespace kImageAnnotator {
38 
39 class AnnotationItemSettings : public AbstractAnnotationDockWidgetContent
40 {
41 Q_OBJECT
42 public:
43 	explicit AnnotationItemSettings();
44 	~AnnotationItemSettings() override;
45 	void setUpForTool(Tools tool);
46 	QColor toolColor() const;
47 	void setToolColor(const QColor &color);
48 	QColor textColor() const;
49 	void setTextColor(const QColor &color);
50 	int toolWidth() const;
51 	void setToolWidth(int width);
52 	FillModes fillMode() const;
53 	void setFillMode(FillModes mode);
54 	int obfuscationFactor() const;
55 	void setObfuscationFactor(int factor);
56 	QString sticker() const;
57 	void setStickers(const QStringList &stickerPaths, bool keepDefault);
58 	bool shadowEnabled() const;
59 	void setShadowEnabled(bool enabled);
60 	void updateNumberToolSeed(int numberToolSeed);
61 	QFont font() const;
62 	void setFont(const QFont &font);
63 	QString name() const override;
64 	void setOrientation(Qt::Orientation orientation) override;
65 
66 signals:
67 	void toolColorChanged(const QColor &color);
68 	void toolTextColorChanged(const QColor &color);
69 	void toolWidthChanged(int width);
70 	void toolFillTypeChanged(FillModes fill);
71 	void notifyNumberToolSeedChanged(int newNumberToolSeed);
72 	void obfuscateFactorChanged(int factor);
73 	void stickerChanged(const QString &sticker);
74 	void shadowEnabledChanged(bool enabled);
75 	void fontChanged(const QFont &font);
76 
77 private:
78 	QBoxLayout *mMainLayout;
79 	ColorPicker *mColorPicker;
80 	NumberPicker *mWidthPicker;
81 	ColorPicker *mTextColorPicker;
82 	FillModePicker *mFillModePicker;
83 	NumberPicker *mNumberToolSeedPicker;
84 	NumberPicker *mObfuscateFactorPicker;
85 	StickerPicker *mStickerPicker;
86 	BoolPicker *mShadowPicker;
87 	FontPicker *mFontPicker;
88 	ItemSettingsWidgetConfigurator mWidgetConfigurator;
89 	QList<AttachedSeparator*> mSeparators;
90 
91 	void initGui();
92 	void insertPickerWidget(SettingsPickerWidget *pickerWidget);
93 };
94 
95 } // namespace kImageAnnotator
96 
97 #endif //KIMAGEANNOTATOR_ANNOTATIONITEMSETTINGS_H
98