diff -Nru sir-2.5.1/.gitignore sir-2.6/.gitignore --- sir-2.5.1/.gitignore 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/.gitignore 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,23 @@ +/qrc_application.cpp +/doc/* +/.ui/* +/.moc/* +/.obj/* +/.project +/.svn/* +/sir.pro.user* +/*.user +/Makefile +/CMakeCache.txt +/CMakeFiles/* +/*.qm +/*.cxx +/*/*.cxx +/*/*/*.cxx +/*/*/*/*.cxx +/ui_*.h +/application.qrc.depends +/cmake_install.cmake +/install_manifest.txt +/sir +/sir.cbp diff -Nru sir-2.5.1/CHANGELOG.txt sir-2.6/CHANGELOG.txt --- sir-2.5.1/CHANGELOG.txt 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/CHANGELOG.txt 2013-04-28 11:49:20.000000000 +0000 @@ -1,3 +1,14 @@ +* Sun Apr 28 2013 - Marek Jędryka - v2.6 + - added command line arguments --help, --session and --lang support + - added background color in convertion options + - added SVG convertion tab: remove single text node and group of text node containing specifed string + - added adding frame, text and picture effect and effect tab + - added sessions storage in XML files + - create empty metadata when converting from SVG file + - set current date time in Exif if needed + - iconsets moved from UI to C++ code for uic<4.8 compatibility + - Polish translation updated + * Wed Nov 14 2012 - Marek Jędryka - v2.5.1 - relative path bug-fix diff -Nru sir-2.5.1/CMakeLists.txt sir-2.6/CMakeLists.txt --- sir-2.5.1/CMakeLists.txt 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/CMakeLists.txt 2013-04-28 11:49:20.000000000 +0000 @@ -7,10 +7,10 @@ project( sir ) cmake_minimum_required( VERSION 2.8.3 ) -# SIR_CMAKE preprocessor define added for QtCreator code parsing and highlighting +# SIR_CMAKE preprocessor define added for code parsing and highlighting QtCreator editor add_definitions( -Wall -DSIR_CMAKE ) -find_package( Qt4 REQUIRED QtCore QtGui QtNetwork QtSvg ) +find_package( Qt4 REQUIRED QtCore QtGui QtNetwork QtSvg QtXml ) include( ${QT_USE_FILE} ) include_directories( @@ -24,56 +24,80 @@ # Headers set( sir_HDRS - src/main.h + src/commandlineassistant.h + src/converteffects.h + src/convertshareddata.h src/defines.h - src/languageutils.h - src/sharedinformation.h - src/rawutils.h src/expressiontree.h + src/languageutils.h + src/main.h src/optionsenums.h + src/rawutils.h + src/regexputils.h + src/session.h + src/sharedinformation.h + src/svgmodifier.h + src/xmlstreamwriter.h src/metadata/string.h ) # Source files set( sir_SRCS - src/main.cpp + src/commandlineassistant.cpp src/convertdialog.cpp - src/widgets/previewdialog.cpp - src/widgets/optionsdialog.cpp - src/widgets/treewidget.cpp - src/widgets/treewidgetheader.cpp + src/converteffects.cpp + src/convertshareddata.cpp src/convertthread.cpp - src/widgets/aboutdialog.cpp + src/expressiontree.cpp src/languageutils.cpp - src/sharedinformation.cpp - src/rawutils.cpp + src/main.cpp src/networkutils.cpp - src/widgets/messagebox.cpp - src/widgets/historycombobox.cpp - src/widgets/timecombobox.cpp + src/rawutils.cpp + src/regexputils.cpp src/selection.cpp - src/expressiontree.cpp + src/session.cpp src/settings.cpp + src/sharedinformation.cpp + src/svgmodifier.cpp + src/xmlstreamwriter.cpp + src/metadata/string.cpp + src/widgets/aboutdialog.cpp + src/widgets/colorframe.cpp src/widgets/detailsbrowser.cpp + src/widgets/historycombobox.cpp + src/widgets/messagebox.cpp + src/widgets/optionsdialog.cpp + src/widgets/posspinbox.cpp + src/widgets/previewdialog.cpp src/widgets/selectiondialog.cpp + src/widgets/timecombobox.cpp + src/widgets/treewidget.cpp + src/widgets/treewidgetheader.cpp + src/widgets/convert/effectsscrollarea.cpp + src/widgets/convert/optionsscrollarea.cpp + src/widgets/convert/sizescrollarea.cpp + src/widgets/convert/svgscrollarea.cpp src/widgets/options/abstractoptions.cpp - src/widgets/options/generalgroupbox.cpp src/widgets/options/filelistgroupbox.cpp - src/widgets/options/selectiongroupbox.cpp + src/widgets/options/generalgroupbox.cpp src/widgets/options/rawgroupbox.cpp - src/metadata/string.cpp + src/widgets/options/selectiongroupbox.cpp ) # User interface files set( sir_UIS - dialogs/convertdialog.ui dialogs/about.ui + dialogs/convertdialog.ui dialogs/previewdialog.ui - dialogs/selection/dirwidget.ui - dialogs/options/generalgroupbox.ui + dialogs/convert/effectsscrollarea.ui + dialogs/convert/optionsscrollarea.ui + dialogs/convert/sizescrollarea.ui + dialogs/convert/svgscrollarea.ui dialogs/options/filelistgroupbox.ui - dialogs/options/selectiongroupbox.ui + dialogs/options/generalgroupbox.ui dialogs/options/rawgroupbox.ui + dialogs/options/selectiongroupbox.ui + dialogs/selection/dirwidget.ui ) set( sir_RSCS @@ -123,30 +147,36 @@ # Meta-object code files set( sir_MOCS src/convertdialog.h - src/widgets/previewdialog.h - src/widgets/optionsdialog.h - src/widgets/treewidget.h - src/widgets/treewidgetheader.h src/convertthread.h - src/widgets/aboutdialog.h src/networkutils.h - src/widgets/messagebox.h - src/widgets/historycombobox.h - src/widgets/timecombobox.h src/selection.h src/settings.h + src/widgets/aboutdialog.h + src/widgets/colorframe.h src/widgets/detailsbrowser.h + src/widgets/historycombobox.h + src/widgets/messagebox.h + src/widgets/optionsdialog.h + src/widgets/posspinbox.h + src/widgets/previewdialog.h src/widgets/selectiondialog.h - src/widgets/options/generalgroupbox.h + src/widgets/timecombobox.h + src/widgets/treewidget.h + src/widgets/treewidgetheader.h + src/widgets/convert/effectsscrollarea.h + src/widgets/convert/optionsscrollarea.h + src/widgets/convert/sizescrollarea.h + src/widgets/convert/svgscrollarea.h + src/widgets/options/abstractoptions.h src/widgets/options/filelistgroupbox.h - src/widgets/options/selectiongroupbox.h + src/widgets/options/generalgroupbox.h src/widgets/options/rawgroupbox.h - src/widgets/options/abstractoptions.h + src/widgets/options/selectiongroupbox.h ) set( sir_LINKING_LIBS - ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} - ${QT_QTNETWORK_LIBRARY} ${QT_QTSVG_LIBRARY} + ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTNETWORK_LIBRARY} + ${QT_QTSVG_LIBRARY} ${QT_QTXML_LIBRARY} ) option( metadata "Metadata support using exiv2 library." ON) @@ -158,33 +188,33 @@ add_definitions( -DSIR_METADATA_SUPPORT ) set( sir_MOCS ${sir_MOCS} src/widgets/metadatadialog.h - src/widgets/selection/anymetadatagroupbox.h src/widgets/options/detailsgroupbox.h src/widgets/options/metadatagroupbox.h + src/widgets/selection/anymetadatagroupbox.h ) set( sir_HDRS ${sir_HDRS} src/metadatautils.h - src/metadata/exif.h src/metadata/error.h + src/metadata/exif.h src/metadata/iptc.h ) set( sir_SRCS ${sir_SRCS} src/metadatautils.cpp src/metadata/exif.cpp - src/widgets/metadatadialog.cpp src/metadata/error.cpp src/metadata/iptc.cpp + src/widgets/metadatadialog.cpp + src/widgets/selection/anymetadatagroupbox.cpp src/widgets/options/detailsgroupbox.cpp src/widgets/options/metadatagroupbox.cpp - src/widgets/selection/anymetadatagroupbox.cpp ) set( sir_UIS ${sir_UIS} dialogs/metadatadialog.ui + dialogs/options/detailsgroupbox.ui + dialogs/options/metadatagroupbox.ui dialogs/selection/anymetadatagroupbox.ui dialogs/selection/exifgroupbox.ui dialogs/selection/iptcgroupbox.ui - dialogs/options/metadatagroupbox.ui - dialogs/options/detailsgroupbox.ui ) set( sir_LINKING_LIBS ${sir_LINKING_LIBS} ${EXIV2_LIBRARY} ) else( EXISTS ${EXIV2_LIBRARY} ) diff -Nru sir-2.5.1/Doxyfile sir-2.6/Doxyfile --- sir-2.5.1/Doxyfile 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/Doxyfile 2013-04-28 11:49:20.000000000 +0000 @@ -1,4 +1,4 @@ -# Doxyfile 1.8.1.2 +# Doxyfile 1.8.3 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project @@ -32,7 +32,7 @@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = "2.5" +PROJECT_NUMBER = 2.6 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer @@ -136,7 +136,9 @@ # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the -# path to strip. +# path to strip. Note that you specify absolute paths here, but also +# relative paths, which will be relative from the directory where doxygen is +# started. STRIP_FROM_PATH = @@ -239,14 +241,15 @@ OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given extension. -# Doxygen has a built-in mapping, but you can override or extend it using this -# tag. The format is ext=language, where ext is a file extension, and language -# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, -# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make -# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C -# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions -# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, +# and language is one of the parsers supported by doxygen: IDL, Java, +# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, +# C++. For instance to make doxygen treat .inc files as Fortran files (default +# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note +# that for custom extensions you also need to set FILE_PATTERNS otherwise the +# files are not read by doxygen. EXTENSION_MAPPING = @@ -259,6 +262,13 @@ MARKDOWN_SUPPORT = YES +# When enabled doxygen tries to link words that correspond to documented classes, +# or namespaces to their corresponding documentation. Such a link can be +# prevented in individual cases by by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. + +AUTOLINK_SUPPORT = YES + # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and @@ -279,10 +289,10 @@ SIP_SUPPORT = NO -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES (the +# default) will make doxygen replace the get and set methods by a property in +# the documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. @@ -544,7 +554,8 @@ GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. +# documentation sections, marked by \if section-label ... \endif +# and \cond section-label ... \endcond blocks. ENABLED_SECTIONS = @@ -601,7 +612,8 @@ # requires the bibtex tool to be installed. See also # http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this -# feature you need bibtex and perl available in the search path. +# feature you need bibtex and perl available in the search path. Do not use +# file names with spaces, bibtex cannot handle them. CITE_BIB_FILES = @@ -811,6 +823,13 @@ FILTER_SOURCE_PATTERNS = +# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page (index.html). +# This can be useful if you have a project on for instance GitHub and want reuse +# the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- @@ -931,13 +950,23 @@ # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# style sheet in the HTML output directory as well, or it will be erased! +# fine-tune the look of the HTML output. If left blank doxygen will +# generate a default style sheet. Note that it is recommended to use +# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this +# tag will in the future become obsolete. HTML_STYLESHEET = +# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional +# user-defined cascading style sheet that is included after the standard +# style sheets created by doxygen. Using this option one can overrule +# certain style aspects. This is preferred over using HTML_STYLESHEET +# since it does not replace the standard style sheet and is therefor more +# robust against future updates. Doxygen will copy the style sheet file to +# the output directory. + +HTML_EXTRA_STYLESHEET = + # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the @@ -1022,9 +1051,9 @@ DOCSET_BUNDLE_ID = org.doxygen.Project -# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely +# identify the documentation publisher. This should be a reverse domain-name +# style string, e.g. com.mycompany.MyDocSet.documentation. DOCSET_PUBLISHER_ID = org.doxygen.Publisher @@ -1209,6 +1238,13 @@ USE_MATHJAX = NO +# When MathJax is enabled you can set the default output format to be used for +# thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and +# SVG. The default value is HTML-CSS, which is slower, but has the best +# compatibility. + +MATHJAX_FORMAT = HTML-CSS + # When MathJax is enabled you need to specify the location relative to the # HTML output directory using the MATHJAX_RELPATH option. The destination # directory should contain the MathJax.js script. For instance, if the mathjax @@ -1236,15 +1272,49 @@ SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a PHP enabled web server instead of at the web client -# using Javascript. Doxygen will generate the search PHP script and index -# file to put on the web server. The advantage of the server -# based approach is that it scales better to large projects and allows -# full text search. The disadvantages are that it is more difficult to setup -# and does not have live searching capabilities. +# implemented using a web server instead of a web client using Javascript. +# There are two flavours of web server based search depending on the +# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for +# searching and an index file used by the script. When EXTERNAL_SEARCH is +# enabled the indexing and searching needs to be provided by external tools. +# See the manual for details. SERVER_BASED_SEARCH = NO +# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP +# script for searching. Instead the search results are written to an XML file +# which needs to be processed by an external indexer. Doxygen will invoke an +# external search engine pointed to by the SEARCHENGINE_URL option to obtain +# the search results. Doxygen ships with an example indexer (doxyindexer) and +# search engine (doxysearch.cgi) which are based on the open source search engine +# library Xapian. See the manual for configuration details. + +EXTERNAL_SEARCH = NO + +# The SEARCHENGINE_URL should point to a search engine hosted by a web server +# which will returned the search results when EXTERNAL_SEARCH is enabled. +# Doxygen ships with an example search engine (doxysearch) which is based on +# the open source search engine library Xapian. See the manual for configuration +# details. + +SEARCHENGINE_URL = + +# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed +# search data is written to a file for indexing by an external tool. With the +# SEARCHDATA_FILE tag the name of this file can be specified. + +SEARCHDATA_FILE = searchdata.xml + +# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through other +# doxygen projects that are not otherwise connected via tags files, but are +# all added to the same search index. Each project needs to have a tag file set +# via GENERATE_TAGFILE. The search mapping then maps the name of the tag file +# to a relative location where the documentation can be found, similar to the +# TAGFILES option but without actually processing the tag file. +# The format is: EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ... + +EXTRA_SEARCH_MAPPINGS = + #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- diff -Nru sir-2.5.1/INSTALL sir-2.6/INSTALL --- sir-2.5.1/INSTALL 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/INSTALL 2013-04-28 11:49:20.000000000 +0000 @@ -2,13 +2,15 @@ -If you want to get up and running quickly and easily- -~/> cd sir-build +~/> cd sir -sir-build/> cmake ../sir -DCMAKE_INSTALL_PREFIX=./usr +sir/> cmake ../sir -DCMAKE_INSTALL_PREFIX=./usr -or if you don't want metadata support (enabled by default) -sir-build/> cmake ../sir -DCMAKE_INSTALL_PREFIX=./usr -Dmetadata=OFF +sir/> cmake ../sir -DCMAKE_INSTALL_PREFIX=./usr -Dmetadata=OFF +-if you have installed Qt5 next to Qt4 you need add -DQT_QMAKE_EXECUTABLE=qmake-qt4 argument to cmake command +sir/> cmake ../sir -DCMAKE_INSTALL_PREFIX=./usr -Dmetadata=OFF -DQT_QMAKE_EXECUTABLE=qmake-qt4 -sir-build/> make -j (ie. -j5 for quad core processor) -sir-build/> make install +sir/> make -j (ie. -j5 for quad core processor) +sir/> make install ================== diff -Nru sir-2.5.1/TODO sir-2.6/TODO --- sir-2.5.1/TODO 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/TODO 2013-04-28 11:49:20.000000000 +0000 @@ -1,16 +1,16 @@ *** nearest release *** *** next release *** - ! substitution color for transparency - ! Sessions: save and restore files list in/from text file + ! support for animated graphics files (QMovie?) + ! defines.h refactorization: change defines to enumerations + ! Make simple effects + * color (sepia, b&w, etc.) and gradient filtres + * histogram operations *** wishlist *** ! SelectionDialog: * add in exifGroupBox: FocalLegth, Aperture, ExpBias, IsoSpeed, ExpTime, ShutterSpeed + ! Geotagging ! Conditional converting (ie. convert if image width > 1000 px) * scripts with exiv2 support - ! Make recursive screen images with (auto detect of sceeen frame) feature - joke :) - ! Make simple effects - * color (sepia, b&w, etc.) and gradient filtres - * watermark - * add frame + * graphical flow diagram editor for scripts substitution diff -Nru sir-2.5.1/debian/changelog sir-2.6/debian/changelog --- sir-2.5.1/debian/changelog 2013-05-07 05:24:22.000000000 +0000 +++ sir-2.6/debian/changelog 2013-05-07 05:24:22.000000000 +0000 @@ -1,3 +1,17 @@ +sir (2.6-1dhor~precise) precise; urgency=low + + * added command line arguments --help, --session and --lang support + * added background color in convertion options + * added SVG convertion tab: remove single text node and group of text node containing specifed string + * added adding frame, text and picture effect and effect tab + * added sessions storage in XML files + * create empty metadata when converting from SVG file + * set current date time in Exif if needed + * iconsets moved from UI to C++ code for uic<4.8 compatibility + * Polish translation updated + + -- Dariusz Duma Tue, 07 May 2013 06:30:18 +0200 + sir (2.5.1-1dhor~precise) precise; urgency=low * relative path fixes diff -Nru sir-2.5.1/debian/control sir-2.6/debian/control --- sir-2.5.1/debian/control 2013-05-07 05:24:22.000000000 +0000 +++ sir-2.6/debian/control 2013-05-07 05:24:22.000000000 +0000 @@ -8,7 +8,7 @@ Package: sir Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, libqt4-core, libqt4-gui +Depends: ${shlibs:Depends}, ${misc:Depends}, libqt4-core, libqt4-gui, libqt4-xml Recommends: dcraw Description: Simple image resizer Simple program to resize and rotate images. diff -Nru sir-2.5.1/dialogs/convert/effectsscrollarea.ui sir-2.6/dialogs/convert/effectsscrollarea.ui --- sir-2.5.1/dialogs/convert/effectsscrollarea.ui 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/dialogs/convert/effectsscrollarea.ui 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,601 @@ + + + EffectsScrollArea + + + + 0 + 0 + 673 + 512 + + + + ScrollArea + + + true + + + + + -13 + 0 + 667 + 517 + + + + + + + Add Image + + + true + + + false + + + + + + Y Coordinate: + + + + + + + + + + X Coordinate: + + + + + + + + + + + + + Image File: + + + + + + + Image Rotation: + + + + + + + Position of: + + + + + + + + + + + + + Browse + + + + + + + + + + + + + Opacity: + + + + + + + 1.000000000000000 + + + 0.010000000000000 + + + 1.000000000000000 + + + + + + + + + + Add Text + + + true + + + false + + + + + + Font Family: + + + + + + + + px + + + + + % + + + + + + + + + + + X Coordinate: + + + + + + + Position of: + + + + + + + Y Coordinate: + + + + + + + Text: + + + + + + + 500 + + + 12 + + + + + + + + + + + Top left corner + + + + + Middle of top edge + + + + + Top right corner + + + + + Center + + + + + Middle of right edge + + + + + Bottom right corner + + + + + Middle of bottom edge + + + + + Bottom left corner + + + + + Middle of left edge + + + + + + + + + pt + + + + + px + + + + + + + + Font Size: + + + + + + + + + + Text in Frame + + + + + + + Text Rotation: + + + + + + + -360 + + + 360 + + + + + + + + + + + + + Font Color: + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 1.000000000000000 + + + 0.010000000000000 + + + 1.000000000000000 + + + + + + + Opacity: + + + + + + + + + + 0 + 0 + + + + Bold + + + true + + + + + + + + 0 + 0 + + + + Italic + + + true + + + + + + + + 0 + 0 + + + + Underline + + + true + + + + + + + + 0 + 0 + + + + Strike out + + + true + + + + + + + + + + + + Add Frame + + + true + + + false + + + + + + px + + + + + + + Add Around + + + true + + + + + + + Frame Width: + + + + + + + Overlay + + + + + + + Frame Color: + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + Inside Border + + + true + + + false + + + + + + Width: + + + + + + + px + + + + + + + Color: + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + + Outside Border + + + true + + + false + + + + + + Width: + + + + + + + px + + + + + + + Color: + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + ColorFrame + QFrame +
widgets/colorframe.h
+ 1 +
+ + PosSpinBox + QSpinBox +
widgets/posspinbox.h
+
+
+ + +
diff -Nru sir-2.5.1/dialogs/convert/optionsscrollarea.ui sir-2.6/dialogs/convert/optionsscrollarea.ui --- sir-2.5.1/dialogs/convert/optionsscrollarea.ui 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/dialogs/convert/optionsscrollarea.ui 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,178 @@ + + + OptionsScrollArea + + + + 0 + 0 + 622 + 120 + + + + QFrame::NoFrame + + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 0 + 0 + + + + + No flip + + + + + Flip vertically + + + + + Flip horizontally + + + + + Flip vertically and horizontally + + + + + + + + Quality: + + + + + + + + 0 + 0 + + + + 1 + + + 100 + + + 100 + + + Qt::Horizontal + + + + + + + Background Color + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + 1 + + + 100 + + + 100 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + QFrame::Box + + + + + + + Rotation Angle: + + + + + + + false + + + + 0 + 0 + + + + + + + + + + ColorFrame + QFrame +
widgets/colorframe.h
+ 1 +
+
+ + +
diff -Nru sir-2.5.1/dialogs/convert/sizescrollarea.ui sir-2.6/dialogs/convert/sizescrollarea.ui --- sir-2.5.1/dialogs/convert/sizescrollarea.ui 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/dialogs/convert/sizescrollarea.ui 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,253 @@ + + + SizeScrollArea + + + QFrame::NoFrame + + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + 0 + 0 + 719 + 121 + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Choose unit + + + + + + + Pixels (px) + + + + + Percent (%) + + + + + Bytes (B) + + + + + + + + + + + 8 + + + + + + 0 + 0 + + + + &Maintain Aspect Ratio + + + Alt+M + + + + + + + + + + 4 + + + 4 + + + + + Width: + + + + + + + auto + + + + + + + Qt::Horizontal + + + QSizePolicy::MinimumExpanding + + + + 40 + 20 + + + + + + + + Height: + + + + + + + auto + + + + + + + + + + + 4 + + + 4 + + + + + Target File Size: + + + + + + + + 0 + 0 + + + + 1.000000000000000 + + + 1024.000000000000000 + + + + + + + + KiB + + + + + MiB + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + diff -Nru sir-2.5.1/dialogs/convert/svgscrollarea.ui sir-2.6/dialogs/convert/svgscrollarea.ui --- sir-2.5.1/dialogs/convert/svgscrollarea.ui 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/dialogs/convert/svgscrollarea.ui 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,74 @@ + + + SvgScrollArea + + + + 0 + 0 + 321 + 139 + + + + QFrame::NoFrame + + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + 0 + 0 + 321 + 139 + + + + + + + Remove Empty Groups + + + + + + + + + + Remove Text Elements + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Save SVG File + + + + + + + + + diff -Nru sir-2.5.1/dialogs/convertdialog.ui sir-2.6/dialogs/convertdialog.ui --- sir-2.5.1/dialogs/convertdialog.ui 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/dialogs/convertdialog.ui 2013-04-28 11:49:20.000000000 +0000 @@ -18,7 +18,7 @@ :/images/sir-32x32.png:/images/sir-32x32.png - + @@ -283,398 +283,43 @@ - - - 0 - 0 - - QTabWidget::North 0 - + + + true + Size - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - 8 - - - - - - 0 - 0 - - - - &Maintain Aspect Ratio - - - Alt+M - - - - - - - - - - 4 - - - 4 - - - - - Width: - - - - - - - auto - - - - - - - Qt::Horizontal - - - QSizePolicy::MinimumExpanding - - - - 40 - 20 - - - - - - - - Height: - - - - - - - auto - - - - - - - - - - - 4 - - - 4 - - - - - Target File Size: - - - - - - - - 0 - 0 - - - - 1.000000000000000 - - - 1024.000000000000000 - - - - - - - - KiB - - - - - MiB - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - Choose unit - - - - - - - Pixels (px) - - - - - Percent (%) - - - - - Bytes (B) - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 40 - - - - - - + + + true + Options - - - - - Rotation Angle: - - - - - - - Quality: - - - - - - - - 0 - 0 - - - - - No flip - - - - - Flip vertically - - - - - Flip horizontally - - - - - Flip vertically and horizontally - - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 40 - 20 - - - - - - - - false - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - 1 - - - 100 - - - 100 - - - - - - - - 0 - 0 - - - - 1 - - - 100 - - - 100 - - - Qt::Horizontal - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + + true + + + Effects + + + + + true + + + SVG + @@ -723,11 +368,6 @@ Convert &All - - - - - Alt+A @@ -751,10 +391,6 @@ &Quit - - - :/images/exit.png:/images/exit.png - @@ -795,19 +431,24 @@ Edit + + + Session + + + + + + - - - :/images/exit.png:/images/exit.png - Quit @@ -822,11 +463,6 @@ - - - - - &Options @@ -835,71 +471,36 @@ - - - - - About Sir... - - - - - About Qt... - - - - - Add &File... - - - - - Add &Dir... - - - - - Check for updates... - - - - - Let us know that you are using SIR... - - - - - Remove Al&l @@ -908,11 +509,6 @@ - - - - - &Select... @@ -924,11 +520,6 @@ - - - - - &Import files... @@ -936,6 +527,16 @@ Alt+I + + + Restore... + + + + + Save... + + @@ -948,6 +549,30 @@ QTextEdit
widgets/detailsbrowser.h
+ + SizeScrollArea + QScrollArea +
widgets/convert/sizescrollarea.h
+ 1 +
+ + OptionsScrollArea + QScrollArea +
widgets/convert/optionsscrollarea.h
+ 1 +
+ + SvgScrollArea + QScrollArea +
widgets/convert/svgscrollarea.h
+ 1 +
+ + EffectsScrollArea + QScrollArea +
widgets/convert/effectsscrollarea.h
+ 1 +
destFileEdit diff -Nru sir-2.5.1/dialogs/metadatadialog.ui sir-2.6/dialogs/metadatadialog.ui --- sir-2.5.1/dialogs/metadatadialog.ui 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/dialogs/metadatadialog.ui 2013-04-28 11:49:20.000000000 +0000 @@ -36,10 +36,6 @@ 24 - - - :/images/previous.png:/images/previous.png - true @@ -59,10 +55,6 @@ 24 - - - :/images/next.png:/images/next.png - true @@ -1250,9 +1242,6 @@ Delete metadata - - - false @@ -1276,9 +1265,6 @@ Save changes - - - true @@ -1289,9 +1275,6 @@ Cancel - - - diff -Nru sir-2.5.1/dialogs/previewdialog.ui sir-2.6/dialogs/previewdialog.ui --- sir-2.5.1/dialogs/previewdialog.ui 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/dialogs/previewdialog.ui 2013-04-28 11:49:20.000000000 +0000 @@ -63,10 +63,6 @@ - - - :/images/previous.png:/images/previous.png - 22 @@ -95,10 +91,6 @@ - - - :/images/next.png:/images/next.png - 22 @@ -143,10 +135,6 @@ - - - :/images/rotate_ccw.png:/images/rotate_ccw.png - 22 @@ -175,10 +163,6 @@ - - - :/images/rotate_cw.png:/images/rotate_cw.png - 22 @@ -220,10 +204,6 @@ 22 - - - :/images/flip_horizontal.png:/images/flip_horizontal.png - 22 @@ -249,10 +229,6 @@ 22 - - - :/images/flip_vertical.png:/images/flip_vertical.png - 22 @@ -339,10 +315,6 @@ - - - :/images/window_fullscreen.png:/images/window_fullscreen.png - 22 @@ -387,10 +359,6 @@ - - - :/images/filesave.png:/images/filesave.png - 22 @@ -419,10 +387,6 @@ - - - :/images/filesaveas.png:/images/filesaveas.png - 22 @@ -467,10 +431,6 @@ - - - :/images/print.png:/images/print.png - 22 @@ -515,10 +475,6 @@ Quit - - - :/images/exit.png:/images/exit.png - 22 diff -Nru sir-2.5.1/src/commandlineassistant.cpp sir-2.6/src/commandlineassistant.cpp --- sir-2.5.1/src/commandlineassistant.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/commandlineassistant.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,97 @@ +/* This file is part of SIR, an open-source cross-platform Image tool + * 2007-2010 Rafael Sachetto + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#include +#include +#include +#include "commandlineassistant.h" +#include "languageutils.h" +#include "settings.h" +#include "metadata/string.h" + +/** Creates CommandLineAssistant object. */ +CommandLineAssistant::CommandLineAssistant() {} + +/** Parses command line arguments and executes the arguments. + * \param args Application argument list created of main functions \a argv array. + * \return Possitive value if success finished, 0 if help message printed and + * negative value if error occured. + */ +int CommandLineAssistant::parse(const QStringList &args) { + QStringList longArgs = args.filter(QRegExp("^(-){2}(help|lang|session)+$")); + QStringList shortArgs = args.filter(QRegExp("^(-){1}(h|l|s)+$")); + QString lang; + int result = 1; + + if (longArgs.contains("--lang")) + lang = args[args.indexOf("--lang")+1]; + else if (!shortArgs.filter("l").isEmpty()) + lang = args[args.indexOf(shortArgs.filter("l")[0])+1]; + if (longArgs.contains("--session")) + sessionFile_ = args[args.indexOf("--session")+1]; + else if (!shortArgs.filter("s").isEmpty()) + sessionFile_ = args[args.indexOf(shortArgs.filter("s")[0])+1]; + + LanguageUtils *languages = LanguageUtils::instance(); + QString qmFile = languages->fileName(lang); + languages->appTranslator->load(qmFile, + QCoreApplication::applicationDirPath() + +QString("../share/sir/translations") ); + languages->qtTranslator->load("qt_"+qmFile.split('_').at(1).split('.').first(), + QLibraryInfo::location(QLibraryInfo::TranslationsPath)); + qApp->installTranslator(languages->qtTranslator); + qApp->installTranslator(languages->appTranslator); + + // print help + if (!shortArgs.filter("h").isEmpty() || !longArgs.filter("help").isEmpty()) { + MetadataUtils::String help = + tr("Usage: sir [options] [files]\n" + "Typed files will load to files list in main window.\n" + "\n" + "Supported arguments:\n" + " --help or -h print help message and quit\n" + " --lang or -l LANG set application language to LANG witch is language symbol\n" + " --session or -s session.xml restore session from XML session file\n" + "\n" + "Example:\n" + "$ sir -hl pl\n" + "is equivalent to\n" + "$ sir --help --lang pl\n" + "both print help message in Polish language and quit.\n" + ); + std::cout << help.toNativeStdString() << std::endl; + return 0; + } + else { + // set language + if (!lang.isEmpty()) { + Settings *s = Settings::instance(); + s->settings.languageFileName = qmFile; + s->settings.languageNiceName = languages->languageInfo(qmFile).niceName; + result += 2; + } + // restore session + if (!sessionFile_.isEmpty()) + result += 1; + } + + return result; +} diff -Nru sir-2.5.1/src/commandlineassistant.h sir-2.6/src/commandlineassistant.h --- sir-2.5.1/src/commandlineassistant.h 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/commandlineassistant.h 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,61 @@ +/* This file is part of SIR, an open-source cross-platform Image tool + * 2007-2010 Rafael Sachetto + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#ifndef COMMANDLINEASSISTANT_H +#define COMMANDLINEASSISTANT_H + +#include +#include + +/** \brief Command line arguments parser class. + * + * Supported arguments: + * * --help or -h print help message and quit + * * --lang or -l LANG set application language to LANG witch is language symbol + * * --session or -s session.xml restore session from XML session file + * + * The same language symbols are used to naming SIR translation files. + * + * SIR supports also common Qt command line options described on + * http://qt-project.org/doc/qt-4.8/qapplication.html#QApplication + * + * Unexpected and invalid options are ignored. + * + * Example: + * $ sir -hl pl + * is equivalent to + * $ sir --help --lang pl + * both print help message in Polish language and quit. + */ +class CommandLineAssistant { + Q_DECLARE_TR_FUNCTIONS(CommandLineAssistant) + +public: + CommandLineAssistant(); + int parse(const QStringList &args = QStringList()); + /** Returns XML session file to read by Session object. */ + QString sessionFile() const { return sessionFile_; } + +private: + QString sessionFile_; +}; + +#endif // COMMANDLINEASSISTANT_H diff -Nru sir-2.5.1/src/convertdialog.cpp sir-2.6/src/convertdialog.cpp --- sir-2.5.1/src/convertdialog.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/convertdialog.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -42,26 +42,33 @@ #include "widgets/messagebox.h" #include "metadatautils.h" #include "selection.h" +#include "languageutils.h" +#include "convertshareddata.h" +#include "session.h" +#include "commandlineassistant.h" /** Default constuctor. * * Sets up window with saved settings like window state, position * and convertion preferences. - * \param parent Pointer to parent object. - * \param args String containing aplication argv tables records - * separated by ** (double star-sign). + * \param parent Pointer to parent object. + * \param args String containing aplication argv tables records + * separated by ** (double star-sign). + * \param cmdAssistant Command line assistant object. * \sa init() */ -ConvertDialog::ConvertDialog(QWidget *parent, QString args) : QMainWindow(parent) { +ConvertDialog::ConvertDialog(QWidget *parent, const QStringList &args, + const CommandLineAssistant &cmdAssistant) + : QMainWindow(parent) { + csd = ConvertSharedData::instance(); setupUi(this); this->args = args; - qtTranslator = new QTranslator(this); - appTranslator = new QTranslator(this); - qApp->installTranslator(qtTranslator); - qApp->installTranslator(appTranslator); net = NULL; sharedInfo = ConvertThread::sharedInfo(); init(); + session = new Session(this); + if (!cmdAssistant.sessionFile().isEmpty()) + session->restore(cmdAssistant.sessionFile()); } /** Destructor.\n @@ -71,8 +78,6 @@ */ ConvertDialog::~ConvertDialog() { writeWindowProperties(); - delete qtTranslator; - delete appTranslator; if(net) delete net; clearTempDir(); @@ -102,6 +107,8 @@ connect(actionAbout_Sir, SIGNAL(triggered()), this, SLOT(about())); connect(actionOptions, SIGNAL(triggered()), this, SLOT(setOptions())); connect(actionCheckforUpdates, SIGNAL(triggered()), SLOT(checkUpdates())); + connect(actionRestore, SIGNAL(triggered()), SLOT(restoreSession())); + connect(actionSave, SIGNAL(triggered()), SLOT(saveSession())); connect(actionSendInstall, SIGNAL(triggered()), SLOT(sendInstall())); // tree view events @@ -115,17 +122,28 @@ connect(convertButton, SIGNAL(clicked()), this, SLOT(convertAll())); connect(convertSelectedButton, SIGNAL(clicked()), SLOT(convertSelected())); connect(quitButton, SIGNAL(clicked()), SLOT(closeOrCancel())); +} - // size tab - connect(rotateCheckBox,SIGNAL(stateChanged (int)), SLOT(verifyRotate(int))); - connect(sizeUnitComboBox, SIGNAL(currentIndexChanged(int)), - this, SLOT(setSizeUnit(int))); - if (maintainCheckBox->isChecked() && sizeUnitComboBox->currentIndex()==1) // % - connectSizeLinesEdit(); - - // quality spin box & slider - connect(qualitySpinBox, SIGNAL(valueChanged(int)), qualitySlider, SLOT(setValue(int))); - connect(qualitySlider, SIGNAL(valueChanged(int)), qualitySpinBox, SLOT(setValue(int))); +/** Sets icons from system theme. */ +void ConvertDialog::setIcons() { + const QIcon appExit = QIcon::fromTheme("application-exit", + QIcon(":/images/exit.png") ); + const QIcon helpAbout = QIcon::fromTheme("help-about"); + const QIcon listAdd = QIcon::fromTheme("list-add"); + + convertButton->setIcon(QIcon::fromTheme("system-run")); + quitButton->setIcon(appExit); + actionExit->setIcon(appExit); + actionOptions->setIcon(QIcon::fromTheme("preferences-desktop")); + actionAbout_Sir->setIcon(helpAbout); + actionAbout_Qt->setIcon(helpAbout); + actionAdd_File->setIcon(listAdd); + actionAdd_Dir->setIcon(listAdd); + actionCheckforUpdates->setIcon(QIcon::fromTheme("system-software-update")); + actionSendInstall->setIcon(QIcon::fromTheme("network-transmit")); + actionRemoveAll->setIcon(QIcon::fromTheme("edit-clear")); + actionSelect->setIcon(QIcon::fromTheme("edit-select-all")); + actionImport_files->setIcon(QIcon::fromTheme("edit-find")); } /** Check updates on SIR website. @@ -200,7 +218,7 @@ "using SIR! You are the user number %1 of "\ "this month!").arg(*result)); alreadySent = true; - Settings::instance().settings.alreadySent = alreadySent; + Settings::instance()->settings.alreadySent = alreadySent; } } @@ -291,19 +309,19 @@ if (!list.contains(str)) list.append(str); } - fileFilters = "*."; - fileFilters.append(list.join(" *.").toLower()); - fileFilters.append(" *.jpg"); - fileFilters.append(" *.JPG"); - fileFilters.append(" *.JPEG"); - fileFilters.append(" *.Jpg"); - fileFilters.append(" *.Jpeg"); + csd->fileFilters = "*."; + csd->fileFilters.append(list.join(" *.").toLower()); + csd->fileFilters.append(" *.jpg"); + csd->fileFilters.append(" *.JPG"); + csd->fileFilters.append(" *.JPEG"); + csd->fileFilters.append(" *.Jpg"); + csd->fileFilters.append(" *.Jpeg"); RawUtils::createRawFilesList(rawFormats); loadSettings(); if (!args.isEmpty()) - filesTreeWidget->initList(args.split("**")); + filesTreeWidget->initList(args); QCompleter *completer = new QCompleter(this); QDirModel *dir = new QDirModel(completer); @@ -322,9 +340,10 @@ horizontalSplitter->setStretchFactor(0,1000); convertProgressBar->setValue(0); - createConnections(); - converting = false; + + createConnections(); + setIcons(); } /** Browse destination directory button slot. @@ -421,12 +440,14 @@ QDir destFolder(destFileEdit->text()); - if (widthDoubleSpinBox->value() != widthDoubleSpinBox->minimum()) { - w = widthDoubleSpinBox->value(); + if (sizeScrollArea->widthDoubleSpinBox->value() + != sizeScrollArea->widthDoubleSpinBox->minimum()) { + w = sizeScrollArea->widthDoubleSpinBox->value(); hasWidth = true; } - if (heightDoubleSpinBox->value() != heightDoubleSpinBox->minimum()) { - h = heightDoubleSpinBox->value(); + if (sizeScrollArea->heightDoubleSpinBox->value() + != sizeScrollArea->heightDoubleSpinBox->minimum()) { + h = sizeScrollArea->heightDoubleSpinBox->value(); hasHeight = true; } @@ -471,26 +492,141 @@ enableConvertButtons(false); - if (sizeUnitComboBox->currentIndex() == 2) { + if (sizeScrollArea->sizeUnitComboBox->currentIndex() == 2) { int multiplier = 1024; - if (fileSizeComboBox->currentIndex() == 1) // MiB + if (sizeScrollArea->fileSizeComboBox->currentIndex() == 1) // MiB multiplier *= 1024; - sharedInfo->setDesiredSize( fileSizeSpinBox->value() * multiplier ); + sharedInfo->setDesiredSize( sizeScrollArea->fileSizeSpinBox->value() + * multiplier ); } else - sharedInfo->setDesiredSize( w, h, (sizeUnitComboBox->currentIndex() == 1), - hasWidth, hasHeight, - maintainCheckBox->isChecked() ); + sharedInfo->setDesiredSize( w, h, + (sizeScrollArea->sizeUnitComboBox->currentIndex() == 1), + hasWidth, hasHeight, + sizeScrollArea->maintainCheckBox->isChecked() ); QString desiredFormat = targetFormatComboBox->currentText().toLower(); sharedInfo->setDesiredFormat( desiredFormat ); - sharedInfo->setDesiredFlip(flipComboBox->currentIndex()); - sharedInfo->setDesiredRotation( rotateCheckBox->isChecked(), - rotateLineEdit->text().toDouble() ); - sharedInfo->setQuality(qualitySpinBox->value()); + sharedInfo->setDesiredFlip(optionsScrollArea->flipComboBox->currentIndex()); + sharedInfo->setDesiredRotation( optionsScrollArea->rotateCheckBox->isChecked(), + optionsScrollArea->rotateLineEdit->text().toDouble() ); + sharedInfo->setQuality(optionsScrollArea->qualitySpinBox->value()); sharedInfo->setDestPrefix(destPrefixEdit->text()); sharedInfo->setDestSuffix(destSuffixEdit->text()); sharedInfo->setDestFolder(destFolder); sharedInfo->setOverwriteAll(false); + // backgroud color + if (optionsScrollArea->backgroundColorCheckBox->isChecked()) + sharedInfo->backgroundColor = optionsScrollArea->backgroundColorFrame->color(); + else + sharedInfo->backgroundColor = QColor(); + // add frame + if (effectsScrollArea->frameGroupBox->isChecked()) { + sharedInfo->frameAddAround = effectsScrollArea->frameAroundRadioButton->isChecked(); + sharedInfo->frameWidth = effectsScrollArea->frameWidthSpinBox->value(); + sharedInfo->frameColor = effectsScrollArea->frameColorFrame->color(); + if (effectsScrollArea->borderOutsideGroupBox->isChecked()) { + sharedInfo->borderOutsideWidth = effectsScrollArea->borderOutsideSpinBox->value(); + sharedInfo->borderOutsideColor = effectsScrollArea->borderOutsideColorFrame->color(); + } + else { + sharedInfo->borderOutsideWidth = -1; + sharedInfo->borderOutsideColor = QColor(); + } + if (effectsScrollArea->borderInsideGroupBox->isChecked()) { + sharedInfo->borderInsideWidth = effectsScrollArea->borderInsideSpinBox->value(); + sharedInfo->borderInsideColor = effectsScrollArea->borderInsideColorFrame->color(); + } + else { + sharedInfo->borderInsideWidth = -1; + sharedInfo->borderInsideColor = QColor(); + } + } + else { + sharedInfo->frameAddAround = false; + sharedInfo->frameWidth = -1; + sharedInfo->frameColor = QColor(); + sharedInfo->borderOutsideWidth = -1; + sharedInfo->borderOutsideColor = QColor(); + sharedInfo->borderInsideWidth = -1; + sharedInfo->borderInsideColor = QColor(); + } + // add text + if (effectsScrollArea->textGroupBox->isChecked() && + !effectsScrollArea->textLineEdit->text().isEmpty()) { + sharedInfo->textString = effectsScrollArea->textLineEdit->text(); + sharedInfo->textFont = effectsScrollArea->textFontComboBox->currentFont(); + if (effectsScrollArea->textFontSizeComboBox->currentIndex() == 0) // pt + sharedInfo->textFont.setPointSize(effectsScrollArea->textFontSizeSpinBox->value()); + else + sharedInfo->textFont.setPixelSize(effectsScrollArea->textFontSizeSpinBox->value()); + sharedInfo->textFont.setBold(effectsScrollArea->textBoldPushButton->isChecked()); + sharedInfo->textFont.setItalic(effectsScrollArea->textItalicPushButton->isChecked()); + sharedInfo->textFont.setUnderline(effectsScrollArea->textUnderlinePushButton->isChecked()); + sharedInfo->textFont.setStrikeOut(effectsScrollArea->textStrikeOutPushButton->isChecked()); + sharedInfo->textColor = effectsScrollArea->textColorFrame->color(); + sharedInfo->textOpacity = effectsScrollArea->textOpacitySpinBox->value(); + sharedInfo->textPosModifier = static_cast( + effectsScrollArea->textPositionComboBox->currentIndex() ); + sharedInfo->textPos = QPoint( effectsScrollArea->textXSpinBox->value(), + effectsScrollArea->textYSpinBox->value() ); + sharedInfo->textUnitPair.first = static_cast( + effectsScrollArea->textXComboBox->currentIndex() ); + sharedInfo->textUnitPair.second = static_cast( + effectsScrollArea->textYComboBox->currentIndex() ); + sharedInfo->textFrame = effectsScrollArea->textFrameCheckBox->isChecked(); + sharedInfo->textRotation = effectsScrollArea->textRotationSpinBox->value(); + } + else { + sharedInfo->textString = QString(); + sharedInfo->textFont = QFont(); + sharedInfo->textColor = QColor(); + sharedInfo->textPosModifier = UndefinedPosModifier; + sharedInfo->textPos = QPoint(); + sharedInfo->textUnitPair = PosUnitPair(UndefinedUnit, UndefinedUnit); + sharedInfo->textFrame = false; + sharedInfo->textRotation = 0; + } + // add image + if (effectsScrollArea->imageGroupBox->isChecked()) { + sharedInfo->image = QImage(effectsScrollArea->imagePathLineEdit->text()); + if (sharedInfo->image.isNull()) { + QMessageBox::StandardButton answer = + QMessageBox::warning(this, tr("Load image failed"), + tr("Load image to add failed.\n" + "Do you want continue anyway?"), + QMessageBox::Ignore | QMessageBox::Abort, + QMessageBox::Abort); + if (answer != QMessageBox::Ignore) + return; + } + sharedInfo->imagePosModifier = static_cast( + effectsScrollArea->imagePositionComboBox->currentIndex() ); + sharedInfo->imagePos = QPoint( effectsScrollArea->imageXSpinBox->value(), + effectsScrollArea->imageYSpinBox->value() ); + sharedInfo->imageUnitPair.first = static_cast( + effectsScrollArea->imageXComboBox->currentIndex() ); + sharedInfo->imageUnitPair.second = static_cast( + effectsScrollArea->imageYComboBox->currentIndex() ); + sharedInfo->imageOpacity = effectsScrollArea->imageOpacitySpinBox->value(); + sharedInfo->imageRotation = effectsScrollArea->imageRotationSpinBox->value(); + } + else { + sharedInfo->image = QImage(); + sharedInfo->imagePosModifier = UndefinedPosModifier; + sharedInfo->imagePos = QPoint(); + sharedInfo->imageUnitPair = PosUnitPair(UndefinedUnit, UndefinedUnit); + sharedInfo->imageRotation = 0; + } + // svg + if (svgScrollArea->removeTextCheckBox->isChecked()) + sharedInfo->svgRemoveText = svgScrollArea->removeTextLineEdit->text(); + else + sharedInfo->svgRemoveText = QString(); + sharedInfo->svgRemoveEmptyGroup = svgScrollArea->removeGroupsCheckBox->isChecked(); + sharedInfo->svgSave = svgScrollArea->saveCheckBox->isChecked(); + sharedInfo->svgModifiersEnabled = (sharedInfo->svgSave + || sharedInfo->svgRemoveEmptyGroup + || !sharedInfo->svgRemoveText.isNull()); //Gives a image to each thread convert for(int i = 0; i < nt; i++) { @@ -503,6 +639,9 @@ } } +/** Shows selection dialog. + * \sa Selection::selectItems() Selection::selectFiles() + */ void ConvertDialog::showSelectionDialog() { Selection selection(this); QAction *action = static_cast (sender()); @@ -512,19 +651,18 @@ qDebug() << "Imported files:" << selection.importFiles(); } -/** Rotate checkbox slot. - * Disables/enables rotation angle line edit. - * \param status Status of the checkbox. - */ -void ConvertDialog::verifyRotate(int status) { - - if (status == Qt::Checked ) { - rotateLineEdit->setEnabled(TRUE); - } - else { - rotateLineEdit->setEnabled(FALSE); - } +void ConvertDialog::restoreSession() { + QString path = QFileDialog::getOpenFileName(this, tr("Choose session file"), + QDir::homePath(), + tr("XML Files") + " (*.xml)"); + session->restore(path); +} +void ConvertDialog::saveSession() { + QString path = QFileDialog::getSaveFileName(this, tr("Choose session file"), + QDir::homePath(), + tr("XML Files") + " (*.xml)"); + session->save(path); } /** Shows window containing information about SIR. */ @@ -549,108 +687,109 @@ // load tree widget settings filesTreeWidget->header()->loadSettings(); - Settings &s = Settings::instance(); + Settings *s = Settings::instance(); // main window - if ( s.mainWindow.maximized) + if ( s->mainWindow.maximized) showMaximized(); - move( s.mainWindow.possition); - resize( s.mainWindow.size); - horizontalSplitter->restoreState( s.mainWindow.horizontalSplitter); - verticalSplitter->restoreState( s.mainWindow.verticalSplitter); + move( s->mainWindow.possition); + resize( s->mainWindow.size); + horizontalSplitter->restoreState( s->mainWindow.horizontalSplitter); + verticalSplitter->restoreState( s->mainWindow.verticalSplitter); // settings - destFileEdit->setText( s.settings.targetFolder); + destFileEdit->setText( s->settings.targetFolder); targetFormatComboBox->setCurrentIndex( - targetFormatComboBox->findText( s.settings.targetFormat)); - destPrefixEdit->setText( s.settings.targetPrefix); - destSuffixEdit->setText( s.settings.targetSuffix); - int quality = s.settings.quality; - qualitySpinBox->setValue(quality); - qualitySlider->setValue(quality); - numThreads = s.settings.cores; + targetFormatComboBox->findText( s->settings.targetFormat)); + destPrefixEdit->setText( s->settings.targetPrefix); + destSuffixEdit->setText( s->settings.targetSuffix); + int quality = s->settings.quality; + optionsScrollArea->qualitySpinBox->setValue(quality); + optionsScrollArea->qualitySlider->setValue(quality); + numThreads = s->settings.cores; if (numThreads == 0) numThreads = GeneralGroupBox::detectCoresCount(); QString selectedTranslationFile = QCoreApplication::applicationDirPath() + "/../share/sir/translations/"; - selectedTranslationFile += s.settings.languageFileName; + selectedTranslationFile += s->settings.languageFileName; QString qtTranslationFile = "qt_" + selectedTranslationFile.split('_').at(1).split('.').first(); - qtTranslator->load(qtTranslationFile, - QLibraryInfo::location(QLibraryInfo::TranslationsPath)); - appTranslator->load(selectedTranslationFile); + LanguageUtils *languages = LanguageUtils::instance(); + languages->qtTranslator->load(qtTranslationFile, + QLibraryInfo::location(QLibraryInfo::TranslationsPath)); + languages->appTranslator->load(selectedTranslationFile); retranslateStrings(); - alreadySent = s.settings.alreadySent; - dateFormat = s.settings.dateDisplayFormat; - timeFormat = s.settings.timeDisplayFormat; - dateTimeFormat = dateFormat + ' ' + timeFormat; + alreadySent = s->settings.alreadySent; + csd->dateFormat = s->settings.dateDisplayFormat; + csd->timeFormat = s->settings.timeDisplayFormat; + csd->dateTimeFormat = csd->dateFormat + ' ' + csd->timeFormat; // size - int sizeUnitIndex = s.size.sizeUnit; - setSizeUnit(sizeUnitIndex); - sizeUnitComboBox->setCurrentIndex(sizeUnitIndex); - fileSizeSpinBox->setValue( s.size.fileSizeValue); - fileSizeComboBox->setCurrentIndex( s.size.fileSizeUnit); - maintainCheckBox->setChecked( s.size.keepAspectRatio); - if (sizeUnitComboBox->currentIndex() == 1) { - sizeWidth = s.size.widthPx; - sizeHeight = s.size.heightPx; - widthDoubleSpinBox->setValue(sizeWidth); - widthDoubleSpinBox->setValue( s.size.widthPercent); - heightDoubleSpinBox->setValue(sizeHeight); - heightDoubleSpinBox->setValue( s.size.heightPercent); - } - else if (sizeUnitComboBox->currentIndex() == 0) { - sizeWidth = s.size.widthPercent; - sizeHeight = s.size.heightPercent; - widthDoubleSpinBox->setValue(sizeWidth); - widthDoubleSpinBox->setValue( s.size.widthPx); - heightDoubleSpinBox->setValue(sizeHeight); - heightDoubleSpinBox->setValue( s.size.heightPx); + int sizeUnitIndex = s->size.sizeUnit; + sizeScrollArea->setSizeUnit(sizeUnitIndex); + sizeScrollArea->sizeUnitComboBox->setCurrentIndex(sizeUnitIndex); + sizeScrollArea->fileSizeSpinBox->setValue( s->size.fileSizeValue); + sizeScrollArea->fileSizeComboBox->setCurrentIndex( s->size.fileSizeUnit); + if (sizeScrollArea->sizeUnitComboBox->currentIndex() == 1) { + csd->sizeWidth = s->size.widthPx; + csd->sizeHeight = s->size.heightPx; + sizeScrollArea->widthDoubleSpinBox->setValue(csd->sizeWidth); + sizeScrollArea->widthDoubleSpinBox->setValue( s->size.widthPercent); + sizeScrollArea->heightDoubleSpinBox->setValue(csd->sizeHeight); + sizeScrollArea->heightDoubleSpinBox->setValue( s->size.heightPercent); + } + else if (sizeScrollArea->sizeUnitComboBox->currentIndex() == 0) { + csd->sizeWidth = s->size.widthPercent; + csd->sizeHeight = s->size.heightPercent; + sizeScrollArea->widthDoubleSpinBox->setValue(csd->sizeWidth); + sizeScrollArea->widthDoubleSpinBox->setValue( s->size.widthPx); + sizeScrollArea->heightDoubleSpinBox->setValue(csd->sizeHeight); + sizeScrollArea->heightDoubleSpinBox->setValue( s->size.heightPx); } + sizeScrollArea->maintainCheckBox->setChecked( s->size.keepAspectRatio); // raw - rawEnabled = s.raw.enabled; + rawEnabled = s->raw.enabled; if(rawEnabled) { foreach(QString ext, rawFormats) { - if(!fileFilters.contains(ext)) { - fileFilters.append(ext); + if(!csd->fileFilters.contains(ext)) { + csd->fileFilters.append(ext); } } } else { foreach(QString ext, rawFormats) { - if(fileFilters.contains(ext) && ext != " *.tif") { - fileFilters.remove(ext); + if(csd->fileFilters.contains(ext) && ext != " *.tif") { + csd->fileFilters.remove(ext); } } } #ifdef SIR_METADATA_SUPPORT // metadata using namespace MetadataUtils; - bool metadataEnabled = s.metadata.enabled; + bool metadataEnabled = s->metadata.enabled; sharedInfo->setMetadataEnabled(metadataEnabled); - bool saveMetadata = s.metadata.saveMetadata; + bool saveMetadata = s->metadata.saveMetadata; sharedInfo->setSaveMetadata(saveMetadata); if (saveMetadata) { - sharedInfo->setRealRotate( s.metadata.realRotate); - sharedInfo->setUpdateThumbnail( s.metadata.updateThumbnail); - sharedInfo->setRotateThumbnail( s.metadata.rotateThumbnail); + sharedInfo->setRealRotate( s->metadata.realRotate); + sharedInfo->setUpdateThumbnail( s->metadata.updateThumbnail); + sharedInfo->setRotateThumbnail( s->metadata.rotateThumbnail); } else sharedInfo->setRealRotate(true); // exif bool exifOverwrite; - exifOverwrite = s.exif.artistOverwrite; + exifOverwrite = s->exif.artistOverwrite; Exif::setArtistOverwrite(exifOverwrite); if (exifOverwrite) - Exif::setArtistString(String( s.exif.artistMap.keys().first())); + Exif::setArtistString(String( s->exif.artistMap.keys().first())); - exifOverwrite = s.exif.copyrightOverwrite; + exifOverwrite = s->exif.copyrightOverwrite; Exif::setCopyrightOverwrite(exifOverwrite); if (exifOverwrite) - Exif::setCopyrightString(String( s.exif.copyrightMap.keys().first())); + Exif::setCopyrightString(String( s->exif.copyrightMap.keys().first())); - exifOverwrite = s.exif.userCommentOverwrite; + exifOverwrite = s->exif.userCommentOverwrite; Exif::setUserCommentOverwrite(exifOverwrite); if (exifOverwrite) - Exif::setUserCommentString(String( s.exif.userCommentMap.keys().first())); + Exif::setUserCommentString(String( s->exif.userCommentMap.keys().first())); #endif // SIR_METADATA_SUPPORT } @@ -760,13 +899,21 @@ /** Retranslates GUI. */ void ConvertDialog::retranslateStrings() { - int sizeUnitIndex = sizeUnitComboBox->currentIndex(); - int fileSizeIndex = fileSizeComboBox->currentIndex(); + int sizeUnitIndex = sizeScrollArea->sizeUnitComboBox->currentIndex(); + int fileSizeIndex = sizeScrollArea->fileSizeComboBox->currentIndex(); + retranslateUi(this); + + // retranslate children widgets filesTreeWidget->retranslateStrings(); + sizeScrollArea->retranslateUi(sizeScrollArea); + optionsScrollArea->retranslateUi(optionsScrollArea); + effectsScrollArea->retranslateUi(effectsScrollArea); + svgScrollArea->retranslateUi(svgScrollArea); + // restoring nulled indexes - sizeUnitComboBox->setCurrentIndex(sizeUnitIndex); - fileSizeComboBox->setCurrentIndex(fileSizeIndex); + sizeScrollArea->sizeUnitComboBox->setCurrentIndex(sizeUnitIndex); + sizeScrollArea->fileSizeComboBox->setCurrentIndex(fileSizeIndex); } /** Returns file size string with \e KiB or \e MiB suffix (depending @@ -775,9 +922,9 @@ */ QString ConvertDialog::fileSizeString(qint64 size) { double fileSize_M_B = size - / pow(1024., this->fileSizeComboBox->currentIndex()+1.); + / pow(1024., sizeScrollArea->fileSizeComboBox->currentIndex()+1.); QString fileSizeString = QString::number(fileSize_M_B, 'f', 2) - + ' ' + this->fileSizeComboBox->currentText(); + + ' ' + sizeScrollArea->fileSizeComboBox->currentText(); return fileSizeString; } @@ -820,76 +967,3 @@ item->setText(StatusColumn, status); } } - -/** Shows size values corresponding index of size unit combo box. */ -void ConvertDialog::setSizeUnit(int index) { - if (index < 0) - return; - static int lastIndex = index; - static int lastIndexPxPercent = index+1; - static bool keepAspectRatio = false; - if (index == 2) { // bytes - geometryWidget->hide(); - fileSizeWidget->show(); - keepAspectRatio = maintainCheckBox->isChecked(); - maintainCheckBox->setChecked(true); - maintainCheckBox->setEnabled(false); - } - else { // px or % - fileSizeWidget->hide(); - geometryWidget->show(); - disconnectSizeLinesEdit(); - if (lastIndexPxPercent != index) { - float tmp = sizeWidth; - sizeWidth = widthDoubleSpinBox->value(); - widthDoubleSpinBox->setValue(tmp); - tmp = sizeHeight; - sizeHeight = heightDoubleSpinBox->value(); - heightDoubleSpinBox->setValue(tmp); - lastIndexPxPercent = index; - QString suffix; - int decimals; - double max; - if (index == 0) { // px - suffix = " px"; - decimals = 0; - max = 100000.; - } - else { // % - suffix = " %"; - decimals = 2; - max = 10000.; - } - widthDoubleSpinBox->setSuffix(suffix); - widthDoubleSpinBox->setDecimals(decimals); - widthDoubleSpinBox->setMaximum(max); - heightDoubleSpinBox->setSuffix(suffix); - heightDoubleSpinBox->setDecimals(decimals); - heightDoubleSpinBox->setMaximum(max); - } - if (lastIndex == 2) { - maintainCheckBox->setEnabled(true); - maintainCheckBox->setChecked(keepAspectRatio); - } - if (maintainCheckBox->isChecked() && index == 1) { // % - heightDoubleSpinBox->setValue(widthDoubleSpinBox->value()); - connectSizeLinesEdit(); - } - } - lastIndex = index; -} - -/** If desired size unit is percent and it keeps aspect ratio this function will - * be change width or heigth percent value following the user change in - * adjacent spin box. Otherwise do nothing. - */ -void ConvertDialog::sizeChanged(double value) { - if (sizeUnitComboBox->currentIndex() != 1 && !maintainCheckBox->isChecked()) - return; - // size unit is % and maintainCheckBox is checked - QDoubleSpinBox *spinBox = static_cast(sender()); - if (spinBox == widthDoubleSpinBox) - heightDoubleSpinBox->setValue(value); - else if (spinBox == heightDoubleSpinBox) - widthDoubleSpinBox->setValue(value); -} diff -Nru sir-2.5.1/src/convertdialog.h sir-2.6/src/convertdialog.h --- sir-2.5.1/src/convertdialog.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/convertdialog.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -26,8 +26,10 @@ #include "convertthread.h" #include "settings.h" -class QTranslator; class NetworkUtils; +class ConvertSharedData; +class Session; +class CommandLineAssistant; //! Main window class provides images convertion dialog. class ConvertDialog : public QMainWindow, public Ui::ConvertDialog { @@ -36,9 +38,11 @@ friend class SelectionDialog; friend class DetailsBrowser; friend class TreeWidget; + friend class Session; public: - ConvertDialog(QWidget *parent = 0, QString args = 0); + ConvertDialog(QWidget *parent, const QStringList &args, + const CommandLineAssistant &cmdAssistant); ~ConvertDialog(); void retranslateStrings(); QString fileSizeString(qint64 size); @@ -47,15 +51,10 @@ // fields SharedInformation *sharedInfo; QList convertThreads; - QString args; - QStringList argsList; - QImage *image; + QStringList args; QString targetFile; - QString fileFilters; QStringList rawFormats; quint8 numThreads; - QTranslator *qtTranslator; - QTranslator *appTranslator; int convertedImages; int numImages; QList itemsToConvert; @@ -65,16 +64,12 @@ NetworkUtils *net; QPoint windowPossition; QSize windowSize; - float sizeWidth; - float sizeHeight; - QString dateFormat; - QString timeFormat; - QString dateTimeFormat; + ConvertSharedData *csd; + Session *session; // methods void init(); void createConnections(); - inline void connectSizeLinesEdit(); - inline void disconnectSizeLinesEdit(); + void setIcons(); void createRawFilesList(); inline void writeWindowProperties(); inline void resetAnswers(); @@ -89,7 +84,6 @@ void convertAll(); void convertSelected(); void enableConvertButtons(bool enable = true); - void verifyRotate(int status); void about(); void setOptions(); void loadSettings(); @@ -106,10 +100,8 @@ void sendInstall(); void showSendInstallResult(QString *result, bool error); void showSelectionDialog(); - -private slots: - void setSizeUnit(int index); - void sizeChanged(double value); + void restoreSession(); + void saveSession(); }; /** Saves window maximized status, possition on screen and size and last @@ -118,19 +110,19 @@ * of normal size mode (before maximizing). */ void ConvertDialog::writeWindowProperties() { - Settings &s = Settings::instance(); + Settings *s = Settings::instance(); if (this->isMaximized()) { - s.mainWindow.maximized = true; - s.mainWindow.possition = windowPossition; - s.mainWindow.size = windowSize; + s->mainWindow.maximized = true; + s->mainWindow.possition = windowPossition; + s->mainWindow.size = windowSize; } else { - s.mainWindow.maximized = false; - s.mainWindow.possition = this->pos(); - s.mainWindow.size = this->size(); + s->mainWindow.maximized = false; + s->mainWindow.possition = this->pos(); + s->mainWindow.size = this->size(); } - s.mainWindow.horizontalSplitter = horizontalSplitter->saveState(); - s.mainWindow.verticalSplitter = verticalSplitter->saveState(); + s->mainWindow.horizontalSplitter = horizontalSplitter->saveState(); + s->mainWindow.verticalSplitter = verticalSplitter->saveState(); } /** Resets user ansers about overwrite file, enlarge image and abort convertion @@ -147,25 +139,6 @@ sharedInfo->noEnlargeAll = false; } -/** Connects width and height lines edit's textChanged() signal to sizeChanged() - * slot. - * \sa disconnectSizeLinesEdit() - */ -void ConvertDialog::connectSizeLinesEdit() { - connect(widthDoubleSpinBox, SIGNAL(valueChanged(double)), - this, SLOT(sizeChanged(double))); - connect(heightDoubleSpinBox, SIGNAL(valueChanged(double)), - this, SLOT(sizeChanged(double))); -} - -/** Disconnects sizeChanged() slot. - * \sa connectSizeLinesEdit() - */ -void ConvertDialog::disconnectSizeLinesEdit() { - widthDoubleSpinBox->disconnect(this,SLOT(sizeChanged(double))); - heightDoubleSpinBox->disconnect(this, SLOT(sizeChanged(double))); -} - /** Removes all files created by SIR from temporary directory. */ void ConvertDialog::clearTempDir() { foreach (QFileInfo info, QDir::temp().entryInfoList(QStringList("sir_*"))) diff -Nru sir-2.5.1/src/converteffects.cpp sir-2.6/src/converteffects.cpp --- sir-2.5.1/src/converteffects.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/converteffects.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,233 @@ +/* This file is part of SIR, an open-source cross-platform Image tool + * 2007-2010 Rafael Sachetto + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#include +#include "converteffects.h" + +/** Creates ConvertEffects object. + * \sa setSharedInfo() + */ +ConvertEffects::ConvertEffects(SharedInformation *shared) { + img = 0; + setSharedInfo(shared); +} + +/** Creates ConvertEffects object. + * \sa setImage() setSharedInfo() + */ +ConvertEffects::ConvertEffects(QImage *image, SharedInformation *shared) { + setImage(image); + setSharedInfo(shared); +} + +/** Destroys ConvertEffects object. */ +ConvertEffects::~ConvertEffects() {} + +/** Sets pointer to shared information object. */ +void ConvertEffects::setSharedInfo(SharedInformation *shared) { + this->shared = shared; +} + +/** Returns pointer to shared information object. */ +SharedInformation * ConvertEffects::sharedInfo() const { + return this->shared; +} + +/** Sets pointer to #img image object. */ +void ConvertEffects::setImage(QImage *image) { + img = image; +} + +/** Returns pointer to #img image object. */ +QImage * ConvertEffects::image() const { + return img; +} + +/** Adds frame to new image and returns this. */ +QImage ConvertEffects::framedImage() { + QImage result; + if (!img || img->isNull()) + return result; + int w2 = 2 * shared->frameWidth; // double frame width + if (shared->frameAddAround) { + QSize size = img->size(); + size += QSize(w2, w2); + result = QImage(size, img->format()); + } + else + result = *img; + QPainter painter(&result); + QPen pen(Qt::SolidLine); + if (shared->borderInsideWidth + shared->borderOutsideWidth < shared->frameWidth) { + pen.setWidth(w2); + pen.setColor(shared->frameColor); + painter.setPen(pen); + painter.drawRect(result.rect()); + } + if (shared->borderOutsideWidth > 0) { + pen.setWidth(2*shared->borderOutsideWidth); + pen.setColor(shared->borderOutsideColor); + painter.setPen(pen); + painter.drawRect(result.rect()); + } + if (shared->borderInsideWidth > 0) { + pen.setWidth(shared->borderInsideWidth); + pen.setColor(shared->borderInsideColor); + painter.setPen(pen); + int ih = shared->frameWidth - shared->borderInsideWidth * 0.5; // half of inside border + int sub = w2 - ih + 1; + painter.drawRect(ih, ih, result.width()-sub, result.height()-sub); + } + if (shared->frameAddAround) + painter.drawImage(shared->frameWidth, shared->frameWidth, *img); + return result; +} + +/** Draws text on #img image. + * \sa addImage() image() setImage() + */ +void ConvertEffects::addText() { + if (!img) { + qDebug("EffectPainter::addText(): image is not set!"); + return; + } + + // reference point setup + QPoint point = getTransformOriginPoint(shared->textPos, shared->textUnitPair); + + // text bounding rect setup + QFontMetrics fontMetrics(shared->textFont, img); + QRect rect = fontMetrics.boundingRect(shared->textString); + const int dx = 5; + const int dy = 1; + rect.adjust(-dx, -dy, dx, dy); + rect = getEffectBoundingRect(rect, point, shared->textPosModifier); + + QPainter painter(img); + painter.setPen(shared->textColor); + painter.setFont(shared->textFont); + painter.setOpacity(shared->textOpacity); + + // rotate painter around center point of image + this->rotate(&painter, point, shared->textRotation); + + // draw text + painter.drawText(rect, Qt::AlignCenter, shared->textString); + if (shared->textFrame) { + painter.setRenderHint(QPainter::HighQualityAntialiasing); + painter.drawRect(rect); + } +} + +/** Draws image on #img image. + * \sa addText() image() setImage() + */ +void ConvertEffects::addImage() { + if (!img) { + qDebug("EffectPainter::addImage(): image is not set!"); + return; + } + + QPoint point = getTransformOriginPoint(shared->imagePos, shared->imageUnitPair); + + QRect rect = getEffectBoundingRect(shared->image.rect(), point, + shared->imagePosModifier); + + QPainter painter(img); + painter.setOpacity(shared->imageOpacity); + painter.resetTransform(); + + this->rotate(&painter, point, shared->imageRotation); + + painter.drawImage(rect, shared->image); +} + +/** Rotates given \a painter around \a originPoint by \a angle in degrees. */ +void ConvertEffects::rotate(QPainter *painter, const QPoint &originPoint, int angle) { + QTransform t; + t.translate(originPoint.x(), originPoint.y()); + t.rotate(angle); + t.translate(-originPoint.x(), -originPoint.y()); + painter->setTransform(t); +} + +/** Returns modified copy of \a position point.\n + * The result of this function are modified by \a units pair items and img image. + * \sa getEffectBoundingRect() image() setImage() + */ +QPoint ConvertEffects::getTransformOriginPoint(const QPoint &position, + const PosUnitPair &units) { + QPoint result(position); + if (units.first == Percent) + result.setX(0.01 * result.x() * img->width()); + if (units.second == Percent) + result.setY(0.01 * result.y() * img->height()); + if (shared->textPos.x() < 0) + result.setX(result.x() + img->width()); + if (shared->textPos.y() < 0) + result.setY(result.y() + img->height()); + return result; +} + +/** Returns moved copy of \a rect rectangle.\n + * The result of this function are moved to \a pos point having regard to + * \a modifier value. + * \sa getTransformOriginPoint() image() setImage() + */ +QRect ConvertEffects::getEffectBoundingRect(const QRect &rect, const QPoint &pos, + PosModifier modifier) { + QRect result(rect); + switch (modifier) { + case Center: + result.moveCenter(pos); + break; + case MiddleTopEdge: + result.moveCenter(pos); + result.moveTop(pos.y()); + break; + case TopRightCorner: + result.moveTopRight(pos); + break; + case MiddleRightEdge: + result.moveCenter(pos); + result.moveRight(pos.x()); + break; + case BottomRightCorner: + result.moveBottomRight(pos); + break; + case MiddleBottomEdge: + result.moveCenter(pos); + result.moveBottom(pos.y()); + break; + case BottomLeftCorner: + result.moveBottomLeft(pos); + break; + case MiddleLeftEdge: + result.moveCenter(pos); + result.moveLeft(pos.x()); + break; + case TopLeftCorner: + default: + result.moveTo(pos); + break; + } + return result; +} diff -Nru sir-2.5.1/src/converteffects.h sir-2.6/src/converteffects.h --- sir-2.5.1/src/converteffects.h 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/converteffects.h 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,68 @@ +/* This file is part of SIR, an open-source cross-platform Image tool + * 2007-2010 Rafael Sachetto + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#ifndef EFFECTPAINTER_H +#define EFFECTPAINTER_H + +#include "sharedinformation.h" + +/** \brief Convertion effects class. + * + * Effects are made on #img QImage object using data from #shared SharedInformation + * object. + * + * This class supports 3 effects: \link #framedImage() \em "Add Frame" \endlink, + * \link #addText() \em "Add Text" \endlink and + * \link #addImage() \em "Add Image" \endlink + * + * \sa framedImage() addText() addImage() + */ +class ConvertEffects { +public: + ConvertEffects(SharedInformation *shared = 0); + ConvertEffects(QImage *image, SharedInformation *shared = 0); + ~ConvertEffects(); + void setSharedInfo(SharedInformation *shared); + SharedInformation *sharedInfo() const; + void setImage(QImage *image); + QImage *image() const; + QImage framedImage(); + void addText(); + void addImage(); + +private: + // fields + /** Image for drawing effects. + * \sa image() setImage() + */ + QImage *img; + /** Convert shared information. + * \sa sharedInfo() setSharedInfo() + */ + SharedInformation *shared; + // methods + void rotate(QPainter *painter, const QPoint &originPoint, int angle); + QPoint getTransformOriginPoint(const QPoint &position, const PosUnitPair &units); + QRect getEffectBoundingRect(const QRect &rect, const QPoint &pos, + PosModifier modifier); +}; + +#endif // EFFECTPAINTER_H diff -Nru sir-2.5.1/src/convertshareddata.cpp sir-2.6/src/convertshareddata.cpp --- sir-2.5.1/src/convertshareddata.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/convertshareddata.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,33 @@ +/* This file is part of SIR, an open-source cross-platform Image tool + * 2007-2010 Rafael Sachetto + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#include "convertshareddata.h" + +/** Returns pointer to the instance of ConvertSharedData class. + * \sa ConvertSharedData() + */ +ConvertSharedData *ConvertSharedData::instance() { + static ConvertSharedData object; + return &object; +} + +/** Creates the ConvertSharedData object. */ +ConvertSharedData::ConvertSharedData() {} diff -Nru sir-2.5.1/src/convertshareddata.h sir-2.6/src/convertshareddata.h --- sir-2.5.1/src/convertshareddata.h 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/convertshareddata.h 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,44 @@ +/* This file is part of SIR, an open-source cross-platform Image tool + * 2007-2010 Rafael Sachetto + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#ifndef CONVERTSETTINGS_H +#define CONVERTSETTINGS_H + +#include + +//! Shared data class of ConvertDialog dialog. +class ConvertSharedData { +public: + // singleton instance + static ConvertSharedData *instance(); + // fields + QString fileFilters; + float sizeWidth; + float sizeHeight; + QString dateFormat; + QString timeFormat; + QString dateTimeFormat; + +private: + ConvertSharedData(); +}; + +#endif // CONVERTSETTINGS_H diff -Nru sir-2.5.1/src/convertthread.cpp sir-2.6/src/convertthread.cpp --- sir-2.5.1/src/convertthread.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/convertthread.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -31,6 +30,8 @@ #include "rawutils.h" #include "widgets/messagebox.h" #include "settings.h" +#include "svgmodifier.h" +#include "converteffects.h" // setup static fields SharedInformation * ConvertThread::shared = new SharedInformation(); @@ -70,7 +71,7 @@ bool rawEnabled = RawUtils::isRawEnabled(); while(work) { - QStringList imgData = this->imageData; // imageData change protection by convertImage() + pd.imgData = this->imageData; // imageData change protection by convertImage() sizeComputed = 0; width = shared->width; height = shared->height; @@ -81,15 +82,15 @@ angle = shared->angle; if (shared->abort) { - emit imageStatus(imgData, tr("Cancelled"), CANCELLED); + emit imageStatus(pd.imgData, tr("Cancelled"), CANCELLED); getNextOrStop(); continue; } - emit imageStatus(imgData, tr("Converting"), CONVERTING); + emit imageStatus(pd.imgData, tr("Converting"), CONVERTING); - QString imageName = imgData.at(0); - QString originalFormat = imgData.at(1); + QString imageName = pd.imgData.at(0); + QString originalFormat = pd.imgData.at(1); targetFilePath = shared->destFolder.absolutePath() + QDir::separator(); if (!shared->prefix.isEmpty()) @@ -99,43 +100,36 @@ targetFilePath += "_" + shared->suffix; targetFilePath += "." + shared->format; - QString imagePath = imgData.at(2) + QDir::separator() + - imgData.at(0) + "." + originalFormat; + pd.imagePath = pd.imgData.at(2) + QDir::separator() + pd.imgData.at(0) + + "." + originalFormat; originalFormat = originalFormat.toLower(); bool svgSource(originalFormat == "svg" || originalFormat == "svgz"); QImage *image = 0; + // load image data if(rawEnabled) { image = new QImage(); - if(RawUtils::isRaw(imagePath)) - image = RawUtils::loadRawImage(imagePath); + if(RawUtils::isRaw(pd.imagePath)) + image = RawUtils::loadRawImage(pd.imagePath); else - image->load(imagePath); + image->load(pd.imagePath); } else if (svgSource) { - QGraphicsSvgItem svgImage(imagePath); - sizeComputed = computeSize(svgImage.renderer(), imagePath); - if (sizeComputed == 1) { + image = loadSvgImage(); + if (!image) { getNextOrStop(); continue; } - image = new QImage(width, height, QImage::Format_ARGB32); - if (shared->format == "gif" || shared->format == "png") - image->fill(Qt::transparent); - else // in other formats tranparency isn't supported - image->fill(Qt::white); - QPainter painter(image); - svgImage.renderer()->render(&painter); } else { image = new QImage(); - image->load(imagePath); + image->load(pd.imagePath); } if(image->isNull()) { //For some reason we where not able to open the image file - emit imageStatus(imgData, tr("Failed to open original image"), + emit imageStatus(pd.imgData, tr("Failed to open original image"), FAILED); delete image; //Ask for the next image and go to the beginning of the loop @@ -145,8 +139,8 @@ #ifdef SIR_METADATA_SUPPORT // read metadata saveMetadata = false; - if (!svgSource && shared->metadataEnabled) { - saveMetadata = metadata.read(imagePath,true); + if (shared->metadataEnabled) { + saveMetadata = metadata.read(pd.imagePath, true, svgSource); int beta = MetadataUtils::Exif::rotationAngle( metadata.exifStruct()->orientation); if (!saveMetadata) @@ -166,7 +160,7 @@ #endif // SIR_METADATA_SUPPORT // compute dest size in px if (sizeComputed == 0) { // false if converting from SVG file - sizeComputed = computeSize(image,imagePath); + sizeComputed = computeSize(image,pd.imagePath); if (sizeComputed == 1) { // image saved delete image; getNextOrStop(); @@ -174,16 +168,11 @@ } } // ask enlarge - if (sizeComputed == -3 || askEnlarge(*image,imagePath) < 0) { + if (sizeComputed == -3 || askEnlarge(*image,pd.imagePath) < 0) { delete image; getNextOrStop(); continue; } - // rotate image and update thumbnail - rotateImage(image); -#ifdef SIR_METADATA_SUPPORT - updateThumbnail(image); -#endif // SIR_METADATA_SUPPORT // create null destination image object QImage destImg; // scale image @@ -201,6 +190,21 @@ destImg = image->scaledToHeight(height, Qt::SmoothTransformation); else if (!hasWidth && !hasHeight) destImg = *image; + // paint effects + ConvertEffects effectPainter(&destImg, shared); + if (shared->frameWidth > 0 && shared->frameColor.isValid()) { + destImg = effectPainter.framedImage(); + effectPainter.setImage(&destImg); + } + if (!shared->image.isNull()) + effectPainter.addImage(); + if (!shared->textString.isEmpty()) + effectPainter.addText(); + // rotate image and update thumbnail + destImg = rotateImage(destImg); +#ifdef SIR_METADATA_SUPPORT + updateThumbnail(destImg); +#endif // SIR_METADATA_SUPPORT // ask overwrite if ( QFile::exists( targetFilePath ) && !(shared->overwriteAll || shared->abort || shared->noOverwriteAll)) { @@ -216,30 +220,30 @@ if (saveMetadata && !metadata.write(targetFilePath, destImg)) printError(); #endif // SIR_METADATA_SUPPORT - emit imageStatus(imgData, tr("Converted"), CONVERTED); + emit imageStatus(pd.imgData, tr("Converted"), CONVERTED); } else - emit imageStatus(imgData, tr("Failed to convert"), FAILED); + emit imageStatus(pd.imgData, tr("Failed to convert"), FAILED); } else if (shared->overwriteResult == QMessageBox::Cancel) - emit imageStatus(imgData, tr("Cancelled"), CANCELLED); + emit imageStatus(pd.imgData, tr("Cancelled"), CANCELLED); else - emit imageStatus(imgData, tr("Skipped"), SKIPPED); + emit imageStatus(pd.imgData, tr("Skipped"), SKIPPED); } else if (shared->noOverwriteAll) - emit imageStatus(imgData, tr("Skipped"), SKIPPED); + emit imageStatus(pd.imgData, tr("Skipped"), SKIPPED); else if (shared->abort) - emit imageStatus(imgData, tr("Cancelled"), CANCELLED); + emit imageStatus(pd.imgData, tr("Cancelled"), CANCELLED); else { // when overwriteAll is true or file not exists if (destImg.save(targetFilePath, 0, shared->quality)) { #ifdef SIR_METADATA_SUPPORT if (saveMetadata && !metadata.write(targetFilePath, destImg)) printError(); #endif // SIR_METADATA_SUPPORT - emit imageStatus(imgData, tr("Converted"), CONVERTED); + emit imageStatus(pd.imgData, tr("Converted"), CONVERTED); } else - emit imageStatus(imgData, tr("Failed to convert"), FAILED); + emit imageStatus(pd.imgData, tr("Failed to convert"), FAILED); } delete image; getNextOrStop(); @@ -267,8 +271,11 @@ } #endif // SIR_METADATA_SUPPORT -/** Rotates \a image */ -void ConvertThread::rotateImage(QImage *image) { +/** Rotates \a image object and returns new QImage object. + * \return Rotated image if just rotated, without metadata manipulation. + * Otherwise returns a copy of \a image object. + */ +QImage ConvertThread::rotateImage(const QImage &image) { int alpha = (int)angle; #ifdef SIR_METADATA_SUPPORT bool saveExifOrientation = !shared->realRotate; @@ -322,6 +329,9 @@ int tmp = width; width = height; height = tmp; + bool temp = hasWidth; + hasWidth = hasHeight; + hasHeight = temp; } // image tranformation matrix QTransform transform; @@ -340,10 +350,11 @@ } #endif // SIR_METADATA_SUPPORT transform.rotate(angle); - *image = image->transformed(transform, Qt::SmoothTransformation); + return image.transformed(transform, Qt::SmoothTransformation); #ifdef SIR_METADATA_SUPPORT } #endif // SIR_METADATA_SUPPORT + return image; } #ifdef SIR_METADATA_SUPPORT @@ -353,13 +364,13 @@ * function.\n * This function is available if SIR_METADATA_SUPPORT is defined only. */ -void ConvertThread::updateThumbnail(const QImage *image) { +void ConvertThread::updateThumbnail(const QImage &image) { // update thumbnail if (saveMetadata && shared->updateThumbnail) { MetadataUtils::ExifStruct *exifStruct = metadata.exifStruct(); int w = exifStruct->thumbnailWidth.split(' ').first().toInt(); int h = exifStruct->thumbnailHeight.split(' ').first().toInt(); - QImage tmpImg = image->scaled(w,h, Qt::KeepAspectRatio, + QImage tmpImg = image.scaled(w,h, Qt::KeepAspectRatio, Qt::SmoothTransformation); bool specialRotate = (rotate && (int)angle%90 != 0); QImage *thumbnail = &exifStruct->thumbnailImage; @@ -369,7 +380,10 @@ *thumbnail = tmpImg; } else { - thumbnail->fill(Qt::black); + if (shared->backgroundColor.isValid()) + thumbnail->fill(shared->backgroundColor); + else + thumbnail->fill(Qt::black); QPoint begin ( (w-tmpImg.width())/2, (h-tmpImg.height())/2 ); for (int i=0, y=begin.y(); iscaled(width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - rotateImage(&tempImage); + tempImage = rotateImage(tempImage); #ifdef SIR_METADATA_SUPPORT - updateThumbnail(&tempImage); + updateThumbnail(tempImage); #endif // SIR_METADATA_SUPPORT if (tempImage.save(&tempFile, 0, shared->quality)) { #ifdef SIR_METADATA_SUPPORT @@ -485,11 +499,13 @@ */ char ConvertThread::computeSize(QSvgRenderer *renderer, const QString &imagePath) { QSize defaultSize = renderer->defaultSize(); - if (shared->sizeUnit == 0) ; // px + if (shared->sizeUnit == 0) // px // compute size when it wasn't typed in pixels + return 1; else if (shared->sizeUnit == 1) { // % width *= defaultSize.width() / 100.; height *= defaultSize.height() / 100.; + return 1; } else if (shared->sizeUnit == 2) { // bytes width = defaultSize.width(); @@ -520,16 +536,13 @@ width = size.width() / fileSizeRatio; height = size.height() / fileSizeRatio; QImage tempImage(width, height, QImage::Format_ARGB32); - if (shared->format == "gif" || shared->format == "png") - tempImage.fill(Qt::transparent); - else // in other formats tranparency isn't supported - tempImage.fill(Qt::white); + fillImage(&tempImage); painter.begin(&tempImage); renderer->render(&painter); painter.end(); - rotateImage(&tempImage); + tempImage = rotateImage(tempImage); #ifdef SIR_METADATA_SUPPORT - updateThumbnail(&tempImage); + updateThumbnail(tempImage); #endif // SIR_METADATA_SUPPORT if (tempImage.save(&tempFile, 0, shared->quality)) { #ifdef SIR_METADATA_SUPPORT @@ -557,7 +570,7 @@ if (answer < 0) return answer; } - return 1; + return 2; } return 0; } @@ -666,3 +679,92 @@ } return 0; } + +/** Fills image with custom background color if is valid or transparent + * (if target file format supports transparency); otherwise with white. + * \sa SharedInformation::backgroundColor SharedInformation::format + */ +void ConvertThread::fillImage(QImage *img) { + if (shared->backgroundColor.isValid()) + img->fill(shared->backgroundColor.rgb()); + else if (shared->format == "gif" || shared->format == "png") + img->fill(Qt::transparent); + else // in other formats tranparency isn't supported + img->fill(Qt::white); +} + +/** Loads and modifies SVG file if needed. Renders SVG data to \a image object. + * \return Pointer to rendered image if succeed. Otherwise null pointer. + */ +QImage * ConvertThread::loadSvgImage() { + QSvgRenderer renderer; + if (shared->svgModifiersEnabled) { + SvgModifier modifier(pd.imagePath); + // modify SVG file + if (!shared->svgRemoveText.isNull()) + modifier.removeText(shared->svgRemoveText); + if (shared->svgRemoveEmptyGroup) + modifier.removeEmptyGroups(); + // save SVG file + if (shared->svgSave) { + QString svgTargetFileName = + targetFilePath.left(targetFilePath.lastIndexOf('.')+1) + "svg"; + QFile file(svgTargetFileName); + // ask overwrite + if (file.exists()) { + shared->mutex.lock(); + emit question(svgTargetFileName, Overwrite); + shared->mutex.unlock(); + } + if (shared->overwriteResult == QMessageBox::Yes || + shared->overwriteResult == QMessageBox::YesToAll) { + if (!file.open(QIODevice::WriteOnly)) { + emit imageStatus(pd.imgData, tr("Failed to save new SVG file"), + FAILED); + return NULL; + } + file.write(modifier.content()); + } + } + // and load QByteArray buffer to renderer + if (!renderer.load(modifier.content())) { + emit imageStatus(pd.imgData, tr("Failed to open changed SVG file"), + FAILED); + return NULL; + } + } + else if (!renderer.load(pd.imagePath)) { + emit imageStatus(pd.imgData, tr("Failed to open SVG file"), FAILED); + return NULL; + } + sizeComputed = computeSize(&renderer, pd.imagePath); + if (sizeComputed == 2) + return NULL; + // keep aspect ratio + if (shared->maintainAspect) { + qreal w = width; + qreal h = height; + qreal targetRatio = w / h; + QSizeF svgSize = renderer.defaultSize(); + qreal currentRatio = svgSize.width() / svgSize.height(); + if (currentRatio != targetRatio) { + qreal diffRatio; + if (currentRatio > targetRatio) + diffRatio = w / svgSize.width(); + else + diffRatio = h / svgSize.height(); + width = diffRatio * svgSize.width(); + height = diffRatio * svgSize.height(); + } + } + // create image + QImage *img = new QImage(width, height, QImage::Format_ARGB32); + fillImage(img); + QPainter painter(img); + renderer.render(&painter); + // don't scale rendered image + hasWidth = false; + hasHeight = false; + // finaly return the image pointer + return img; +} diff -Nru sir-2.5.1/src/convertthread.h sir-2.6/src/convertthread.h --- sir-2.5.1/src/convertthread.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/convertthread.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -48,7 +48,7 @@ /** \brief Image convertion thread class. * - * Threads converting images work in main loop implemented in run method. + * Threads converting images work in main loop implemented in run() method. * \sa run() */ class ConvertThread : public QThread { @@ -71,35 +71,58 @@ void question(const QString& targetFilePath, Question whatToDo); void getNextImage(int tid); +protected: + void run(); + private: // fields - static SharedInformation *shared; - bool work; - QStringList imageData; - int tid; + static SharedInformation *shared; /**< The theads shared information. */ + bool work; /**< True means this thread still working. */ + QStringList imageData; /**< List of strings: file name, extension and path. */ + int tid; /**< The thread ID. */ + /** If it's true the converting image will be scaled to #width value. */ bool hasWidth; + /** If it's true the converting image will be scaled to #height value. */ bool hasHeight; + /** Desired width of the converting image. + * \sa #hasWidth + */ int width; + /** Desired height of the converting image. + * \sa #hasHeight + */ int height; + /** Describes size compute state. + * \sa computeSize() + */ char sizeComputed; + /** If it's true the converting image will be rotated by #angle value. */ bool rotate; + /** Desired rotation angle of the converting image in degree. + * \sa #rotate + */ double angle; + struct ThreadPrivateData { + QString imagePath; + QStringList imgData; + } pd; #ifdef SIR_METADATA_SUPPORT bool saveMetadata; MetadataUtils::Metadata metadata; #endif // SIR_METADATA_SUPPORT QString targetFilePath; // methods - void run(); - void rotateImage(QImage *image); + QImage rotateImage(const QImage &image); #ifdef SIR_METADATA_SUPPORT - void updateThumbnail(const QImage *image); + void updateThumbnail(const QImage &image); #endif // SIR_METADATA_SUPPORT char computeSize(const QImage *image, const QString &imagePath); char computeSize(QSvgRenderer *renderer, const QString &imagePath); bool isLinearFileSizeFormat(double *destSize); char askEnlarge(const QImage &image, const QString &imagePath); char askOverwrite(QFile *tempFile); + void fillImage(QImage *img); + QImage *loadSvgImage(); }; -#endif +#endif // CONVERTTHREAD_H diff -Nru sir-2.5.1/src/defines.h sir-2.6/src/defines.h --- sir-2.5.1/src/defines.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/defines.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -23,7 +23,7 @@ #define SIR_METADATA_SUPPORT #endif // SIR_CMAKE -#define VERSION "2.5.1" +#define VERSION "2.6" #define NOTCONVERTED 1 #define CONVERTED 2 #define SKIPPED 3 diff -Nru sir-2.5.1/src/expressiontree.cpp sir-2.6/src/expressiontree.cpp --- sir-2.5.1/src/expressiontree.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/expressiontree.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 diff -Nru sir-2.5.1/src/expressiontree.h sir-2.6/src/expressiontree.h --- sir-2.5.1/src/expressiontree.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/expressiontree.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 diff -Nru sir-2.5.1/src/languageutils.cpp sir-2.6/src/languageutils.cpp --- sir-2.5.1/src/languageutils.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/languageutils.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -27,7 +27,20 @@ #include #include #include +#include +#include #include "languageutils.h" +#include "settings.h" + +/** Returns singledon instance pointer. + * \sa LanguageUtils() + */ +LanguageUtils * LanguageUtils::instance() { + static LanguageUtils *object = 0; + if (!object && QCoreApplication::instance()) + object = new LanguageUtils(); + return object; +} /** Default constructor.\n * Reads informations about languages and loads into languageInfoMap language @@ -35,11 +48,15 @@ * \sa LanguageInfo readLanguages() */ LanguageUtils::LanguageUtils() { + qtTranslator = new QTranslator; + appTranslator = new QTranslator; this->readLanguages(); } /** Deallocates memory. */ LanguageUtils::~LanguageUtils() { + delete qtTranslator; + delete appTranslator; delete languageInfoMap; } @@ -82,7 +99,27 @@ } } -/** Returns LanguageInfo about typed \a language name. */ -const LanguageInfo LanguageUtils::getLanguageInfo(const QString & language) const { - return languageInfoMap->value(language); +/** Returns LanguageInfo about typed \a qmFile name. */ +const LanguageInfo LanguageUtils::languageInfo(const QString &qmFile) const { + return languageInfoMap->value(qmFile); +} + +/** Returns name of file corresponding \a lang language symbol, i.e. en for + * english.\n + * If \a lang is null string returns translation file name from Settings. + * \sa languageInfoMap + */ +QString LanguageUtils::fileName(const QString &lang) const { + if (lang.isNull()) + return Settings::instance()->settings.languageFileName; + QStringList qmFiles = fileNames(); + QStringList translations = qmFiles.filter(lang); + if (translations.isEmpty()) + translations = qmFiles.filter(lang.section('_',0,0)); + if (translations.isEmpty()) { + qDebug() << QString("Translation file for %1 language symbol not found.\n" + "Loading english translation.").arg(lang); + return "sir_en.qm"; + } + return translations[0]; } diff -Nru sir-2.5.1/src/languageutils.h sir-2.6/src/languageutils.h --- sir-2.5.1/src/languageutils.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/languageutils.h 2013-04-28 11:49:20.000000000 +0000 @@ -29,6 +29,8 @@ #include #include +class QTranslator; + //! Struct containing user visible information about language. struct LanguageInfo { QString niceName; /**< Language name. */ @@ -38,10 +40,19 @@ //! Multi languages support tool class. class LanguageUtils { public: + static LanguageUtils *instance(); + const LanguageInfo languageInfo(const QString &qmFile) const; + QString fileName(const QString &lang) const; + /** Returns list of compiled translation file names (*.qm). + * \sa languageInfoMap + */ + QStringList fileNames() const { return languageInfoMap->keys(); } + QTranslator *qtTranslator; /**< Translator of standard Qt objects. */ + QTranslator *appTranslator; /**< Translator of SIR objects. */ + +private: LanguageUtils(); ~LanguageUtils(); - const LanguageInfo getLanguageInfo(const QString & language) const; -private: void readLanguages(); /** Language information map. Key is compiled translation file name. */ QMap *languageInfoMap; diff -Nru sir-2.5.1/src/main.cpp sir-2.6/src/main.cpp --- sir-2.5.1/src/main.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/main.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -19,24 +19,30 @@ * Program URL: http://sir.projet-libre.org/ */ - #include #include #include "main.h" +#include "commandlineassistant.h" int main(int argc, char *argv[]) { -// Q_INIT_RESOURCE(application); + Q_INIT_RESOURCE(application); QApplication app(argc, argv); QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); QTextCodec* codec = QTextCodec::codecForLocale (); - QString args = ""; - /*Parse the arguments from the command line*/ + // Parse the arguments from the command line + QStringList args; for(int i = 1; i < argc; i++) - args = args + codec->toUnicode(argv[i]) + "**" ; + args += codec->toUnicode(argv[i]); + args.removeDuplicates(); + + CommandLineAssistant cmd; + int cmdParseResult = cmd.parse(args); + if (cmdParseResult < 1) + return cmdParseResult; - ConvertDialog w(0,args); + ConvertDialog w(0, args, cmd); w.show(); app.connect( &app, SIGNAL( lastWindowClosed() ), &app, SLOT( quit() ) ); return app.exec(); diff -Nru sir-2.5.1/src/metadata/error.cpp sir-2.6/src/metadata/error.cpp --- sir-2.5.1/src/metadata/error.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/metadata/error.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 diff -Nru sir-2.5.1/src/metadata/error.h sir-2.6/src/metadata/error.h --- sir-2.5.1/src/metadata/error.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/metadata/error.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 diff -Nru sir-2.5.1/src/metadata/exif.cpp sir-2.6/src/metadata/exif.cpp --- sir-2.5.1/src/metadata/exif.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/metadata/exif.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 diff -Nru sir-2.5.1/src/metadata/exif.h sir-2.6/src/metadata/exif.h --- sir-2.5.1/src/metadata/exif.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/metadata/exif.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 diff -Nru sir-2.5.1/src/metadata/iptc.cpp sir-2.6/src/metadata/iptc.cpp --- sir-2.5.1/src/metadata/iptc.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/metadata/iptc.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 diff -Nru sir-2.5.1/src/metadata/iptc.h sir-2.6/src/metadata/iptc.h --- sir-2.5.1/src/metadata/iptc.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/metadata/iptc.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 diff -Nru sir-2.5.1/src/metadata/string.cpp sir-2.6/src/metadata/string.cpp --- sir-2.5.1/src/metadata/string.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/metadata/string.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -127,6 +127,19 @@ } #endif // SIR_METADATA_SUPPORT +/** Converts this string to boolean value. + * \return True if the string is \e yes, \e y, \e true, \e t or integer value + * of the string isn't 0. Otherwise false. + */ +bool String::toBool() const { + static QStringList list; + if (list.isEmpty()) + list << "yes" << "y" << "true" << "t"; + if (list.contains(*this, Qt::CaseInsensitive) || this->toInt() != 0) + return true; + return false; +} + /** Returns string converted from \a s. */ String String::fromStdString(const std::string &s) { return String( QString::fromStdString(s) ); @@ -134,12 +147,20 @@ /** Returns date and time string in \a formatOut format converted from * \a dateTimeStr date and time string in \a formatIn format. + * \sa currentDateTimeString() */ String String::fromDateTimeString(const String &dateTimeStr, const QString &formatIn, const QString &formatOut) { return QDateTime::fromString(dateTimeStr, formatIn).toString(formatOut); } +/** Returns date and time string in \a format format. + * \sa fromDateTimeString() + */ +String String::currentDateTimeString(const QString &format) { + return QDateTime::currentDateTime().toString(format); +} + /** Returns translated \em "no data" string. */ QString String::noData() { return tr("no data"); diff -Nru sir-2.5.1/src/metadata/string.h sir-2.6/src/metadata/string.h --- sir-2.5.1/src/metadata/string.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/metadata/string.h 2013-04-28 11:49:20.000000000 +0000 @@ -52,6 +52,7 @@ Exiv2::Rational toRational() const; Exiv2::Rational toRationalPower() const; #endif // SIR_METADATA_SUPPORT + bool toBool() const; String & operator =(const char *str); String & operator =(const QString &other); String & operator =(const std::string &str); @@ -60,6 +61,7 @@ static String fromStdString(const std::string &s); static String fromDateTimeString(const String &dateTimeStr, const QString &formatIn, const QString &formatOut); + static String currentDateTimeString(const QString &format); }; } diff -Nru sir-2.5.1/src/metadatautils.cpp sir-2.6/src/metadatautils.cpp --- sir-2.5.1/src/metadatautils.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/metadatautils.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -43,17 +43,25 @@ close(); } -/** Reads metadata from \b path file path and optionaly setup ExifStruct if - * \b setupStructs is true, and returns read success value.\n - * If exception catched this error data will be appended to errorList list. +/** Reads metadata from file. + * \param path file path + * \param setupStructs setup ExifStruct if it's true + * \param fromSvg create new image object, don't read metadata from file + * \return Read success value.\n + * If exception catched this error data will be appended to errorList + * list and returns false. * \sa lastError() */ -bool Metadata::read(const String& path, bool setupStructs) { +bool Metadata::read(const String& path, bool setupStructs, bool fromSvg) { close(); std::string filePath = path.toNativeStdString(); try { - image = Exiv2::ImageFactory::open(filePath); - image->readMetadata(); + if (fromSvg) + image = Exiv2::ImageFactory::create(1); + else { + image = Exiv2::ImageFactory::open(filePath); + image->readMetadata(); + } // load Exif data exifData = image->exifData(); exif.setVersion(exifData["Exif.Photo.ExifVersion"]); @@ -93,8 +101,8 @@ } /** This is overloaded function. */ -bool Metadata::read(const QString &path, bool setupStructs) { - return read((const String&)path,setupStructs); +bool Metadata::read(const QString &path, bool setupStructs, bool fromSvg) { + return read((const String&)path, setupStructs, fromSvg); } /** Writes metadata about file corresponding with \a path file path and @@ -107,8 +115,8 @@ */ bool Metadata::write(const String& path, const QImage& qImage) { close(); + std::string filePath = path.toNativeStdString(); try { - std::string filePath = path.toNativeStdString(); image = Exiv2::ImageFactory::open(filePath); image->readMetadata(); image->clearMetadata(); @@ -177,6 +185,15 @@ if (Exif::isUserCommentOverwrite()) exifData["Exif.Photo.UserComment"] = Exif::stringUserComment().toNativeStdString(); + std::string currentDateTimeString = + String::currentDateTimeString(Exif::dateTimeFormat).toNativeStdString(); + exifData["Exif.Image.DateTime"] = currentDateTimeString; + if (exifData["Exif.Image.DateTimeOriginal"].toString().empty()) + exifData["Exif.Image.DateTimeOriginal"] = currentDateTimeString; + if (exifData["Exif.Photo.DateTimeOriginal"].toString().empty()) + exifData["Exif.Photo.DateTimeOriginal"] = currentDateTimeString; + if (exifData["Exif.Photo.DateTimeDigitized"].toString().empty()) + exifData["Exif.Photo.DateTimeDigitized"] = currentDateTimeString; image->setExifData(exifData); result = true; } diff -Nru sir-2.5.1/src/metadatautils.h sir-2.6/src/metadatautils.h --- sir-2.5.1/src/metadatautils.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/metadatautils.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -40,8 +40,8 @@ // methods Metadata(); ~Metadata(); - bool read(const String& path, bool setupStructs = false); - bool read(const QString& path, bool setupStructs = false); + bool read(const String& path, bool setupStructs = false, bool fromSvg = false); + bool read(const QString& path, bool setupStructs = false, bool fromSvg = false); bool write(const String& path, const QImage& image = QImage()); bool write(const QString& path, const QImage& image = QImage()); void close(); diff -Nru sir-2.5.1/src/networkutils.cpp sir-2.6/src/networkutils.cpp --- sir-2.5.1/src/networkutils.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/networkutils.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 diff -Nru sir-2.5.1/src/rawutils.cpp sir-2.6/src/rawutils.cpp --- sir-2.5.1/src/rawutils.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/rawutils.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -132,14 +132,14 @@ * \sa readDcrawPath readDcrawOptions */ bool RawUtils::isRawEnabled() { - return Settings::instance().raw.enabled; + return Settings::instance()->raw.enabled; } /** Reads from settings and returns path string to dcraw executable file. * \sa readDcrawOptions isRawEnabled */ QString RawUtils::readDcrawPath() { - return Settings::instance().raw.dcrawPath; + return Settings::instance()->raw.dcrawPath; } /** Reads from settings and returns dcraw options string splited by @@ -147,7 +147,7 @@ * \sa readDcrawPath isRawEnabled */ QStringList RawUtils::readDcrawOptions() { - return Settings::instance().raw.dcrawOptions.split(" ", QString::SkipEmptyParts); + return Settings::instance()->raw.dcrawOptions.split(" ", QString::SkipEmptyParts); } /** Creates list of supported image file extensions into \b rawFormats. */ diff -Nru sir-2.5.1/src/regexputils.cpp sir-2.6/src/regexputils.cpp --- sir-2.5.1/src/regexputils.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/regexputils.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,65 @@ +/* This file is part of SIR, an open-source cross-platform Image tool + * 2007-2010 Rafael Sachetto + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#include "regexputils.h" + +namespace RegExpUtils { + +/** This is overloaded function.\n + * Returns true if one member of \a rxList list is \a string string compatible. + * \param string Testing string. + * \param rxList Pointer to list of pointers to regular expression objects. + */ +bool isCompatible(const QString &string, const QList &rxList) { + bool result = false; + foreach (QRegExp *rx, rxList) { + result = string.contains(*rx); + if (result) + break; + } + return result; +} + +/** This is overloaded function.\n + * Returns true if one member of \a rxList list is one member of \a list + * list of strings compatible. + * \param string Testing list of strings. + * \param rxList Pointer to list of pointers to regular expression objects. + */ +bool isCompatible(const QStringList &list, const QList &rxList) { + bool result = false; + foreach (QString str, list) { + result = isCompatible(str, rxList); + if (result) + break; + } + return result; +} + +/** Clears \a list and deallocates regular expression objects safe. + * \param list Pointer to list of pointers to regular expression objects. + */ +void clearPointerList(QList *list) { + while (!list->isEmpty()) + delete list->takeLast(); +} + +} diff -Nru sir-2.5.1/src/regexputils.h sir-2.6/src/regexputils.h --- sir-2.5.1/src/regexputils.h 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/regexputils.h 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,33 @@ +/* This file is part of SIR, an open-source cross-platform Image tool + * 2007-2010 Rafael Sachetto + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#ifndef REGEXPUTILS_H +#define REGEXPUTILS_H + +#include + +namespace RegExpUtils { +bool isCompatible(const QString &string, const QList &rxList); +bool isCompatible(const QStringList &list, const QList &rxList); +void clearPointerList(QList *list); +} + +#endif // REGEXPUTILS_H diff -Nru sir-2.5.1/src/selection.cpp sir-2.6/src/selection.cpp --- sir-2.5.1/src/selection.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/selection.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -27,6 +27,8 @@ #include "defines.h" #include "expressiontree.h" #include "widgets/selectiondialog.h" +#include "regexputils.h" +#include "convertshareddata.h" // static variables @@ -54,6 +56,10 @@ QStringList Selection::allOperators = QStringList() << Selection::logicalOperators << Selection::comparisonOperators; +// Namespace setup + +using namespace RegExpUtils; + // ________________________________ Selection ________________________________ /** Selection object default constructor. */ @@ -208,10 +214,10 @@ } void Selection::loadSymbols() { - Settings &s = Settings::instance(); - fileSizeSymbols << s.selection.fileSizeSymbol; - imageSizeSymbols << s.selection.imageWidthSymbol - << s.selection.imageHeightSymbol; + Settings *s = Settings::instance(); + fileSizeSymbols << s->selection.fileSizeSymbol; + imageSizeSymbols << s->selection.imageWidthSymbol + << s->selection.imageHeightSymbol; } /** Sets up this objects regular expression lists setupListRegExp() method. @@ -261,14 +267,6 @@ } } -/** Clears \a list and deallocates regular expression objects safe. - * \param list Pointer to list of pointers to regular expression objects. - */ -void Selection::clearPointerList(QList *list) { - while (!list->isEmpty()) - delete list->takeLast(); -} - /** Loads information about files from \a dir directory to \a list. * \param dir Full path of directory. * \param list List contain file info objects. @@ -279,7 +277,7 @@ int Selection::loadFileInfo(const QString &dir, QFileInfoList *list, bool recursive) { int result = 0; qDebug() << "Watching dir:" << dir; - QDir sourceDir(dir, convertDialog->fileFilters); + QDir sourceDir(dir, convertDialog->csd->fileFilters); sourceDir.setFilter(QDir::Files | QDir::NoSymLinks | QDir::Readable); QFileInfoList fileInfoList = sourceDir.entryInfoList(); list->append(fileInfoList); @@ -298,43 +296,12 @@ } /** This is overloaded function.\n - * Returns true if one member of \a rxList list is \a string string compatible. - * \param string Testing string. - * \param rxList Pointer to list of pointers to regular expression objects. - */ -bool Selection::isCompatible(const QString &string, const QList &rxList) { - bool result = false; - foreach (QRegExp *rx, rxList) { - result = string.contains(*rx); - if (result) - break; - } - return result; -} - -/** This is overloaded function.\n - * Returns true if one member of \a rxList list is one member of \a list - * list of strings compatible. - * \param string Testing list of strings. - * \param rxList Pointer to list of pointers to regular expression objects. - */ -bool Selection::isCompatible(const QStringList &list, const QList &rxList) { - bool result = false; - foreach (QString str, list) { - result = isCompatible(str, rxList); - if (result) - break; - } - return result; -} - -/** This is overloaded function.\n * Returns true if \a date and \a time object values are between value of first * and second item (including extreme values) of \a dtArray; otherwise returns false. * \note \a dtArray must be 2-item (or more) array; otherwise it will send SIGSEGV * (segmentation fault signal) to operating system. */ -bool Selection::isCompatible(const QDate &date, const QTime &time, QDateTime *dtArray) { +bool Selection::isInTime(const QDate &date, const QTime &time, QDateTime *dtArray) { return ( (dtArray[0].date() <= date && date <= dtArray[1].date()) && (dtArray[0].time() <= time && time <= dtArray[1].time()) ); } @@ -345,7 +312,7 @@ * \note \a dtArray must be 2-item (or more) array; otherwise it will send SIGSEGV * (segmentation fault signal) to operating system. */ -bool Selection::isCompatible(const QDateTime &dateTime, QDateTime *dtArray) { +bool Selection::isInTime(const QDateTime &dateTime, QDateTime *dtArray) { return (dtArray[0] <= dateTime && dateTime <= dtArray[1]); } @@ -376,7 +343,7 @@ #ifdef SIR_METADATA_SUPPORT MetadataUtils::Metadata *metadata = 0; bool setupStructs; - if (Settings::instance().metadata.enabled) { + if (Settings::instance()->metadata.enabled) { setupStructs = (params.checkMetadata || params.checkExif || params.checkIPTC); metadata = new MetadataUtils::Metadata(); } @@ -402,14 +369,14 @@ MetadataUtils::IptcStruct *iptcStruct = metadata->iptcStruct(); // check any metadata if (params.checkMetadata) { - if (!isCompatible(QDateTime::fromString(exifStruct->originalDate, Qt::ISODate), + if (!isInTime(QDateTime::fromString(exifStruct->originalDate, Qt::ISODate), params.createdDateTime) && - !isCompatible(iptcStruct->dateCreated, iptcStruct->timeCreated, + !isInTime(iptcStruct->dateCreated, iptcStruct->timeCreated, params.createdDateTime)) return false; - if (!isCompatible(QDateTime::fromString(exifStruct->digitizedDate, Qt::ISODate), + if (!isInTime(QDateTime::fromString(exifStruct->digitizedDate, Qt::ISODate), params.digitizedDateTime) && - !isCompatible(iptcStruct->digitizationDate, iptcStruct->digitizationTime, + !isInTime(iptcStruct->digitizationDate, iptcStruct->digitizationTime, params.digitizedDateTime)) return false; QStringList strList; @@ -423,9 +390,11 @@ } // check Exif metadata if (params.checkExif) { - if (!isCompatible(exifStruct->processingSoftware, exifProcessingSoftwareListRx)) + if (!isCompatible(exifStruct->processingSoftware, + exifProcessingSoftwareListRx)) return false; - if (!isCompatible(exifStruct->cameraManufacturer, exifCameraManufacturerListRx)) + if (!isCompatible(exifStruct->cameraManufacturer, + exifCameraManufacturerListRx)) return false; if (!isCompatible(exifStruct->cameraModel, exifCameraModelListRx)) return false; diff -Nru sir-2.5.1/src/selection.h sir-2.6/src/selection.h --- sir-2.5.1/src/selection.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/selection.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -109,12 +109,9 @@ void setupRegExps(); void setupListRegExp(const MetadataUtils::String &strExp, QList *listRx); int loadFileInfo(const QString &dir, QFileInfoList *list, bool recursive); - bool isCompatible(const QString &string, const QList &rxList); - bool isCompatible(const QStringList &list, const QList &rxList); - bool isCompatible(const QDate &date, const QTime &time, QDateTime *dtArray); - bool isCompatible(const QDateTime &dateTime, QDateTime *dtArray); + bool isInTime(const QDate &date, const QTime &time, QDateTime *dtArray); + bool isInTime(const QDateTime &dateTime, QDateTime *dtArray); bool testFile(const QFileInfo &info); - void clearPointerList(QList *list); void setupExpressionTrees(); void loadSymbols(); }; diff -Nru sir-2.5.1/src/session.cpp sir-2.6/src/session.cpp --- sir-2.5.1/src/session.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/session.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,456 @@ +#include +#include +#include "session.h" +#include "convertdialog.h" +#include "xmlstreamwriter.h" +#include "defines.h" +#include "metadata/string.h" +#include "convertshareddata.h" + +const QString falseString = "no"; + +/** Creates the Session object. + * \param parent Parent convert dialog. + */ +Session::Session(ConvertDialog *parent) { + convertDialog = parent; + if (convertDialog) { + sizeArea = convertDialog->sizeScrollArea; + optionsArea = convertDialog->optionsScrollArea; + effectsArea = convertDialog->effectsScrollArea; + svgArea = convertDialog->svgScrollArea; + } + else { + sizeArea = 0; + optionsArea = 0; + effectsArea = 0; + svgArea = 0; + } +} + +/** Writes session to XML file in \a fileName path. */ +void Session::save(const QString &fileName) { + QFile file(fileName); + if (!file.open(QIODevice::WriteOnly)) { + QMessageBox::warning(convertDialog, tr("Session write error"), + tr("Session saving to %1 file failed.\n" + "Can't open the file.").arg(fileName) ); + return; + } + + QString str; // working string + + XmlStreamWriter writer(&file); + writer.setAutoFormatting(true); + writer.setAutoFormattingIndent(2); + writer.setCodec("UTF-8"); + writer.writeStartDocument(); + writer.writeStartElement("sir"); + writer.writeAttribute("version", VERSION); + writer.writeStartElement("session"); + + writer.writeStartElement("files"); + for (int i=0; ifilesTreeWidget->topLevelItemCount(); i++) { + QTreeWidgetItem *item = convertDialog->filesTreeWidget->topLevelItem(i); + QString path = item->text(2); + if (!path.endsWith(QDir::separator())) + path += QDir::separator(); + path += item->text(0) + '.' + item->text(1); + writer.writeStartElement("file"); + writer.writeCharacters(path); + writer.writeEndElement(); // file + } + writer.writeEndElement(); // files + + writer.writeStartElement("target"); + writer.writeStartElement("dir"); + writer.writeCharacters(convertDialog->destFileEdit->text()); + writer.writeEndElement(); // dir + writer.writeStartElement("prefix"); + writer.writeCharacters(convertDialog->destPrefixEdit->text()); + writer.writeEndElement(); // prefix + writer.writeStartElement("suffix"); + writer.writeCharacters(convertDialog->destSuffixEdit->text()); + writer.writeEndElement(); // suffix + writer.writeStartElement("format"); + writer.writeCharacters(convertDialog->targetFormatComboBox->currentText()); + writer.writeEndElement(); // format + writer.writeEndElement(); // target + + writer.writeStartElement("size"); + writer.writeAttribute("keepaspect", sizeArea->maintainCheckBox->isChecked()); + str = sizeArea->sizeUnitComboBox->currentText().split('(')[1].split(')')[0]; + writer.writeAttribute("unit", str); + if (sizeArea->sizeUnitComboBox->currentIndex() == 0) { + writer.writeStartElement("pixels"); + writer.writeAttribute("width", sizeArea->widthDoubleSpinBox->value()); + writer.writeAttribute("height", sizeArea->heightDoubleSpinBox->value()); + writer.writeEndElement(); // pixels + writer.writeStartElement("percent"); + writer.writeAttribute("width", ConvertSharedData::instance()->sizeWidth); + writer.writeAttribute("height", ConvertSharedData::instance()->sizeHeight); + writer.writeEndElement(); // percent + } + else { + writer.writeStartElement("percent"); + writer.writeAttribute("width", sizeArea->widthDoubleSpinBox->value()); + writer.writeAttribute("height", sizeArea->heightDoubleSpinBox->value()); + writer.writeEndElement(); // percent + writer.writeStartElement("pixels"); + writer.writeAttribute("width", ConvertSharedData::instance()->sizeWidth); + writer.writeAttribute("height", ConvertSharedData::instance()->sizeHeight); + writer.writeEndElement(); // pixels + } + writer.writeStartElement("bytes"); + writer.writeCharacters(QString::number(sizeArea->fileSizeSpinBox->value()) + + ' ' + sizeArea->fileSizeComboBox->currentText() ); + writer.writeEndElement(); // bytes + writer.writeEndElement(); // size + + writer.writeStartElement("options"); + writer.writeStartElement("quality"); + writer.writeValue(optionsArea->qualitySpinBox->value()); + writer.writeEndElement(); // quality + writer.writeStartElement("background"); + writer.writeAttribute("enabled", optionsArea->backgroundColorCheckBox->isChecked()); + writer.writeColorElement(optionsArea->backgroundColorFrame->color()); + writer.writeEndElement(); // background + writer.writeStartElement("rotation"); + writer.writeAttribute("enabled", optionsArea->rotateCheckBox->isChecked()); + writer.writeCharacters(optionsArea->rotateLineEdit->text()); + writer.writeEndElement(); // rotation + writer.writeStartElement("flip"); + writer.writeValue(optionsArea->flipComboBox->currentIndex()); + writer.writeEndElement(); // flip + writer.writeEndElement(); // options + + writer.writeStartElement("effects"); + // add frame + writer.writeStartElement("addframe"); + writer.writeAttribute("enabled", effectsArea->frameGroupBox->isChecked()); + writer.writeStartElement("frame"); + writer.writeAttribute("around", effectsArea->frameAroundRadioButton->isChecked()); + writer.writeAttribute("width", effectsArea->frameWidthSpinBox->value()); + writer.writeColorElement(effectsArea->frameColorFrame->color()); + writer.writeEndElement(); // frame + writer.writeStartElement("insideborder"); + writer.writeAttribute("enabled", effectsArea->borderInsideGroupBox->isChecked()); + writer.writeAttribute("width", effectsArea->borderInsideSpinBox->value()); + writer.writeColorElement(effectsArea->borderInsideColorFrame->color()); + writer.writeEndElement(); // insideborder + writer.writeStartElement("outsideborder"); + writer.writeAttribute("enabled", effectsArea->borderOutsideGroupBox->isChecked()); + writer.writeAttribute("width", effectsArea->borderOutsideSpinBox->value()); + writer.writeColorElement(effectsArea->borderOutsideColorFrame->color()); + writer.writeEndElement(); // outsideborder + writer.writeEndElement(); // addframe + // add text + writer.writeStartElement("addtext"); + writer.writeAttribute("enabled", effectsArea->textGroupBox->isChecked()); + writer.writeAttribute("opacity", effectsArea->textOpacitySpinBox->value()); + writer.writeStartElement("text"); + writer.writeAttribute("frame", effectsArea->textFrameCheckBox->isChecked()); + writer.writeCharacters(effectsArea->textLineEdit->text()); + writer.writeEndElement(); // text + writer.writeStartElement("font"); + writer.writeAttribute("family", + effectsArea->textFontComboBox->currentFont().family() ); + writer.writeAttribute("size", + QString::number(effectsArea->textFontSizeSpinBox->value()) + + ' ' + + effectsArea->textFontSizeComboBox->currentText() ); + writer.writeAttribute("bold", effectsArea->textBoldPushButton->isChecked()); + writer.writeAttribute("italic", effectsArea->textItalicPushButton->isChecked()); + writer.writeAttribute("underline", + effectsArea->textUnderlinePushButton->isChecked() ); + writer.writeAttribute("strikeout", + effectsArea->textStrikeOutPushButton->isChecked() ); + writer.writeColorElement(effectsArea->textColorFrame->color()); + writer.writeEndElement(); // font + writer.writeStartElement("pos"); + writer.writeAttribute("x", QString::number(effectsArea->textXSpinBox->value()) + + ' ' + effectsArea->textXComboBox->currentText() ); + writer.writeAttribute("y", QString::number(effectsArea->textYSpinBox->value()) + + ' ' + effectsArea->textYComboBox->currentText() ); + writer.writeAttribute("mod", effectsArea->textPositionComboBox->currentIndex()); + writer.writeAttribute("rotation", effectsArea->textRotationSpinBox->value()); + writer.writeEndElement(); // pos + writer.writeEndElement(); // addtext + // add image + writer.writeStartElement("addimage"); + writer.writeAttribute("enabled", effectsArea->imageGroupBox->isChecked()); + writer.writeAttribute("opacity", effectsArea->imageOpacitySpinBox->value()); + writer.writeStartElement("image"); + writer.writeCharacters(effectsArea->imagePathLineEdit->text()); + writer.writeEndElement(); // image + writer.writeStartElement("pos"); + writer.writeAttribute("x", QString::number(effectsArea->imageXSpinBox->value()) + + ' ' + effectsArea->imageXComboBox->currentText() ); + writer.writeAttribute("y", QString::number(effectsArea->imageYSpinBox->value()) + + ' ' + effectsArea->imageYComboBox->currentText() ); + writer.writeAttribute("mod", effectsArea->imagePositionComboBox->currentIndex()); + writer.writeAttribute("rotation", effectsArea->imageRotationSpinBox->value()); + writer.writeEndElement(); // pos + writer.writeEndElement(); // addimage + writer.writeEndElement(); // effects + + writer.writeStartElement("svg"); + writer.writeAttribute("save", svgArea->saveCheckBox->isChecked()); + writer.writeStartElement("remove"); + writer.writeAttribute("emptygroups", svgArea->removeGroupsCheckBox->isChecked()); + writer.writeStartElement("text"); + writer.writeAttribute("enabled", svgArea->removeTextCheckBox->isChecked()); + writer.writeCharacters(svgArea->removeTextLineEdit->text()); + writer.writeEndElement(); // text + writer.writeEndElement(); // remove + writer.writeEndElement(); // svg + + writer.writeEndElement(); // session + writer.writeEndElement(); // sir + writer.writeEndDocument(); +} + +/** Restores session from XML file in \a fileName path. */ +void Session::restore(const QString &fileName) { + QFile file(fileName); + if (!file.open(QIODevice::ReadOnly)) { + QMessageBox::warning(convertDialog, tr("Session read error"), + tr("Session restoring from %1 file failed.\n" + "Can't open the file.").arg(fileName) ); + return; + } + QDomDocument document; + if (!document.setContent(&file)) { + QMessageBox::warning(convertDialog, tr("Session read error"), + tr("Session restoring from %1 file failed.\n" + "Can't parse the file.").arg(fileName) ); + return; + } + QDomElement sir = document.firstChildElement("sir"); + bool fileInvalid(sir.isNull() || sir.attribute("version", VERSION) != VERSION); + QDomElement session = sir.firstChildElement("session"); + if (!fileInvalid) + fileInvalid = (session.isNull() || !session.hasChildNodes()); + if (fileInvalid) { + QMessageBox::warning(convertDialog, tr("Session read error"), + tr("Session restoring from %1 file failed.\n" + "Invalid file format.").arg(fileName) ); + return; + } + + QDomElement elem, el, e; // working DOM element variables + MetadataUtils::String str; + QStringList list; + int x; + + elem = session.firstChildElement("files"); + el = elem.firstChildElement("file"); + while (el.isNull()) { + convertDialog->filesTreeWidget->loadFile(el.text()); + el = el.nextSiblingElement("file"); + } + + elem = session.firstChildElement("target"); + if (!elem.isNull()) { + el = elem.firstChildElement("dir"); + if (!el.isNull()) + convertDialog->destFileEdit->setText(el.text()); + el = elem.firstChildElement("prefix"); + if (!el.isNull()) + convertDialog->destPrefixEdit->setText(el.text()); + el = elem.firstChildElement("suffix"); + if (!el.isNull()) + convertDialog->destSuffixEdit->setText(el.text()); + el = elem.firstChildElement("format"); + if (!el.isNull()) + convertDialog->targetFormatComboBox->setCurrentIndex( + convertDialog->targetFormatComboBox->findText(el.text()) ); + } + + elem = session.firstChildElement("size"); + if (!elem.isNull()) { + str = elem.attribute("keepaspect", falseString); + sizeArea->maintainCheckBox->setChecked(str.toBool()); + sizeArea->sizeUnitComboBox->setCurrentIndex(0); + el = elem.firstChildElement("pixels"); + if (!el.isNull()) { + sizeArea->widthDoubleSpinBox->setValue(elem.attribute("width").toDouble()); + sizeArea->heightDoubleSpinBox->setValue(elem.attribute("height").toDouble()); + } + el = elem.firstChildElement("percent"); + if (!el.isNull()) { + ConvertSharedData::instance()->sizeWidth = el.attribute("width").toDouble(); + ConvertSharedData::instance()->sizeHeight = el.attribute("height").toDouble(); + } + el = elem.firstChildElement("filesize"); + if (!el.isNull()) { + list = el.text().split(' '); + sizeArea->fileSizeSpinBox->setValue(list[0].toDouble()); + sizeArea->fileSizeComboBox->setCurrentIndex( + sizeArea->fileSizeComboBox->findText(list[1]) ); + } + x = sizeArea->sizeUnitComboBox->findText('(' + elem.attribute("unit") + ')', + Qt::MatchContains); + sizeArea->sizeUnitComboBox->setCurrentIndex(x); + } + + elem = session.firstChildElement("options"); + if (!elem.isNull()) { + el = elem.firstChildElement("quality"); + if (!el.isNull()) + optionsArea->qualitySpinBox->setValue(el.text().toInt()); + el = elem.firstChildElement("background"); + if (!el.isNull()) { + str = el.attribute("enabled", falseString); + optionsArea->backgroundColorCheckBox->setChecked(str.toBool()); + optionsArea->backgroundColorFrame->setColor(readColor(el)); + } + el = elem.firstChildElement("rotation"); + if (!el.isNull()) { + str = el.attribute("enabled", falseString); + optionsArea->rotateCheckBox->setChecked(str.toBool()); + optionsArea->rotateLineEdit->setText(el.text()); + } + el = elem.firstChildElement("flip"); + if (!el.isNull()) + optionsArea->flipComboBox->setCurrentIndex(el.text().toInt()); + } + + elem = session.firstChildElement("effects"); + if (!elem.isNull()) { + el = elem.firstChildElement("addframe"); + if (!el.isNull()) { + str = el.attribute("enabled", falseString); + effectsArea->frameGroupBox->setChecked(str.toBool()); + e = el.firstChildElement("frame"); + if (!e.isNull()) { + str = e.attribute("around", falseString); + if (str.toBool()) + effectsArea->frameAroundRadioButton->setChecked(true); + else + effectsArea->frameOverlayRadioButton->setChecked(true); + effectsArea->frameWidthSpinBox->setValue(e.attribute("width").toInt()); + effectsArea->frameColorFrame->setColor(readColor(e)); + } + e = el.firstChildElement("insideborder"); + if (!e.isNull()) { + str = e.attribute("enabled", falseString); + effectsArea->borderInsideGroupBox->setChecked(str.toBool()); + effectsArea->borderInsideSpinBox->setValue( + e.attribute("width").toInt() ); + effectsArea->borderInsideColorFrame->setColor(readColor(e)); + } + e = el.firstChildElement("outsideborder"); + if (!e.isNull()) { + str = e.attribute("enabled", falseString); + effectsArea->borderOutsideGroupBox->setChecked(str.toBool()); + effectsArea->borderOutsideSpinBox->setValue( + e.attribute("width").toInt() ); + effectsArea->borderOutsideColorFrame->setColor(readColor(e)); + } + } + el = elem.firstChildElement("addtext"); + if (!el.isNull()) { + str = el.attribute("enabled", falseString); + effectsArea->textGroupBox->setChecked(str.toBool()); + effectsArea->textOpacitySpinBox->setValue( + el.attribute("opacity").toDouble() ); + e = el.firstChildElement("text"); + if (!e.isNull()) { + str = e.attribute("frame", falseString); + effectsArea->textFrameCheckBox->setChecked(str.toBool()); + effectsArea->textLineEdit->setText(e.text()); + } + e = el.firstChildElement("font"); + if (!e.isNull()) { + effectsArea->textFontComboBox->setCurrentFont( + QFont(e.attribute("family")) ); + list = e.attribute("size").split(' '); + effectsArea->textFontSizeSpinBox->setValue(list[0].toInt()); + effectsArea->textFontSizeComboBox->setCurrentIndex( + effectsArea->textFontSizeComboBox->findText(list[1]) ); + str = e.attribute("bold", falseString); + effectsArea->textBoldPushButton->setChecked(str.toBool()); + str = e.attribute("italic", falseString); + effectsArea->textItalicPushButton->setChecked(str.toBool()); + str = e.attribute("underline", falseString); + effectsArea->textUnderlinePushButton->setChecked(str.toBool()); + str = e.attribute("strikeout", falseString); + effectsArea->textStrikeOutPushButton->setChecked(str.toBool()); + effectsArea->textColorFrame->setColor(readColor(e)); + } + e = el.firstChildElement("pos"); + if (!e.isNull()) { + list = e.attribute("x").split(' '); + effectsArea->textXSpinBox->setValue(list[0].toInt()); + effectsArea->textXComboBox->setCurrentIndex( + effectsArea->textXComboBox->findText(list[1]) ); + list = e.attribute("y").split(' '); + effectsArea->textYSpinBox->setValue(list[0].toInt()); + effectsArea->textYComboBox->setCurrentIndex( + effectsArea->textYComboBox->findText(list[1]) ); + effectsArea->textPositionComboBox->setCurrentIndex( + e.attribute("mod").toInt() ); + effectsArea->textRotationSpinBox->setValue( + e.attribute("rotation").toInt() ); + } + } + el = elem.firstChildElement("addimage"); + if (!el.isNull()) { + str = el.attribute("enabled", falseString); + effectsArea->imageGroupBox->setChecked(str.toBool()); + effectsArea->imageOpacitySpinBox->setValue( + el.attribute("opacity").toDouble() ); + e = el.firstChildElement("image"); + if (!e.isNull()) + effectsArea->imagePathLineEdit->setText(e.text()); + e = el.firstChildElement("pos"); + if (!e.isNull()) { + list = e.attribute("x").split(' '); + effectsArea->imageXSpinBox->setValue(list[0].toInt()); + effectsArea->imageXComboBox->setCurrentIndex( + effectsArea->imageXComboBox->findText(list[1]) ); + list = e.attribute("y").split(' '); + effectsArea->imageYSpinBox->setValue(list[0].toInt()); + effectsArea->imageYComboBox->setCurrentIndex( + effectsArea->imageYComboBox->findText(list[1]) ); + effectsArea->imagePositionComboBox->setCurrentIndex( + e.attribute("mod").toInt() ); + effectsArea->imageRotationSpinBox->setValue( + e.attribute("rotation").toInt() ); + } + } + } + + elem = session.firstChildElement("svg"); + if (!elem.isNull()) { + str = elem.attribute("save"); + svgArea->saveCheckBox->setChecked(str.toBool()); + el = elem.firstChildElement("remove"); + if (!el.isNull()) { + str = el.attribute("emptygroups", falseString); + svgArea->removeGroupsCheckBox->setChecked(str.toBool()); + e = el.firstChildElement("text"); + if (!e.isNull()) { + str = e.attribute("enabled", falseString); + svgArea->removeTextCheckBox->setChecked(str.toBool()); + svgArea->removeTextLineEdit->setText(e.text()); + } + } + } +} + +/** Reads color data from \e color child node of \a parentElement node. + * \return Read color object. + */ +QColor Session::readColor(const QDomElement &parentElement) { + QColor result; + QDomElement e = parentElement.firstChildElement("color"); + if (e.isNull()) + return result; + result.setRed( e.attribute("r").toInt()); + result.setGreen(e.attribute("g").toInt()); + result.setBlue( e.attribute("b").toInt()); + result.setAlpha(e.attribute("a").toInt()); + return result; +} diff -Nru sir-2.5.1/src/session.h sir-2.6/src/session.h --- sir-2.5.1/src/session.h 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/session.h 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,37 @@ +#ifndef SESSION_H +#define SESSION_H + +#include +#include +#include + +class ConvertDialog; +class SizeScrollArea; +class OptionsScrollArea; +class EffectsScrollArea; +class SvgScrollArea; + +//! Session files reader and writer class. +class Session { + Q_DECLARE_TR_FUNCTIONS(Session) + +public: + explicit Session(ConvertDialog *parent = 0); + void save(const QString &fileName); + void restore(const QString &fileName); + +private: + // fields + /** Parent convert dialog. + * \sa sizeArea optionsArea effectsArea svgArea + */ + ConvertDialog *convertDialog; + SizeScrollArea *sizeArea; /**< Size scroll area in convertDialog. */ + OptionsScrollArea *optionsArea; /**< Options scroll area in convertDialog. */ + EffectsScrollArea *effectsArea; /**< Effects scroll area in convertDialog. */ + SvgScrollArea *svgArea; /**< SVG scroll area in convertDialog. */ + // methods + QColor readColor(const QDomElement &parentElement); +}; + +#endif // SESSION_H diff -Nru sir-2.5.1/src/settings.cpp sir-2.6/src/settings.cpp --- sir-2.5.1/src/settings.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/settings.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -23,13 +23,14 @@ #include #include #include +#include #include "settings.h" #include "languageutils.h" -/** Returns reference to the instance of Settings class. +/** Returns pointer to the instance of Settings class. * \sa Settings(const QString &, const QString &, QObject *) */ -Settings & Settings::instance() { +Settings * Settings::instance() { #ifdef Q_OS_WIN32 // avoid registry Settings::setDefaultFormat(Settings::IniFormat); @@ -37,7 +38,9 @@ // UNIX *.conf files in INI format Settings::setDefaultFormat(Settings::NativeFormat); #endif // Q_OS_WIN32 - static Settings object("SIR"); + static Settings *object = 0; + if (!object && QCoreApplication::instance()) + object = new Settings("SIR", QString(), QCoreApplication::instance()); return object; } @@ -57,7 +60,7 @@ readSettings(); } -/** Destructor of Settings object. Writes settings to settings file. +/** Destructor of Settings object. Writes settings to file. * \sa writeSettings() */ Settings::~Settings() { @@ -95,9 +98,9 @@ settings.targetFormat = value("targetFormat","bmp").toString(); settings.targetPrefix = value("targetPrefix","web").toString(); settings.targetSuffix = value("targetSuffix","thumb").toString(); - LanguageUtils languages; + LanguageUtils *languages = LanguageUtils::instance(); QString localeFile = "sir_" + QLocale::system().name() + ".qm"; - QString defaultLanguage = languages.getLanguageInfo(localeFile).niceName; + QString defaultLanguage = languages->languageInfo(localeFile).niceName; settings.languageNiceName = value("languageNiceName",defaultLanguage).toString(); settings.languageFileName = value("languageFileName",localeFile).toString(); settings.dateDisplayFormat = value("dateDisplayFormat","dd.MM.yyyy").toString(); diff -Nru sir-2.5.1/src/settings.h sir-2.6/src/settings.h --- sir-2.5.1/src/settings.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/settings.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -46,7 +46,7 @@ public: // singletons pattern instance - static Settings &instance(); + static Settings *instance(); // I/O operations void readSettings(); void writeSettings(); diff -Nru sir-2.5.1/src/sharedinformation.cpp sir-2.6/src/sharedinformation.cpp --- sir-2.5.1/src/sharedinformation.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/sharedinformation.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -107,7 +107,7 @@ format.toAscii().constData()); } else - saveMetadata = Settings::instance().metadata.saveMetadata; + saveMetadata = Settings::instance()->metadata.saveMetadata; #endif // SIR_METADATA_SUPPORT } diff -Nru sir-2.5.1/src/sharedinformation.h sir-2.6/src/sharedinformation.h --- sir-2.5.1/src/sharedinformation.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/sharedinformation.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -25,11 +25,46 @@ #include #include #include +#include +#include +#include +#include + +/** Position modificators enumerator for \em "Add Text" and \em "Add Image" + * effects. It's correlated position combo boxes in EffectsScrollArea. + * \sa PosUnit + */ +enum PosModifier { + TopLeftCorner, + MiddleTopEdge, + TopRightCorner, + Center, + MiddleRightEdge, + BottomRightCorner, + MiddleBottomEdge, + BottomLeftCorner, + MiddleLeftEdge, + UndefinedPosModifier = -1 +}; + +/** Position unit enumerator for \em "Add Text" and \em "Add Image" effects. + * It's correlated position combo boxes in EffectsScrollArea. + * \sa PosUnitPair PosModifier + */ +enum PosUnit { + Pixel, + Percent, + UndefinedUnit = -1 +}; + +/** Pair of two PosUnit: first item is X coordinate, second is Y coordinate. */ +typedef QPair PosUnitPair; //! ConvertThread threads shared information. class SharedInformation { friend class ConvertThread; friend class ConvertDialog; + friend class ConvertEffects; public: // constructor @@ -65,7 +100,8 @@ bool hasHeight; /**< Height given indicator. */ bool maintainAspect; /**< Keep/Ignore aspect ratio indicator. */ quint32 sizeBytes; /**< Size of target image in bytes. */ - char sizeUnit; /**< Size unit code based on size unit combo box index into ConvertDialog. */ + /** Size unit code based on size unit combo box index into ConvertDialog. */ + char sizeUnit; // destinated image file parameters QDir destFolder; /**< Destination directory. */ QString prefix; /**< Target file prefix. */ @@ -76,28 +112,128 @@ bool rotate; /**< Rotation indicator. */ double angle; /**< Rotation angle. */ int flip; /**< MetadataUtils::Flip code. */ + // destinated effects + /** Custom background color of image. + * If custom background color is disabled it's invalid QColor object. + */ + QColor backgroundColor; + // add frame + /** Frame width for \em "Add Frame" effect. + * \sa #frameColor + */ + int frameWidth; + /** Frame color for \em "Add Frame" effect. + * \sa #frameWidth + */ + QColor frameColor; + /** A flag for \em "Add Frame" effect. + * + * True means the frame will be added around the converting image and it + * will be extended in coclusion. + * + * False means the frame will be painted on the current converting image. + */ + bool frameAddAround; + /** Width of border painded on inside edge of the \em "Add Frame" effects frame. + * \sa #borderInsideColor + */ + int borderInsideWidth; + /** Color of border painded on inside edge of the \em "Add Frame" effects frame. + * \sa #borderInsideWidth + */ + QColor borderInsideColor; + /** Width of border painded on outside edge of the \em "Add Frame" effects frame. + * \sa #borderOutsideColor + */ + int borderOutsideWidth; + /** Color of border painded on outside edge of the \em "Add Frame" effects frame. + * \sa #borderOutsideWidth + */ + QColor borderOutsideColor; + // add text + /** Text for \em "Add Text" effect. + * \sa #textFont #textColor + */ + QString textString; + /** Font for \em "Add Text" effect. + * \sa #textString #textColor + */ + QFont textFont; + /** Font color for \em "Add Text" effect. + * \sa #textString #textFont + */ + QColor textColor; + /** Text position modificator for \em "Add Text" effect. + * \sa #textPos + */ + double textOpacity; /**< Text opacity for \em "Add Text" effect. */ + PosModifier textPosModifier; + /** Text position for \em "Add Text" effect. + * \sa #textPosModifier #textUnitPair + */ + QPoint textPos; + /** \link #textPos Text position \endlink units for \em "Add Text" effect. + * \sa #textPos + */ + PosUnitPair textUnitPair; + /** Drawing text flag for \em "Add Text" effect. + * + * True means a rectangle will be drawn around the text. + */ + bool textFrame; + /** Text rotation angle in degree for \em "Add Text" effect. */ + int textRotation; + // add image + QImage image; /**< Image for \em "Add Image" effect. */ + /** Image position modificator for \em "Add Image" effect. + * \sa #imagePos + */ + PosModifier imagePosModifier; + /** Image position for \em "Add Image" effect. + * \sa #imagePosModifier #imageUnitPair + */ + QPoint imagePos; + /** \link #imagePos Text position \endlink units for \em "Add Image" effect. + * \sa #imagePos + */ + PosUnitPair imageUnitPair; + double imageOpacity; /**< Image opacity for \em "Add Image" effect. */ + /** Image rotation angle in degree for \em "Add Image" effect. */ + int imageRotation; + // SVG modifiers + bool svgModifiersEnabled; /**< Set it true if you want modify SVG file. */ + /** Text value of SVG \e text nodes to delete. Plain text and regular + * expression are supported. + */ + QString svgRemoveText; + bool svgRemoveEmptyGroup; /**< Enables removing all empty SVG \e g nodes. */ + bool svgSave; /**< Enables saving changed SVG file in SVG format also. */ #ifdef SIR_METADATA_SUPPORT // metadata settings bool metadataEnabled; /**< Indicates that metadata support enabled. */ bool saveMetadata; /**< Saving metadata into target image indicator. */ - bool realRotate; /**< Real rotation indicator - not save into \em Exif.Image.Orientation field. */ + /** Real rotation indicator - not save into \em Exif.Image.Orientation field. */ + bool realRotate; bool updateThumbnail; /**< Update thumbnail of target image indicator. */ bool rotateThumbnail; /**< Rotate thumbnail of target image indicator. */ #endif // SIR_METADATA_SUPPORT // thread synchronization data // mutexes - QMutex mutex; /**< Mutual exclusion object using for worker threads synchronization. */ + /** Mutual exclusion object using for worker threads synchronization. */ + QMutex mutex; // user conversation data // cancel bool abort; /**< Abort indicator. */ // overwrite bool overwriteAll; /**< Overwrite all conflicting files indicator. */ bool noOverwriteAll; /**< No overwrite all conflicting files indicator. */ - int overwriteResult; /**< Message box containing question about overwriting file result code. */ + /** Message box containing question about overwriting file result code. */ + int overwriteResult; // enlarge bool enlargeAll; /**< Enlarge all conflicting files indicator. */ bool noEnlargeAll; /**< No enlarge all conflicting files indicator. */ - int enlargeResult; /**< Message box containing question about enlarging image result code. */ + /** Message box containing question about enlarging image result code. */ + int enlargeResult; }; #endif // SHAREDINFORMATION_H diff -Nru sir-2.5.1/src/svgmodifier.cpp sir-2.6/src/svgmodifier.cpp --- sir-2.5.1/src/svgmodifier.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/svgmodifier.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,88 @@ +/* This file is part of SIR, an open-source cross-platform Image tool + * 2007-2010 Rafael Sachetto + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#include +#include +#include +#include "svgmodifier.h" +#include "regexputils.h" + +/** Creates the SvgModifier object. */ +SvgModifier::SvgModifier() {} + +/** Creates the SvgModifier object and loads SVG file data. + * \sa load() + */ +SvgModifier::SvgModifier(const QString &fileName) { + load(fileName); +} + +/** Loads XML data from SVG file called \a fileName file path. */ +bool SvgModifier::load(const QString &fileName) { + QFile file(fileName); + if (!file.open(QIODevice::ReadOnly)) + return false; + if (!document.setContent(&file)) { + file.close(); + return false; + } + file.close(); + return true; +} + +/** Deletes all SVG \b text nodes containig \a text parsed text including regular + * expressions from loaded SVG file. + * \sa load() removeEmptyGroups() + */ +void SvgModifier::removeText(const QString &text) { + using namespace RegExpUtils; + QList rxList; + rxList << new QRegExp(text, Qt::CaseSensitive, QRegExp::FixedString) + << new QRegExp(text, Qt::CaseSensitive, QRegExp::WildcardUnix) + << new QRegExp(text, Qt::CaseSensitive, QRegExp::RegExp2); + QDomNodeList nodeList = document.elementsByTagName("text"); + for (uint i=0; i + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#ifndef SVGMODIFIER_H +#define SVGMODIFIER_H + +#include + +class SvgModifier { +public: + SvgModifier(); + SvgModifier(const QString &fileName); + bool load(const QString &fileName); + QByteArray content() const { return document.toByteArray(); } + void removeText(const QString &text); + void removeEmptyGroups(); + +private: + QDomDocument document; /**< SVG document. */ +}; + +#endif // SVGMODIFIER_H diff -Nru sir-2.5.1/src/widgets/colorframe.cpp sir-2.6/src/widgets/colorframe.cpp --- sir-2.5.1/src/widgets/colorframe.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/widgets/colorframe.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,56 @@ +/* This file is part of SIR, an open-source cross-platform Image tool + * 2007-2010 Rafael Sachetto + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#include +#include +#include +#include "colorframe.h" + +/** Creates ColorFrame object. */ +ColorFrame::ColorFrame(QWidget *parent) : QFrame(parent) { + setAutoFillBackground(true); +} + +/** Returns current color. */ +const QColor & ColorFrame::color() const { + return palette().color(QPalette::Window); +} + +/** Sets background color to \a color. */ +void ColorFrame::setColor(const QColor &color) { + QPalette palette(this->palette()); + palette.setColor(QPalette::Window, color); + setPalette(palette); +} + +/** Means end of left button mouse click. If click finished on this object shows + * color dialog and sets choosed color to current color; otherwise does nothing. + * \sa color() + */ +void ColorFrame::mouseReleaseEvent(QMouseEvent *e) { + if (e->button() == Qt::LeftButton && qApp->widgetAt(e->globalPos()) == this) { + QColor color = QColorDialog::getColor(this->color(), this, + tr("Choose Color"), + QColorDialog::ShowAlphaChannel); + if (color.isValid()) + setColor(color); + } +} diff -Nru sir-2.5.1/src/widgets/colorframe.h sir-2.6/src/widgets/colorframe.h --- sir-2.5.1/src/widgets/colorframe.h 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/widgets/colorframe.h 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,44 @@ +/* This file is part of SIR, an open-source cross-platform Image tool + * 2007-2010 Rafael Sachetto + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#ifndef COLORFRAME_H +#define COLORFRAME_H + +#include + +/** \brief The empty frame class providing easy access to color customization. + * + * This class provides color dialog (on left click), current color presentation + * on the frame and color read access method color(). + */ +class ColorFrame : public QFrame { + Q_OBJECT + +public: + explicit ColorFrame(QWidget *parent = 0); + const QColor &color() const; + void setColor(const QColor &color); + +protected: + void mouseReleaseEvent(QMouseEvent *); +}; + +#endif // COLORFRAME_H diff -Nru sir-2.5.1/src/widgets/convert/effectsscrollarea.cpp sir-2.6/src/widgets/convert/effectsscrollarea.cpp --- sir-2.5.1/src/widgets/convert/effectsscrollarea.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/widgets/convert/effectsscrollarea.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,82 @@ +/* This file is part of SIR, an open-source cross-platform Image tool + * 2007-2010 Rafael Sachetto + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#include +#include +#include "effectsscrollarea.h" + +/** Creates the EffectsScrollArea object. Sets up GUI. */ +EffectsScrollArea::EffectsScrollArea(QWidget *parent) : QScrollArea(parent) { + setupUi(this); + + // create connections + connect(imagePathPushButton, SIGNAL(clicked()), this, SLOT(browseImage())); + connect(textXComboBox, SIGNAL(currentIndexChanged(QString)), + textXSpinBox, SLOT(posUnitChanged(QString)) ); + connect(textYComboBox, SIGNAL(currentIndexChanged(QString)), + textYSpinBox, SLOT(posUnitChanged(QString)) ); + connect(imageXComboBox, SIGNAL(currentIndexChanged(QString)), + imageXSpinBox, SLOT(posUnitChanged(QString)) ); + connect(imageYComboBox, SIGNAL(currentIndexChanged(QString)), + imageYSpinBox, SLOT(posUnitChanged(QString)) ); + + // set combo box models + QAbstractItemModel *posUnitModel = textXComboBox->model(); + textYComboBox->setModel(posUnitModel); + textColorFrame->setColor(Qt::black); + imagePositionComboBox->setModel(textPositionComboBox->model()); + imageXComboBox->setModel(posUnitModel); + imageYComboBox->setModel(posUnitModel); + + // set range + const QPair posRange(-20000, 20000); + textXSpinBox->setRange(posRange.first, posRange.second); + textYSpinBox->setRange(posRange.first, posRange.second); + imageXSpinBox->setRange(posRange.first, posRange.second); + imageYSpinBox->setRange(posRange.first, posRange.second); + imageRotationSpinBox->setRange(textRotationSpinBox->minimum(), + textRotationSpinBox->maximum()); + + // set icons + textBoldPushButton->setIcon(QIcon::fromTheme("format-text-bold")); + textItalicPushButton->setIcon(QIcon::fromTheme("format-text-italic")); + textUnderlinePushButton->setIcon(QIcon::fromTheme("format-text-underline")); + textStrikeOutPushButton->setIcon(QIcon::fromTheme("format-text-strikethrough")); +} + +/** Browses image file to open and sets the new path to image path line edit. */ +void EffectsScrollArea::browseImage() { + QString path = imagePathLineEdit->text(); + QFileInfo oldImageFileInfo(path); + if (oldImageFileInfo.exists()) + path = oldImageFileInfo.absoluteDir().absolutePath(); + else + path = QDir::homePath(); + QString formats; + foreach (QByteArray format, QImageReader::supportedImageFormats()) + formats += "*." + format + ' '; + formats.resize(formats.size()-1); + + path = QFileDialog::getOpenFileName(this, tr("Choose Image File"), path, + tr("Images")+" ("+formats+")"); + if (!path.isEmpty()) + imagePathLineEdit->setText(path); +} diff -Nru sir-2.5.1/src/widgets/convert/effectsscrollarea.h sir-2.6/src/widgets/convert/effectsscrollarea.h --- sir-2.5.1/src/widgets/convert/effectsscrollarea.h 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/widgets/convert/effectsscrollarea.h 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,37 @@ +/* This file is part of SIR, an open-source cross-platform Image tool + * 2007-2010 Rafael Sachetto + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#ifndef EFFECTSSCROLLAREA_H +#define EFFECTSSCROLLAREA_H + +#include "ui_effectsscrollarea.h" + +class EffectsScrollArea : public QScrollArea, public Ui::EffectsScrollArea { + Q_OBJECT + +public: + explicit EffectsScrollArea(QWidget *parent = 0); + +private slots: + void browseImage(); +}; + +#endif // EFFECTSSCROLLAREA_H diff -Nru sir-2.5.1/src/widgets/convert/optionsscrollarea.cpp sir-2.6/src/widgets/convert/optionsscrollarea.cpp --- sir-2.5.1/src/widgets/convert/optionsscrollarea.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/widgets/convert/optionsscrollarea.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,44 @@ +/* This file is part of SIR, an open-source cross-platform Image tool + * 2007-2010 Rafael Sachetto + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#include "optionsscrollarea.h" + +/** Creates the OptionsScrollArea object. Sets up GUI and creates connections. */ +OptionsScrollArea::OptionsScrollArea(QWidget *parent) : QScrollArea(parent) { + setupUi(this); + // create connections + connect(rotateCheckBox, SIGNAL(stateChanged(int)), SLOT(verifyRotate(int))); + // quality spin box & slider + connect(qualitySpinBox, SIGNAL(valueChanged(int)), qualitySlider, SLOT(setValue(int))); + connect(qualitySlider, SIGNAL(valueChanged(int)), qualitySpinBox, SLOT(setValue(int))); +} + +/** Rotate checkbox slot. + * + * Disables/enables rotation angle line edit. + * \param status Status of the checkbox. + */ +void OptionsScrollArea::verifyRotate(int status) { + if (status == Qt::Checked) + rotateLineEdit->setEnabled(true); + else + rotateLineEdit->setEnabled(false); +} diff -Nru sir-2.5.1/src/widgets/convert/optionsscrollarea.h sir-2.6/src/widgets/convert/optionsscrollarea.h --- sir-2.5.1/src/widgets/convert/optionsscrollarea.h 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/widgets/convert/optionsscrollarea.h 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,38 @@ +/* This file is part of SIR, an open-source cross-platform Image tool + * 2007-2010 Rafael Sachetto + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#ifndef OPTIONSSCROLLAREA_H +#define OPTIONSSCROLLAREA_H + +#include "ui_optionsscrollarea.h" + +//! Image options scroll area used in ConvertDialog +class OptionsScrollArea : public QScrollArea, public Ui::OptionsScrollArea { + Q_OBJECT + +public: + explicit OptionsScrollArea(QWidget *parent = 0); + +private slots: + void verifyRotate(int status); +}; + +#endif // OPTIONSSCROLLAREA_H diff -Nru sir-2.5.1/src/widgets/convert/sizescrollarea.cpp sir-2.6/src/widgets/convert/sizescrollarea.cpp --- sir-2.5.1/src/widgets/convert/sizescrollarea.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/widgets/convert/sizescrollarea.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,164 @@ +/* This file is part of SIR, an open-source cross-platform Image tool + * 2007-2010 Rafael Sachetto + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#include "sizescrollarea.h" +#include "convertshareddata.h" + +/** Creates the SizeScrollArea object. Sets up GUI and creates connections. */ +SizeScrollArea::SizeScrollArea(QWidget *parent) : QScrollArea(parent) { + setupUi(this); + + // create connections + connect(sizeUnitComboBox, SIGNAL(currentIndexChanged(int)), + this, SLOT(setSizeUnit(int))); + connect(maintainCheckBox, SIGNAL(toggled(bool)), + this, SLOT(maintainCheckBoxChecked(bool))); + + if (maintainCheckBox->isChecked()) { + switch (sizeUnitComboBox->currentIndex()) { + case 0: // px + case 1: // % + connectSizeLinesEdit(); + break; + default: + break; + } + } +} + +/** Shows size values corresponding index of size unit combo box. */ +void SizeScrollArea::setSizeUnit(int index) { + if (index < 0) + return; + static int lastIndex = index; + static int lastIndexPxPercent = index+1; + static bool keepAspectRatio = false; + if (index == 2) { // bytes + geometryWidget->hide(); + fileSizeWidget->show(); + keepAspectRatio = maintainCheckBox->isChecked(); + maintainCheckBox->setChecked(true); + maintainCheckBox->setEnabled(false); + } + else { // px or % + fileSizeWidget->hide(); + geometryWidget->show(); + disconnectSizeLinesEdit(); + if (lastIndexPxPercent != index) { + ConvertSharedData *csd = ConvertSharedData::instance(); + float tmp = csd->sizeWidth; + csd->sizeWidth = widthDoubleSpinBox->value(); + widthDoubleSpinBox->setValue(tmp); + tmp = csd->sizeHeight; + csd->sizeHeight = heightDoubleSpinBox->value(); + heightDoubleSpinBox->setValue(tmp); + lastIndexPxPercent = index; + QString suffix; + int decimals; + double max; + if (index == 0) { // px + suffix = " px"; + decimals = 0; + max = 100000.; + } + else { // % + suffix = " %"; + decimals = 2; + max = 10000.; + } + widthDoubleSpinBox->setSuffix(suffix); + widthDoubleSpinBox->setDecimals(decimals); + widthDoubleSpinBox->setMaximum(max); + heightDoubleSpinBox->setSuffix(suffix); + heightDoubleSpinBox->setDecimals(decimals); + heightDoubleSpinBox->setMaximum(max); + } + if (lastIndex == 2) { + maintainCheckBox->setEnabled(true); + maintainCheckBox->setChecked(keepAspectRatio); + } + if (maintainCheckBox->isChecked()) { + switch (index) { + case 1: // % + heightDoubleSpinBox->setValue(widthDoubleSpinBox->value()); + case 0: // px + connectSizeLinesEdit(); + break; + default: + break; + } + } + } + lastIndex = index; +} + +/** If it keeps aspect ratio, this function will be change width or heigth value + * following the user change in adjacent spin box. Otherwise does nothing. + * \sa maintainCheckBoxChecked() + */ +void SizeScrollArea::sizeChanged(double value) { + if (!maintainCheckBox->isChecked()) + return; + + QDoubleSpinBox *spinBox = static_cast(sender()); + + disconnectSizeLinesEdit(); + + switch (sizeUnitComboBox->currentIndex()) { + case 0: // px + if (spinBox == widthDoubleSpinBox) + value /= aspectRatio; + else + value *= aspectRatio; + break; + case 1: // % + break; + default: + return; + } + + if (spinBox == widthDoubleSpinBox) + heightDoubleSpinBox->setValue(value); + else if (spinBox == heightDoubleSpinBox) + widthDoubleSpinBox->setValue(value); + + connectSizeLinesEdit(); +} + +/** If \a keepAspect is true and pixels are current size unit, this function + * will compute current aspectRatio rational. Otherwise does nothing. + * \sa sizeChanged() + */ +void SizeScrollArea::maintainCheckBoxChecked(bool keepAspect) { + if (keepAspect && sizeUnitComboBox->currentIndex() == 0) { + switch (sizeUnitComboBox->currentIndex()) { + case 0: // px + aspectRatio = widthDoubleSpinBox->value() / heightDoubleSpinBox->value(); + case 1: // % + connectSizeLinesEdit(); + break; + default: + break; + } + } + else + disconnectSizeLinesEdit(); +} diff -Nru sir-2.5.1/src/widgets/convert/sizescrollarea.h sir-2.6/src/widgets/convert/sizescrollarea.h --- sir-2.5.1/src/widgets/convert/sizescrollarea.h 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/widgets/convert/sizescrollarea.h 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,68 @@ +/* This file is part of SIR, an open-source cross-platform Image tool + * 2007-2010 Rafael Sachetto + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#ifndef SIZESCROLLAREA_H +#define SIZESCROLLAREA_H + +#include "ui_sizescrollarea.h" + +//! Image size options scroll area used in ConvertDialog +class SizeScrollArea : public QScrollArea, public Ui::SizeScrollArea { + Q_OBJECT + +public: + explicit SizeScrollArea(QWidget *parent = 0); + +private: + // fields + double aspectRatio; + // methods + inline void connectSizeLinesEdit(); + inline void disconnectSizeLinesEdit(); + +public slots: + void setSizeUnit(int index); + +private slots: + void sizeChanged(double value); + void maintainCheckBoxChecked(bool keepAspect); +}; + +/** Connects width and height lines edit's textChanged() signal to sizeChanged() + * slot. + * \sa disconnectSizeLinesEdit() + */ +void SizeScrollArea::connectSizeLinesEdit() { + connect(widthDoubleSpinBox, SIGNAL(valueChanged(double)), + this, SLOT(sizeChanged(double))); + connect(heightDoubleSpinBox, SIGNAL(valueChanged(double)), + this, SLOT(sizeChanged(double))); +} + +/** Disconnects sizeChanged() slot. + * \sa connectSizeLinesEdit() + */ +void SizeScrollArea::disconnectSizeLinesEdit() { + widthDoubleSpinBox->disconnect(this, SLOT(sizeChanged(double))); + heightDoubleSpinBox->disconnect(this, SLOT(sizeChanged(double))); +} + +#endif // SIZESCROLLAREA_H diff -Nru sir-2.5.1/src/widgets/convert/svgscrollarea.cpp sir-2.6/src/widgets/convert/svgscrollarea.cpp --- sir-2.5.1/src/widgets/convert/svgscrollarea.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/widgets/convert/svgscrollarea.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,27 @@ +/* This file is part of SIR, an open-source cross-platform Image tool + * 2007-2010 Rafael Sachetto + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#include "svgscrollarea.h" + +/** Creates the SvgScrollArea object. Sets up GUI. */ +SvgScrollArea::SvgScrollArea(QWidget *parent) : QScrollArea(parent) { + setupUi(this); +} diff -Nru sir-2.5.1/src/widgets/convert/svgscrollarea.h sir-2.6/src/widgets/convert/svgscrollarea.h --- sir-2.5.1/src/widgets/convert/svgscrollarea.h 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/widgets/convert/svgscrollarea.h 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,35 @@ +/* This file is part of SIR, an open-source cross-platform Image tool + * 2007-2010 Rafael Sachetto + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#ifndef SVGSCROLLAREA_H +#define SVGSCROLLAREA_H + +#include "ui_svgscrollarea.h" + +//! SVG image options scroll area used in ConvertDialog +class SvgScrollArea : public QScrollArea, public Ui::SvgScrollArea { + Q_OBJECT + +public: + explicit SvgScrollArea(QWidget *parent = 0); +}; + +#endif // SVGSCROLLAREA_H diff -Nru sir-2.5.1/src/widgets/detailsbrowser.cpp sir-2.6/src/widgets/detailsbrowser.cpp --- sir-2.5.1/src/widgets/detailsbrowser.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/detailsbrowser.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -26,6 +26,7 @@ #include "detailsbrowser.h" #include "convertdialog.h" #include "optionsenums.h" +#include "convertshareddata.h" // this file specifed variables // HTML constants @@ -38,8 +39,6 @@ const QString htmlEnd = ""; const QString htmlBr = "
"; const QString htmlHr = "
"; -// settings object reference -Settings &settings = Settings::instance(); DetailsBrowser::DetailsBrowser(QWidget *parent) : QTextEdit(parent) { setReadOnly(true); @@ -89,7 +88,8 @@ QSize imageSize; bool isSvg = false; #ifdef SIR_METADATA_SUPPORT - bool metadataEnabled(settings.metadata.enabled); + Settings *s = Settings::instance(); + bool metadataEnabled(s->metadata.enabled); MetadataUtils::Metadata metadata; exifStruct = 0; iptcStruct = 0; @@ -103,7 +103,7 @@ // thumbnail generation if (ext != "SVG" && ext != "SVGZ") { #ifdef SIR_METADATA_SUPPORT - bool fromData(!settings.metadata.enabled); + bool fromData(!s->metadata.enabled); if (!fromData) { if (!metadata.read(imagePath, true)) fromData = true; @@ -182,13 +182,14 @@ */ void DetailsBrowser::loadSettings() { #ifdef SIR_METADATA_SUPPORT - if (settings.metadata.enabled) { + Settings *s = Settings::instance(); + if (s->metadata.enabled) { // details - exifAuthor = settings.details.exifAuthor; - exifCamera = settings.details.exifCamera; - exifPhoto = settings.details.exifPhoto; - exifImage = settings.details.exifImage; - iptcPrint = settings.details.iptc; + exifAuthor = s->details.exifAuthor; + exifCamera = s->details.exifCamera; + exifPhoto = s->details.exifPhoto; + exifImage = s->details.exifImage; + iptcPrint = s->details.iptc; } else { exifAuthor = 0; @@ -227,13 +228,13 @@ MetadataUtils::String::fromDateTimeString( exifStruct->originalDate, MetadataUtils::Exif::dateTimeFormat, - convertDialog->dateTimeFormat) + htmlBr; + convertDialog->csd->dateTimeFormat) + htmlBr; if (exifImage & DetailsOptions::DigitizedDateAndTime) htmlContent += tr("Digitized Date and Time") + ": " + MetadataUtils::String::fromDateTimeString( exifStruct->digitizedDate, MetadataUtils::Exif::dateTimeFormat, - convertDialog->dateTimeFormat) + htmlBr; + convertDialog->csd->dateTimeFormat) + htmlBr; // exif photo if (exifPhoto & DetailsOptions::FocalLenght) htmlContent += tr("Focal lenght") + ": " + @@ -289,17 +290,17 @@ iptcStruct->modelVersion + htmlBr; if (iptcPrint & DetailsOptions::DateCreated) htmlContent += tr("Created date") + ": " + - iptcStruct->dateCreated.toString(convertDialog->dateFormat) + htmlBr; + iptcStruct->dateCreated.toString(convertDialog->csd->dateFormat) + htmlBr; if (iptcPrint & DetailsOptions::TimeCreated) htmlContent += tr("Created time") + ": " + - iptcStruct->timeCreated.toString(convertDialog->timeFormat) + htmlBr; + iptcStruct->timeCreated.toString(convertDialog->csd->timeFormat) + htmlBr; if (iptcPrint & DetailsOptions::DigitizedDate) htmlContent += tr("Digitized date") + ": " + - iptcStruct->digitizationDate.toString(convertDialog->dateFormat) + iptcStruct->digitizationDate.toString(convertDialog->csd->dateFormat) + htmlBr; if (iptcPrint & DetailsOptions::DigitizedTime) htmlContent += tr("Digitized time") + ": " + - iptcStruct->digitizationTime.toString(convertDialog->timeFormat) + iptcStruct->digitizationTime.toString(convertDialog->csd->timeFormat) + htmlBr; if (iptcPrint & DetailsOptions::Byline) htmlContent += tr("Author") + ": " + iptcStruct->byline + htmlBr; diff -Nru sir-2.5.1/src/widgets/detailsbrowser.h sir-2.6/src/widgets/detailsbrowser.h --- sir-2.5.1/src/widgets/detailsbrowser.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/detailsbrowser.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 diff -Nru sir-2.5.1/src/widgets/metadatadialog.cpp sir-2.6/src/widgets/metadatadialog.cpp --- sir-2.5.1/src/widgets/metadatadialog.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/metadatadialog.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -50,6 +50,14 @@ readFile(); setupValues(); createConnections(); + + // set icons + previousButton->setIcon(QIcon::fromTheme("go-previous", + QIcon(":/images/previous.png")) ); + nextButton->setIcon(QIcon::fromTheme("go-next", QIcon(":/images/next.png"))); + deleteButton->setIcon(QIcon::fromTheme("edit-delete")); + saveButton->setIcon(QIcon::fromTheme("document-save")); + cancelButton->setIcon(QIcon::fromTheme("cancel")); } /** Destructor. @@ -115,11 +123,11 @@ exifFlashModeComboBox->addItem(Exif::flashString(0x4d)); exifFlashModeComboBox->addItem(Exif::flashString(0x47)); // load settings - Settings &s = Settings::instance(); - QString dateFormat = s.settings.dateDisplayFormat; - QString timeFormat = s.settings.timeDisplayFormat; + Settings *s = Settings::instance(); + QString dateFormat = s->settings.dateDisplayFormat; + QString timeFormat = s->settings.timeDisplayFormat; // max history count for HistoryComboBox's import functions - int maxHistoryCount = s.settings.maxHistoryCount; + int maxHistoryCount = s->settings.maxHistoryCount; // display format of date/time editors exifOriginalDateEdit->setDisplayFormat(dateFormat); exifOriginalTimeEdit->setDisplayFormat(timeFormat); @@ -131,26 +139,26 @@ iptcDigitizedTimeEdit->setDisplayFormat(timeFormat); // Exif tab // Camera toolbox - exifManufacturerComboBox->importHistory(s.exif.cameraManufacturerMap, - s.exif.cameraManufacturerList, + exifManufacturerComboBox->importHistory(s->exif.cameraManufacturerMap, + s->exif.cameraManufacturerList, maxHistoryCount); exifManufacturerComboBox->setCurrentIndex(-1); - exifModelComboBox->importHistory( s.exif.cameraModelMap, - s.exif.cameraModelList, maxHistoryCount); + exifModelComboBox->importHistory( s->exif.cameraModelMap, + s->exif.cameraModelList, maxHistoryCount); exifModelComboBox->setCurrentIndex(-1); // Author toolbox - exifArtistComboBox->importHistory( s.exif.artistMap, - s.exif.artistList, maxHistoryCount); + exifArtistComboBox->importHistory( s->exif.artistMap, + s->exif.artistList, maxHistoryCount); exifArtistComboBox->setCurrentIndex(-1); - exifCopyrightComboBox->importHistory( s.exif.copyrightMap, - s.exif.copyrightList, maxHistoryCount); + exifCopyrightComboBox->importHistory( s->exif.copyrightMap, + s->exif.copyrightList, maxHistoryCount); exifCopyrightComboBox->setCurrentIndex(-1); - exifUserCommentComboBox->importHistory( s.exif.userCommentMap, - s.exif.userCommentList, maxHistoryCount); + exifUserCommentComboBox->importHistory( s->exif.userCommentMap, + s->exif.userCommentList, maxHistoryCount); exifUserCommentComboBox->setCurrentIndex(-1); // IPTC tab - iptcEditStatusComboBox->importHistory( s.iptc.editStatusMap, - s.iptc.editStatusList, maxHistoryCount); + iptcEditStatusComboBox->importHistory( s->iptc.editStatusMap, + s->iptc.editStatusList, maxHistoryCount); iptcEditStatusComboBox->setCurrentIndex(-1); } @@ -298,31 +306,31 @@ void MetadataDialog::saveHistory() { HistoryMap map; HistoryList list; - Settings &s = Settings::instance(); + Settings *s = Settings::instance(); // general settings - int maxHistoryCount = s.settings.maxHistoryCount; + int maxHistoryCount = s->settings.maxHistoryCount; // Exif tab // Camera toolbox exifManufacturerComboBox->exportHistory(&map, &list, maxHistoryCount); - s.exif.cameraManufacturerMap = map; - s.exif.cameraManufacturerList = list; + s->exif.cameraManufacturerMap = map; + s->exif.cameraManufacturerList = list; exifModelComboBox->exportHistory(&map, &list, maxHistoryCount); - s.exif.cameraModelMap = map; - s.exif.cameraModelList = list; + s->exif.cameraModelMap = map; + s->exif.cameraModelList = list; // Artist toolbox exifArtistComboBox->exportHistory(&map, &list, maxHistoryCount); - s.exif.artistMap = map; - s.exif.artistList = list; + s->exif.artistMap = map; + s->exif.artistList = list; exifCopyrightComboBox->exportHistory(&map, &list, maxHistoryCount); - s.exif.copyrightMap = map; - s.exif.copyrightList = list; + s->exif.copyrightMap = map; + s->exif.copyrightList = list; exifUserCommentComboBox->exportHistory(&map, &list, maxHistoryCount); - s.exif.userCommentMap = map; - s.exif.userCommentList = list; + s->exif.userCommentMap = map; + s->exif.userCommentList = list; // IPTC tab iptcEditStatusComboBox->exportHistory(&map, &list, maxHistoryCount); - s.iptc.editStatusMap = map; - s.iptc.editStatusList = list; + s->iptc.editStatusMap = map; + s->iptc.editStatusList = list; } void MetadataDialog::previousImage() { diff -Nru sir-2.5.1/src/widgets/options/abstractoptions.cpp sir-2.6/src/widgets/options/abstractoptions.cpp --- sir-2.5.1/src/widgets/options/abstractoptions.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/options/abstractoptions.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -27,9 +27,12 @@ */ CommonOptions::CommonOptions() { targetDirPath_ = QDir::homePath(); - maxHistoryCount_ = Settings::instance().settings.maxHistoryCount; + maxHistoryCount_ = Settings::instance()->settings.maxHistoryCount; } -// static fields - -CommonOptions AbstractOptions::common = CommonOptions(); +CommonOptions * CommonOptions::instance() { + static CommonOptions *object = 0; + if (!object && Settings::instance()) + object = new CommonOptions(); + return object; +} diff -Nru sir-2.5.1/src/widgets/options/abstractoptions.h sir-2.6/src/widgets/options/abstractoptions.h --- sir-2.5.1/src/widgets/options/abstractoptions.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/options/abstractoptions.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -28,8 +28,8 @@ //! Common options data for classes inherited from AbstractOptions class. class CommonOptions { public: - // constructor - CommonOptions(); + // singleton instance + static CommonOptions *instance(); // access methods QString targetDirPath() const { return targetDirPath_; } void setTargetDirPath(const QString &path) @@ -38,6 +38,8 @@ void setMaxHistoryCount(int v) { maxHistoryCount_ = v; } private: + // constructor + CommonOptions(); // fields QString targetDirPath_; int maxHistoryCount_; @@ -53,8 +55,6 @@ // pure virtual functions virtual void loadSettings() = 0; virtual void saveSettings() = 0; - // fields - static CommonOptions common; }; //! Abstract base class for all derived classes from QGroupBox and AbstractOptions. diff -Nru sir-2.5.1/src/widgets/options/detailsgroupbox.cpp sir-2.6/src/widgets/options/detailsgroupbox.cpp --- sir-2.5.1/src/widgets/options/detailsgroupbox.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/options/detailsgroupbox.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -51,16 +51,16 @@ * \sa Settings saveSettings() */ void DetailsGroupBox::loadSettings() { - Settings &s = Settings::instance(); + Settings *s = Settings::instance(); int hex; // exif - hex = s.details.exifImage; + hex = s->details.exifImage; exifVersionCheckBox->setChecked(hex & DetailsOptions::ExifVersion); exifSoftCheckBox->setChecked(hex & DetailsOptions::ProcessingSoftware); exifOrientationCheckBox->setChecked(hex & DetailsOptions::Orientation); exifGeneratedTimeCheckBox->setChecked(hex & DetailsOptions::GeneratedDateAndTime); exifDigitizedTimeCheckBox->setChecked(hex & DetailsOptions::DigitizedDateAndTime); - hex = s.details.exifPhoto; + hex = s->details.exifPhoto; exifFocalLengthCheckBox->setChecked(hex & DetailsOptions::FocalLenght); exifApertureCheckBox->setChecked(hex & DetailsOptions::Aperture); exifIsoCheckBox->setChecked(hex & DetailsOptions::IsoSpeed); @@ -70,15 +70,15 @@ exifExpProgramCheckBox->setChecked(hex & DetailsOptions::ExposureProgram); exifMeteringCheckBox->setChecked(hex & DetailsOptions::LightMeteringMode); exifFlashCheckBox->setChecked(hex & DetailsOptions::FlashMode); - hex = s.details.exifCamera; + hex = s->details.exifCamera; exifManufacturerCheckBox->setChecked(hex & DetailsOptions::Manufacturer); exifModelCheckBox->setChecked(hex & DetailsOptions::Model); - hex = s.details.exifAuthor; + hex = s->details.exifAuthor; exifArtistCheckBox_D->setChecked(hex & DetailsOptions::Artist); exifCopyrightCheckBox_D->setChecked(hex & DetailsOptions::Copyright); exifUserCommentCheckBox_D->setChecked(hex & DetailsOptions::UserComment); // iptc - hex = s.details.iptc; + hex = s->details.iptc; iptcVersionCheckBox->setChecked(hex & DetailsOptions::ModelVersion); iptcBylineCheckBox->setChecked(hex & DetailsOptions::Byline); iptcCopyrightCheckBox->setChecked(hex & DetailsOptions::CopyrightIptc); @@ -98,7 +98,7 @@ * \sa Settings loadSettings() */ void DetailsGroupBox::saveSettings() { - Settings &s = Settings::instance(); + Settings *s = Settings::instance(); // Exif image int hex = 0; if (exifVersionCheckBox->isChecked()) @@ -111,7 +111,7 @@ hex |= DetailsOptions::GeneratedDateAndTime; if (exifDigitizedTimeCheckBox->isChecked()) hex |= DetailsOptions::DigitizedDateAndTime; - s.details.exifImage = hex; + s->details.exifImage = hex; // Exif photo hex = 0; if (exifFocalLengthCheckBox->isChecked()) @@ -132,14 +132,14 @@ hex |= DetailsOptions::LightMeteringMode; if (exifFlashCheckBox->isChecked()) hex |= DetailsOptions::FlashMode; - s.details.exifPhoto = hex; + s->details.exifPhoto = hex; // Exif camera hex = 0; if (exifManufacturerCheckBox->isChecked()) hex |= DetailsOptions::Manufacturer; if (exifModelCheckBox->isChecked()) hex |= DetailsOptions::Model; - s.details.exifCamera = hex; + s->details.exifCamera = hex; // Exif author hex = 0; if (exifArtistCheckBox_D->isChecked()) @@ -148,7 +148,7 @@ hex |= DetailsOptions::Copyright; if (exifUserCommentCheckBox_D->isChecked()) hex |= DetailsOptions::UserComment; - s.details.exifAuthor = hex; + s->details.exifAuthor = hex; // IPTC hex = 0; if (iptcVersionCheckBox->isChecked()) @@ -177,7 +177,7 @@ hex |= DetailsOptions::DigitizedDate; if (iptcDigitizedTimeCheckBox->isChecked()) hex |= DetailsOptions::DigitizedTime; - s.details.iptc = hex; + s->details.iptc = hex; } /** Counts how much check boxes are checked and enables or disables diff -Nru sir-2.5.1/src/widgets/options/detailsgroupbox.h sir-2.6/src/widgets/options/detailsgroupbox.h --- sir-2.5.1/src/widgets/options/detailsgroupbox.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/options/detailsgroupbox.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 diff -Nru sir-2.5.1/src/widgets/options/filelistgroupbox.cpp sir-2.6/src/widgets/options/filelistgroupbox.cpp --- sir-2.5.1/src/widgets/options/filelistgroupbox.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/options/filelistgroupbox.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -49,7 +49,7 @@ * \sa Settings saveSettings() */ void FileListGroupBox::loadSettings() { - int hex = Settings::instance().treeWidget.columns; + int hex = Settings::instance()->treeWidget.columns; nameCheckBox->setChecked (hex & NameColumn); extCheckBox->setChecked (hex & ExtColumn); pathCheckBox->setChecked (hex & PathColumn); @@ -75,7 +75,7 @@ hex |= FileSizeColumn; if (statusCheckBox->isChecked()) hex |= StatusColumn; - Settings::instance().treeWidget.columns = hex; + Settings::instance()->treeWidget.columns = hex; } /** Returns true if at least 1 column check box is checked, otherwise returns diff -Nru sir-2.5.1/src/widgets/options/filelistgroupbox.h sir-2.6/src/widgets/options/filelistgroupbox.h --- sir-2.5.1/src/widgets/options/filelistgroupbox.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/options/filelistgroupbox.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 diff -Nru sir-2.5.1/src/widgets/options/generalgroupbox.cpp sir-2.6/src/widgets/options/generalgroupbox.cpp --- sir-2.5.1/src/widgets/options/generalgroupbox.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/options/generalgroupbox.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -38,7 +38,7 @@ GeneralGroupBox::GeneralGroupBox(QWidget *parent) : AbstractOptionsGroupBox(parent) { setupUi(this); - languages = new LanguageUtils(); + languages = LanguageUtils::instance(); fileToNiceName = new QMap(); QList imageFormats = QImageWriter::supportedImageFormats(); @@ -97,18 +97,18 @@ * \sa Settings saveSettings() */ void GeneralGroupBox::loadSettings() { - Settings &s = Settings::instance(); + Settings *s = Settings::instance(); // settings - targetFolderLineEdit->setText( s.settings.targetFolder); + targetFolderLineEdit->setText( s->settings.targetFolder); targetFormatComboBox->setCurrentIndex( - targetFormatComboBox->findText( s.settings.targetFormat)); - targetPrefixLineEdit->setText( s.settings.targetPrefix); - targetSuffixLineEdit->setText( s.settings.targetSuffix); - qualitySpinBox->setValue( s.settings.quality); + targetFormatComboBox->findText( s->settings.targetFormat)); + targetPrefixLineEdit->setText( s->settings.targetPrefix); + targetSuffixLineEdit->setText( s->settings.targetSuffix); + qualitySpinBox->setValue( s->settings.quality); languagesComboBox->setCurrentIndex( - languagesComboBox->findText( s.settings.languageNiceName, + languagesComboBox->findText( s->settings.languageNiceName, Qt::MatchExactly) ); - coresCount = s.settings.cores; + coresCount = s->settings.cores; if (coresCount == 0) { coresCheckBox->setChecked(true); respondCoresSpinBox(true); @@ -117,50 +117,50 @@ coresCheckBox->setChecked(false); respondCoresSpinBox(false); } - dateDisplayFormatLineEdit->setText( s.settings.dateDisplayFormat); - timeDisplayFormatLineEdit->setText( s.settings.timeDisplayFormat); - historySpinBox->setValue(common.maxHistoryCount()); + dateDisplayFormatLineEdit->setText( s->settings.dateDisplayFormat); + timeDisplayFormatLineEdit->setText( s->settings.timeDisplayFormat); + historySpinBox->setValue(CommonOptions::instance()->maxHistoryCount()); // size - widthPxSpinBox->setValue( s.size.widthPx); - widthPercentDoubleSpinBox->setValue( s.size.widthPercent); - heightPxSpinBox->setValue( s.size.heightPx); - heightPercentDoubleSpinBox->setValue( s.size.heightPercent); - fileSizeSpinBox->setValue( s.size.fileSizeValue); - fileSizeComboBox->setCurrentIndex( s.size.fileSizeUnit); - sizeUnitComboBox->setCurrentIndex( s.size.sizeUnit); - aspectRatioCheckBox->setChecked( s.size.keepAspectRatio); + widthPxSpinBox->setValue( s->size.widthPx); + widthPercentDoubleSpinBox->setValue( s->size.widthPercent); + heightPxSpinBox->setValue( s->size.heightPx); + heightPercentDoubleSpinBox->setValue( s->size.heightPercent); + fileSizeSpinBox->setValue( s->size.fileSizeValue); + fileSizeComboBox->setCurrentIndex( s->size.fileSizeUnit); + sizeUnitComboBox->setCurrentIndex( s->size.sizeUnit); + aspectRatioCheckBox->setChecked( s->size.keepAspectRatio); } /** Saves settings basing member widgets values. * \sa Settings loadSettings() */ void GeneralGroupBox::saveSettings() { - Settings &s = Settings::instance(); + Settings *s = Settings::instance(); // settings - s.settings.targetFolder = targetFolderLineEdit->text(); - s.settings.targetFormat = targetFormatComboBox->currentText(); - s.settings.targetPrefix = targetPrefixLineEdit->text(); - s.settings.targetSuffix = targetSuffixLineEdit->text(); - s.settings.quality = qualitySpinBox->value(); - s.settings.languageNiceName = languagesComboBox->currentText(); - s.settings.languageFileName = fileToNiceName->value( + s->settings.targetFolder = targetFolderLineEdit->text(); + s->settings.targetFormat = targetFormatComboBox->currentText(); + s->settings.targetPrefix = targetPrefixLineEdit->text(); + s->settings.targetSuffix = targetSuffixLineEdit->text(); + s->settings.quality = qualitySpinBox->value(); + s->settings.languageNiceName = languagesComboBox->currentText(); + s->settings.languageFileName = fileToNiceName->value( languagesComboBox->currentText() ); - s.settings.dateDisplayFormat = dateDisplayFormatLineEdit->text(); - s.settings.timeDisplayFormat = timeDisplayFormatLineEdit->text(); + s->settings.dateDisplayFormat = dateDisplayFormatLineEdit->text(); + s->settings.timeDisplayFormat = timeDisplayFormatLineEdit->text(); if (coresCheckBox->isChecked()) - s.settings.cores = 0; + s->settings.cores = 0; else - s.settings.cores = coresSpinBox->value(); - s.settings.maxHistoryCount = historySpinBox->value(); + s->settings.cores = coresSpinBox->value(); + s->settings.maxHistoryCount = historySpinBox->value(); // size - s.size.widthPx = widthPxSpinBox->value(); - s.size.widthPercent = widthPercentDoubleSpinBox->value(); - s.size.heightPx = heightPxSpinBox->value(); - s.size.heightPercent = heightPercentDoubleSpinBox->value(); - s.size.fileSizeValue = fileSizeSpinBox->value(); - s.size.fileSizeUnit = fileSizeComboBox->currentIndex(); - s.size.sizeUnit = sizeUnitComboBox->currentIndex(); - s.size.keepAspectRatio = aspectRatioCheckBox->isChecked(); + s->size.widthPx = widthPxSpinBox->value(); + s->size.widthPercent = widthPercentDoubleSpinBox->value(); + s->size.heightPx = heightPxSpinBox->value(); + s->size.heightPercent = heightPercentDoubleSpinBox->value(); + s->size.fileSizeValue = fileSizeSpinBox->value(); + s->size.fileSizeUnit = fileSizeComboBox->currentIndex(); + s->size.sizeUnit = sizeUnitComboBox->currentIndex(); + s->size.keepAspectRatio = aspectRatioCheckBox->isChecked(); } /** Allows the user to set target directory path. */ @@ -194,21 +194,12 @@ /** Sets up language combo box. */ void GeneralGroupBox::createLanguageMenu() { - QDir dir(QCoreApplication::applicationDirPath() + "/../share/sir/translations/"); - QStringList filter; - filter << "sir_*.qm"; - QStringList fileNames = dir.entryList(filter); - - QString languageName; - QIcon * countryFlag; - LanguageInfo info; - - for (int i = 0; i < (int)fileNames.size(); ++i) { - info = languages->getLanguageInfo(fileNames[i]); - languageName = info.niceName; - countryFlag = new QIcon(QCoreApplication::applicationDirPath() + - "/../share/sir/images/" + info.flagFile); - languagesComboBox->insertItem(i, *(countryFlag), languageName); - fileToNiceName->insert(languageName, fileNames[i]); + foreach (QString qmFile, languages->fileNames()) { + LanguageInfo info = languages->languageInfo(qmFile); + QString languageName = info.niceName; + QIcon countryFlag(QCoreApplication::applicationDirPath() + + "/../share/sir/images/" + info.flagFile); + languagesComboBox->addItem(countryFlag, languageName); + fileToNiceName->insert(languageName, qmFile); } } diff -Nru sir-2.5.1/src/widgets/options/generalgroupbox.h sir-2.6/src/widgets/options/generalgroupbox.h --- sir-2.5.1/src/widgets/options/generalgroupbox.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/options/generalgroupbox.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 diff -Nru sir-2.5.1/src/widgets/options/metadatagroupbox.cpp sir-2.6/src/widgets/options/metadatagroupbox.cpp --- sir-2.5.1/src/widgets/options/metadatagroupbox.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/options/metadatagroupbox.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -57,21 +57,21 @@ * \sa Settings saveSettings() */ void MetadataGroupBox::loadSettings() { - Settings &s = Settings::instance(); + Settings *s = Settings::instance(); // general metadata part - metadataCheckBox->setChecked( s.metadata.enabled); + metadataCheckBox->setChecked( s->metadata.enabled); if (!metadataCheckBox->isChecked()) { saveMetadataCheckBox->setEnabled(false); thumbUpdateCheckBox->setEnabled(false); thumbRotateCheckBox->setEnabled(false); } else - saveMetadataCheckBox->setChecked( s.metadata.saveMetadata); + saveMetadataCheckBox->setChecked( s->metadata.saveMetadata); if (saveMetadataCheckBox->isChecked()) { - thumbUpdateCheckBox->setChecked( s.metadata.updateThumbnail); + thumbUpdateCheckBox->setChecked( s->metadata.updateThumbnail); if (thumbUpdateCheckBox->isChecked()) - thumbRotateCheckBox->setChecked(s.metadata.rotateThumbnail); - rotateRadioButton->setChecked( s.metadata.realRotate); + thumbRotateCheckBox->setChecked(s->metadata.rotateThumbnail); + rotateRadioButton->setChecked( s->metadata.realRotate); } else { thumbUpdateCheckBox->setEnabled(false); @@ -83,27 +83,31 @@ // Exif part bool exifOverwrite; HistoryMap exifDefaultMap; - exifOverwrite = s.exif.artistOverwrite; + CommonOptions *common = CommonOptions::instance(); + exifOverwrite = s->exif.artistOverwrite; exifArtistCheckBox->setChecked(exifOverwrite); exifDefaultMap.insert(tr("Camera owner: ; Photographer: "),false); - exifArtistComboBox->importHistory( s.exif.artistMap, - s.exif.artistList, common.maxHistoryCount()); + exifArtistComboBox->importHistory( s->exif.artistMap, + s->exif.artistList, + common->maxHistoryCount()); exifArtistComboBox->setEnabled(exifOverwrite); - exifOverwrite = s.exif.copyrightOverwrite; + exifOverwrite = s->exif.copyrightOverwrite; exifCopyrightCheckBox->setChecked(exifOverwrite); exifDefaultMap.clear(); exifDefaultMap.insert(tr("Copyright owner"),false); - exifCopyrightComboBox->importHistory( s.exif.copyrightMap, - s.exif.copyrightList, common.maxHistoryCount()); + exifCopyrightComboBox->importHistory( s->exif.copyrightMap, + s->exif.copyrightList, + common->maxHistoryCount()); exifCopyrightComboBox->setEnabled(exifOverwrite); - exifOverwrite = s.exif.userCommentOverwrite; + exifOverwrite = s->exif.userCommentOverwrite; exifUserCommentCheckBox->setChecked(exifOverwrite); exifDefaultMap.clear(); exifDefaultMap.insert( tr("This picture was edited with Simple Image Resizer"),false); - exifUserCommentComboBox->importHistory( s.exif.userCommentMap, - s.exif.userCommentList, common.maxHistoryCount()); + exifUserCommentComboBox->importHistory( s->exif.userCommentMap, + s->exif.userCommentList, + common->maxHistoryCount()); exifUserCommentComboBox->setEnabled(exifOverwrite); } @@ -111,28 +115,32 @@ * \sa Settings loadSettings() */ void MetadataGroupBox::saveSettings() { - Settings &s = Settings::instance(); + Settings *s = Settings::instance(); // general part - s.metadata.enabled = metadataCheckBox->isChecked(); - s.metadata.saveMetadata = saveMetadataCheckBox->isChecked(); - s.metadata.realRotate = rotateRadioButton->isChecked(); - s.metadata.updateThumbnail = thumbUpdateCheckBox->isChecked(); - s.metadata.rotateThumbnail = thumbRotateCheckBox->isChecked(); + s->metadata.enabled = metadataCheckBox->isChecked(); + s->metadata.saveMetadata = saveMetadataCheckBox->isChecked(); + s->metadata.realRotate = rotateRadioButton->isChecked(); + s->metadata.updateThumbnail = thumbUpdateCheckBox->isChecked(); + s->metadata.rotateThumbnail = thumbRotateCheckBox->isChecked(); // Exif part HistoryMap historyMap; HistoryList historyList; - s.exif.artistOverwrite = exifArtistCheckBox->isChecked(); - exifArtistComboBox->exportHistory(&historyMap,&historyList,common.maxHistoryCount()); - s.exif.artistMap = historyMap; - s.exif.artistList = historyList; - s.exif.copyrightOverwrite = exifCopyrightCheckBox->isChecked(); - exifCopyrightComboBox->exportHistory(&historyMap,&historyList,common.maxHistoryCount()); - s.exif.copyrightMap = historyMap; - s.exif.copyrightList = historyList; - s.exif.userCommentOverwrite = exifUserCommentCheckBox->isChecked(); - exifUserCommentComboBox->exportHistory(&historyMap,&historyList,common.maxHistoryCount()); - s.exif.userCommentMap = historyMap; - s.exif.userCommentList = historyList; + CommonOptions *common = CommonOptions::instance(); + s->exif.artistOverwrite = exifArtistCheckBox->isChecked(); + exifArtistComboBox->exportHistory(&historyMap, &historyList, + common->maxHistoryCount()); + s->exif.artistMap = historyMap; + s->exif.artistList = historyList; + s->exif.copyrightOverwrite = exifCopyrightCheckBox->isChecked(); + exifCopyrightComboBox->exportHistory(&historyMap, &historyList, + common->maxHistoryCount()); + s->exif.copyrightMap = historyMap; + s->exif.copyrightList = historyList; + s->exif.userCommentOverwrite = exifUserCommentCheckBox->isChecked(); + exifUserCommentComboBox->exportHistory(&historyMap, &historyList, + common->maxHistoryCount()); + s->exif.userCommentMap = historyMap; + s->exif.userCommentList = historyList; } /** Enable or disable metadata check boxes depending on \a checked value. */ diff -Nru sir-2.5.1/src/widgets/options/metadatagroupbox.h sir-2.6/src/widgets/options/metadatagroupbox.h --- sir-2.5.1/src/widgets/options/metadatagroupbox.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/options/metadatagroupbox.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 diff -Nru sir-2.5.1/src/widgets/options/rawgroupbox.cpp sir-2.6/src/widgets/options/rawgroupbox.cpp --- sir-2.5.1/src/widgets/options/rawgroupbox.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/options/rawgroupbox.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -40,7 +40,7 @@ void RawGroupBox::browseDcraw() { QString fileName = QFileDialog::getOpenFileName(this, tr("Select dcraw executable"), - common.targetDirPath() ); + CommonOptions::instance()->targetDirPath() ); fileName = QDir::convertSeparators(fileName); dcrawLineEdit->setText(fileName); } @@ -56,40 +56,40 @@ * \sa Settings saveSettings() */ void RawGroupBox::loadSettings() { - Settings &s = Settings::instance(); - int state = s.raw.enabled; + Settings *s = Settings::instance(); + int state = s->raw.enabled; rawCheckBox->setChecked(state); setRawStatus(state); - dcrawLineEdit->setText( s.raw.dcrawPath); - dcrawOptions->setText( s.raw.dcrawOptions); + dcrawLineEdit->setText( s->raw.dcrawPath); + dcrawOptions->setText( s->raw.dcrawOptions); } /** Saves settings basing member widgets values. * \sa Settings loadSettings() */ void RawGroupBox::saveSettings() { - Settings &s = Settings::instance(); + Settings *s = Settings::instance(); bool dcrawOk = false; bool firstState = rawCheckBox->isChecked(); //check dcraw executable if(rawCheckBox->isChecked()) { if((dcrawOk = checkDcrawPath(dcrawLineEdit->text()))) { - s.raw.enabled = true; - s.raw.dcrawPath = dcrawLineEdit->text(); - s.raw.dcrawOptions = dcrawOptions->text(); + s->raw.enabled = true; + s->raw.dcrawPath = dcrawLineEdit->text(); + s->raw.dcrawOptions = dcrawOptions->text(); } else { - s.raw.enabled = false; + s->raw.enabled = false; rawCheckBox->setChecked(false); - s.raw.dcrawPath = dcrawLineEdit->text(); - s.raw.dcrawOptions = dcrawOptions->text(); + s->raw.dcrawPath = dcrawLineEdit->text(); + s->raw.dcrawOptions = dcrawOptions->text(); setRawStatus(false); } } else { - s.raw.enabled = false; - s.raw.dcrawPath = dcrawLineEdit->text(); - s.raw.dcrawOptions = dcrawOptions->text(); + s->raw.enabled = false; + s->raw.dcrawPath = dcrawLineEdit->text(); + s->raw.dcrawOptions = dcrawOptions->text(); } if(dcrawOk || !firstState) { emit ok(); diff -Nru sir-2.5.1/src/widgets/options/rawgroupbox.h sir-2.6/src/widgets/options/rawgroupbox.h --- sir-2.5.1/src/widgets/options/rawgroupbox.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/options/rawgroupbox.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 diff -Nru sir-2.5.1/src/widgets/options/selectiongroupbox.cpp sir-2.6/src/widgets/options/selectiongroupbox.cpp --- sir-2.5.1/src/widgets/options/selectiongroupbox.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/options/selectiongroupbox.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -34,24 +34,24 @@ * \sa Settings saveSettings() */ void SelectionGroupBox::loadSettings() { - Settings &s = Settings::instance(); - clearSelectionCheckBox->setChecked( s.selection.clearSelection); - importSubdirsCheckBox->setChecked( s.selection.subdirs); - selectImportedCheckBox->setChecked( s.selection.selectImported); - sFileSizeLineEdit->setText( s.selection.fileSizeSymbol); - sImgWidthLineEdit->setText( s.selection.imageWidthSymbol); - sImgHeightLineEdit->setText( s.selection.imageHeightSymbol); + Settings *s = Settings::instance(); + clearSelectionCheckBox->setChecked( s->selection.clearSelection); + importSubdirsCheckBox->setChecked( s->selection.subdirs); + selectImportedCheckBox->setChecked( s->selection.selectImported); + sFileSizeLineEdit->setText( s->selection.fileSizeSymbol); + sImgWidthLineEdit->setText( s->selection.imageWidthSymbol); + sImgHeightLineEdit->setText( s->selection.imageHeightSymbol); } /** Saves settings basing member widgets values. * \sa Settings loadSettings() */ void SelectionGroupBox::saveSettings() { - Settings &s = Settings::instance(); - s.selection.clearSelection = clearSelectionCheckBox->isChecked(); - s.selection.subdirs = importSubdirsCheckBox->isChecked(); - s.selection.selectImported = selectImportedCheckBox->isChecked(); - s.selection.fileSizeSymbol = sFileSizeLineEdit->text(); - s.selection.imageWidthSymbol = sImgWidthLineEdit->text(); - s.selection.imageHeightSymbol = sImgHeightLineEdit->text(); + Settings *s = Settings::instance(); + s->selection.clearSelection = clearSelectionCheckBox->isChecked(); + s->selection.subdirs = importSubdirsCheckBox->isChecked(); + s->selection.selectImported = selectImportedCheckBox->isChecked(); + s->selection.fileSizeSymbol = sFileSizeLineEdit->text(); + s->selection.imageWidthSymbol = sImgWidthLineEdit->text(); + s->selection.imageHeightSymbol = sImgHeightLineEdit->text(); } diff -Nru sir-2.5.1/src/widgets/options/selectiongroupbox.h sir-2.6/src/widgets/options/selectiongroupbox.h --- sir-2.5.1/src/widgets/options/selectiongroupbox.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/options/selectiongroupbox.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 diff -Nru sir-2.5.1/src/widgets/optionsdialog.cpp sir-2.6/src/widgets/optionsdialog.cpp --- sir-2.5.1/src/widgets/optionsdialog.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/optionsdialog.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -90,7 +90,7 @@ for (quint8 i=0; isaveSettings(); // Write file settings - Settings::instance().writeSettings(); + Settings::instance()->writeSettings(); } /** \e Ok button clicked slot.\n @@ -222,8 +222,10 @@ // copying items of combo boxes from parent ConvertDialog window ConvertDialog* mainWindow = (ConvertDialog*)parent(); - generalGroupBox->sizeUnitComboBox->setModel(mainWindow->sizeUnitComboBox->model()); - generalGroupBox->fileSizeComboBox->setModel(mainWindow->fileSizeComboBox->model()); + generalGroupBox->sizeUnitComboBox->setModel( + mainWindow->sizeScrollArea->sizeUnitComboBox->model()); + generalGroupBox->fileSizeComboBox->setModel( + mainWindow->sizeScrollArea->fileSizeComboBox->model()); verticalLayout->addItem(horizontalLayout); diff -Nru sir-2.5.1/src/widgets/optionsdialog.h sir-2.6/src/widgets/optionsdialog.h --- sir-2.5.1/src/widgets/optionsdialog.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/optionsdialog.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 diff -Nru sir-2.5.1/src/widgets/posspinbox.cpp sir-2.6/src/widgets/posspinbox.cpp --- sir-2.5.1/src/widgets/posspinbox.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/widgets/posspinbox.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,37 @@ +/* This file is part of SIR, an open-source cross-platform Image tool + * 2007-2010 Rafael Sachetto + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#include "posspinbox.h" + +/** Creates the PosSpinBox object. + * \param parent Parent widget. + */ +PosSpinBox::PosSpinBox(QWidget *parent) : QSpinBox(parent) {} + +/** If \a text is \e % (percent mark) sets range of this spin box to [-100; 100]. + * Otherwise sets range to [-20000; 20000]. + */ +void PosSpinBox::posUnitChanged(const QString &text) { + if (text == "%") + this->setRange(-100, 100); + else + this->setRange(-20000, 20000); +} diff -Nru sir-2.5.1/src/widgets/posspinbox.h sir-2.6/src/widgets/posspinbox.h --- sir-2.5.1/src/widgets/posspinbox.h 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/widgets/posspinbox.h 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,38 @@ +/* This file is part of SIR, an open-source cross-platform Image tool + * 2007-2010 Rafael Sachetto + * 2011-2013 Marek Jędryka + * + * 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 + * + * Program URL: http://sir.projet-libre.org/ + */ + +#ifndef POSSPINBOX_H +#define POSSPINBOX_H + +#include + +//! Position spin box class used in EffectsScrollArea. +class PosSpinBox : public QSpinBox { + Q_OBJECT + +public: + explicit PosSpinBox(QWidget *parent = 0); + +public slots: + void posUnitChanged(const QString &text); +}; + +#endif // POSSPINBOX_H diff -Nru sir-2.5.1/src/widgets/previewdialog.cpp sir-2.6/src/widgets/previewdialog.cpp --- sir-2.5.1/src/widgets/previewdialog.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/previewdialog.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -64,7 +64,7 @@ rawEnabled = RawUtils::isRawEnabled(); #ifdef SIR_METADATA_SUPPORT metadataEnabled = isntTiffImage(); - saveMetadata = Settings::instance().metadata.saveMetadata; + saveMetadata = Settings::instance()->metadata.saveMetadata; #endif // SIR_METADATA_SUPPORT initBar(); createConnections(); @@ -133,48 +133,61 @@ /** Sets up \em Actions toolbar. */ void PreviewDialog::initBar() { - for(int i = 100; i >= 10; i-=10) { - zoomComboBox->addItem(QString::number(i) + "%"); - } - zoomComboBox->addItem(tr("Fit to window size")); - - comboLabel->setFixedSize(22,22); - zoomComboBox->setEditable(true); - zoomComboBox->setToolTip(tr("Zoom image")); - previousButton->setDefault(false); - - previousButton->setFixedSize(22,22); - nextButton->setFixedSize(22,22); - previousButton->setToolTip(tr("Back to previous image")); - nextButton->setToolTip(tr("Go to next image")); - nextButton->setShortcut(Qt::Key_Right); previousButton->setShortcut(Qt::Key_Left); + previousButton->setIcon(QIcon::fromTheme("go-previous", + QIcon(":/images/previous.png")) ); - rotateCcwButton->setFixedSize(22,22); - rotateCwButton->setFixedSize(22,22); + nextButton->setToolTip(tr("Go to next image")); + nextButton->setShortcut(Qt::Key_Right); + nextButton->setIcon(QIcon::fromTheme("go-next", QIcon(":/images/next.png"))); rotateCcwButton->setToolTip(tr("Rotate counter clockwise")); + rotateCcwButton->setIcon(QIcon::fromTheme("object-rotate-left", + QIcon(":/images/rotate_ccw.png")) ); + rotateCwButton->setToolTip(tr("Rotate clockwise")); + rotateCwButton->setIcon(QIcon::fromTheme("object-rotate-right", + QIcon(":/images/rotate_cw.png")) ); - saveImageButton->setFixedSize(22,22); - saveImageButton->setToolTip(tr("Save image")); - saveImageButton->setShortcut(Qt::CTRL + Qt::Key_S); + flipHButton->setIcon(QIcon::fromTheme("object-flip-horizontal", + QIcon(":/images/flip_horizontal.png")) ); - saveAsButton->setFixedSize(22,22); - saveAsButton->setToolTip(tr("Save image as...")); + flipVButton->setIcon(QIcon::fromTheme("object-flip-vertical", + QIcon(":/images/flip_vertical.png")) ); - quitButton->setFixedSize(80,22); - quitButton->setToolTip(tr("Quit preview")); + comboLabel->setFixedSize(22,22); + + for (int i=100; i>=10; i-=10) + zoomComboBox->addItem(QString::number(i) + "%"); + zoomComboBox->addItem(tr("Fit to window size")); + zoomComboBox->setEditable(true); + zoomComboBox->setToolTip(tr("Zoom image")); - fullScreenButton->setFixedSize(22,22); fullScreenButton->setToolTip(tr("Fullscreen")); fullScreenButton->setShortcut(Qt::Key_F11); + fullScreenButton->setIcon(QIcon::fromTheme("view-fullscreen", + QIcon(":/images/window_fullscreen.png")) ); + + saveImageButton->setToolTip(tr("Save image")); + saveImageButton->setShortcut(Qt::CTRL + Qt::Key_S); + saveImageButton->setIcon(QIcon::fromTheme("document-save", + QIcon(":/images/filesave.png")) ); + + saveAsButton->setToolTip(tr("Save image as...")); + saveAsButton->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_S); + saveAsButton->setIcon(QIcon::fromTheme("document-save-as", + QIcon(":/images/filesaveas.png")) ); - printButton->setFixedSize(22,22); printButton->setToolTip(tr("Print current image...")); printButton->setShortcut(Qt::CTRL + Qt::Key_P); + printButton->setIcon(QIcon::fromTheme("document-print", + QIcon(":/images/print.png")) ); + + quitButton->setToolTip(tr("Quit preview")); + quitButton->setIcon(QIcon::fromTheme("application-exit", + QIcon(":/images/exit.png")) ); } /** Zoom combo box slot. @@ -468,7 +481,7 @@ connect(comboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(setDestFileExt(QString)) ); comboBox->setCurrentIndex( - comboBox->findText(Settings::instance().settings.targetFormat)); + comboBox->findText(Settings::instance()->settings.targetFormat)); layout->addWidget(comboBox); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, diff -Nru sir-2.5.1/src/widgets/previewdialog.h sir-2.6/src/widgets/previewdialog.h --- sir-2.5.1/src/widgets/previewdialog.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/previewdialog.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -95,7 +95,7 @@ bool PreviewDialog::isntTiffImage() { QString ext = imagePath.split('.').last().toLower(); bool tiffMetadataDisabled(!(ext == "tif" || ext == "tiff")); - if (Settings::instance().metadata.enabled && tiffMetadataDisabled) { + if (Settings::instance()->metadata.enabled && tiffMetadataDisabled) { metadata = new MetadataUtils::Metadata(); return true; } diff -Nru sir-2.5.1/src/widgets/selection/anymetadatagroupbox.cpp sir-2.6/src/widgets/selection/anymetadatagroupbox.cpp --- sir-2.5.1/src/widgets/selection/anymetadatagroupbox.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/selection/anymetadatagroupbox.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 diff -Nru sir-2.5.1/src/widgets/selection/anymetadatagroupbox.h sir-2.6/src/widgets/selection/anymetadatagroupbox.h --- sir-2.5.1/src/widgets/selection/anymetadatagroupbox.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/selection/anymetadatagroupbox.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 diff -Nru sir-2.5.1/src/widgets/selectiondialog.cpp sir-2.6/src/widgets/selectiondialog.cpp --- sir-2.5.1/src/widgets/selectiondialog.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/selectiondialog.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -42,7 +42,7 @@ : QDialog(parent,f) { this->convertDialog = static_cast (parent); this->params = params; - this->params->path = Settings::instance().settings.lastDir; + this->params->path = Settings::instance()->settings.lastDir; setupUi(); QGridLayout *scrollGridLayout = (QGridLayout*)scrollAreaWidgetContents->layout(); int columnSpan = scrollGridLayout->columnCount(); @@ -264,13 +264,13 @@ QString dirPath = QFileDialog::getExistingDirectory( this, tr("Choose a directory"), - Settings::instance().settings.lastDir, + Settings::instance()->settings.lastDir, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if (dirPath.isEmpty()) return; dirPath = QDir::convertSeparators(dirPath); params->path = dirPath; - Settings::instance().settings.lastDir = dirPath; + Settings::instance()->settings.lastDir = dirPath; uiDirWidget->dirLineEdit->setText(dirPath); } @@ -279,27 +279,27 @@ * \sa saveSettings() */ void SelectionDialog::loadSettings() { - Settings &s = Settings::instance(); + Settings *s = Settings::instance(); // general settings #ifdef SIR_METADATA_SUPPORT // set display format for date/time edit widgets - QString dateTimeFormat = s.settings.dateDisplayFormat - + ' ' + s.settings.timeDisplayFormat; + QString dateTimeFormat = s->settings.dateDisplayFormat + + ' ' + s->settings.timeDisplayFormat; anyMetadataGroupBox->createdBeforeDateTimeEdit->setDisplayFormat(dateTimeFormat); anyMetadataGroupBox->createdAfterDateTimeEdit->setDisplayFormat(dateTimeFormat); anyMetadataGroupBox->digitizedBeforeDateTimeEdit->setDisplayFormat(dateTimeFormat); anyMetadataGroupBox->digitizedAfterDateTimeEdit->setDisplayFormat(dateTimeFormat); #endif // SIR_METADATA_SUPPORT // max history count for HistoryComboBox's import functions - int maxHistoryCount = s.settings.maxHistoryCount; + int maxHistoryCount = s->settings.maxHistoryCount; // selection settings - clearSelectionCheckBox->setChecked( s.selection.clearSelection); + clearSelectionCheckBox->setChecked( s->selection.clearSelection); if (dirWidget) { - uiDirWidget->dirCheckBox->setChecked( s.selection.subdirs); - uiDirWidget->selectImportedCheckBox->setChecked( s.selection.selectImported); + uiDirWidget->dirCheckBox->setChecked( s->selection.subdirs); + uiDirWidget->selectImportedCheckBox->setChecked( s->selection.selectImported); } // settings of selection dialog - Settings::SelectionDialogGroup &sd = s.selectionDialog; + Settings::SelectionDialogGroup &sd = s->selectionDialog; // file fileNameComboBox->importHistory( sd.fileNameMap, sd.fileNameList, @@ -354,58 +354,58 @@ * \sa loadSettings() */ void SelectionDialog::saveSettings() { - Settings &s = Settings::instance(); + Settings *s = Settings::instance(); HistoryMap map; HistoryList list; // general settings - int maxHistoryCount = s.settings.maxHistoryCount; + int maxHistoryCount = s->settings.maxHistoryCount; // settings of selection dialog // file fileNameComboBox->exportHistory(&map, &list, maxHistoryCount); - s.selectionDialog.fileNameMap = map; - s.selectionDialog.fileNameList = list; + s->selectionDialog.fileNameMap = map; + s->selectionDialog.fileNameList = list; fileSizeComboBox->exportHistory(&map, &list, maxHistoryCount); - s.selectionDialog.fileSizeMap = map; - s.selectionDialog.fileSizeList = list; + s->selectionDialog.fileSizeMap = map; + s->selectionDialog.fileSizeList = list; imageSizeComboBox->exportHistory(&map, &list, maxHistoryCount); - s.selectionDialog.imageSizeMap = map; - s.selectionDialog.imageSizeList = list; + s->selectionDialog.imageSizeMap = map; + s->selectionDialog.imageSizeList = list; #ifdef SIR_METADATA_SUPPORT // any metadata anyMetadataGroupBox->authorComboBox->exportHistory(&map, &list, maxHistoryCount); - s.selectionDialog.anyAuthorMap = map; - s.selectionDialog.anyAuthorList = list; + s->selectionDialog.anyAuthorMap = map; + s->selectionDialog.anyAuthorList = list; anyMetadataGroupBox->copyrightComboBox->exportHistory(&map, &list, maxHistoryCount); - s.selectionDialog.anyCopyrightMap = map; - s.selectionDialog.anyCopyrightList = list; + s->selectionDialog.anyCopyrightMap = map; + s->selectionDialog.anyCopyrightList = list; // Exif uiExif.softwareComboBox->exportHistory(&map, &list, maxHistoryCount); - s.selectionDialog.exifSoftMap = map; - s.selectionDialog.exifSoftList = list; + s->selectionDialog.exifSoftMap = map; + s->selectionDialog.exifSoftList = list; uiExif.cameraManufacturerComboBox->exportHistory(&map, &list, maxHistoryCount); - s.selectionDialog.exifCameraManufacturerMap = map; - s.selectionDialog.exifCameraManufacturerList = list; + s->selectionDialog.exifCameraManufacturerMap = map; + s->selectionDialog.exifCameraManufacturerList = list; uiExif.cameraModelComboBox->exportHistory(&map, &list, maxHistoryCount); - s.selectionDialog.exifCameraModelMap = map; - s.selectionDialog.exifCameraModelList = list; + s->selectionDialog.exifCameraModelMap = map; + s->selectionDialog.exifCameraModelList = list; // IPTC uiIptc.objectNameComboBox->exportHistory(&map, &list, maxHistoryCount); - s.selectionDialog.iptcObjectNameMap = map; - s.selectionDialog.iptcObjectNameList = list; + s->selectionDialog.iptcObjectNameMap = map; + s->selectionDialog.iptcObjectNameList = list; uiIptc.keywordsComboBox->exportHistory(&map, &list, maxHistoryCount); - s.selectionDialog.iptcKeywordsMap = map; - s.selectionDialog.iptcKeywordsList = list; + s->selectionDialog.iptcKeywordsMap = map; + s->selectionDialog.iptcKeywordsList = list; uiIptc.descriptionComboBox->exportHistory(&map, &list, maxHistoryCount); - s.selectionDialog.iptcDescriptionMap = map; - s.selectionDialog.iptcDescriptionList = list; + s->selectionDialog.iptcDescriptionMap = map; + s->selectionDialog.iptcDescriptionList = list; uiIptc.countryNameComboBox->exportHistory(&map, &list, maxHistoryCount); - s.selectionDialog.iptcCountryNameMap = map; - s.selectionDialog.iptcCountryNameList = list; + s->selectionDialog.iptcCountryNameMap = map; + s->selectionDialog.iptcCountryNameList = list; uiIptc.cityComboBox->exportHistory(&map, &list, maxHistoryCount); - s.selectionDialog.iptcCityMap = map; - s.selectionDialog.iptcCityList = list; + s->selectionDialog.iptcCityMap = map; + s->selectionDialog.iptcCityList = list; uiIptc.editStatusComboBox->exportHistory(&map, &list, maxHistoryCount); - s.selectionDialog.iptcEditStatusMap = map; - s.selectionDialog.iptcEditStatusList = list; + s->selectionDialog.iptcEditStatusMap = map; + s->selectionDialog.iptcEditStatusList = list; #endif // SIR_METADATA_SUPPORT } diff -Nru sir-2.5.1/src/widgets/selectiondialog.h sir-2.6/src/widgets/selectiondialog.h --- sir-2.5.1/src/widgets/selectiondialog.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/selectiondialog.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 diff -Nru sir-2.5.1/src/widgets/treewidget.cpp sir-2.6/src/widgets/treewidget.cpp --- sir-2.5.1/src/widgets/treewidget.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/treewidget.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -38,6 +38,7 @@ #ifdef SIR_METADATA_SUPPORT #include "widgets/metadatadialog.h" #endif // SIR_METADATA_SUPPORT +#include "convertshareddata.h" /** Default constructor. */ TreeWidget::TreeWidget(QWidget *parent) : QTreeWidget(parent) { @@ -91,7 +92,7 @@ if (!fileName.isEmpty() && info.exists()) { //Directory if (info.isDir()) { - QDir sourceFolder(fileName, convertDialog->fileFilters); + QDir sourceFolder(fileName, convertDialog->csd->fileFilters); sourceFolder.setFilter( QDir::Files | QDir::NoSymLinks); QList list = sourceFolder.entryInfoList(); @@ -110,7 +111,7 @@ int comp = QString::compare("",QFileInfo(fileName).suffix()); - if((convertDialog->fileFilters.contains(QFileInfo(fileName).suffix())) + if((convertDialog->csd->fileFilters.contains(QFileInfo(fileName).suffix())) && (comp !=0)) { item = new QTreeWidgetItem(itemList(info)); @@ -145,6 +146,30 @@ return result; } +/** Adds directory button and action slot. + * Load all supported image files from choosed directory (non-recursive) + * into tree widget and set state to \em "Not converted yet".\n + * This function remember last opened directory in the same session. + * Default directory is home directory. + * \sa addFile() + */ +void TreeWidget::addDir() { + QString dirPath = QFileDialog::getExistingDirectory( + this, + tr("Choose a directory"), + Settings::instance()->settings.lastDir, + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); + + dirPath = QDir::convertSeparators(dirPath); + if (dirPath.isEmpty()) + return; + Settings::instance()->settings.lastDir = dirPath; + QDir sourceFolder(dirPath, convertDialog->csd->fileFilters); + sourceFolder.setFilter( QDir::Files | QDir::NoSymLinks); + QList list = sourceFolder.entryInfoList(); + loadFiles(list); +} + /** Add file button and action slot. * Load selected image files into tree widget and set state to * \em "Not converted yet".\n @@ -153,50 +178,42 @@ * \sa addDir() loadFiles(const QStringList&) */ void TreeWidget::addFile() { - QString aux = tr("Images") + "(" + convertDialog->fileFilters + ")"; + QString aux = tr("Images") + "(" + convertDialog->csd->fileFilters + ")"; QStringList files = QFileDialog::getOpenFileNames( this, tr("Select one or more files to open"), - Settings::instance().settings.lastDir, + Settings::instance()->settings.lastDir, aux ); if (files.isEmpty()) return; aux = files.first(); if (!aux.isEmpty()) { - Settings::instance().settings.lastDir = + Settings::instance()->settings.lastDir = aux.left(aux.lastIndexOf(QDir::separator())); loadFiles(files); } } -/** Adds directory button and action slot. - * Load all supported image files from choosed directory (non-recursive) - * into tree widget and set state to \em "Not converted yet".\n - * This function remember last opened directory in the same session. - * Default directory is home directory. - * \sa addFile() +/** Loads file into tree widget. + * \param file Full file path. */ -void TreeWidget::addDir() { - QString dirPath = QFileDialog::getExistingDirectory( - this, - tr("Choose a directory"), - Settings::instance().settings.lastDir, - QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); +void TreeWidget::loadFile(const QString &file) { + QFileInfo info(file); + statusList->insert(info.absoluteFilePath(), NOTCONVERTED); - dirPath = QDir::convertSeparators(dirPath); - if (dirPath.isEmpty()) - return; - Settings::instance().settings.lastDir = dirPath; - QDir sourceFolder(dirPath, convertDialog->fileFilters); - sourceFolder.setFilter( QDir::Files | QDir::NoSymLinks); - QList list = sourceFolder.entryInfoList(); - loadFiles(list); + QTreeWidgetItem *item = new QTreeWidgetItem(itemList(info)); + this->addTopLevelItem(item); + + if (info.exists()) { + convertDialog->enableConvertButtons(); + resizeColumnsToContents(); + } } /** Loads files into tree widget. - * \param files Full paths list. + * \param files Full file paths list. */ void TreeWidget::loadFiles(const QStringList &files) { QStringList::const_iterator it = files.begin(); @@ -211,7 +228,7 @@ item = new QTreeWidgetItem(itemList(info)); this->addTopLevelItem(item); ++it; - Settings::instance().settings.lastDir = info.path(); + Settings::instance()->settings.lastDir = info.path(); } if (!files.isEmpty()) { convertDialog->enableConvertButtons(); @@ -539,7 +556,7 @@ // thumbnail generation if (ext != "SVG" && ext != "SVGZ") { #ifdef SIR_METADATA_SUPPORT - bool fromData(!Settings::instance().metadata.enabled); + bool fromData(!Settings::instance()->metadata.enabled); if (!fromData) { if (!metadata.read(imagePath, true)) fromData = true; @@ -557,11 +574,8 @@ imageSize = img.size(); } } - else { // render from SVG file - QGraphicsSvgItem svg(imagePath); - QSvgRenderer *renderer = svg.renderer(); - imageSize = renderer->defaultSize(); - } + else // render from SVG file + imageSize = QSvgRenderer(imagePath).defaultSize(); // creating result string QString result; if (imageSize.isValid()) diff -Nru sir-2.5.1/src/widgets/treewidget.h sir-2.6/src/widgets/treewidget.h --- sir-2.5.1/src/widgets/treewidget.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/treewidget.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -93,6 +93,7 @@ public slots: void addDir(); void addFile(); + void loadFile(const QString &file); void loadFiles(const QStringList &files); void loadFiles(const QList &files); void removeAll(); diff -Nru sir-2.5.1/src/widgets/treewidgetheader.cpp sir-2.6/src/widgets/treewidgetheader.cpp --- sir-2.5.1/src/widgets/treewidgetheader.cpp 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/treewidgetheader.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 @@ -58,7 +58,7 @@ void TreeWidgetHeader::loadSettings() { if (window()->isHidden()) return; - int hex = Settings::instance().treeWidget.columns; + int hex = Settings::instance()->treeWidget.columns; setSectionHidden(NameColumn, !(hex & TreeWidgetOptions::NameColumn)); setSectionHidden(ExtColumn, !(hex & TreeWidgetOptions::ExtColumn)); setSectionHidden(PathColumn, !(hex & TreeWidgetOptions::PathColumn)); @@ -86,7 +86,7 @@ hex |= TreeWidgetOptions::FileSizeColumn; if (actions[StatusColumn]->isChecked()) hex |= TreeWidgetOptions::StatusColumn; - Settings::instance().treeWidget.columns = hex; + Settings::instance()->treeWidget.columns = hex; } /** Loads settings if \a event is QEvent::Show (tree widget just was showed). diff -Nru sir-2.5.1/src/widgets/treewidgetheader.h sir-2.6/src/widgets/treewidgetheader.h --- sir-2.5.1/src/widgets/treewidgetheader.h 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/src/widgets/treewidgetheader.h 2013-04-28 11:49:20.000000000 +0000 @@ -1,6 +1,6 @@ /* This file is part of SIR, an open-source cross-platform Image tool * 2007-2010 Rafael Sachetto - * 2011-2012 Marek Jędryka + * 2011-2013 Marek Jędryka * * 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 diff -Nru sir-2.5.1/src/xmlstreamwriter.cpp sir-2.6/src/xmlstreamwriter.cpp --- sir-2.5.1/src/xmlstreamwriter.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/xmlstreamwriter.cpp 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,68 @@ +#include "xmlstreamwriter.h" + +/** Creates the XmlStreamWriter object. */ +XmlStreamWriter::XmlStreamWriter() : QXmlStreamWriter() {} + +/** Creates the XmlStreamWriter object connected to \a device buffer. */ +XmlStreamWriter::XmlStreamWriter(QIODevice *device) : QXmlStreamWriter(device) {} + +/** Creates the XmlStreamWriter object connected to \a array buffer. */ +XmlStreamWriter::XmlStreamWriter(QByteArray *array) : QXmlStreamWriter(array) {} + +/** Creates the XmlStreamWriter object connected to \a string buffer. */ +XmlStreamWriter::XmlStreamWriter(QString *string) : QXmlStreamWriter(string) {} + +/** Writes current node attribute called \a qualifiedName and sets the attribute + * value to \a value string. + */ +void XmlStreamWriter::writeAttribute(const QString &qualifiedName, + const QString &value) { + QXmlStreamWriter::writeAttribute(qualifiedName, value); +} + +/** Writes current node attribute called \a qualifiedName and sets the attribute + * value to \a value string. + */ +void XmlStreamWriter::writeAttribute(const QString &qualifiedName, + const char *value) { + QXmlStreamWriter::writeAttribute(qualifiedName, QString::fromStdString(value)); +} + +/** Writes current node attribute called \a qualifiedName and sets the attribute + * value to string corresponding \a value: \e yes if true, otherwise \e no. + */ +void XmlStreamWriter::writeAttribute(const QString &qualifiedName, bool value) { + QXmlStreamWriter::writeAttribute(qualifiedName, (value) ? "yes" : "no"); +} + +/** Writes current node attribute called \a qualifiedName and sets the attribute + * value to \a value decimal string. + */ +void XmlStreamWriter::writeAttribute(const QString &qualifiedName, int value) { + QXmlStreamWriter::writeAttribute(qualifiedName, QString::number(value)); +} + +/** Writes current node attribute called \a qualifiedName and sets the attribute + * value to \a value decimal string. + */ +void XmlStreamWriter::writeAttribute(const QString &qualifiedName, double value) { + QXmlStreamWriter::writeAttribute(qualifiedName, QString::number(value)); +} + +/** Writes current node child node called \e color and sets attributes + * \e r (red), \e g (green), \e b (blue) and \e a (alpha) values to \a color + * components decimal values. + */ +void XmlStreamWriter::writeColorElement(const QColor &color) { + writeStartElement("color"); + writeAttribute("r", color.red()); + writeAttribute("g", color.green()); + writeAttribute("b", color.blue()); + writeAttribute("a", color.alpha()); + writeEndElement(); +} + +/** Writes current node value as \a value decimal node text. */ +void XmlStreamWriter::writeValue(int value) { + QXmlStreamWriter::writeCharacters(QString::number(value)); +} diff -Nru sir-2.5.1/src/xmlstreamwriter.h sir-2.6/src/xmlstreamwriter.h --- sir-2.5.1/src/xmlstreamwriter.h 1970-01-01 00:00:00.000000000 +0000 +++ sir-2.6/src/xmlstreamwriter.h 2013-04-28 11:49:20.000000000 +0000 @@ -0,0 +1,23 @@ +#ifndef XMLSTREAMWRITER_H +#define XMLSTREAMWRITER_H + +#include +#include + +//! XML writer for Session class. +class XmlStreamWriter : public QXmlStreamWriter { +public: + XmlStreamWriter(); + XmlStreamWriter(QIODevice *device); + XmlStreamWriter(QByteArray *array); + XmlStreamWriter(QString *string); + void writeAttribute(const QString &qualifiedName, const QString &value); + void writeAttribute(const QString &qualifiedName, const char *value); + void writeAttribute(const QString &qualifiedName, bool value); + void writeAttribute(const QString &qualifiedName, int value); + void writeAttribute(const QString &qualifiedName, double value); + void writeColorElement(const QColor &color); + void writeValue(int value); +}; + +#endif // XMLSTREAMWRITER_H diff -Nru sir-2.5.1/translations/sir_pl.ts sir-2.6/translations/sir_pl.ts --- sir-2.5.1/translations/sir_pl.ts 2012-11-13 23:35:19.000000000 +0000 +++ sir-2.6/translations/sir_pl.ts 2013-04-28 11:49:20.000000000 +0000 @@ -174,6 +174,47 @@ + ColorFrame + + + Choose Color + Wybierz kolor + + + + CommandLineAssistant + + + Usage: sir [options] [files] +Typed files will load to files list in main window. + +Supported arguments: + --help or -h print help message and quit + --lang or -l LANG set application language to LANG witch is language symbol + --session or -s session.xml restore session from XML session file + +Example: +$ sir -hl pl +is equivalent to +$ sir --help --lang pl +both print help message in Polish language and quit. + + Użycie: sir [opcje] [pliki] +Podane pliki zostaną wczytane na listę plików w oknie głównym. + +Obsługiwane opcje: + --help lub -h wypisuje pomoc i wychodzi + --lang lub -l JĘZYK ustawia język programu na JĘZYKl + --session lub -s session.xml przywraca sesję z pliku XML + +Przykład: +$ sir -hl pl +jest równoważne +$ sir --help --lang pl +oba wypisują pomoc w języku polskim i wychodzą. + + + ConvertDialog @@ -181,27 +222,27 @@ SIR - Simple Image Resizer - + &Quit &Wyjście - + &Convert Selected Konwertuj &zaznaczone - + Alt+C Alt+Z - + Convert &All Ko&nwertuj wszystkie - + Alt+A Alt+N @@ -217,7 +258,7 @@ - + Add &Dir... Dodaj &katalog... @@ -228,7 +269,7 @@ - + Remove Al&l Usuń w&szystkie @@ -248,9 +289,8 @@ Dodaj prefiks: - Height: - Wysokość: + Wysokość: @@ -263,13 +303,12 @@ Alt+P - Width: - Szerokość: + Szerokość: - + Add &File... &Dodaj plik... @@ -279,24 +318,21 @@ Alt+D - + Options Opcje - Rotation Angle: - Obróć o kąt: + Obróć o kąt: - &Maintain Aspect Ratio - Zachowaj p&roporcje obrazu + Zachowaj p&roporcje obrazu - Alt+M - Alt+R + Alt+R @@ -309,98 +345,92 @@ Format docelowy: - + Size Rozmiar - - auto - auto + auto - Target File Size: - Rozmiar docelowy: + Rozmiar docelowy: - KiB - KiB + KiB - MiB - MiB + MiB - Choose unit - Wybierz jednostkę + Wybierz jednostkę - Pixels (px) - Piksele (px) + Piksele (px) - Percent (%) - Procenty (%) + Procenty (%) - Bytes (B) - Bajty (B) + Bajty (B) - Quality: - Jakość: + Jakość: - No flip - Brak odbicia + Brak odbicia - + &Select... &Zaznacz... - + Alt+S Alt+Z - + &Import files... &Importuj pliki... - + Alt+I Alt+I - + Do advanced selection of images on list Dokonaj zaawansowanej selekcji obrazów na liście - + + Effects + Efekty + + + Check for updates... Sprawdź aktualizacje... - + Let us know that you are using SIR... Daj znać, że używasz SIR... - + Remove all filles the files list Usuń wszystkie pliki z listy plików @@ -409,210 +439,246 @@ Plik - + Edit Edytuj - + About Pomoc - Flip vertically - Odbij pionowo + Odbij pionowo - Flip horizontally - Odbij pionowo + Odbij pionowo - Flip vertically and horizontally - Odbij pionowo i poziomo + Odbij pionowo i poziomo - + Actions Akcje - - - - + + Session + Sesja + + + + + + Quit Wyjście - + &Options &Opcje - + Alt+O Alt+O - + About Sir... O SIR... - + About Qt... O Qt... - - - - + + Restore... + Przywróć... + + + + Save... + Zapisz... + + + + + + Let us know! Daj nam znak! - + You alread sent information about your SIR installation. Thank you very much! Już wysłałeś informację o Twojej instalacji SIR. Dziękujemy! - + IMPORTANT: this action will not send any private data about you or your computer to SIR developers! It will only update a counter of unique installations of SIR. WAŻNE: ta akcja nie wysyła żadnych prywatnych danych o Tobie i Twoim komputerze do twórców SIR! Jedynie zwiększa liczbę unikalnych instalacji SIR. - + Go for it! Prześlij! - + No thanks! Nie, dziękuję! - + There was an error while trying to connect with SIR website! Check your internet connection and try again later! Wystąpił błąd podczas łączenia z serwerem SIR! Sprawdź połączenie z Internetem i spróbuj ponownie! - + Thank you for let us know that you are using SIR! You are the user number %1 of this month! Dziękujemy za informację, że używasz SIR! Jesteś %1 użytkownikiem w tym miesiącu! - - - + + + SIR Updates Aktualizacje SIR - + There was an error while trying to connect with SIR update website! Check your internet connection and try again later! Wystąpił błąd podczas łączenia z serwerem SIR! Sprawdź połączenie z Internetem i spróbuj ponownie! - + You have the lastest version of SIR! Masz najnowszą wersję SIR! - + There is a new version of SIR available for download! Nowa wersja SIR jest dostępna do pobrania! - + Go to SIR website! Idź do strony internetowej SIR! - + I will check later! Sprawdzę później! - + Choose a directory Wybierz katalog - + Please add at least one image file. Proszę, dodaj co najmniej jeden plik obrazu. - + Please select at least one image file. Proszę, wybierz co najmniej jeden plik obrazu. - + Create Folder? -- SIR Utworzyć katalog? - SIR - + The folder %1 do not exists.Do you want to create it? Katalog %1 nie istnieje. Chcesz go utworzyć? - + &Yes &Tak - + &No &Nie - + Unable to create target folder. Nie można stworzyć docelowego katalogu. - + Cancel Anuluj - + + Load image failed + Nieudane wczytanie obrazka + + + + Load image to add failed. +Do you want continue anyway? + Nieudane wczytanie obrazka. +Chcesz kontynuować mimo to? + + + + + Choose session file + Wybierz plik sesji + + + + + XML Files + Pliki XML + + + Version Wersja - + Enlarge File? - SIR Powiększyć plik? - SIR - + A file called %1 is smaller than the requested size. Enlargement can cause deterioration of picture quality. Do you want enlarge it? Plik %1 jest mniejszy od rządanego rozmiaru. Powiększenie może spowodować pogorszenie jakości zdjęcia. Czy chcesz powiększyć? - + Overwrite File? -- SIR Nadpisać plik? -- SIR - + A file called %1 already exists.Do you want to overwrite it? Plik %1 już istnieje. Czy chcesz go nadpisać? - + Cancelled Anulowano - + Converted Skonwertowany @@ -620,70 +686,85 @@ ConvertThread - - - - - - + + + + + + Cancelled Anulowano - + Converting Konwertuję - + Failed to open original image Błąd otwarcia obrazu źródłowego - - - - + + + + Converted Skonwertowany - - + + Failed to convert Nieudana konwersja - - - - - + + + + + Skipped Pominięty - + Error code: Kod błędu: - - + + Failed to compute image size Błąd obliczenia rozmiaru obrazu - - + + Failed to save Nieudany zapis + + + Failed to save new SVG file + Nieudany zapis nowego pliku SVG + + + + Failed to open changed SVG file + Błąd otwarcia zmodyfikowanego pliku SVG + + + + Failed to open SVG file + Błąd otwarcia pliku pliku SVG + DetailsBrowser - + Select image to show this one details. Zaznacz obraz, by zobaczyć jego szczegóły. @@ -703,158 +784,158 @@ Rozmiar pliku: - + Exif Version Wersja Exif - + Processing Software Obróbka programem - + Orientation Orientacja - + Generated Date and Time Data i godzina utworzenia - + Digitized Date and Time Data i godzina cyfryzacji - + Focal lenght Ogniskowa - + Aperture Przesłona - + Exposure time Czas naświetlania - + Shutter Speed Czas migawki - + Exposure bias Ekspozycja - + ISO Speed Czułość ISO - + Exposure program Program ekspozycji - + Light metering mode Tryb pomiaru światła - + Flash mode Tryb lampy błyskowej - + Camera manufacturer: Producent aparatu: - + Camera model: Model aparatu: - + Artist Artysta - - + + Copyright Prawa autorskie - + User Comment Komentarz użytkownika - + Model version Wersja wzoru - + Created date Data utworzenia - + Created time Godzina utworzenia - + Digitized date Data cyfryzacji - + Digitized time Godzina cyfryzacji - + Author Autor - + Object name Nazwa objektu - + Keywords Słowa kluczowe - + Description Opis - + Country Kraj - + City Miasto - + Edit status Status edycji @@ -1072,6 +1153,215 @@ + EffectsScrollArea + + + ScrollArea + + + + + Add Image + Dodaj obraz + + + + + Y Coordinate: + Współrzędna Y: + + + + + X Coordinate: + Współrzędna X: + + + + Image File: + Plik: + + + + Image Rotation: + Obrót: + + + + + Position of: + Pozycja: + + + + Browse + Przeglądaj + + + + + Opacity: + Nieprzezroczystość: + + + + Add Text + Dodaj napis + + + + Font Family: + Czcionka: + + + + Text: + Napis: + + + + Top left corner + Lewy górny róg + + + + Middle of top edge + Środek górnej krawędzi + + + + Top right corner + Prawy górny róg + + + + Center + Środek + + + + Middle of right edge + Środek prawej krawędzi + + + + Bottom right corner + Prawy dolny róg + + + + Middle of bottom edge + Środek dolnej krawędzi + + + + Bottom left corner + Lewy dolny róg + + + + Middle of left edge + Środek lewej krawędzi + + + + Font Size: + Rozmiar czcionki: + + + + Text in Frame + Ramka wokół napisu + + + + Text Rotation: + Obrót: + + + + Font Color: + Kolor czcionki: + + + + Bold + Pogrubienie + + + + Italic + Kursywa + + + + Underline + Podkreślenie + + + + Strike out + Przekreślenie + + + + Add Frame + Dodaj ramkę + + + + Add Around + Dodaj wokół + + + + Frame Width: + Grubość ramki: + + + + Overlay + Przesłoń + + + + Frame Color: + Kolor ramki: + + + + Inside Border + Wewnętrzna ramka + + + + + Width: + Grubość: + + + + + Color: + Kolor: + + + + Outside Border + Zewnętrzna ramka + + + + Choose Image File + Wybierz plik obrazu + + + + Images + Obrazy + + + ExifGroupBox @@ -1247,7 +1537,7 @@ Zachowaj proporcje obrazu - + Choose a directory Wybierz katalog @@ -1255,29 +1545,29 @@ HistoryComboBox - + Remove item Usuń element - + Full text history - SIR Pełna historia edycji- SIR - + Text history memory is full of favorite items. SIR can't automatically remove favorite item. Do it manually. Pamięc edycji zapełniona. SIR nie może automatycznie usunąć ulubionych elementów. Zrób to ręcznie. - + Throw away from favorite Usuń z ulubionych - + Mark as favorite Oznacz jako ulubiony @@ -1338,550 +1628,546 @@ Metadane - SIR - + Exif Exif - + Image Obrazek - + Exif Version Wersja Exif - + Processing Software Obróbka programem - - - - - - - - + + + + TextLabel Tekst etykiety - - + + Size Rozmiar - - + + Width Szerokość - - + + Height Wysokość - + Orientation Orientacja - + Generated Date and Time Data i godzina utworzenia - + Digitized Date and Time Data i godzina cyfryzacji - + Thumbnail Miniatura - + Thumbnail Label Etykieta miniaturki - + Photo Zdjęcie - + Focal length Ogniskowa - + Exposure time Czas naświetlania - + Exposure bias Ekspozycja - + mm mm - + 1/2000 s 1/2000 s - + 1/1600 s 1/1600 s - + 1/1250 s 1/1250 s - + 1/1000 s 1/1000 s - + 1/800 s 1/800 s - + 1/640 s 1/640 s - + 1/500 s 1/500 s - + 1/400 s 1/400 s - + 1/320 s 1/320 s - + 1/250 s 1/250 s - + 1/200 s 1/200 s - + 1/160 s 1/160 s - + 1/125 s 1/125 s - + 1/100 s 1/100 s - + 1/80 s 1/80 s - + 1/60 s 1/60 s - + 1/50 s 1/50 s - + 1/40 s 1/40 s - + 1/30 s 1/30 s - + 1/25 s 1/25 s - + 1/20 s 1/20 s - + 1/15 s 1/15 s - + 1/13 s 1/13 s - + 1/10 s 1/10 s - - + + 1/8 s 1/8 s - + 1/6 s 1/6 s - + 1/5 s 1/5 s - - + + 1/4 s 1/4 s - + 1/3 s 1/3 s - + 2/5 s 2/5 s - - + + 1/2 s 1/2 s - + 2/3 s 2/3 s - + 4/5 s 4/5 s - - + + 1 s 1 s - + 1 1/3 s 1 1/3 s - + 1 2/3 s 1 2/3 s - - + + 2 s 2 s - + 2 1/2 s 2 1/2 s - + 3 1/5 s 3 1/5 s - - + + 4 s 4 s - + 5 s 5 s - + 6 s 6 s - - + + 8 s 8 s - + 10 s 10 s - + 13 s 13 s - + 15 s 15 s - + EV EV - + Aperture Przesłona - + Shutter Speed Szybkość migawki - + ISO Speed Czułość ISO - + F F - + Exposure program Program ekspozycji - + Light metering mode Tryb pomiaru światła - + Flash mode Tryb lampy błyskowej - + 1/2048 s 1/2048 s - + 1/1024 s 1/1024 s - + 1/512 s 1/512 s - + 1/256 s 1/256 s - + 1/128 s 1/128 s - + 1/64 s 1/64 s - + 1/32 s 1/32 s - + 1/16 s 1/16 s - + Camera Aparat - + Manufacturer Producent - + Model Model - + Author Autor - + Artist Artysta - + Copyright Prawa autorskie - + User Comment Komentarz użytkownika - + IPTC IPTC - + Copyright: Prawa autorskie: - + Model version: Wersja wzoru: - + Country: Kraj: - + Digitized date: Data cyfryzacji: - + Created date: Data utworzenia: - + Keywords: Słowa kluczowe: - + Digitized time: Godzina cyfryzacji: - + Description: Opis: - + Created time: Godzina utworzenia: - + City: Miasto: - + Author: Autor: - + Edit status: Status edycji: - + Object name: Nazwa objektu: - - + + Delete metadata Usuń metadane - + Save changes Zapisz zmiany - + Cancel Anuluj - + Metadata error Błąd metadanych - + Error code: %1 Error message: %2 @@ -1890,32 +2176,32 @@ Informacja: %2 - + Unexpected metadata read error occured. Wystąpił nieoczekiwany błąd odczytu metadanych. - + No Exif and IPTC metadata. Brak metadanych Exif i IPTC. - + No Exif metadata. Brak metadanych Exif. - + No IPTC metadata. Brak metadanych IPTC. - + Metadata warning Ostrzeżenie metadanych - + Do you really want to delete metadata from this image? Jesteś pewien, że chcesz usunąć metadane z tego zdjęcia? @@ -1983,17 +2269,17 @@ Nadpisz komentarz użytkownika Exif - + Camera owner: ; Photographer: Właściciel aparatu: ; Fotograf: - + Copyright owner Właściciel praw autorskich - + This picture was edited with Simple Image Resizer Ten program był edytowany przy pomocy Simple Image Resizer @@ -2001,130 +2287,130 @@ MetadataUtils::Exif - - + + Unknown Nieznany - - + + No rotation Brak obrotu - + No rotation, flip verticaly Brak obrotu, odbij pionowo - + Rotation 180° Obróć o 180° - + Rotation 180°, flip verticaly Obróć o 180°, odbij pionowo - + Clockwise rotation, flip horizontaly Obróć zgodnie z ruchem wskazówek zegara, odbij pionowo - + Clockwise rotation Obróć zgodnie z kierunkiem ruchu wskazówek zegara - + Counterclockwise rotation, flip horizontaly Obróć przeciwnie do kierunku ruchu wskazówek zegara, odbij pionowo - + Counterclockwise rotation Obróć przeciwnie do kierunku ruchu wskazówek zegara - - + + Not defined Niezdefiniowany - + Manual Ręczny - + Auto Automatyczny - + Aperture priority Priorytet przesłony - + Shutter priority Priorytet migawki - + Creative program (biased toward depth of field) Kreatywny (duża głębia ostrości) - + Action program (biased toward fast shutter speed) Akcja (krótki czas naświetlania) - + Portrait mode (for closeup photos with the background out of focus) Potret (zdjęcia z bliska z odciętym tłem) - + Landscape mode (for landscape photos with the background in focus) Krajobraz (zdjęcia krajobrazu z ostrym tłem) - + Average Średnia - + Center weighted average Centralnie ważony uśredniony - + Spot Punktowy - + Multi spot Wielopunktowy - + Pattern Wzorcowy - + Partial Częściowy - + Other Inny @@ -2132,42 +2418,42 @@ MetadataUtils::Flash - + No flash function. Brak lampy błyskowej. - + Flash fired Błysk - + Flash didn't fire Brak błysku - + , compulsory flash mode , wymuszony - + , auto mode , automatycznie - + , red-eye reduction , redukcja czerwonych oczu - + , strobe return light detected , wykryto światło stroboskopowe - + , strobe return light not detected , nie wykryto światła stroboskopowego @@ -2175,18 +2461,18 @@ MetadataUtils::Metadata - - + + Error open file %1 Błąd otwarcia pliku %1 - + Write file %1 error Błąd zapisu pliku %1 - + Save thumnail failed Nieudany zapis miniaturki @@ -2194,7 +2480,7 @@ MetadataUtils::String - + no data brak danych @@ -2248,6 +2534,44 @@ + OptionsScrollArea + + + No flip + Brak odbicia + + + + Flip vertically + Odbij pionowo + + + + Flip horizontally + Odbij pionowo + + + + Flip vertically and horizontally + Odbij pionowo i poziomo + + + + Quality: + Jakość: + + + + Background Color + Kolor tła + + + + Rotation Angle: + Obróć o kąt: + + + PreviewDialog @@ -2255,42 +2579,42 @@ Akcje - + Zoom image Zoom - + Back to previous image Poprzedni obraz - + Go to next image Następny obraz - + Rotate counter clockwise Obróć przeciwnie do kierunku ruchu wskazówek zegara - + Rotate clockwise Obróć zgodnie z kierunkiem ruchu wskazówek zegara - + Save image Zapisz obraz - + Save image as... Zapisz obraz jako... - + Quit Wyjście @@ -2300,91 +2624,91 @@ SIR - podgląd obrazów - - - + + + Fit to window size Dopasuj do rozmiaru okna - + Quit preview Zakończ podgląd - + Fullscreen Pełny ekran - + Print current image... Drukuj obraz... - + Please enter a valid zoom factor. Wprowadź prawidłowy współczynnik powiększenia. - + Overwrite File? -- SIR Nadpisać plik? -- SIR - + A file called %1 already exists.Do you want to overwrite it? Plik %1 już istnieje. Czy chcesz go nadpisać? - + &Yes &Tak - + &No &Nie - + Save File Zapisz plik - + Unsupported file format Nieobsługiwany format pliku - + Write into %1 file is unsupported. Choose supported file extension: Zapis do pliku %1 jest nieobsługiwany. Wybierz obsługiwane rozszerzenie pliku: - + File saved Plik zapisany - + Failed to save image Błąd zapisu pliku - + Image file error Błąd pliku obrazu - + Load image %1 failed Nieudane wczytanie obrazka %1 - + Error code: %1 Error message: %2 @@ -2393,7 +2717,7 @@ Informacja: %2 - + Metadata error! Błąd metadanych! @@ -2403,7 +2727,7 @@ - + TextLabel @@ -2459,32 +2783,32 @@ Selection - + Conditions of items selection - SIR Warunki zaznaczenia pozycji - SIR - + Checking selection conditions... Sprawdzanie warunków zaznaczenia... - + Conditions of import files - SIR Warunki importu plików - SIR - + Checking import conditions... Sprawdzanie warunków importu... - + Scanning directories... Skanowanie katalogów... - + Not converted yet Nie skonwertowany @@ -2492,12 +2816,12 @@ SelectionDialog - + File size Rozmiar pliku - + Image size [px] Rozmiar obrazu [px] @@ -2507,22 +2831,22 @@ Akceptuje wyrażenia regularne - + File name Nazwa pliku - + Unselect items selected before this action Odznacza elementy zaznaczone przed tą akcją - + Clear current selection Wyczyść bieżące zaznaczenie - + Choose a directory Wybierz katalog @@ -2566,120 +2890,245 @@ + Session + + + Session write error + Błąd zapisu sesji + + + + Session saving to %1 file failed. +Can't open the file. + Nieudany zapis sesji do pliku %1. +Nie można otworzyć pliku. + + + + + + Session read error + Błąd odczytu sesji + + + + Session restoring from %1 file failed. +Can't open the file. + Nieudane przywrócenie sesji z pliku %1. +Nie można otworzyć pliku. + + + + Session restoring from %1 file failed. +Can't parse the file. + Nieudane przywrócenie sesji z pliku %1. +Nie można przetworzyć pliku. + + + + Session restoring from %1 file failed. +Invalid file format. + Nieudane przywrócenie sesji z pliku %1. +Nieprawidłowy format pliku. + + + + SizeScrollArea + + + Choose unit + Wybierz jednostkę + + + + Pixels (px) + Piksele (px) + + + + Percent (%) + Procenty (%) + + + + Bytes (B) + Bajty (B) + + + + &Maintain Aspect Ratio + Zachowaj p&roporcje obrazu + + + + Alt+M + Alt+R + + + + Width: + Szerokość: + + + + + auto + auto + + + + Height: + Wysokość: + + + + Target File Size: + Rozmiar docelowy: + + + + KiB + KiB + + + + MiB + MiB + + + + SvgScrollArea + + + Remove Empty Groups + Usuń puste grupy + + + + Remove Text Elements + Usuń elementy "text" + + + + Save SVG File + Zapisz plik SVG + + + TreeWidget - + Images Obrazy - + Select one or more files to open Zaznacz jeden lub więcej plików do otwarcia - + Choose a directory Wybierz katalog - + Converted Skonwertowany - + Skipped Pominięty - + Failed to convert Nieudana konwersja - - + + Not converted yet Nie skonwertowany - + Converting Konwertuję - + Cancelled Anulowano - + Name Nazwa - + Ext Rozszerzenie - + Path Ścieżka - + Image size Rozmiar obrazu - + File size Rozmiar pliku - + Status Status - + Remove Selected Usuń zaznaczone - + Remove selected images Usuń zaznaczone obrazki - + Convert Selected Konwertuj zaznaczone - + Convert selected images Konwertuj zaznaczone obrazki - + Show Image Pokaz obrazek - + Show preview selected image Pokaż podgląd zaznaczonego obrazka - + Show Metadata Pokaż metadane - + Show metadata of selected image Pokaż metadane zaznaczonego obrazka