diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-03-10 20:44:18 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-03-10 20:44:18 +0000 |
commit | a39b92f278f6d1530cb151875b445185951634df (patch) | |
tree | 3adaf003614915d78c38782a51353690f9136852 /src | |
download | potracegui-a39b92f278f6d1530cb151875b445185951634df.tar.gz potracegui-a39b92f278f6d1530cb151875b445185951634df.zip |
Added KDE3 version of POTraceGUI
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/potracegui@1101754 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src')
-rw-r--r-- | src/MainWidgetBase.ui | 2939 | ||||
-rw-r--r-- | src/Makefile.am | 34 | ||||
-rw-r--r-- | src/autotraceformats.cpp | 71 | ||||
-rw-r--r-- | src/autotraceformats.h | 86 | ||||
-rw-r--r-- | src/hi16-app-potracegui.png | bin | 0 -> 1032 bytes | |||
-rw-r--r-- | src/hi32-app-potracegui.png | bin | 0 -> 2748 bytes | |||
-rw-r--r-- | src/main.cpp | 57 | ||||
-rw-r--r-- | src/mainwidget.cpp | 1055 | ||||
-rw-r--r-- | src/mainwidget.h | 200 | ||||
-rw-r--r-- | src/options.cpp | 87 | ||||
-rw-r--r-- | src/options.h | 66 | ||||
-rw-r--r-- | src/potracegui.cpp | 158 | ||||
-rw-r--r-- | src/potracegui.desktop | 27 | ||||
-rw-r--r-- | src/potracegui.h | 98 | ||||
-rw-r--r-- | src/potracegui.lsm | 16 | ||||
-rw-r--r-- | src/potraceguiui.rc | 5 |
16 files changed, 4899 insertions, 0 deletions
diff --git a/src/MainWidgetBase.ui b/src/MainWidgetBase.ui new file mode 100644 index 0000000..e1a5a43 --- /dev/null +++ b/src/MainWidgetBase.ui @@ -0,0 +1,2939 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>MainWidgetBase</class> +<widget class="QWidget"> + <property name="name"> + <cstring>MainWidgetBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>555</width> + <height>642</height> + </rect> + </property> + <property name="cursor"> + <cursor>0</cursor> + </property> + <property name="caption"> + <string>MainWidgetBase</string> + </property> + <property name="acceptDrops"> + <bool>true</bool> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QTabWidget"> + <property name="name"> + <cstring>imagesTabs</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>800</width> + <height>600</height> + </size> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&Original image</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + </grid> + </widget> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout7</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QWidgetStack"> + <property name="name"> + <cstring>backendStack</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>potracePage</cstring> + </property> + <attribute name="id"> + <number>0</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QTabWidget" row="0" column="0"> + <property name="name"> + <cstring>tabWidget3</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&Input-Output</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox" row="0" column="0"> + <property name="name"> + <cstring>groupBox2</cstring> + </property> + <property name="title"> + <string>Input</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel2_3</cstring> + </property> + <property name="text"> + <string>Black level:</string> + </property> + <property name="toolTip" stdset="0"> + <string>Pixel threshold for B&W conversion of the image</string> + </property> + </widget> + <widget class="KDoubleNumInput" row="0" column="1"> + <property name="name"> + <cstring>blackLevel</cstring> + </property> + <property name="value"> + <number>0.5</number> + </property> + <property name="maxValue"> + <number>1</number> + </property> + <property name="toolTip" stdset="0"> + <string>Pixel threshold for B&W conversion of the image</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>invertInput</cstring> + </property> + <property name="text"> + <string>In&vert</string> + </property> + <property name="accel"> + <string>Alt+V</string> + </property> + <property name="toolTip" stdset="0"> + <string>Inverts the image before processing</string> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox" row="0" column="1"> + <property name="name"> + <cstring>groupBox8</cstring> + </property> + <property name="title"> + <string>Color</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KColorButton" row="0" column="1"> + <property name="name"> + <cstring>foregroundBtn</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="toolTip" stdset="0"> + <string>Output foreground color</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel4_2_2_3</cstring> + </property> + <property name="text"> + <string>Foreground color:</string> + </property> + <property name="toolTip" stdset="0"> + <string>Output foreground color</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>opaque</cstring> + </property> + <property name="text"> + <string>Opa&que:</string> + </property> + <property name="toolTip" stdset="0"> + <string>Fill in the white parts of the image opaquely</string> + </property> + </widget> + <widget class="KColorButton" row="1" column="1"> + <property name="name"> + <cstring>backgroundBtn</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="toolTip" stdset="0"> + <string>Fill color</string> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>groupBox1</cstring> + </property> + <property name="title"> + <string>Output</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KSqueezedTextLabel" row="1" column="0"> + <property name="name"> + <cstring>kSqueezedTextLabel2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Format:</string> + </property> + </widget> + <widget class="KComboBox" row="1" column="1" rowspan="1" colspan="2"> + <item> + <property name="text"> + <string>eps</string> + </property> + </item> + <item> + <property name="text"> + <string>postscript</string> + </property> + </item> + <item> + <property name="text"> + <string>SVG</string> + </property> + </item> + <item> + <property name="text"> + <string>pgm</string> + </property> + </item> + <item> + <property name="text"> + <string>Gimp path</string> + </property> + </item> + <item> + <property name="text"> + <string>Xfig</string> + </property> + </item> + <property name="name"> + <cstring>outputFormat</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip" stdset="0"> + <string>Output format</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidgetStack" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>optionsStack</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>psPage</cstring> + </property> + <attribute name="id"> + <number>0</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox" row="0" column="0"> + <property name="name"> + <cstring>psFrame</cstring> + </property> + <property name="title"> + <string>PS-EPS output</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel3_3</cstring> + </property> + <property name="text"> + <string>Page size:</string> + </property> + <property name="toolTip" stdset="0"> + <string>Output page size</string> + </property> + </widget> + <widget class="KComboBox" row="0" column="1"> + <item> + <property name="text"> + <string>a4</string> + </property> + </item> + <item> + <property name="text"> + <string>a3</string> + </property> + </item> + <item> + <property name="text"> + <string>a5</string> + </property> + </item> + <item> + <property name="text"> + <string>b5</string> + </property> + </item> + <item> + <property name="text"> + <string>letter</string> + </property> + </item> + <item> + <property name="text"> + <string>legal</string> + </property> + </item> + <item> + <property name="text"> + <string>tabloid</string> + </property> + </item> + <item> + <property name="text"> + <string>statement</string> + </property> + </item> + <item> + <property name="text"> + <string>executive</string> + </property> + </item> + <item> + <property name="text"> + <string>folio</string> + </property> + </item> + <item> + <property name="text"> + <string>quarto</string> + </property> + </item> + <item> + <property name="text"> + <string>10x14</string> + </property> + </item> + <property name="name"> + <cstring>pageSize</cstring> + </property> + <property name="editable"> + <bool>true</bool> + </property> + <property name="currentItem"> + <number>4</number> + </property> + <property name="toolTip" stdset="0"> + <string>Output page size</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>optimizedNumericalCode</cstring> + </property> + <property name="text"> + <string>Optimized numerical code</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Use a compact numerical format to represent Bezier curves in +PostScript</string> + </property> + </widget> + <widget class="QButtonGroup" row="0" column="2" rowspan="2" colspan="1"> + <property name="name"> + <cstring>compressionLevel</cstring> + </property> + <property name="title"> + <string>Compression level</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>level1</cstring> + </property> + <property name="text"> + <string>None</string> + </property> + <property name="buttonGroupId"> + <number>3</number> + </property> + <property name="toolTip" stdset="0"> + <string>No compression</string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>level2</cstring> + </property> + <property name="text"> + <string>Level 2</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="buttonGroupId"> + <number>3</number> + </property> + <property name="toolTip" stdset="0"> + <string>Standard compression (needs LZW-enabled compress)</string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>level3</cstring> + </property> + <property name="text"> + <string>Level 3</string> + </property> + <property name="buttonGroupId"> + <number>3</number> + </property> + <property name="toolTip" stdset="0"> + <string>Maximum compression</string> + </property> + </widget> + </vbox> + </widget> + </grid> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>svgPage</cstring> + </property> + <attribute name="id"> + <number>1</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox" row="0" column="0"> + <property name="name"> + <cstring>svgFrame</cstring> + </property> + <property name="title"> + <string>SVG</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>SVGGroup</cstring> + </property> + <property name="text"> + <string>Group</string> + </property> + <property name="toolTip" stdset="0"> + <string>Try to group related paths together in the SVG output</string> + </property> + </widget> + </grid> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>pgmPage</cstring> + </property> + <attribute name="id"> + <number>2</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox" row="0" column="0"> + <property name="name"> + <cstring>pgmFrame</cstring> + </property> + <property name="title"> + <string>PGM</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel5_2</cstring> + </property> + <property name="text"> + <string>Antialias gamma:</string> + </property> + <property name="toolTip" stdset="0"> + <string>Gamma value for anti-aliasing</string> + </property> + </widget> + <widget class="KDoubleNumInput" row="0" column="1"> + <property name="name"> + <cstring>antialiasGamma</cstring> + </property> + <property name="value"> + <number>2.2</number> + </property> + <property name="toolTip" stdset="0"> + <string>Gamma value for anti-aliasing</string> + </property> + </widget> + <widget class="QButtonGroup" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>buttonGroup1</cstring> + </property> + <property name="title"> + <string>Scale</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>scaleAllBTN</cstring> + </property> + <property name="text"> + <string>All</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>All dimesions at once</string> + </property> + </widget> + <widget class="KDoubleNumInput"> + <property name="name"> + <cstring>scaleAll</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Scale factor (>1 enlarges, <1 shrinks)</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget" row="0" column="1"> + <property name="name"> + <cstring>layout4</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel10_3</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Y</string> + </property> + <property name="toolTip" stdset="0"> + <string>Scale factor (>1 enlarges, <1 shrinks)</string> + </property> + </widget> + <widget class="KDoubleNumInput" row="2" column="1"> + <property name="name"> + <cstring>scaleY</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Scale factor (>1 enlarges, <1 shrinks)</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel9_3</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>X</string> + </property> + <property name="toolTip" stdset="0"> + <string>Scale factor (>1 enlarges, <1 shrinks)</string> + </property> + </widget> + <widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>scaleXYBTN</cstring> + </property> + <property name="text"> + <string>Each</string> + </property> + <property name="buttonGroupId"> + <number>-1</number> + </property> + <property name="toolTip" stdset="0"> + <string>Each dimension separately</string> + </property> + </widget> + <widget class="KDoubleNumInput" row="1" column="1"> + <property name="name"> + <cstring>scaleX</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Scale factor (>1 enlarges, <1 shrinks)</string> + </property> + </widget> + </grid> + </widget> + </grid> + </widget> + </grid> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>undefinedPage</cstring> + </property> + <attribute name="id"> + <number>3</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KActiveLabel" row="1" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>kActiveLabel1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Sorry, no options for this format.</string> + </property> + </widget> + <spacer row="0" column="1"> + <property name="name"> + <cstring>spacer8</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + <spacer row="2" column="2"> + <property name="name"> + <cstring>spacer9</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + <spacer row="1" column="0"> + <property name="name"> + <cstring>spacer10</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + <spacer row="1" column="3"> + <property name="name"> + <cstring>spacer11</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + </widget> + <spacer row="3" column="0"> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>A&lgorithm</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="6" column="0"> + <property name="name"> + <cstring>spacer5_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>297</height> + </size> + </property> + </spacer> + <widget class="QCheckBox" row="5" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>curveOptimization</cstring> + </property> + <property name="text"> + <string>Cur&ve optimization</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Join adiacent bezier curves (off=larger file)</string> + </property> + </widget> + <widget class="KDoubleNumInput" row="3" column="1"> + <property name="name"> + <cstring>optimizationTolerance</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="value"> + <number>0.2</number> + </property> + <property name="toolTip" stdset="0"> + <string>Curve optimization tolerance (default = 0.2)</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Set the curve optimization tolerance. The default value is 0.2. Larger values allow more consecutive Bezier curve segments to be joined together in a single segment, at the expense of accuracy.</string> + </property> + </widget> + <widget class="KDoubleNumInput" row="2" column="1"> + <property name="name"> + <cstring>cornerThreshold</cstring> + </property> + <property name="value"> + <number>1</number> + </property> + <property name="minValue"> + <number>-1</number> + </property> + <property name="maxValue"> + <number>1.34</number> + </property> + <property name="precision"> + <number>2</number> + </property> + <property name="toolTip" stdset="0"> + <string>Corner Threshold parameter (<1 hard corners, >1 soft corners)</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Set the corner threshold parameter. The default value is 1. The smaller this value, the more sharp corners will be produced. If this parameter is negative, then no smoothing will be performed and the output is a polygon. The largest useful value is 4/3 or 1.334, which suppresses all corners and leads to completely smooth output.</string> + </property> + </widget> + <widget class="KIntNumInput" row="1" column="1"> + <property name="name"> + <cstring>despeckle</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minValue"> + <number>0</number> + </property> + <property name="toolTip" stdset="0"> + <string>Suppress speckles of up to this many pixels</string> + </property> + </widget> + <widget class="KComboBox" row="0" column="1"> + <item> + <property name="text"> + <string>black</string> + </property> + </item> + <item> + <property name="text"> + <string>white</string> + </property> + </item> + <item> + <property name="text"> + <string>right</string> + </property> + </item> + <item> + <property name="text"> + <string>left</string> + </property> + </item> + <item> + <property name="text"> + <string>minority</string> + </property> + </item> + <item> + <property name="text"> + <string>majority</string> + </property> + </item> + <item> + <property name="text"> + <string>random</string> + </property> + </item> + <property name="name"> + <cstring>policy</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="currentItem"> + <number>4</number> + </property> + <property name="toolTip" stdset="0"> + <string>How to resolve ambiguities in path +decomposition</string> + </property> + </widget> + <widget class="KIntNumInput" row="4" column="1"> + <property name="name"> + <cstring>outputQuantization</cstring> + </property> + <property name="value"> + <number>10</number> + </property> + <property name="minValue"> + <number>0</number> + </property> + <property name="toolTip" stdset="0"> + <string>To how many points/pixel the output is rounded</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Set output quantization. Coordinates in the output are rounded to 1/value pixels. The default value of 10 usually gives good results. In the case of the gimppath backend, this option is used to set the desired magnification. This option has no effect for the XFig backend, which always rasterizes to 1/1200 inch.</string> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>textLabel1_4</cstring> + </property> + <property name="text"> + <string>Output quantization:</string> + </property> + <property name="toolTip" stdset="0"> + <string>How exactly the output is rounded</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Set output quantization. Coordinates in the output are rounded to 1/value pixels. The default value of 10 usually gives good results. In the case of the gimppath backend, this option is used to set the desired magnification. This option has no effect for the XFig backend, which always rasterizes to 1/1200 inch.</string> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel4</cstring> + </property> + <property name="text"> + <string>Optimization tolerance:</string> + </property> + <property name="toolTip" stdset="0"> + <string>Curve optimization tolerance (default = 0.2)</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Set the curve optimization tolerance. The default value is 0.2. Larger values allow more consecutive Bezier curve segments to be joined together in a single segment, at the expense of accuracy.</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string>Corner Threshold:</string> + </property> + <property name="toolTip" stdset="0"> + <string>Corner Threshold parameter (<1 hard corners, >1 soft corners)</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Set the corner threshold parameter. The default value is 1. The smaller this value, the more sharp corners will be produced. If this parameter is negative, then no smoothing will be performed and the output is a polygon. The largest useful value is 4/3 or 1.334, which suppresses all corners and leads to completely smooth output.</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Despeckle:</string> + </property> + <property name="toolTip" stdset="0"> + <string>Suppress speckles of up to this many pixels</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Policy:</string> + </property> + <property name="toolTip" stdset="0"> + <string>How to resolve ambiguities in path +decomposition</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>TabPage</cstring> + </property> + <attribute name="title"> + <string>&Scaling and transformations</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox" row="0" column="0"> + <property name="name"> + <cstring>groupBox7</cstring> + </property> + <property name="title"> + <string>Transformation</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="2" column="1"> + <property name="name"> + <cstring>spacer17</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>80</width> + <height>31</height> + </size> + </property> + </spacer> + <spacer row="3" column="1"> + <property name="name"> + <cstring>spacer17_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>80</width> + <height>31</height> + </size> + </property> + </spacer> + <widget class="KDoubleNumInput" row="3" column="2"> + <property name="name"> + <cstring>rotation</cstring> + </property> + <property name="minValue"> + <number>-360</number> + </property> + <property name="maxValue"> + <number>360</number> + </property> + <property name="toolTip" stdset="0"> + <string>Rotate output by x degrees</string> + </property> + </widget> + <widget class="KDoubleNumInput" row="2" column="2"> + <property name="name"> + <cstring>stretch</cstring> + </property> + <property name="value"> + <number>1</number> + </property> + <property name="maxValue"> + <number>2</number> + </property> + <property name="toolTip" stdset="0"> + <string>Aspect ratio (<1 stretched in the x direction, >1 stretched in the y direction)</string> + </property> + </widget> + <spacer row="1" column="1"> + <property name="name"> + <cstring>spacer17_3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>80</width> + <height>31</height> + </size> + </property> + </spacer> + <widget class="KDoubleNumInput" row="1" column="2"> + <property name="name"> + <cstring>height</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Output image height</string> + </property> + </widget> + <widget class="KDoubleNumInput" row="0" column="2"> + <property name="name"> + <cstring>width</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip" stdset="0"> + <string>Output image width</string> + </property> + </widget> + <spacer row="0" column="1"> + <property name="name"> + <cstring>spacer17_4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>80</width> + <height>31</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="0" column="3"> + <property name="name"> + <cstring>textLabel1_3</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>cm</string> + </property> + </widget> + <widget class="QLabel" row="1" column="3"> + <property name="name"> + <cstring>textLabel1_3_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>cm</string> + </property> + </widget> + <widget class="QLabel" row="3" column="3"> + <property name="name"> + <cstring>textLabel1_3_4</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>degree</string> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel3_2</cstring> + </property> + <property name="text"> + <string>Rotation:</string> + </property> + <property name="toolTip" stdset="0"> + <string>Rotate output by x degrees</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel8</cstring> + </property> + <property name="text"> + <string>Stretch:</string> + </property> + <property name="toolTip" stdset="0"> + <string>Aspect ratio (<1 stretched in the x direction, >1 stretched in the y direction)</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel6</cstring> + </property> + <property name="text"> + <string>Height:</string> + </property> + <property name="toolTip" stdset="0"> + <string>Output image height</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel5</cstring> + </property> + <property name="text"> + <string>Width:</string> + </property> + <property name="toolTip" stdset="0"> + <string>Output image width</string> + </property> + </widget> + </grid> + </widget> + <widget class="QButtonGroup" row="1" column="0"> + <property name="name"> + <cstring>buttonGroup3</cstring> + </property> + <property name="title"> + <string>Resolution (dpi)</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>resolutionAllBTN</cstring> + </property> + <property name="text"> + <string>All</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="buttonGroupId"> + <number>2</number> + </property> + <property name="toolTip" stdset="0"> + <string>All dimensions</string> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>X</string> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>textLabel2_2</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Y</string> + </property> + </widget> + <widget class="QRadioButton" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>resolutionXYBTN</cstring> + </property> + <property name="text"> + <string>Each</string> + </property> + <property name="buttonGroupId"> + <number>2</number> + </property> + <property name="toolTip" stdset="0"> + <string>Each dimension separately</string> + </property> + </widget> + <widget class="KDoubleNumInput" row="3" column="1"> + <property name="name"> + <cstring>resolutionX</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>set the resolution (in dpi). One inch in the output image corresponds to this many +pixels in the input</string> + </property> + </widget> + <widget class="KDoubleNumInput" row="4" column="1"> + <property name="name"> + <cstring>resolutionY</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>set the resolution (in dpi). One inch in the output image corresponds to this many +pixels in the input</string> + </property> + </widget> + <widget class="KDoubleNumInput" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>resolutionAll</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>set the resolution (in dpi). One inch in the output image corresponds to this many +pixels in the input</string> + </property> + </widget> + </grid> + </widget> + <spacer row="2" column="0"> + <property name="name"> + <cstring>spacer7</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>TabPage</cstring> + </property> + <attribute name="title"> + <string>&Margins</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="1" column="0"> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>270</height> + </size> + </property> + </spacer> + <widget class="QButtonGroup" row="0" column="0"> + <property name="name"> + <cstring>buttonGroup2</cstring> + </property> + <property name="title"> + <string>Margins</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="3" column="5"> + <property name="name"> + <cstring>textLabel1_3_7</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>cm</string> + </property> + </widget> + <widget class="KDoubleNumInput" row="3" column="4"> + <property name="name"> + <cstring>marginsB</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Set output margins</string> + </property> + </widget> + <widget class="KDoubleNumInput" row="2" column="4"> + <property name="name"> + <cstring>marginsT</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Set output margins</string> + </property> + </widget> + <widget class="KDoubleNumInput" row="1" column="4"> + <property name="name"> + <cstring>marginsR</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Set output margins</string> + </property> + </widget> + <widget class="QLabel" row="0" column="5"> + <property name="name"> + <cstring>textLabel1_3_3</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>cm</string> + </property> + </widget> + <widget class="QLabel" row="1" column="5"> + <property name="name"> + <cstring>textLabel1_3_5</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>cm</string> + </property> + </widget> + <widget class="QLabel" row="2" column="5"> + <property name="name"> + <cstring>textLabel1_3_6</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>cm</string> + </property> + </widget> + <widget class="KDoubleNumInput" row="0" column="4"> + <property name="name"> + <cstring>marginsL</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip" stdset="0"> + <string>Set output margins</string> + </property> + </widget> + <spacer row="0" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>spacer22</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>71</width> + <height>21</height> + </size> + </property> + </spacer> + <spacer row="1" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>spacer22_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>71</width> + <height>21</height> + </size> + </property> + </spacer> + <spacer row="2" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>spacer22_3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>71</width> + <height>21</height> + </size> + </property> + </spacer> + <spacer row="3" column="3"> + <property name="name"> + <cstring>spacer22_4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>71</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel13</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Top:</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel12</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Right:</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel11</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Left:</string> + </property> + </widget> + <widget class="QLabel" row="3" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>textLabel14</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Bottom:</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="6"> + <property name="name"> + <cstring>checkBoxSyncronizeMargins</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>syncronize</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </grid> + </widget> + </grid> + </widget> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>autotracePage</cstring> + </property> + <attribute name="id"> + <number>1</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QTabWidget" row="0" column="0"> + <property name="name"> + <cstring>autotraceTabs</cstring> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&Input - output</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox11</cstring> + </property> + <property name="title"> + <string>&Output format</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KComboBox" row="0" column="0"> + <property name="name"> + <cstring>autotraceOutputFormat</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Select wanted output format</string> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox9</cstring> + </property> + <property name="title"> + <string>Input image</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>autotraceDpiCheckbox</cstring> + </property> + <property name="text"> + <string>&DPI:</string> + </property> + <property name="accel"> + <string>Alt+D</string> + </property> + <property name="toolTip" stdset="0"> + <string><p>Dot per inch of input image</p><p>(affects scaling in mif output)</p></string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>autotraceCheckBoxReduceColors</cstring> + </property> + <property name="text"> + <string>&reduce color count to:</string> + </property> + <property name="accel"> + <string>Alt+R</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string><p>Reduce input image to this number of colors (range: 2 - 256)</p></string> + </property> + </widget> + <widget class="KIntNumInput" row="0" column="1"> + <property name="name"> + <cstring>autotraceDpiInput</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="minValue"> + <number>0</number> + </property> + <property name="toolTip" stdset="0"> + <string><p>Dot per inch of input image</p><p>(affects scaling in mif output)</p></string> + </property> + </widget> + <widget class="KIntNumInput" row="1" column="1"> + <property name="name"> + <cstring>autotraceColorCount</cstring> + </property> + <property name="value"> + <number>2</number> + </property> + <property name="minValue"> + <number>2</number> + </property> + <property name="maxValue"> + <number>256</number> + </property> + <property name="toolTip" stdset="0"> + <string><p>Reduce input image to this number of colors (range: 2 - 256)</p></string> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox8_2</cstring> + </property> + <property name="title"> + <string>Transparent color</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>autotraceUseBackground</cstring> + </property> + <property name="text"> + <string>&Use:</string> + </property> + <property name="accel"> + <string>Alt+U</string> + </property> + <property name="toolTip" stdset="0"> + <string><p>Toggle transparent color</p></string> + </property> + </widget> + <widget class="KColorButton" row="0" column="1"> + <property name="name"> + <cstring>autotraceBackground</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string></string> + </property> + <property name="color"> + <color> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + <property name="toolTip" stdset="0"> + <string><p>Ignore this color in input file</p><p>(The color will be rendered as transparent in the output image)</p></string> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox10</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="title"> + <string>Log</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>autotraceLog</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Create &logfile</string> + </property> + <property name="accel"> + <string>Alt+L</string> + </property> + <property name="toolTip" stdset="0"> + <string>Not working at the moment</string> + </property> + </widget> + </grid> + </widget> + <spacer> + <property name="name"> + <cstring>spacer14</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>30</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&Corners and curves</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox" row="0" column="0"> + <property name="name"> + <cstring>groupBox12</cstring> + </property> + <property name="title"> + <string>Corners</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel3_4</cstring> + </property> + <property name="text"> + <string>Thre&shold:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>autotraceThreshold</cstring> + </property> + <property name="toolTip" stdset="0"> + <string><p>Consider any pixel which forms an angle with its predecessor(s) and successor(s) that is smaller than the specified angle (in degrees) as a corner.</p></string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel4_2</cstring> + </property> + <property name="text"> + <string>Alwa&ys threshold:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>autotraceAlwaysThreshold</cstring> + </property> + <property name="toolTip" stdset="0"> + <string><p>Consider any angle at a pixel which falls below the specified angle (in degrees) as a corner, even if it is bordered by other corner pixels.</p></string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel5_3</cstring> + </property> + <property name="focusPolicy"> + <enum>NoFocus</enum> + </property> + <property name="text"> + <string>&Surround:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>autotraceSurround</cstring> + </property> + <property name="toolTip" stdset="0"> + <string><p>Consider the specified number of pixels on either side of a point when determining if that point is a corner.</p></string> + </property> + </widget> + <widget class="KIntNumInput" row="2" column="1"> + <property name="name"> + <cstring>autotraceSurround</cstring> + </property> + <property name="value"> + <number>4</number> + </property> + <property name="minValue"> + <number>0</number> + </property> + <property name="toolTip" stdset="0"> + <string><p>Consider the specified number of pixels on either side of a point when determining if that point is a corner.</p></string> + </property> + </widget> + <widget class="KIntNumInput" row="1" column="1"> + <property name="name"> + <cstring>autotraceAlwaysThreshold</cstring> + </property> + <property name="value"> + <number>60</number> + </property> + <property name="minValue"> + <number>0</number> + </property> + <property name="maxValue"> + <number>360</number> + </property> + <property name="toolTip" stdset="0"> + <string><p>Consider any angle at a pixel which falls below the specified angle (in degrees) as a corner, even if it is bordered by other corner pixels.</p></string> + </property> + </widget> + <widget class="KIntNumInput" row="0" column="1"> + <property name="name"> + <cstring>autotraceThreshold</cstring> + </property> + <property name="value"> + <number>100</number> + </property> + <property name="minValue"> + <number>0</number> + </property> + <property name="maxValue"> + <number>360</number> + </property> + <property name="toolTip" stdset="0"> + <string><p>Consider any pixel which forms an angle with its predecessor(s) and successor(s) that is smaller than the specified angle (in degrees) as a corner.</p></string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>autotraceAdjacentCorners</cstring> + </property> + <property name="text"> + <string>&Remove adjacent corners</string> + </property> + <property name="accel"> + <string>Alt+R</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + </grid> + </widget> + <spacer row="2" column="0"> + <property name="name"> + <cstring>spacer15</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QGroupBox" row="1" column="0"> + <property name="name"> + <cstring>groupBox13</cstring> + </property> + <property name="title"> + <string>Curves</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KDoubleNumInput" row="2" column="1"> + <property name="name"> + <cstring>autotraceReversionThreshold</cstring> + </property> + <property name="value"> + <number>0.01</number> + </property> + <property name="toolTip" stdset="0"> + <string><p>When a spline is closer to a straight line than the specified real number weighted by the square of the curve length, maintain it as a straight line, even if it is a list with curves.</p></string> + </property> + </widget> + <widget class="KIntNumInput" row="3" column="1"> + <property name="name"> + <cstring>autotraceIterations</cstring> + </property> + <property name="value"> + <number>4</number> + </property> + <property name="minValue"> + <number>0</number> + </property> + <property name="toolTip" stdset="0"> + <string><p>Smooth the curve the specified number of times prior to fitting</p></string> + </property> + </widget> + <widget class="KDoubleNumInput" row="1" column="1"> + <property name="name"> + <cstring>autotraceLineThreshold</cstring> + </property> + <property name="value"> + <number>1</number> + </property> + <property name="toolTip" stdset="0"> + <string><p>If a spline does not deviate from the straight line defined by its endpoints by more than the specified number of pixels, then treat it as a straight line.</p></string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel7</cstring> + </property> + <property name="text"> + <string>Re&version threshold:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>autotraceReversionThreshold</cstring> + </property> + <property name="toolTip" stdset="0"> + <string><p>When a spline is closer to a straight line than the specified real number weighted by the square of the curve length, maintain it as a straight line, even if it is a list with curves.</p></string> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel8_2</cstring> + </property> + <property name="text"> + <string>&Filter iterations:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>autotraceIterations</cstring> + </property> + <property name="toolTip" stdset="0"> + <string><p>Smooth the curve the specified number of times prior to fitting</p></string> + </property> + </widget> + <widget class="KDoubleNumInput" row="0" column="1"> + <property name="name"> + <cstring>autotraceErrorThreshold</cstring> + </property> + <property name="value"> + <number>2</number> + </property> + <property name="toolTip" stdset="0"> + <string><p>Subdivide fitted curves that are offset by a number of pixels exceeding the specified real number</p></string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel6_2</cstring> + </property> + <property name="text"> + <string>&Error threshold:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>autotraceErrorThreshold</cstring> + </property> + <property name="toolTip" stdset="0"> + <string><p>Subdivide fitted curves that are offset by a number of pixels exceeding the specified real number</p></string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel1_5</cstring> + </property> + <property name="text"> + <string>&Line threshold:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>autotraceLineThreshold</cstring> + </property> + <property name="toolTip" stdset="0"> + <string><p>If a spline does not deviate from the straight line defined by its endpoints by more than the specified number of pixels, then treat it as a straight line.</p></string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>autotracePreserveWidth</cstring> + </property> + <property name="text"> + <string>&Preserve width</string> + </property> + <property name="accel"> + <string>Alt+P</string> + </property> + <property name="toolTip" stdset="0"> + <string><p>Preserve line width prior to thinning</p></string> + </property> + </widget> + </grid> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>TabPage</cstring> + </property> + <attribute name="title"> + <string>&Various</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QButtonGroup" row="0" column="0"> + <property name="name"> + <cstring>buttonGroup5</cstring> + </property> + <property name="title"> + <string>Object recognition</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton" row="0" column="0"> + <property name="name"> + <cstring>autotraceNoCenterline</cstring> + </property> + <property name="text"> + <string>&Outline</string> + </property> + <property name="accel"> + <string>Alt+O</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QRadioButton" row="0" column="1"> + <property name="name"> + <cstring>autotraceCenterline</cstring> + </property> + <property name="text"> + <string>C&enterline</string> + </property> + <property name="accel"> + <string>Alt+E</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox" row="1" column="0"> + <property name="name"> + <cstring>groupBox15</cstring> + </property> + <property name="title"> + <string>Tangent</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel9</cstring> + </property> + <property name="text"> + <string>&Surround:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>autotraceTangentSurround</cstring> + </property> + <property name="toolTip" stdset="0"> + <string><p>Consider the specified number of points to either side of a point when computing the tangent at that point</p></string> + </property> + </widget> + <widget class="KIntNumInput"> + <property name="name"> + <cstring>autotraceTangentSurround</cstring> + </property> + <property name="value"> + <number>3</number> + </property> + <property name="minValue"> + <number>0</number> + </property> + <property name="toolTip" stdset="0"> + <string><p>Consider the specified number of points to either side of a point when computing the tangent at that point</p></string> + </property> + </widget> + </hbox> + </widget> + <spacer row="3" column="0"> + <property name="name"> + <cstring>spacer16</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>110</height> + </size> + </property> + </spacer> + <widget class="QGroupBox" row="2" column="0"> + <property name="name"> + <cstring>groupBox16</cstring> + </property> + <property name="title"> + <string>Despeckle</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KDoubleNumInput" row="2" column="1"> + <property name="name"> + <cstring>autotraceDespeckleTightness</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="value"> + <number>2</number> + </property> + <property name="maxValue"> + <number>8</number> + </property> + <property name="toolTip" stdset="0"> + <string><p>Employ the specified real number as the value for despeckle tightness (range: 0-8)</p></string> + </property> + </widget> + <widget class="KIntNumInput" row="1" column="1"> + <property name="name"> + <cstring>autotraceDespeckleLevel</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="minValue"> + <number>1</number> + </property> + <property name="maxValue"> + <number>20</number> + </property> + <property name="toolTip" stdset="0"> + <string><p>Employ the specified integer as the value for despeckling(range: 1-20)</p></string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel10</cstring> + </property> + <property name="text"> + <string>&Level:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>autotraceDespeckleLevel</cstring> + </property> + <property name="toolTip" stdset="0"> + <string><p>Employ the specified integer as the value for despeckling(range: 1-20)</p></string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel11_2</cstring> + </property> + <property name="text"> + <string>T&ightness:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>autotraceDespeckleTightness</cstring> + </property> + <property name="toolTip" stdset="0"> + <string><p>Employ the specified real number as the value for despeckle tightness (range: 0-8)</p></string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>autotraceDoDespeckle</cstring> + </property> + <property name="text"> + <string>despec&kle</string> + </property> + <property name="accel"> + <string>Alt+K</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + </grid> + </widget> + </grid> + </widget> + </widget> + </grid> + </widget> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout6</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer12</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KActiveLabel"> + <property name="name"> + <cstring>kActiveLabel2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>NoFocus</enum> + </property> + <property name="text"> + <string>Backend:</string> + </property> + </widget> + <widget class="KComboBox"> + <item> + <property name="text"> + <string>potrace</string> + </property> + </item> + <item> + <property name="text"> + <string>autotrace</string> + </property> + </item> + <property name="name"> + <cstring>backendCombo</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer13</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer7_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>113</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>traceBtn</cstring> + </property> + <property name="text"> + <string>&Trace</string> + </property> + <property name="accel"> + <string>Alt+T</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>60</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>defaultBtn</cstring> + </property> + <property name="text"> + <string>D&efault options</string> + </property> + <property name="accel"> + <string>Alt+E</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>autoTraceCheck</cstring> + </property> + <property name="text"> + <string>Automatic Preview</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>preserveCheck</cstring> + </property> + <property name="text"> + <string>Preserve options</string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + </hbox> +</widget> +<connections> + <connection> + <sender>opaque</sender> + <signal>toggled(bool)</signal> + <receiver>backgroundBtn</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>scaleAllBTN</sender> + <signal>toggled(bool)</signal> + <receiver>scaleAll</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>scaleXYBTN</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel9_3</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>scaleXYBTN</sender> + <signal>toggled(bool)</signal> + <receiver>scaleX</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>scaleXYBTN</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel10_3</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>scaleXYBTN</sender> + <signal>toggled(bool)</signal> + <receiver>scaleY</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>resolutionAllBTN</sender> + <signal>toggled(bool)</signal> + <receiver>resolutionAll</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>resolutionXYBTN</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel1_2</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>resolutionXYBTN</sender> + <signal>toggled(bool)</signal> + <receiver>resolutionX</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>resolutionXYBTN</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel2_2</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>resolutionXYBTN</sender> + <signal>toggled(bool)</signal> + <receiver>resolutionY</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>outputFormat</sender> + <signal>activated(const QString&)</signal> + <receiver>MainWidgetBase</receiver> + <slot>showOptions(const QString&)</slot> + </connection> + <connection> + <sender>backendCombo</sender> + <signal>activated(const QString&)</signal> + <receiver>MainWidgetBase</receiver> + <slot>backendChoosen(const QString&)</slot> + </connection> + <connection> + <sender>autotraceDpiCheckbox</sender> + <signal>toggled(bool)</signal> + <receiver>autotraceDpiInput</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>autotraceUseBackground</sender> + <signal>toggled(bool)</signal> + <receiver>autotraceBackground</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>autotraceCheckBoxReduceColors</sender> + <signal>toggled(bool)</signal> + <receiver>autotraceColorCount</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>marginsL</sender> + <signal>valueChanged(double)</signal> + <receiver>MainWidgetBase</receiver> + <slot>marginValueChanged(double)</slot> + </connection> + <connection> + <sender>marginsR</sender> + <signal>valueChanged(double)</signal> + <receiver>MainWidgetBase</receiver> + <slot>marginValueChanged(double)</slot> + </connection> + <connection> + <sender>marginsB</sender> + <signal>valueChanged(double)</signal> + <receiver>MainWidgetBase</receiver> + <slot>marginValueChanged(double)</slot> + </connection> + <connection> + <sender>marginsT</sender> + <signal>valueChanged(double)</signal> + <receiver>MainWidgetBase</receiver> + <slot>marginValueChanged(double)</slot> + </connection> + <connection> + <sender>checkBoxSyncronizeMargins</sender> + <signal>toggled(bool)</signal> + <receiver>MainWidgetBase</receiver> + <slot>syncronizeMarginsChanged(bool)</slot> + </connection> + <connection> + <sender>autotraceDoDespeckle</sender> + <signal>toggled(bool)</signal> + <receiver>autotraceDespeckleLevel</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>autotraceDoDespeckle</sender> + <signal>toggled(bool)</signal> + <receiver>autotraceDespeckleTightness</receiver> + <slot>setEnabled(bool)</slot> + </connection> +</connections> +<tabstops> + <tabstop>tabWidget3</tabstop> + <tabstop>blackLevel</tabstop> + <tabstop>invertInput</tabstop> + <tabstop>foregroundBtn</tabstop> + <tabstop>opaque</tabstop> + <tabstop>backgroundBtn</tabstop> + <tabstop>outputFormat</tabstop> + <tabstop>kActiveLabel1</tabstop> + <tabstop>pageSize</tabstop> + <tabstop>optimizedNumericalCode</tabstop> + <tabstop>level2</tabstop> + <tabstop>SVGGroup</tabstop> + <tabstop>antialiasGamma</tabstop> + <tabstop>scaleAllBTN</tabstop> + <tabstop>scaleAll</tabstop> + <tabstop>scaleXYBTN</tabstop> + <tabstop>scaleX</tabstop> + <tabstop>scaleY</tabstop> + <tabstop>policy</tabstop> + <tabstop>despeckle</tabstop> + <tabstop>cornerThreshold</tabstop> + <tabstop>optimizationTolerance</tabstop> + <tabstop>outputQuantization</tabstop> + <tabstop>curveOptimization</tabstop> + <tabstop>width</tabstop> + <tabstop>height</tabstop> + <tabstop>stretch</tabstop> + <tabstop>rotation</tabstop> + <tabstop>resolutionAllBTN</tabstop> + <tabstop>resolutionAll</tabstop> + <tabstop>resolutionX</tabstop> + <tabstop>resolutionY</tabstop> + <tabstop>marginsL</tabstop> + <tabstop>marginsR</tabstop> + <tabstop>marginsT</tabstop> + <tabstop>marginsB</tabstop> + <tabstop>checkBoxSyncronizeMargins</tabstop> + <tabstop>autotraceTabs</tabstop> + <tabstop>autotraceOutputFormat</tabstop> + <tabstop>autotraceDpiCheckbox</tabstop> + <tabstop>autotraceDpiInput</tabstop> + <tabstop>autotraceCheckBoxReduceColors</tabstop> + <tabstop>autotraceColorCount</tabstop> + <tabstop>autotraceUseBackground</tabstop> + <tabstop>autotraceBackground</tabstop> + <tabstop>autotraceLog</tabstop> + <tabstop>autotraceThreshold</tabstop> + <tabstop>autotraceAlwaysThreshold</tabstop> + <tabstop>autotraceSurround</tabstop> + <tabstop>autotraceAdjacentCorners</tabstop> + <tabstop>autotraceErrorThreshold</tabstop> + <tabstop>autotraceReversionThreshold</tabstop> + <tabstop>autotraceIterations</tabstop> + <tabstop>autotracePreserveWidth</tabstop> + <tabstop>autotraceNoCenterline</tabstop> + <tabstop>autotraceTangentSurround</tabstop> + <tabstop>autotraceDespeckleLevel</tabstop> + <tabstop>autotraceDespeckleTightness</tabstop> + <tabstop>kActiveLabel2</tabstop> + <tabstop>backendCombo</tabstop> + <tabstop>traceBtn</tabstop> + <tabstop>defaultBtn</tabstop> + <tabstop>autoTraceCheck</tabstop> + <tabstop>preserveCheck</tabstop> + <tabstop>imagesTabs</tabstop> +</tabstops> +<slots> + <slot access="protected">showOptions( const QString & )</slot> + <slot access="protected">backendChoosen( const QString & )</slot> + <slot>valueChanged()</slot> + <slot>marginValueChanged( double )</slot> + <slot>syncronizeMarginsChanged( bool isChecked )</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>ksqueezedtextlabel.h</includehint> + <includehint>kcombobox.h</includehint> + <includehint>kcombobox.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>kactivelabel.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>kcombobox.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>kcombobox.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>kactivelabel.h</includehint> + <includehint>kcombobox.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..377314a --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,34 @@ +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = potracegui.h autotraceformats.h mainwidget.h options.h + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/potracegui.pot + +KDE_ICON = potracegui + +######################################################################### +# APPLICATION SECTION +######################################################################### +# this is the program that gets installed. it's name is used for all +# of the other Makefile.am variables +bin_PROGRAMS = potracegui + +# the application source, library search path, and link libraries +potracegui_SOURCES = main.cpp potracegui.cpp autotraceformats.cpp MainWidgetBase.ui mainwidget.cpp options.cpp +potracegui_LDFLAGS = $(KDE_RPATH) $(all_libraries) +potracegui_LDADD = $(LIB_KIO) $(LIB_KDEUI) + +# this is where the desktop file will go +shelldesktopdir = $(kde_appsdir)/Utilities +shelldesktop_DATA = potracegui.desktop + +# this is where the shell's XML-GUI resource file goes +shellrcdir = $(kde_datadir)/potracegui +shellrc_DATA = potraceguiui.rc + diff --git a/src/autotraceformats.cpp b/src/autotraceformats.cpp new file mode 100644 index 0000000..4f8ff9c --- /dev/null +++ b/src/autotraceformats.cpp @@ -0,0 +1,71 @@ +/*************************************************************************** + * Copyright (C) 2004 by Antonio Fasolato * + * Antonio.Fasolato@poste.it * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ +#include "autotraceformats.h" + +AutotraceFormats::AutotraceFormats(QObject *parent, const char *name): QObject(parent, name), allOK(true) { + inputProcess=new QProcess(this); + outputProcess=new QProcess(this); + + inputProcess->addArgument("autotrace"); + inputProcess->addArgument("--list-input-formats"); + + outputProcess->addArgument("autotrace"); + outputProcess->addArgument("--list-output-formats"); + + connect(inputProcess,SIGNAL(readyReadStderr()),this,SLOT(inputRead())); + connect(outputProcess,SIGNAL(readyReadStderr()),this,SLOT(outputRead())); + + if(!(inputProcess->start()) || !(outputProcess->start())) { + allOK=false; + } +} + +void AutotraceFormats::inputRead( ) { + while(inputProcess->canReadLineStderr()) { + input+=inputProcess->readLineStderr(); + } +} + +void AutotraceFormats::outputRead( ) { + while(outputProcess->canReadLineStderr()) { + QString tmp=outputProcess->readLineStderr(); + if(!(tmp.startsWith("Supported"))) + output+=tmp.stripWhiteSpace(); + } +} + +bool AutotraceFormats::OK( ) { + return allOK; +} + +bool AutotraceFormats::done( ) { + return (!(inputProcess->isRunning()) && !(outputProcess->isRunning())); +} + +QStringList AutotraceFormats::inputFormats( ) { + return input; +} + +QStringList AutotraceFormats::outputFormats( ) { + return output; +} + + +#include "autotraceformats.moc" diff --git a/src/autotraceformats.h b/src/autotraceformats.h new file mode 100644 index 0000000..00359d8 --- /dev/null +++ b/src/autotraceformats.h @@ -0,0 +1,86 @@ +/*************************************************************************** + * Copyright (C) 2004 by Antonio Fasolato * + * Antonio.Fasolato@poste.it * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ +#ifndef AUTOTRACEFORMATS_H +#define AUTOTRACEFORMATS_H + +#include <qobject.h> +#include <qstringlist.h> +#include <qprocess.h> + +//! Class to read autotrace input and output formats +/** This class executes autotrace to gain informations about the formats it can use + * \author Antonio Fasolato + */ +class AutotraceFormats : public QObject +{ +Q_OBJECT +public: + //! Standard QObject-like constructor + /** The constructor, nothing fancy + * \param parent The parent of the QObject + * \param name The name of the QObject + */ + AutotraceFormats(QObject *parent = 0, const char *name = 0); + //!Returns the list of supported input formats + /** This class returns the list of formats returned by <code>autotrace -list-input-formats</code> + * \return The supported formats + */ + QStringList inputFormats(); + //!Returns the list of supported output formats + /** This class returns the list of formats returned by <code>autotrace -list-output-formats</code> + * \return The supported formats + */ + QStringList outputFormats(); + //! Function to test the execution of autotrace + /** This functions returns <code>true</code> if the autotrace command could be run succesfully. If it returns + * <code>false</code> autotrace executable can not be found in the environment + * \return <code>true</code> if autotrace ran, <code>false</code> otherways + */ + bool OK(); + //! Tests if the class has ended its work + /** This class tests if the autotrace processes ended, thus completing the formats listing + * \return <code>true</code> if the processes has ended, <code>false</code> otherways + */ + bool done(); + +private: + //! The process to get input formats + QProcess *inputProcess; + //! The process to get output formats + QProcess *outputProcess; + //! The list of input formats + QStringList input; + //! The list of output formats + QStringList output; + //! <code>true</code> if autotrace could be run + bool allOK; + +private slots: + //! Reads from inputProcess stderr + /** Reads, when possible, the output of AutotraceFormats::inputProcess + */ + void inputRead(); + //! Reads from outputProcess stderr + /** Reads, when possible, the output of AutotraceFormats::outputProcess + */ + void outputRead(); +}; + +#endif diff --git a/src/hi16-app-potracegui.png b/src/hi16-app-potracegui.png Binary files differnew file mode 100644 index 0000000..1160eab --- /dev/null +++ b/src/hi16-app-potracegui.png diff --git a/src/hi32-app-potracegui.png b/src/hi32-app-potracegui.png Binary files differnew file mode 100644 index 0000000..82121d6 --- /dev/null +++ b/src/hi32-app-potracegui.png diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..d0d8a76 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,57 @@ +/*************************************************************************** + * Copyright (C) 2004 by Antonio Fasolato * + * Antonio.Fasolato@poste.it * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include "potracegui.h" + +#include <kapplication.h> +#include <kaboutdata.h> +#include <kcmdlineargs.h> +#include <klocale.h> + +static const char description[] = + I18N_NOOP("An interface for potrace and autotrace"); + +static KCmdLineOptions options[] = +{ + { "+[URL]", I18N_NOOP( "Document to open" ), 0 }, + KCmdLineLastOption +}; + +int main(int argc, char **argv) +{ + KAboutData about("potracegui", I18N_NOOP("potracegui"), "1.3", description, + KAboutData::License_GPL, "(C) 2004 Antonio Fasolato", 0, 0, "Antonio.Fasolato@poste.it"); + about.addAuthor( "Antonio Fasolato", 0, "Antonio.Fasolato@poste.it" ); + about.addCredit( "Tim Fechtner", I18N_NOOP("German translation"), "Tim.Fechtner@gmx.de"); + KCmdLineArgs::init(argc, argv, &about); + KCmdLineArgs::addCmdLineOptions( options ); + KApplication app; + potracegui *firstWidget = 0; + + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + + firstWidget = new potracegui(); + firstWidget->show(); + + args->clear(); + + return app.exec(); +} + diff --git a/src/mainwidget.cpp b/src/mainwidget.cpp new file mode 100644 index 0000000..6e85ce1 --- /dev/null +++ b/src/mainwidget.cpp @@ -0,0 +1,1055 @@ +/*************************************************************************** + * Copyright (C) 2004 by Antonio Fasolato * + * Antonio.Fasolato@poste.it * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + + +#include "mainwidget.h" +#include "options.h" +#include "autotraceformats.h" + +#include <qcheckbox.h> +#include <qradiobutton.h> +#include <qbuffer.h> +#include <qbuttongroup.h> +#include <qtabwidget.h> +#include <qcursor.h> +#include <qapplication.h> +#include <qwidgetstack.h> +#include <qglobal.h> + +#include <kurldrag.h> +#include <kfiledialog.h> +#include <kimageio.h> +#include <kio/netaccess.h> +#include <klocale.h> +#include <knuminput.h> +#include <kcombobox.h> +#include <kcolorbutton.h> +#include <kpushbutton.h> +#include <kmessagebox.h> + +#include <cstdlib> +#include <fstream> +using namespace std; + +MainWidget::MainWidget(QWidget* parent, const char* name, WFlags fl): MainWidgetBase(parent,name,fl), m_changed(false) { + KImageIO::registerFormats(); + + setAcceptDrops(true); + + /*Scrolled image viewers*/ + delete imagesTabs->page(0); + QScrollView *originalScroll=new QScrollView(this); + QScrollView *previewScroll=new QScrollView(this); + imagesTabs->addTab(originalScroll,i18n("Original image")); + imagesTabs->addTab(previewScroll,i18n("Preview")); + originalLabel=new QLabel(this); + previewLabel=new QLabel(this); + originalLabel->setGeometry(0,0,10,10); + previewLabel->setGeometry(0,0,10,10); + originalScroll->addChild(originalLabel); + previewScroll->addChild(previewLabel); + + /*Load default options*/ + marginValueSynconizingNecessary=true; + Options *o=new Options(); + o->defaultOptions(); + m_state.clear(); + m_oldPreviews.clear(); + m_state.push_back(o); + m_oldPreviews.push_back(QPixmap()); + m_currentState=m_state.begin(); + m_currentPreview=m_oldPreviews.begin(); + + connect(&tracer,SIGNAL(processExited()),this,SLOT(tracerExited())); + connect(&tracer,SIGNAL(wroteToStdin()),this,SLOT(writeCompleted())); + connect(traceBtn,SIGNAL(clicked()),this,SLOT(trace())); + connect(defaultBtn,SIGNAL(clicked()),this,SLOT(defaultOptions())); + + emit(signalChangeStatusbar(i18n("Checking autotrace formats."))); + AutotraceFormats *formats=new AutotraceFormats(); + if(formats->OK()) { + while(!(formats->done())); //wait till AutotraceFormats has finished + autotraceOutputFormat->insertStringList(formats->outputFormats()); + emit(signalChangeStatusbar(i18n("Done."))); + } + else { + emit(signalChangeStatusbar(i18n("Autotrace not found."))); + backendCombo->setEnabled(false); + } + + readOptions(); +} + +MainWidget::~MainWidget() { + if (tracer.isRunning()) + tracer.tryTerminate(); + if(m_tmpFilename!="") + deleteTmpFilename(); +} + +void MainWidget::fileOpen() { + KFileDialog d(QString::null,KImageIO::pattern(),this,i18n("Select an image"),true); + d.exec(); + + if(d.result()==QDialog::Accepted) + getImageFromURL(d.selectedURL()); +} + +void MainWidget::fileSave() { + if(m_outputFilename=="" && m_changed) + { + QString filter; + if(backendCombo->currentText()=="potrace") { //potrace formats + if((**m_currentState)["outputFormat"]==i18n("eps")) + filter=i18n("*.eps|Encapsulated postscript"); + else if((**m_currentState)["outputFormat"]==i18n("postscript")) + filter=i18n("*.ps|Postscript"); + else if((**m_currentState)["outputFormat"]==i18n("SVG")) + filter=i18n("*.svg|SVG images"); + else if((**m_currentState)["outputFormat"]==i18n("Gimp path")) + filter=i18n("*.*|Gimp path"); + else if((**m_currentState)["outputFormat"]==i18n("Xfig")) + filter=i18n("*.fig|XFig drawing"); + else + filter=i18n("*.pgm|PGM image"); + } + else { //autotrace formats + filter="*."+(**m_currentState)["outputFormat"]; + } + QString saveFilename=KFileDialog::getSaveFileName(QString::null,filter,this,i18n("Select the file to save to")); + + bool salva=false; + while(saveFilename!="") + { + int res; + if(QFile::exists(saveFilename)) + res=KMessageBox::warningYesNo(this, i18n("Overwrite %1 ?").arg(saveFilename)); + else + { + salva=true; + break; + } + if(res==KMessageBox::Yes) + { + salva=true; + break; + } + else + saveFilename=KFileDialog::getSaveFileName(QString::null,filter,this,i18n("Select the file to save to")); + } + + if(salva) + { + m_outputFilename=saveFilename; + ifstream in(m_tmpFilename); + ofstream out(m_outputFilename); + if(!in || !out) + { + emit signalChangeStatusbar(i18n(i18n("Error while saving file"))); + return; + } + emit signalChangeStatusbar(i18n("Saving %1...").arg(m_outputFilename)); + char ch; + while(in.get(ch)) + out.put(ch); + in.close(); + out.close(); + m_changed=false; + emit signalChangeStatusbar(i18n("File %1 saved.").arg(m_outputFilename)); + } + else + emit signalChangeStatusbar(i18n("File not saved")); + } + else if (m_changed) + { + ifstream in(m_tmpFilename); + ofstream out(m_outputFilename); + if(!in || !out) + { + emit signalChangeStatusbar(i18n("Error while saving file")); + return; + } + emit signalChangeStatusbar(i18n("Saving %1...").arg(m_outputFilename)); + char ch; + while(in.get(ch)) + out.put(ch); + + in.close(); + out.close(); + emit signalChangeStatusbar(i18n("File %1 saved.").arg(m_outputFilename)); + m_changed=false; + } +} + +void MainWidget::fileSaveAs() { + if(previewLabel->pixmap()!=0 || previewLabel->text()!="") + { + QString filter; + if(backendCombo->currentText()=="potrace") { //potrace formats + if((**m_currentState)["outputFormat"]==i18n("eps")) + filter=i18n("*.eps|Encapsulated postscript"); + else if((**m_currentState)["outputFormat"]==i18n("postscript")) + filter=i18n("*.ps|Postscript"); + else if((**m_currentState)["outputFormat"]==i18n("SVG")) + filter=i18n("*.svg|SVG images"); + else if((**m_currentState)["outputFormat"]==i18n("Gimp path")) + filter=i18n("*.*|Gimp path"); + else if((**m_currentState)["outputFormat"]==i18n("Xfig")) + filter=i18n("*.fig|XFig drawing"); + else + filter=i18n("*.pgm|PGM image"); + } + else { //autotrace formats + filter="*."+(**m_currentState)["outputFormat"]; + } + QString saveFilename=KFileDialog::getSaveFileName(QString::null,filter,this,i18n("Select the file to save to")); + + bool salva=false; + while(saveFilename!="") + { + int res; + if(QFile::exists(saveFilename)) + res=KMessageBox::warningYesNo(this,i18n("Overwrite %1 ?").arg(saveFilename)); + else + { + salva=true; + break; + } + if(res==KMessageBox::Yes) + { + salva=true; + break; + } + else + saveFilename=KFileDialog::getSaveFileName(QString::null,filter,this,i18n("Select the file to save to")); + } + + if(salva) + { + m_outputFilename=saveFilename; + ifstream in(m_tmpFilename); + ofstream out(m_outputFilename); + if(!in || !out) + { + emit signalChangeStatusbar(i18n("Error while saving file")); + return; + } + emit signalChangeStatusbar(i18n("Saving %1...").arg(m_outputFilename)); + char ch; + while(in.get(ch)) + out.put(ch); + in.close(); + out.close(); + m_changed=false; + emit signalChangeStatusbar(i18n("File %1 saved.").arg(m_outputFilename)); + } + else + emit signalChangeStatusbar(i18n("File not saved")); + } +} + +void MainWidget::fileClose() { + originalLabel->clear(); + originalLabel->setGeometry(0,0,10,10); + previewLabel->clear(); + previewLabel->setGeometry(0,0,10,10); + if(m_tmpFilename!="" && !deleteTmpFilename()) + emit signalChangeStatusbar(i18n("Warning: could not remove temporary file.")); + Options *o=new Options(); + o->defaultOptions(); + m_state.clear(); + m_oldPreviews.clear(); + m_state.push_back(o); + m_oldPreviews.push_back(QPixmap()); + m_currentState=m_state.begin(); + m_currentPreview=m_oldPreviews.begin(); + readOptions(); +} + +void MainWidget::cut() { + if(originalLabel->pixmap()!=0) + { + QApplication::clipboard()->setPixmap(QPixmap(*(originalLabel->pixmap()))); + fileClose(); + } +} + +void MainWidget::copy() { + if(originalLabel->pixmap()!=0) + { + QApplication::clipboard()->setPixmap(QPixmap(*(originalLabel->pixmap()))); + } +} + +void MainWidget::paste() { + QPixmap clip=QApplication::clipboard()->pixmap(); + if(!clip.isNull()) + { + if(!createTmpFilename()) + { + emit signalChangeStatusbar(i18n("Could not create temporary filename")); + return; + } + + m_outputFilename=""; + QPixmap pix(QApplication::clipboard()->pixmap()); + originalLabel->clear(); + originalLabel->setGeometry(0,0,pix.width(),pix.height()); + originalLabel->setPixmap(pix); + previewLabel->clear(); + previewLabel->setGeometry(0,0,10,10); + imagesTabs->setCurrentPage(0); + emit signalChangeStatusbar(i18n("Image pasted.")); + + Options *o=new Options(); + if (!preserveCheck->isChecked()) + { //I have to reset the options + o->defaultOptions(); + } + else + { + o=*m_currentState; + } + m_state.clear(); + m_oldPreviews.clear(); + m_state.push_back(o); + if(previewLabel->pixmap()!=0) + m_oldPreviews.push_back(*(previewLabel->pixmap())); + else + m_oldPreviews.push_back(QPixmap()); + m_currentState=m_state.begin(); + m_currentPreview=m_oldPreviews.begin(); + + readOptions(); + } +} + +void MainWidget::getImageFromURL(KURL url) { + QString filename; // prevent overwriting previous local file with current remote one + if (!url.isLocalFile()) + { // download to temporary file + if (!KIO::NetAccess::download(url,filename,this)) + emit signalChangeStatusbar(i18n("Selected URL is not a valid image.")); + return; + } + else + filename=url.path(); + + if(!createTmpFilename()) + { + emit signalChangeStatusbar(i18n("Could not create temporary filename.")); + return; + } + + m_outputFilename=""; + QPixmap pix(filename); + originalLabel->clear(); + originalLabel->setGeometry(0,0,pix.width(),pix.height()); + originalLabel->setPixmap(pix); + previewLabel->clear(); + previewLabel->setGeometry(0,0,10,10); + imagesTabs->setCurrentPage(0); + emit signalChangeStatusbar(i18n("File %1 loaded.").arg(filename)); + + if (!url.isLocalFile()) + KIO::NetAccess::removeTempFile(filename); + + Options *o=new Options(); + if (!preserveCheck->isChecked()) + { //I have to reset the options + o->defaultOptions(); + } + else + { + o=*m_currentState; + } + m_state.clear(); + m_oldPreviews.clear(); + m_state.push_back(o); + if(previewLabel->pixmap()!=0) + m_oldPreviews.push_back(*(previewLabel->pixmap())); + else + m_oldPreviews.push_back(QPixmap()); + m_currentState=m_state.begin(); + m_currentPreview=m_oldPreviews.begin(); + + readOptions(); +} + +void MainWidget::readOptions() { + //input + blackLevel->setValue(((**m_currentState)["blackLevel"]).toFloat()); + invertInput->setChecked((**m_currentState)["invertInput"]=="y"); + + //output + outputFormat->setCurrentText((**m_currentState)["outputFormat"]); + if((**m_currentState)["outputFormat"]==i18n("eps") || (**m_currentState)["outputFormat"]==i18n("postscript")) + { //eps format + pageSize->setCurrentText((**m_currentState)["pageSize"]); + optimizedNumericalCode->setChecked((**m_currentState)["optimizedNumericalCode"]=="y"); + level1->setChecked((**m_currentState)["compressionLevel"]=="1"); + level2->setChecked((**m_currentState)["compressionLevel"]=="2"); + level3->setChecked((**m_currentState)["compressionLevel"]=="3"); + } + else if((**m_currentState)["outputFormat"]==i18n("SVG")) //SVG format + SVGGroup->setChecked((**m_currentState)["SVGGroup"]=="y"); + else if((**m_currentState)["outputFormat"]==i18n("Gimp path")); //Gimp format + else if((**m_currentState)["outputFormat"]==i18n("Xfig path")); //Xfig format + else + { //pgm format + antialiasGamma->setValue(((**m_currentState)["antialiasGamma"]).toFloat()); + //Scale + if(((**m_currentState)["scale"]).find('x')==-1) + { //only one value + scaleAll->setValue(((**m_currentState)["scale"]).toFloat()); + scaleAllBTN->setChecked(true); + } + else + { + QString tmp=(**m_currentState)["scale"]; + scaleX->setValue((tmp.section('x',0,0)).toFloat()); + scaleY->setValue((tmp.section('x',1,1)).toFloat()); + scaleXYBTN->setChecked(true); + } + } + + //Color + foregroundBtn->setColor(QColor((**m_currentState)["foregroundBtn"])); + opaque->setChecked((**m_currentState)["opaque"]=="y"); + backgroundBtn->setColor(QColor((**m_currentState)["backgroundBtn"])); + + //Algorithm + policy->setCurrentItem(((**m_currentState)["policy"]).toInt()); + despeckle->setValue(((**m_currentState)["despeckle"]).toInt()); + cornerThreshold->setValue(((**m_currentState)["cornerThreshold"]).toFloat()); + optimizationTolerance->setValue(((**m_currentState)["optimizationTolerance"]).toFloat()); + outputQuantization->setValue(((**m_currentState)["outputQuantization"]).toInt()); + curveOptimization->setChecked((**m_currentState)["curveOptimization"]=="y"); + + //Transformation + width->setValue(((**m_currentState)["width"]).toFloat()); + height->setValue(((**m_currentState)["height"]).toFloat()); + stretch->setValue(((**m_currentState)["stretch"]).toFloat()); + rotation->setValue(((**m_currentState)["rotation"]).toFloat()); + + //Resolution + if(((**m_currentState)["resolution"]).find('x')==-1) + { //only one value + resolutionAll->setValue(((**m_currentState)["resolution"]).toFloat()); + resolutionAllBTN->setChecked(true); + } + else + { + QString tmp=(**m_currentState)["resolution"]; + resolutionX->setValue((tmp.section('x',0,0)).toFloat()); + resolutionY->setValue((tmp.section('x',1,1)).toFloat()); + resolutionXYBTN->setChecked(true); + } + + //Margins + QString tmp=(**m_currentState)["margins"]; + marginsL->setValue((tmp.section('x',0,0)).toFloat()); + marginsR->setValue((tmp.section('x',1,1)).toFloat()); + marginsT->setValue((tmp.section('x',2,2)).toFloat()); + marginsB->setValue((tmp.section('x',3,3)).toFloat()); + checkBoxSyncronizeMargins->setChecked((**m_currentState)["syncronizeMargins"]=="y"); + + //missing restoring for autotrace interface part + +} + +void MainWidget::getOptions() { + if(backendCombo->currentText()=="potrace") + getPotraceOptions(); + else + getAutotraceOptions(); +} + +void MainWidget::getPotraceOptions( ) { + //input-output + (*m_currentState)->setValue("blackLevel",QString::number(blackLevel->value())); + if(invertInput->isChecked()) + (*m_currentState)->setValue("invertInput","y"); + else + (*m_currentState)->setValue("invertInput","n"); + (*m_currentState)->setValue("outputFormat",outputFormat->currentText()); + if(outputFormat->currentText()==i18n("eps") || outputFormat->currentText()==i18n("postscript")) + { //ps options + (*m_currentState)->setValue("pageSize",pageSize->currentText()); + (*m_currentState)->setValue("optimizedNumericalCode",(optimizedNumericalCode->isChecked())?"y":"n"); + QButton *b=compressionLevel->selected(); + if(b->text()=="None") + (*m_currentState)->setValue("compressionLevel","1"); + else if(b->text()=="Level 2") + (*m_currentState)->setValue("compressionLevel","2"); + else + (*m_currentState)->setValue("compressionLevel","3"); + } + else if(outputFormat->currentText()==i18n("SVG")) + { //SVG options + (*m_currentState)->setValue("SVGGroup",(SVGGroup->isChecked())?"y":"n"); + } + else if(outputFormat->currentText()==i18n("Gimp path")) + { //Gimp options + } + else if(outputFormat->currentText()==i18n("Xfig")) + { //Xfig options + } + else + { //pgm options + (*m_currentState)->setValue("antialiasGamma",QString::number(antialiasGamma->value())); + //Scale + if(scaleAll->isEnabled()) + (*m_currentState)->setValue("scale",QString::number(scaleAll->value())); + else + (*m_currentState)->setValue("scale",QString::number(scaleX->value())+"x"+QString::number(scaleY->value())); + } + + //Color + QColor c=foregroundBtn->color(); + (*m_currentState)->setValue("foregroundBtn",c.name()); + (*m_currentState)->setValue("opaque",(opaque->isChecked())?"y":"n"); + c=backgroundBtn->color(); + (*m_currentState)->setValue("backgroundBtn",c.name()); + + //Algorithm + (*m_currentState)->setValue("policy",QString::number(policy->currentItem())); + (*m_currentState)->setValue("despeckle",QString::number(despeckle->value())); + (*m_currentState)->setValue("cornerThreshold",QString::number(cornerThreshold->value())); + (*m_currentState)->setValue("optimizationTolerance",QString::number(optimizationTolerance->value())); + (*m_currentState)->setValue("outputQuantization",QString::number(outputQuantization->value())); + (*m_currentState)->setValue("curveOptimization",(curveOptimization->isChecked())?"y":"n"); + + //Transformation + (*m_currentState)->setValue("width",QString::number(width->value())); + (*m_currentState)->setValue("height",QString::number(height->value())); + (*m_currentState)->setValue("stretch",QString::number(stretch->value())); + (*m_currentState)->setValue("rotation",QString::number(rotation->value())); + + //Resolution + if(resolutionAll->isEnabled()) + (*m_currentState)->setValue("resolution",QString::number(resolutionAll->value())); + else + (*m_currentState)->setValue("resolution",QString::number(resolutionX->value())+"x"+QString::number(resolutionY->value())); + + //Margins + (*m_currentState)->setValue("syncronizeMargins",checkBoxSyncronizeMargins->isChecked()?"y":"n"); + (*m_currentState)->setValue("margins",QString::number(marginsL->value())+"x"+QString::number(marginsR->value())+"x"+QString::number(marginsT->value())+"x"+QString::number(marginsB->value())); +} + +void MainWidget::getAutotraceOptions( ) { + Options *opt=*m_currentState; + + opt->clear(); + + //input output + QString tmp=autotraceOutputFormat->currentText(); + tmp.truncate(tmp.find(" ")); + opt->setValue("outputFormat",tmp); + if(autotraceDpiCheckbox->isChecked() && autotraceDpiInput->value()!=0) + opt->setValue("dpi",QString::number(autotraceDpiInput->value())); + opt->setValue("reduceColorsEnabled",(autotraceCheckBoxReduceColors->isChecked())?"y":"n"); + opt->setValue("colorCount",QString::number(autotraceColorCount->value())); + if(autotraceUseBackground->isChecked()) + opt->setValue("background",autotraceBackground->color().name().upper()); + if(autotraceLog->isChecked()) + opt->setValue("log","y"); + + //corners and curves + if(autotraceThreshold->value()!=100) + opt->setValue("threshold",QString::number(autotraceThreshold->value())); + if(autotraceAlwaysThreshold->value()!=60) + opt->setValue("alwaysThreshold",QString::number(autotraceAlwaysThreshold->value())); + if(autotraceSurround->value()!=4) + opt->setValue("surround",QString::number(autotraceSurround->value())); + if(autotraceAdjacentCorners->isChecked()) + opt->setValue("removeAdjacentCorners","y"); + if(autotraceErrorThreshold->value()!=2) + opt->setValue("errorThreshold",QString::number(autotraceErrorThreshold->value())); + if(autotraceLineThreshold->value()!=1) + opt->setValue("lineThreshold",QString::number(autotraceLineThreshold->value())); + if(autotraceReversionThreshold->value()!=0.01) + opt->setValue("reversionThreshold",QString::number(autotraceReversionThreshold->value())); + if(autotraceIterations->value()!=4) + opt->setValue("iterations",QString::number(autotraceIterations->value())); + if(autotracePreserveWidth->isChecked()) + opt->setValue("preserveWidth","y"); + + //various + if(autotraceCenterline->isChecked()) + opt->setValue("centerline","y"); + if(autotraceTangentSurround->value()!=3) + opt->setValue("tangentSurround",QString::number(autotraceTangentSurround->value())); + + //despeckle + opt->setValue("doDespeckle",(autotraceDoDespeckle->isChecked()?"y":"n")); + opt->setValue("despeckleLevel",QString::number(autotraceDespeckleLevel->value())); + opt->setValue("despeckleTightness",QString::number(autotraceDespeckleTightness->value())); +} + +QStringList MainWidget::createCommandLine() { + if(backendCombo->currentText()=="potrace") + return createPotraceCommandLine(); + else + return createAutotraceCommandLine(); +} + +QStringList MainWidget::createPotraceCommandLine( ) { + QStringList toReturn; + toReturn+="potrace"; + + //input + if((**m_currentState)["blackLevel"]!="0.5") //only if it is not the default value + toReturn+="-k"+(**m_currentState)["blackLevel"]; + if((**m_currentState)["invertInput"]=="y") + toReturn+="-i"; + + //output + toReturn+="-o"; + toReturn+=m_tmpFilename; + if((**m_currentState)["outputFormat"]==i18n("eps")) + { //eps format + toReturn+="-e"; + toReturn+="-P"+(**m_currentState)["pageSize"]; + toReturn+="-C"+(**m_currentState)["foregroundBtn"]; + if((**m_currentState)["opaque"]=="y") + { + toReturn+="--opaque"; + //toReturn+="--fillcolor"+(**m_currentState)["backgroundBtn"]; + } + if((**m_currentState)["optimizedNumericalCode"]=="n") + toReturn+="-q"; + if((**m_currentState)["compressionLevel"]=="1") + toReturn+="-c"; + if((**m_currentState)["compressionLevel"]=="2") + toReturn+="-2"; + if((**m_currentState)["compressionLevel"]=="3") + toReturn+="-3"; + } + else if((**m_currentState)["outputFormat"]==i18n("postscript")) + { //ps format + toReturn+="-p"; + toReturn+="-P"+(**m_currentState)["pageSize"]; + toReturn+="-C"+(**m_currentState)["foregroundBtn"]; + if((**m_currentState)["opaque"]=="y") + { + toReturn+="--opaque"; + //toReturn+="--fillcolor"+(**m_currentState)["backgroundBtn"]; + } + if((**m_currentState)["optimizedNumericalCode"]=="n") + toReturn+="-q"; + if((**m_currentState)["compressionLevel"]=="1") + toReturn+="-c"; + if((**m_currentState)["compressionLevel"]=="2") + toReturn+="-2"; + if((**m_currentState)["compressionLevel"]=="3") + toReturn+="-3"; + } + else if((**m_currentState)["outputFormat"]==i18n("SVG")) + { //SVG format + toReturn+="-s"; + toReturn+="-C"+(**m_currentState)["foregroundBtn"]; + if((**m_currentState)["opaque"]=="y") + { + toReturn+="--opaque"; + //toReturn+="--fillcolor"+(**m_currentState)["backgroundBtn"]; + } + if((**m_currentState)["SVGGroup"]=="y") + toReturn+="--group"; + } + else if((**m_currentState)["outputFormat"]==i18n("Gimp path")) + { //Gimp format + toReturn+="-bgimppath"; + } + else if((**m_currentState)["outputFormat"]==i18n("Xfig")) + { //Xfig format + toReturn+="-bxfig"; + toReturn+="-C"+(**m_currentState)["foregroundBtn"]; + if((**m_currentState)["opaque"]=="y") + { + toReturn+="--opaque"; + //toReturn+="--fillcolor"+(**m_currentState)["backgroundBtn"]; + } + } + else + { //pgm format + toReturn+="-g"; + toReturn+="-G"+(**m_currentState)["antialiasGamma"]; + if((**m_currentState)["opaque"]=="y") + { + toReturn+="--opaque"; + //toReturn+="--fillcolor"+(**m_currentState)["backgroundBtn"]; + } + } + + //Algorithm + switch((**m_currentState)["policy"].toInt()) { + case 0: + toReturn+="-zblack"; + break; + case 1: + toReturn+="-zwhite"; + break; + case 2: + toReturn+="-zright"; + break; + case 3: + toReturn+="-zleft"; + break; + case 4: + toReturn+="-zminority"; + break; + case 5: + toReturn+="-zmajority"; + break; + case 6: + toReturn+="-zrandom"; + break; + default: + toReturn+="-zminority"; + break; + } + toReturn+="-t"+(**m_currentState)["despeckle"]; + toReturn+="-a"+(**m_currentState)["cornerThreshold"]; + toReturn+="-O"+(**m_currentState)["optimizationTolerance"]; + toReturn+="-u"+(**m_currentState)["outputQuantization"]; + if((**m_currentState)["curveOptimization"]=="n") + toReturn+="-n"; + + //Transformation + if((**m_currentState)["width"]!="0") + toReturn+="-W"+(**m_currentState)["width"]+"cm"; + if((**m_currentState)["height"]!="0") + toReturn+="-H"+(**m_currentState)["height"]+"cm"; + if((**m_currentState)["stretch"]!="1") + toReturn+="-S"+(**m_currentState)["stretch"]; + if((**m_currentState)["rotation"]!="0") + toReturn+="-A"+(**m_currentState)["rotation"]; + + //Resolution + if((**m_currentState)["resolution"]!="0" && (**m_currentState)["resolution"]!="0x0") + toReturn+="-r"+(**m_currentState)["resolution"]; + + //Margins + if((**m_currentState)["margins"]!="0" && (**m_currentState)["margins"]!="0x0x0x0") + { + if((**m_currentState)["margins"].find('x')==-1) + toReturn+="-M"+(**m_currentState)["margins"]+"cm"; + else + { + QString tmp=(**m_currentState)["margins"]; + toReturn+="-L"+tmp.section('x',0,0)+"cm"; + toReturn+="-R"+tmp.section('x',1,1)+"cm"; + toReturn+="-T"+tmp.section('x',2,2)+"cm"; + toReturn+="-B"+tmp.section('x',3,3)+"cm"; + } + } + + return toReturn; +} + +QStringList MainWidget::createAutotraceCommandLine( ) { + QStringList toReturn; + QString tmp; + toReturn+="autotrace"; + + //iput-output + toReturn+="--output-file"; + toReturn+=m_tmpFilename; + toReturn+="-output-format"; + toReturn+=(**m_currentState)["outputFormat"]; + if((**m_currentState)["dpi"]!="") + toReturn+="--dpi="+(**m_currentState)["dpi"]; + if((**m_currentState)["reduceColorsEnabled"]=="y") + toReturn+="--color-count="+(**m_currentState)["colorCount"]; + if((**m_currentState)["background"]!="") { + tmp=(**m_currentState)["background"]; + tmp=tmp.right(tmp.length()-1); + toReturn+="-background-color="+tmp; + } + if((**m_currentState)["log"]=="y") + toReturn+="-log"; + + //corner and curves + if((**m_currentState)["threshold"]!="") + toReturn+="--corner-threshold="+(**m_currentState)["threshold"]; + if((**m_currentState)["alwaysThreshold"]!="") + toReturn+="--corner-always-threshold="+(**m_currentState)["alwaysThreshold"]; + if((**m_currentState)["surround"]!="") + toReturn+="--corner-surround="+(**m_currentState)["surround"]; + if((**m_currentState)["removeAdjacentCorners"]=="y") + toReturn+="--remove-adjacent-corners"; + if((**m_currentState)["errorThreshold"]!="") + toReturn+="--error-threshold="+(**m_currentState)["errorThreshold"]; + if((**m_currentState)["lineThreshold"]!="") + toReturn+="--line-threshold="+(**m_currentState)["lineThreshold"]; + if((**m_currentState)["reversionThreshold"]!="") + toReturn+="--line-reversion-threshold="+(**m_currentState)["reversionThreshold"]; + if((**m_currentState)["iterations"]!="") + toReturn+="--filter-iterations="+(**m_currentState)["iterations"]; + if((**m_currentState)["preserveWidth"]=="y") + toReturn+="--preserve-width"; + + //various + if((**m_currentState)["centerline"]=="y") + toReturn+="--centerline"; + if((**m_currentState)["tangentSurround"]!="") + toReturn+="--tangent-surround="+(**m_currentState)["tangentSurround"]; + + //despeckle + if((**m_currentState)["doDespeckle"]=="y") { + toReturn+="--despeckle-level="+(**m_currentState)["despeckleLevel"]; + toReturn+="--despeckle-tightness="+(**m_currentState)["despeckleTightness"]; + }; + + //input file + char inputFile[]="/tmp/potraceguiTmp-XXXXXX"; + mkstemp(inputFile); + m_tmpInputFilename=QString(inputFile); + originalLabel->pixmap()->save(m_tmpInputFilename,"PPM"); + toReturn+="--input-format=PPM"; + toReturn+=m_tmpInputFilename; + + qDebug("Executed:\n%s",toReturn.join(" ").ascii()); + + return toReturn; +} + +void MainWidget::trace() { + if(originalLabel->pixmap()==0) + { + emit(signalChangeStatusbar(i18n("You must open an image first."))); + return; + } + setCursor(WaitCursor); + if (tracer.isRunning()) + { // already tracing, this means abort + aborted=true; + tracer.tryTerminate(); + return; + } + aborted=false; + + getOptions(); + QStringList commandLine=createCommandLine(); + tracer.clearArguments(); + tracer.setArguments(commandLine); + + if(!(tracer.start())) + { + previewLabel->setText(i18n("The process couldn't be started\nThe process executed was:\n")+commandLine.join(" ")); + emit(signalChangeStatusbar("Error executing command")); + setCursor(ArrowCursor); + imagesTabs->setCurrentPage(1); + } + else + { + emit(signalChangeStatusbar(i18n("Tracing..."))); + traceBtn->setText(i18n("Abort")); + QByteArray pixData; + QBuffer buf(pixData); + buf.open(IO_WriteOnly); + originalLabel->pixmap()->save(&buf,"PPM"); + tracer.writeToStdin(pixData); + } +} + +void MainWidget::tracerExited() { + traceBtn->setText(i18n("&Trace")); + if (aborted) + { + emit(signalChangeStatusbar(i18n("Aborted"))); + setCursor(ArrowCursor); + return; + } + if(tracer.exitStatus()!=0) + { + emit(signalChangeStatusbar(i18n("Finished with errors"))); + QString tmp(i18n("Error during the process:")); + tmp+=i18n("Standard output:\n"); + QString t=tracer.readLineStdout(); + while(t!=QString::null) + { + tmp+= t+"\n"; + t=tracer.readLineStdout(); + } + tmp+=i18n("Standard error:\n"); + t=tracer.readLineStderr(); + while(t!=QString::null) + { + tmp+=t+"\n"; + t=tracer.readLineStderr(); + } + QStringList l=tracer.arguments(); + tmp+=i18n("Executed:\n")+l.join(" "); + previewLabel->setText(tmp); + setCursor(ArrowCursor); + imagesTabs->setCurrentPage(1); + return; + } + + if(autoTraceCheck->isChecked()) + { + emit(signalChangeStatusbar(i18n("Loading preview image..."))); + QImage img(m_tmpFilename); + QPixmap pix; + if(pix.convertFromImage(img,0)) + { + previewLabel->clear(); + previewLabel->setGeometry(0,0,pix.width(),pix.height()); + previewLabel->setPixmap(pix); + } + else + { + emit(signalChangeStatusbar(i18n("Output format not recognized"))); + previewLabel->setText(i18n("Sorry, but the image format which you are working with\nis not recognized by KDE.\nThe image will be correctly saved if you want to,\nbut to see a preview try working with another image format (EPS and PGM showld work well)\nand only when you are satisfied with the result revert to the format\nof your choiche and save the result.")); + imagesTabs->setCurrentPage(1); + setCursor(ArrowCursor); + return; + } + + imagesTabs->setCurrentPage(1); + } + + //delete autotrace tempfile + if(backendCombo->currentText()=="autotrace") { + QFile tmp(m_tmpInputFilename); + tmp.remove(); + } + + setCursor(ArrowCursor); + m_changed=true; + emit(signalChangeStatusbar(i18n("Image traced"))); +} + +void MainWidget::writeCompleted() { + tracer.closeStdin(); +} + +bool MainWidget::createTmpFilename() { + char tmp[]="/tmp/potraceguiTmp-XXXXXX"; + if (mkstemp(tmp)!=-1) + { + m_tmpFilename=QString(tmp); + return true; + } + else + return false; +} + +bool MainWidget::deleteTmpFilename() { + QFile tmp(m_tmpFilename); + bool toReturn=tmp.remove(); + if(toReturn==true) + m_tmpFilename=""; + return toReturn; +} + +int MainWidget::notificationDialog(QString caption, QString text) { + KDialogBase w(this, "potracegui", true, caption, KDialogBase::Ok|KDialogBase::Cancel,KDialogBase::Ok,true); + w.setMainWidget(new QLabel(text,&w)); + w.exec(); + return w.result(); +} + +void MainWidget::dragEnterEvent(QDragEnterEvent* event) { + event->accept(KURLDrag::canDecode(event)); +} + +void MainWidget::dropEvent(QDropEvent* event) { + KURL::List urls; + if (KURLDrag::decode(event,urls)) + { + getImageFromURL(urls[0]); + } +} + +void MainWidget::defaultOptions() { + /*Load default options*/ + backendCombo->setCurrentItem(0); + backendStack->raiseWidget(potracePage); + Options *o=new Options(); + o->defaultOptions(); + m_state.clear(); + m_oldPreviews.clear(); + m_state.push_back(o); + m_oldPreviews.push_back(QPixmap()); + m_currentState=m_state.begin(); + m_currentPreview=m_oldPreviews.begin(); + + //default options for autotrace + autotraceTabs->setCurrentPage(0); + autotraceOutputFormat->setCurrentItem(0); + autotraceDpiCheckbox->setChecked(false); + autotraceDpiInput->setValue(0); + autotraceCheckBoxReduceColors->setChecked(true); + autotraceColorCount->setValue(2); + autotraceUseBackground->setChecked(false); + autotraceBackground->setColor("#ffffff"); + autotraceLog->setChecked(false); + autotraceThreshold->setValue(100); + autotraceAlwaysThreshold->setValue(60); + autotraceSurround->setValue(4); + autotraceAdjacentCorners->setChecked(false); + autotraceErrorThreshold->setValue(2); + autotraceLineThreshold->setValue(1); + autotraceReversionThreshold->setValue(0.01); + autotraceIterations->setValue(4); + autotracePreserveWidth->setChecked(false); + autotraceNoCenterline->setChecked(true); + autotraceTangentSurround->setValue(3); + autotraceDoDespeckle->setChecked(false); + autotraceDespeckleLevel->setValue(1); + autotraceDespeckleTightness->setValue(2); + + readOptions(); + optionsStack->raiseWidget(psPage); +} + +void MainWidget::showOptions(const QString &selection) { + if(selection==i18n("SVG")) + optionsStack->raiseWidget(svgPage); + else if(selection==i18n("pgm")) + optionsStack->raiseWidget(pgmPage); + else if(selection==i18n("postscript") || selection==i18n("eps")) + optionsStack->raiseWidget(psPage); + else + optionsStack->raiseWidget(undefinedPage); +} + +void MainWidget::backendChoosen( const QString & back ) { + if(back=="potrace") + backendStack->raiseWidget(potracePage); + else + backendStack->raiseWidget(autotracePage); +} + +void MainWidget::marginValueChanged( double newValue) { + if (marginValueSynconizingNecessary and checkBoxSyncronizeMargins->isChecked()) { + marginValueSynconizingNecessary=false; + marginsL->setValue(newValue); + marginsR->setValue(newValue); + marginsT->setValue(newValue); + marginsB->setValue(newValue); + marginValueSynconizingNecessary=true; + } +} + +#include "mainwidget.moc" diff --git a/src/mainwidget.h b/src/mainwidget.h new file mode 100644 index 0000000..51f65fc --- /dev/null +++ b/src/mainwidget.h @@ -0,0 +1,200 @@ +/*************************************************************************** + * Copyright (C) 2004 by Antonio Fasolato * + * Antonio.Fasolato@poste.it * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef MAINWIDGET_H +#define MAINWIDGET_H + +#include "MainWidgetBase.h" + +#include <qstring.h> +#include <qprocess.h> +#include <qstringlist.h> +#include <qpixmap.h> +#include <qclipboard.h> +#include <qevent.h> +#include <qlabel.h> + +#include <kurl.h> + +#include <vector> +using namespace std; + +class Options; + +//! The app's main widget +/*! + * \author Antonio Fasolato <Antonio.Fasolato@poste.it> + * \version 1.2 + * + * This is the widget containing all the facilities to work with the image the user is tracing. It shows the current image and potrace output (if it exists), an interface to set the options and the buttons to control the execution of potrace. + */ +class MainWidget : public MainWidgetBase +{ + Q_OBJECT + + //! For simplicity + friend class potracegui; + +public: + //! Default constructor (all parameters are simply passed to MainWidgetBase) + MainWidget(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + //! Default destructor + ~MainWidget(); + +private: + //! Contains the temporary file name used while tracing + QString m_tmpFilename; + //! Contains the input file name for autotrace + QString m_tmpInputFilename; + //! Contains the real file name where to save the traced image + QString m_outputFilename; + //! The process of potrace (used to abort it and to control its exit status) + QProcess tracer; + //! To know if the tracing has exited normally, or it has been interrupted + bool aborted; + //! To know if the current document is different from the saved one + bool m_changed; + //! The history of the options (not used yet, it will permit undo/redo in the future) + vector<Options *> m_state; + //! The history of the previews (not used yet, it will permit undo/redo in the future) + vector<QPixmap> m_oldPreviews; + //! The current options + vector<Options *>::iterator m_currentState; + //! The current preview image + vector<QPixmap>::iterator m_currentPreview; + //! Label to display the original image + QLabel *originalLabel; + //! Label to display the traced image + QLabel *previewLabel; + + //! Retrives an image from an URL + /*! + * \param url The url of the image + * + * Retrives an image from an URL and loads into the original image viewer: if it is a local file, it simply loads it, if it is a remote URL, first it downloads it, then it loads it.<BR> + * After loading the image, it resets the options for the document (unless otherwise specified by the user.) + */ + void getImageFromURL(KURL url); + //! Gets the options from m_currentState and sets up all the widget from this informations + /*! + * \sa getOptions() + */ + void readOptions(); + //! Gets the options from all the widget and saves them into m_currentState + /*! + * \sa readOptions() + */ + void getOptions(); + //! Gets the options for potrace from all the widget and saves them into m_currentState + /*! + * \sa readOptions() + */ + void getPotraceOptions(); + //! Gets the options for autotrace from all the widget and saves them into m_currentState + /*! + * \sa readOptions() + */ + void getAutotraceOptions(); + //! Creates the command line for tracing + /*! + * It reads m_currentState and creates from all the options a commandline to be executed + * \returns A QStringList that can be used as a commandline to a QProcess + */ + QStringList createCommandLine(); + //! Creates the command line for tracing with potrace + /*! + * It reads m_currentState and creates from all the options a commandline to be executed + * \returns A QStringList that can be used as a commandline to a QProcess + */ + QStringList createPotraceCommandLine(); + //! Creates the command line for tracing with autotrace + /*! + * It reads m_currentState and creates from all the options a commandline to be executed + * \returns A QStringList that can be used as a commandline to a QProcess + */ + QStringList createAutotraceCommandLine(); + //! Sets m_tmpFilename to a new temporary filename (generated through mkstemp()) + bool createTmpFilename(); + //! Deletes the file pointed by m_tmpFilename + bool deleteTmpFilename(); + //! Shows a KDialog whit nformations + /*! + * \param caption The caption of the dialog + * \param text The text to display into the dialog + * \returns The code of the dialog button pressed. + */ + int notificationDialog(QString caption, QString text); + //! Accepts only a KURL + void dragEnterEvent(QDragEnterEvent* event); + //! Receives a KURL and loads it. + /*! + * \sa getImageFromURL() + */ + void dropEvent(QDropEvent* event); + +private slots: + //! Opens a file (whith a KFileDialog) + void fileOpen(); + //! Saves the current image + void fileSave(); + //! Saves the current image whith an alternate name + void fileSaveAs(); + //! Closes the file (and the window) + void fileClose(); + //! Cuts the original image into the clipboard + void cut(); + //! Copies the current image into the clipboard + void copy(); + //! Gets an image (if any) from the clipboard + void paste(); + //! Executed when the tracer process has ended. + /*! + * Executed when the tracer process has ended. If the process was successful it loads the traced image into the preview widget (unless otherways specified by the user) + */ + void tracerExited(); + //! Closes tracer stdin after passing the original image to it + void writeCompleted(); + //! Executes potrace whith the options specified by the user + /*! + * \sa createCommandLine() + */ + void trace(); + //! Reverts to the default options + void defaultOptions(); + //! When an output format for potrace has been selected, it shows the relevant options + void showOptions(const QString &selection); + //! When a backend has been selected, it shows the relevant options + void backendChoosen(const QString &back); + //! Syncronize margins if corresponding checkbox is checked + void marginValueChanged( double newValue); + + +signals: + //! Emitted to change the statusbar + /*! + * \param message The message to display into the statusbar + */ + void signalChangeStatusbar(QString message); +protected: + bool marginValueSynconizingNecessary; +}; + +#endif + diff --git a/src/options.cpp b/src/options.cpp new file mode 100644 index 0000000..e3aaa71 --- /dev/null +++ b/src/options.cpp @@ -0,0 +1,87 @@ +/*************************************************************************** + * Copyright (C) 2003 by Antonio Fasolato * + * Antonio.Fasolato@poste.it * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ +#include "options.h" + +#include <iostream> +#include <map> +using namespace std; + +#include <qstring.h> + +Options::Options(): options() +{ +} + +void Options::setValue(QString key, QString value) { + if(options.find(key)!=options.end()) + options.erase(options.find(key)); + map<QString,QString>::value_type v(key,value); + options.insert(v); +} + +bool Options::isEmpty() { + return options.empty(); +} + +void Options::clear() { + options.clear(); +} + +QString Options::operator[](QString key) { + if(options.find(key)!=options.end()) + return options[key]; + else + return ""; +} + +void Options::defaultOptions(){ + clear(); + + //input-output + setValue("blackLevel","0.5"); + setValue("invertInput","n"); + setValue("outputFileName",""); + setValue("outputFormat","eps"); + setValue("pageSize","letter"); + setValue("optimizedNumericalCode","y"); + setValue("compressionLevel","2"); + + //Color + setValue("foregroundBtn","#000000"); + setValue("backgroundBtn","#F8F9FB"); + + //Algorithm + setValue("policy","4"); + setValue("despeckle","0"); + setValue("cornerThreshold","1.00"); + setValue("optimizationTolerance","0.2"); + setValue("outputQuantization","10"); + setValue("curveOptimization","y"); + + //Transformation + setValue("width","0.0"); + setValue("height","0.0"); + setValue("stretch","1.0"); + setValue("rotation","0.0"); + + //Resolution + setValue("resolution","0.0"); + + //Margins + setValue("syncronizeMargins","y"); + setValue("margins","0.0"); +} + +void Options::debug() { + for(map<QString,QString>::iterator i=options.begin(); i!=options.end(); i++) + cout << (*i).first << "=" << (*i).second << endl; +} + + diff --git a/src/options.h b/src/options.h new file mode 100644 index 0000000..3ab53c0 --- /dev/null +++ b/src/options.h @@ -0,0 +1,66 @@ +/*************************************************************************** + * Copyright (C) 2003 by Antonio Fasolato * + * Antonio.Fasolato@poste.it * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ +#ifndef OPTIONS_H +#define OPTIONS_H + +#include <map> +using namespace std; + +#include <qstring.h> + + +//! Class that contains all the options for a document. +/*! + * \author Antonio Fasolato <Antonio.Fasolato@poste.it> + * \version 1.0 + * + * Class that contains all the options for a document. These options regards the most disparate values: output formats, algorithm to use with potrace...<BR> + * Mainly this class contains options relevant to potrace. + */ +class Options{ +public: + //! Default constructor + Options(); + + //! Sets a pair (key,value) in this Options object. + /*! + * \param key The name of the option. Later on it will be used to read its value + * \param value The value associated with the key + * + * Sets a pair (key,value) in this Options object. If name is not in this object, it is added. + * + * \sa operator[]() + */ + void setValue(QString key, QString value); + //! Checks if the object contains no keys + /*! + * \returns \b true if the object is empty, \b false otherwise + */ + bool isEmpty(); + //! Clears all the options in the object + void clear(); + + //! Retrives an option value from the key associated whith it + /*! + * \param key the key of the option to retrive + * \returns The value associated with the key + * \sa setValue() + */ + QString operator[](QString key); + //! Sets all the options to their default value. + void defaultOptions(); + //! Prints the list of options + void debug(); + +private: + map<QString,QString> options; /*!< The map containing the options */ +}; + +#endif diff --git a/src/potracegui.cpp b/src/potracegui.cpp new file mode 100644 index 0000000..70168b2 --- /dev/null +++ b/src/potracegui.cpp @@ -0,0 +1,158 @@ +/*************************************************************************** + * Copyright (C) 2004 by Antonio Fasolato * + * Antonio.Fasolato@poste.it * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include "potracegui.h" +#include "mainwidget.h" + +#include <qlabel.h> +#include <qclipboard.h> + +#include <kmainwindow.h> +#include <klocale.h> +#include <kstatusbar.h> +#include <ktoolbar.h> +#include <kmenubar.h> +#include <kpopupmenu.h> +#include <kstdaccel.h> +#include <kaction.h> +#include <kstdaction.h> +#include <kio/netaccess.h> +#include <kimageio.h> +#include <kkeydialog.h> +#include <kedittoolbar.h> +#include <kmessagebox.h> + +potracegui::potracegui() + : KMainWindow( 0, "potracegui" ), m_centralWidget(new MainWidget(this)) +{ + // set the shell's ui resource file + setXMLFile("potraceguiui.rc"); + KImageIO::registerFormats(); + + setCentralWidget(m_centralWidget); + + setAcceptDrops(true); + + statusBar()->show(); + statusBar()->message(i18n("Welcome to PotraceGui 1.3")); + setAutoSaveSettings(); + setAcceptDrops(true); + + connect(m_centralWidget,SIGNAL(signalChangeStatusbar(QString)),this,SLOT(changeStatusbar(QString))); + + createInterface(); +} + +potracegui::~potracegui() +{ +} + +void potracegui::createInterface() +{ + /*handled by potracegui*/ + KStdAction::openNew(this, SLOT(fileNew()),actionCollection()); + KStdAction::quit(this, SLOT(quit()),actionCollection()); + m_toolbarAction=KStdAction::showToolbar(this, SLOT(showToolbar()),actionCollection()); + m_statusbarAction=KStdAction::showStatusbar(this, SLOT(showStatusbar()),actionCollection()); + KStdAction::keyBindings(this, SLOT(configureKeys()),actionCollection()); + KStdAction::configureToolbars(this, SLOT(configureTB()),actionCollection()); + + /*handled by MainWidget*/ + KStdAction::open(m_centralWidget, SLOT(fileOpen()),actionCollection()); + KStdAction::save(m_centralWidget, SLOT(fileSave()),actionCollection()); + KStdAction::saveAs(m_centralWidget, SLOT(fileSaveAs()),actionCollection()); + KStdAction::close(m_centralWidget, SLOT(fileClose()),actionCollection()); + KStdAction::cut(m_centralWidget, SLOT(cut()),actionCollection()); + KStdAction::copy(m_centralWidget, SLOT(copy()),actionCollection()); + KStdAction::paste(m_centralWidget, SLOT(paste()),actionCollection()); + + /*Create menu and toolbar*/ + createGUI(); +} + + +//MENU ACTIONS +void potracegui::fileNew() +{ + (new potracegui)->show(); +} + +void potracegui::quit() +{ + close(); +} + +void potracegui::showToolbar() +{ + if(m_toolbarAction->isChecked()) + toolBar()->show(); + else + toolBar()->hide(); +} + +void potracegui::showStatusbar() +{ + if(m_statusbarAction->isChecked()) + statusBar()->show(); + else + statusBar()->hide(); +} + +void potracegui::configureKeys() +{ + KKeyDialog::configure(actionCollection(),"potraceguiui.rc"); +} + +void potracegui::configureTB() +{ + KEditToolbar dlg(actionCollection()); + connect(&dlg,SIGNAL(newToolbarConfig()),this,SLOT(NewTBConfig())); + dlg.exec(); +} + +void potracegui::NewTBConfig() +{ + createGUI(); + saveMainWindowSettings(KGlobal::config()); +} + +void potracegui::changeStatusbar(QString message) +{ + statusBar()->message(message); +} + +bool potracegui::queryClose() { + if(m_centralWidget->m_changed) { + int res= KMessageBox::warningYesNoCancel(this, i18n("Save changes?")); + if(res==KMessageBox::Yes) { + m_centralWidget->fileSave(); + return true; + } + else if(res==KMessageBox::Cancel) { + return false; + } + if(res==KMessageBox::No) { + return true; + } + } + return true; +} + +#include "potracegui.moc" diff --git a/src/potracegui.desktop b/src/potracegui.desktop new file mode 100644 index 0000000..3e7e0a4 --- /dev/null +++ b/src/potracegui.desktop @@ -0,0 +1,27 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=potracegui +Name[xx]=xxpotraceguixx +Exec=potracegui +Icon=potracegui +Type=Application +Comment=A simple KDE Application +Comment[ca]=Una simple aplicació KDE +Comment[da]=Et simpelt KDE program +Comment[de]=Eine einfache KDE-Anwendung +Comment[el]=Μια απλή εφαρμογή του KDE +Comment[es]=Una aplicación de KDE sencilla +Comment[et]=Lihtne KDE rakendus +Comment[fr]=Une application simple pour KDE. +Comment[hu]=Egyszerű KDE-alkalmazás +Comment[it]=Una semplice applicazione KDE +Comment[nl]=Een eenvoudige KDE-toepassing +Comment[pt]=Uma aplicação KDE simples +Comment[pt_BR]=Um simples Aplicativo do KDE +Comment[ru]=Простое приложение KDE +Comment[sl]=Preprost program za KDE +Comment[sr]=Једноставан KDE програм +Comment[sv]=Ett enkelt KDE-program +Comment[ta]=ஒரு சாஅதரன கெடி பயன்பாடு +Comment[xx]=xxA simple KDE Applicationxx +Comment[zh_CN]=一个简单的KDE应用程序 diff --git a/src/potracegui.h b/src/potracegui.h new file mode 100644 index 0000000..ab0aeaa --- /dev/null +++ b/src/potracegui.h @@ -0,0 +1,98 @@ +/*************************************************************************** + * Copyright (C) 2004 by Antonio Fasolato * + * Antonio.Fasolato@poste.it * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef _POTRACEGUI_H_ +#define _POTRACEGUI_H_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <kmainwindow.h> +#include <kapplication.h> + +#include <qlabel.h> + +class KToggleAction; +class MainWidget; + +/** + * @short Application Main Window + * @author Antonio Fasolato <Antonio.Fasolato@poste.it> + * @version 1.0 + * + * This is potracegui main window. It controls the menu, the toolbar and the statusbar. Its main widget (MainWidget object) copes with the actual options gaining and image tracing. + */ +class potracegui : public KMainWindow +{ + Q_OBJECT +public: + /** + * @short Default Constructor + * + * Nothing special. + */ + potracegui(); + + /** + * @short Default Destructor + * + * Nothing special + */ + virtual ~potracegui(); + +private: + MainWidget *m_centralWidget; /**< Main widget: everithing not related to menu, toolbar or statusbar */ + KToggleAction *m_toolbarAction; /**< Action for showing/hiding the toolbar */ + KToggleAction *m_statusbarAction; /**< Action for showing/hiding the statusbar */ + + //! Connects all the signals and calls createGUI() + void createInterface(); + //! If the window is being closed with unsaved changes to the document + /*! + * Asks the user if he wants to save the document if he is closing the window and there are unsaved changes + */ + bool queryClose(); + +// Menu and toolbar operations +private slots: + //! Used to create a new document (new window) + void fileNew(); + //! Used when exiting the app + void quit(); + + //! Used to show/hide the toolbar + void showToolbar(); + //! Used to show/hide the statusbar + void showStatusbar(); + //! Used to call the key configuration dialog + void configureKeys(); + //! Used to call the toolbar configuration dialog + void configureTB(); + //! Used to update the toolbar after having changed it + void NewTBConfig(); + //! Used to set a message in the statusbar (used by MainWidget) + /*! + * \param message The message to show + */ + void changeStatusbar(QString message); +}; + +#endif // _POTRACEGUI_H_ diff --git a/src/potracegui.lsm b/src/potracegui.lsm new file mode 100644 index 0000000..8b62775 --- /dev/null +++ b/src/potracegui.lsm @@ -0,0 +1,16 @@ +Begin3 +Title: potracegui -- Some description +Version: 1.3 +Entered-date: +Description: +Keywords: KDE Qt +Author: Antonio Fasolato <Antonio.Fasolato@poste.it> +Maintained-by: Antonio Fasolato <Antonio.Fasolato@poste.it> +Home-page: +Alternate-site: +Primary-site: ftp://ftp.kde.org/pub/kde/unstable/apps/utils + xxxxxx potracegui-1.3.tar.gz + xxx potracegui-1.3.lsm +Platform: Linux. Needs KDE +Copying-policy: GPL +End diff --git a/src/potraceguiui.rc b/src/potraceguiui.rc new file mode 100644 index 0000000..3a3954b --- /dev/null +++ b/src/potraceguiui.rc @@ -0,0 +1,5 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<kpartgui name="potracegui" version="1"> +<MenuBar> +</MenuBar> +</kpartgui> |