2
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
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_sketch_paintop_settings_widget.h"
21
#include "kis_sketchop_option.h"
22
#include "kis_sketch_paintop_settings.h"
24
#include <kis_curve_option_widget.h>
25
#include <kis_pressure_opacity_option.h>
27
#include <kis_paintop_options_widget.h>
28
#include <kis_paint_action_type_option.h>
29
#include <kis_airbrush_option.h>
30
#include <kis_pressure_size_option.h>
32
#include <QDomDocument>
33
#include <QDomElement>
34
#include <kis_pressure_rotation_option.h>
36
KisSketchPaintOpSettingsWidget::KisSketchPaintOpSettingsWidget(QWidget* parent)
37
: KisBrushBasedPaintopOptionWidget(parent)
39
m_sketchOption = new KisSketchOpOption();
41
addPaintOpOption(m_sketchOption);
42
addPaintOpOption(new KisCurveOptionWidget(new KisPressureSizeOption()));
43
addPaintOpOption(new KisCurveOptionWidget(new KisPressureOpacityOption()));
44
addPaintOpOption(new KisCurveOptionWidget(new KisPressureRotationOption()));
45
addPaintOpOption(new KisAirbrushOption(false));
47
m_paintActionType = new KisPaintActionTypeOption();
48
KisPropertiesConfiguration defaultSetting;
49
defaultSetting.setProperty("PaintOpAction",BUILDUP);
50
m_paintActionType->readOptionSetting(&defaultSetting);
52
addPaintOpOption(m_paintActionType);
54
KisPropertiesConfiguration* reconfigurationCourier = configuration();
55
QDomDocument xMLAnalyzer("");
56
xMLAnalyzer.setContent(reconfigurationCourier->getString("brush_definition") );
58
QDomElement firstTag = xMLAnalyzer.documentElement();
59
QDomElement firstTagsChild = firstTag.elementsByTagName("MaskGenerator").item(0).toElement();
61
firstTagsChild.attributeNode("diameter").setValue("128");
63
reconfigurationCourier->setProperty("brush_definition", xMLAnalyzer.toString() );
64
setConfiguration(reconfigurationCourier);
65
delete reconfigurationCourier;
68
KisSketchPaintOpSettingsWidget::~ KisSketchPaintOpSettingsWidget()
72
KisPropertiesConfiguration* KisSketchPaintOpSettingsWidget::configuration() const
74
KisSketchPaintOpSettings* config = new KisSketchPaintOpSettings();
75
config->setOptionsWidget(const_cast<KisSketchPaintOpSettingsWidget*>(this));
76
config->setProperty("paintop", "sketchbrush"); // XXX: make this a const id string
77
writeConfiguration(config);