~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to krita/plugins/paintops/sketch/kis_sketch_paintop_settings_widget.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
 
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_sketch_paintop_settings_widget.h"
 
20
 
 
21
#include "kis_sketchop_option.h"
 
22
#include "kis_sketch_paintop_settings.h"
 
23
 
 
24
#include <kis_curve_option_widget.h>
 
25
#include <kis_pressure_opacity_option.h>
 
26
 
 
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>
 
31
 
 
32
#include <QDomDocument>
 
33
#include <QDomElement>
 
34
#include <kis_pressure_rotation_option.h>
 
35
 
 
36
KisSketchPaintOpSettingsWidget::KisSketchPaintOpSettingsWidget(QWidget* parent)
 
37
        : KisBrushBasedPaintopOptionWidget(parent)
 
38
{
 
39
    m_sketchOption =  new KisSketchOpOption();
 
40
        
 
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));
 
46
    
 
47
    m_paintActionType = new KisPaintActionTypeOption();
 
48
    KisPropertiesConfiguration defaultSetting;
 
49
    defaultSetting.setProperty("PaintOpAction",BUILDUP);
 
50
    m_paintActionType->readOptionSetting(&defaultSetting);
 
51
 
 
52
    addPaintOpOption(m_paintActionType);
 
53
    
 
54
    KisPropertiesConfiguration* reconfigurationCourier = configuration();
 
55
    QDomDocument xMLAnalyzer("");
 
56
    xMLAnalyzer.setContent(reconfigurationCourier->getString("brush_definition") );
 
57
    
 
58
    QDomElement firstTag = xMLAnalyzer.documentElement();
 
59
    QDomElement firstTagsChild = firstTag.elementsByTagName("MaskGenerator").item(0).toElement();
 
60
    
 
61
    firstTagsChild.attributeNode("diameter").setValue("128");
 
62
    
 
63
    reconfigurationCourier->setProperty("brush_definition", xMLAnalyzer.toString() );
 
64
    setConfiguration(reconfigurationCourier);  
 
65
    delete reconfigurationCourier;
 
66
}
 
67
 
 
68
KisSketchPaintOpSettingsWidget::~ KisSketchPaintOpSettingsWidget()
 
69
{
 
70
}
 
71
 
 
72
KisPropertiesConfiguration*  KisSketchPaintOpSettingsWidget::configuration() const
 
73
{
 
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);
 
78
    return config;
 
79
}
 
80