diff --git a/conf/intelliphoto_dox b/conf/intelliphoto_dox new file mode 100644 index 0000000..1326066 --- /dev/null +++ b/conf/intelliphoto_dox @@ -0,0 +1,382 @@ +# Doxyfile 1.8.16 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = IntelliPhoto +PROJECT_NUMBER = 0.5 +PROJECT_BRIEF = +PROJECT_LOGO = +OUTPUT_DIRECTORY = docs +CREATE_SUBDIRS = NO +ALLOW_UNICODE_NAMES = NO +OUTPUT_LANGUAGE = English +OUTPUT_TEXT_DIRECTION = None +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +JAVADOC_BANNER = NO +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 4 +ALIASES = +TCL_SUBST = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_OUTPUT_VHDL = NO +OPTIMIZE_OUTPUT_SLICE = NO +EXTENSION_MAPPING = +MARKDOWN_SUPPORT = YES +TOC_INCLUDE_HEADINGS = 5 +AUTOLINK_SUPPORT = YES +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +SIP_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = NO +GROUP_NESTED_COMPOUNDS = NO +SUBGROUPING = YES +INLINE_GROUPED_CLASSES = NO +INLINE_SIMPLE_STRUCTS = NO +TYPEDEF_HIDES_STRUCT = NO +LOOKUP_CACHE_SIZE = 0 +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = NO +EXTRACT_PRIV_VIRTUAL = NO +EXTRACT_PACKAGE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +EXTRACT_ANON_NSPACES = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = NO +HIDE_SCOPE_NAMES = NO +HIDE_COMPOUND_REFERENCE= NO +SHOW_INCLUDE_FILES = YES +SHOW_GROUPED_MEMB_INC = NO +FORCE_LOCAL_INCLUDES = NO +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_MEMBERS_CTORS_1ST = NO +SORT_GROUP_NAMES = NO +SORT_BY_SCOPE_NAME = NO +STRICT_PROTO_MATCHING = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_FILES = YES +SHOW_NAMESPACES = YES +FILE_VERSION_FILTER = +LAYOUT_FILE = +CITE_BIB_FILES = +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_AS_ERROR = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = src +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.pyw \ + *.f90 \ + *.f95 \ + *.f03 \ + *.f08 \ + *.f \ + *.for \ + *.tcl \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf \ + *.ice +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXCLUDE_SYMBOLS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +FILTER_SOURCE_PATTERNS = +USE_MDFILE_AS_MAINPAGE = +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = YES +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +REFERENCES_LINK_SOURCE = YES +SOURCE_TOOLTIPS = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +CLANG_ASSISTED_PARSING = NO +CLANG_OPTIONS = +CLANG_DATABASE_PATH = +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_EXTRA_STYLESHEET = +HTML_EXTRA_FILES = +HTML_COLORSTYLE_HUE = 187 +HTML_COLORSTYLE_SAT = 5 +HTML_COLORSTYLE_GAMMA = 150 +HTML_TIMESTAMP = NO +HTML_DYNAMIC_MENUS = YES +HTML_DYNAMIC_SECTIONS = NO +HTML_INDEX_NUM_ENTRIES = 100 +GENERATE_DOCSET = NO +DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_BUNDLE_ID = org.doxygen.Project +DOCSET_PUBLISHER_ID = org.doxygen.Publisher +DOCSET_PUBLISHER_NAME = Publisher +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +CHM_INDEX_ENCODING = +BINARY_TOC = NO +TOC_EXPAND = NO +GENERATE_QHP = NO +QCH_FILE = +QHP_NAMESPACE = org.doxygen.Project +QHP_VIRTUAL_FOLDER = doc +QHP_CUST_FILTER_NAME = +QHP_CUST_FILTER_ATTRS = +QHP_SECT_FILTER_ATTRS = +QHG_LOCATION = +GENERATE_ECLIPSEHELP = NO +ECLIPSE_DOC_ID = org.doxygen.Project +DISABLE_INDEX = NO +GENERATE_TREEVIEW = YES +ENUM_VALUES_PER_LINE = 4 +TREEVIEW_WIDTH = 250 +EXT_LINKS_IN_WINDOW = NO +FORMULA_FONTSIZE = 10 +FORMULA_TRANSPARENT = YES +USE_MATHJAX = NO +MATHJAX_FORMAT = HTML-CSS +MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/ +MATHJAX_EXTENSIONS = +MATHJAX_CODEFILE = +SEARCHENGINE = YES +SERVER_BASED_SEARCH = NO +EXTERNAL_SEARCH = NO +SEARCHENGINE_URL = +SEARCHDATA_FILE = searchdata.xml +EXTERNAL_SEARCH_ID = +EXTRA_SEARCH_MAPPINGS = +#--------------------------------------------------------------------------- +# Configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = +MAKEINDEX_CMD_NAME = makeindex +LATEX_MAKEINDEX_CMD = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4 +EXTRA_PACKAGES = +LATEX_HEADER = +LATEX_FOOTER = +LATEX_EXTRA_STYLESHEET = +LATEX_EXTRA_FILES = +PDF_HYPERLINKS = YES +USE_PDFLATEX = YES +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +LATEX_SOURCE_CODE = NO +LATEX_BIB_STYLE = plain +LATEX_TIMESTAMP = NO +LATEX_EMOJI_DIRECTORY = +#--------------------------------------------------------------------------- +# Configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +RTF_SOURCE_CODE = NO +#--------------------------------------------------------------------------- +# Configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_SUBDIR = +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# Configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_PROGRAMLISTING = YES +XML_NS_MEMB_FILE_SCOPE = NO +#--------------------------------------------------------------------------- +# Configuration options related to the DOCBOOK output +#--------------------------------------------------------------------------- +GENERATE_DOCBOOK = NO +DOCBOOK_OUTPUT = docbook +DOCBOOK_PROGRAMLISTING = NO +#--------------------------------------------------------------------------- +# Configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# Configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration options related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +EXTERNAL_PAGES = YES +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +DIA_PATH = +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +DOT_NUM_THREADS = 0 +DOT_FONTNAME = Helvetica +DOT_FONTSIZE = 10 +DOT_FONTPATH = +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +UML_LIMIT_NUM_FIELDS = 10 +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +INTERACTIVE_SVG = NO +DOT_PATH = +DOTFILE_DIRS = +MSCFILE_DIRS = +DIAFILE_DIRS = +PLANTUML_JAR_PATH = +PLANTUML_CFG_FILE = +PLANTUML_INCLUDE_PATH = +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES diff --git a/conf/uncrustify.cfg b/conf/uncrustify.cfg index 9d843ca..b01a13a 100644 --- a/conf/uncrustify.cfg +++ b/conf/uncrustify.cfg @@ -49,7 +49,7 @@ disable_processing_cmt = " *INDENT-OFF*" # string enable_processing_cmt = " *INDENT-ON*" # string # Enable parsing of digraphs. -enable_digraphs = false # true/false +enable_digraphs = true # true/false # Add or remove the UTF-8 BOM (recommend 'remove'). utf8_bom = ignore # ignore/add/remove/force @@ -59,16 +59,16 @@ utf8_bom = ignore # ignore/add/remove/force utf8_byte = false # true/false # Force the output encoding to UTF-8. -utf8_force = false # true/false +utf8_force = true # true/false # Add or remove space between 'do' and '{'. -sp_do_brace_open = ignore # ignore/add/remove/force +sp_do_brace_open = add # ignore/add/remove/force # Add or remove space between '}' and 'while'. -sp_brace_close_while = ignore # ignore/add/remove/force +sp_brace_close_while = add # ignore/add/remove/force # Add or remove space between 'while' and '('. -sp_while_paren_open = ignore # ignore/add/remove/force +sp_while_paren_open = add # ignore/add/remove/force # # Spacing options @@ -76,70 +76,70 @@ sp_while_paren_open = ignore # ignore/add/remove/force # Add or remove space around non-assignment symbolic operators ('+', '/', '%', # '<<', and so forth). -sp_arith = ignore # ignore/add/remove/force +sp_arith = add # ignore/add/remove/force # Add or remove space around arithmetic operators '+' and '-'. # # Overrides sp_arith. -sp_arith_additive = ignore # ignore/add/remove/force +sp_arith_additive = add # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc. -sp_assign = ignore # ignore/add/remove/force +sp_assign = add # ignore/add/remove/force # Add or remove space around '=' in C++11 lambda capture specifications. # # Overrides sp_assign. -sp_cpp_lambda_assign = ignore # ignore/add/remove/force +sp_cpp_lambda_assign = add # ignore/add/remove/force # Add or remove space after the capture specification of a C++11 lambda when # an argument list is present, as in '[] (int x){ ... }'. -sp_cpp_lambda_square_paren = ignore # ignore/add/remove/force +sp_cpp_lambda_square_paren = add # ignore/add/remove/force # Add or remove space after the capture specification of a C++11 lambda with # no argument list is present, as in '[] { ... }'. -sp_cpp_lambda_square_brace = ignore # ignore/add/remove/force +sp_cpp_lambda_square_brace = add # ignore/add/remove/force # Add or remove space after the argument list of a C++11 lambda, as in # '[](int x) { ... }'. -sp_cpp_lambda_paren_brace = ignore # ignore/add/remove/force +sp_cpp_lambda_paren_brace = add # ignore/add/remove/force # Add or remove space between a lambda body and its call operator of an # immediately invoked lambda, as in '[]( ... ){ ... } ( ... )'. -sp_cpp_lambda_fparen = ignore # ignore/add/remove/force +sp_cpp_lambda_fparen = add # ignore/add/remove/force # Add or remove space around assignment operator '=' in a prototype. # # If set to ignore, use sp_assign. -sp_assign_default = ignore # ignore/add/remove/force +sp_assign_default = add # ignore/add/remove/force # Add or remove space before assignment operator '=', '+=', etc. # # Overrides sp_assign. -sp_before_assign = ignore # ignore/add/remove/force +sp_before_assign = add # ignore/add/remove/force # Add or remove space after assignment operator '=', '+=', etc. # # Overrides sp_assign. -sp_after_assign = ignore # ignore/add/remove/force +sp_after_assign = add # ignore/add/remove/force # Add or remove space in 'NS_ENUM ('. -sp_enum_paren = ignore # ignore/add/remove/force +sp_enum_paren = add # ignore/add/remove/force # Add or remove space around assignment '=' in enum. -sp_enum_assign = ignore # ignore/add/remove/force +sp_enum_assign = add # ignore/add/remove/force # Add or remove space before assignment '=' in enum. # # Overrides sp_enum_assign. -sp_enum_before_assign = ignore # ignore/add/remove/force +sp_enum_before_assign = add # ignore/add/remove/force # Add or remove space after assignment '=' in enum. # # Overrides sp_enum_assign. -sp_enum_after_assign = ignore # ignore/add/remove/force +sp_enum_after_assign = add # ignore/add/remove/force # Add or remove space around assignment ':' in enum. -sp_enum_colon = ignore # ignore/add/remove/force +sp_enum_colon = add # ignore/add/remove/force # Add or remove space around preprocessor '##' concatenation operator. # diff --git a/cppcheck_config.txt b/cppcheck_config.txt new file mode 100644 index 0000000..65db50d --- /dev/null +++ b/cppcheck_config.txt @@ -0,0 +1,300 @@ +src/GUI/IntelliPhotoGui.h:4:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/GUI/IntelliPhotoGui.h:5:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/GUI/IntelliPhotoGui.h:6:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/GUI/IntelliPhotoGui.h:7:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/GUI/IntelliPhotoGui.h:8:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/GUI/IntelliPhotoGui.h:9:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/GUI/IntelliPhotoGui.h:10:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/GUI/IntelliPhotoGui.h:11:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/GUI/IntelliPhotoGui.h:12:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/GUI/IntelliPhotoGui.cpp:4:0: information: Include file: "Layer/PaintingArea.h" not found. [missingInclude] + +^ +src/Image/IntelliImage.cpp:1:0: information: Include file: "Image/IntelliImage.h" not found. [missingInclude] + +^ +src/Image/IntelliImage.cpp:2:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Image/IntelliImage.cpp:3:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Image/IntelliRasterImage.cpp:1:0: information: Include file: "Image/IntelliRasterImage.h" not found. [missingInclude] + +^ +src/Image/IntelliRasterImage.cpp:2:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Image/IntelliRasterImage.cpp:3:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Image/IntelliRasterImage.cpp:4:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Image/IntelliShapedImage.cpp:1:0: information: Include file: "Image/IntelliShapedImage.h" not found. [missingInclude] + +^ +src/Image/IntelliShapedImage.cpp:2:0: information: Include file: "IntelliHelper/IntelliTriangulation.h" not found. [missingInclude] + +^ +src/Image/IntelliShapedImage.cpp:3:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Image/IntelliShapedImage.cpp:4:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Image/IntelliShapedImage.cpp:5:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/IntelliHelper/IntelliColorPicker.h:4:0: information: Include file: "QColor" not found. [missingInclude] + +^ +src/IntelliHelper/IntelliColorPicker.h:5:0: information: Include file: "QPoint" not found. [missingInclude] + +^ +src/IntelliHelper/IntelliColorPicker.h:6:0: information: Include file: "QColorDialog" not found. [missingInclude] + +^ +src/IntelliHelper/IntelliToolsettings.cpp:2:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/IntelliHelper/IntelliTriangulation.h:4:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/IntelliHelper/IntelliTriangulation.h:5:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/IntelliHelper/IntelliTriangulation.cpp:2:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/IntelliHelper/IntelliTriangulation.cpp:3:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/IntelliHelper/IntelliTriangulation.cpp:4:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Layer/PaintingArea.cpp:2:0: information: Include file: "string.h" not found. [missingInclude] + +^ +src/Layer/PaintingArea.cpp:4:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Layer/PaintingArea.cpp:6:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Layer/PaintingArea.cpp:7:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Layer/PaintingArea.cpp:8:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Layer/PaintingArea.h:5:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Layer/PaintingArea.h:6:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Layer/PaintingArea.h:7:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Layer/PaintingArea.h:8:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Layer/PaintingArea.h:9:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Layer/PaintingArea.h:10:0: information: Include file: "GUI/IntelliPhotoGui.h" not found. [missingInclude] + +^ +src/Layer/PaintingArea.h:11:0: information: Include file: "Image/IntelliImage.h" not found. [missingInclude] + +^ +src/Layer/PaintingArea.h:12:0: information: Include file: "Image/IntelliRasterImage.h" not found. [missingInclude] + +^ +src/Layer/PaintingArea.h:13:0: information: Include file: "Image/IntelliShapedImage.h" not found. [missingInclude] + +^ +src/Layer/PaintingArea.h:14:0: information: Include file: "Tool/IntelliTool.h" not found. [missingInclude] + +^ +src/Layer/PaintingArea.h:15:0: information: Include file: "IntelliHelper/IntelliColorPicker.h" not found. [missingInclude] + +^ +src/Layer/PaintingArea.cpp:11:0: information: Include file: "Image/IntelliRasterImage.h" not found. [missingInclude] + +^ +src/Layer/PaintingArea.cpp:12:0: information: Include file: "Image/IntelliShapedImage.h" not found. [missingInclude] + +^ +src/Layer/PaintingArea.cpp:13:0: information: Include file: "Tool/IntelliToolPen.h" not found. [missingInclude] + +^ +src/Layer/PaintingArea.cpp:14:0: information: Include file: "Tool/IntelliToolPlain.h" not found. [missingInclude] + +^ +src/Layer/PaintingArea.cpp:15:0: information: Include file: "Tool/IntelliToolLine.h" not found. [missingInclude] + +^ +src/Layer/PaintingArea.cpp:16:0: information: Include file: "Tool/IntelliToolCircle.h" not found. [missingInclude] + +^ +src/Layer/PaintingArea.cpp:17:0: information: Include file: "Tool/IntelliToolRectangle.h" not found. [missingInclude] + +^ +src/Layer/PaintingArea.cpp:18:0: information: Include file: "Tool/IntelliToolFloodFill.h" not found. [missingInclude] + +^ +src/Layer/PaintingArea.cpp:19:0: information: Include file: "Tool/IntelliToolPolygon.h" not found. [missingInclude] + +^ +src/Tool/IntelliColorPicker.cpp:1:0: information: Include file: "IntelliColorPicker.h" not found. [missingInclude] + +^ +src/Tool/IntelliColorPicker.cpp:2:0: information: Include file: "QDebug" not found. [missingInclude] + +^ +src/Tool/IntelliTool.h:4:0: information: Include file: "IntelliHelper/IntelliColorPicker.h" not found. [missingInclude] + +^ +src/Tool/IntelliTool.h:5:0: information: Include file: "IntelliHelper/IntelliToolsettings.h" not found. [missingInclude] + +^ +src/Tool/IntelliTool.h:6:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Tool/IntelliTool.cpp:2:0: information: Include file: "Layer/PaintingArea.h" not found. [missingInclude] + +^ +src/Tool/IntelliToolCircle.h:5:0: information: Include file: "QColor" not found. [missingInclude] + +^ +src/Tool/IntelliToolCircle.h:6:0: information: Include file: "QPoint" not found. [missingInclude] + +^ +src/Tool/IntelliToolCircle.cpp:2:0: information: Include file: "Layer/PaintingArea.h" not found. [missingInclude] + +^ +src/Tool/IntelliToolCircle.cpp:3:0: information: Include file: "QInputDialog" not found. [missingInclude] + +^ +src/Tool/IntelliToolCircle.cpp:4:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Tool/IntelliToolFloodFill.h:5:0: information: Include file: "QColor" not found. [missingInclude] + +^ +src/Tool/IntelliToolFloodFill.cpp:2:0: information: Include file: "Layer/PaintingArea.h" not found. [missingInclude] + +^ +src/Tool/IntelliToolFloodFill.cpp:3:0: information: Include file: "QColorDialog" not found. [missingInclude] + +^ +src/Tool/IntelliToolFloodFill.cpp:4:0: information: Include file: "QInputDialog" not found. [missingInclude] + +^ +src/Tool/IntelliToolFloodFill.cpp:5:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Tool/IntelliToolFloodFill.cpp:6:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Tool/IntelliToolLine.h:5:0: information: Include file: "QPoint" not found. [missingInclude] + +^ +src/Tool/IntelliToolLine.cpp:2:0: information: Include file: "Layer/PaintingArea.h" not found. [missingInclude] + +^ +src/Tool/IntelliToolLine.cpp:3:0: information: Include file: "QColorDialog" not found. [missingInclude] + +^ +src/Tool/IntelliToolLine.cpp:4:0: information: Include file: "QInputDialog" not found. [missingInclude] + +^ +src/Tool/IntelliToolPen.h:5:0: information: Include file: "QColor" not found. [missingInclude] + +^ +src/Tool/IntelliToolPen.h:6:0: information: Include file: "QPoint" not found. [missingInclude] + +^ +src/Tool/IntelliToolPen.cpp:2:0: information: Include file: "Layer/PaintingArea.h" not found. [missingInclude] + +^ +src/Tool/IntelliToolPen.cpp:3:0: information: Include file: "QDebug" not found. [missingInclude] + +^ +src/Tool/IntelliToolPen.cpp:4:0: information: Include file: "QColorDialog" not found. [missingInclude] + +^ +src/Tool/IntelliToolPen.cpp:5:0: information: Include file: "QInputDialog" not found. [missingInclude] + +^ +src/Tool/IntelliToolPlain.h:5:0: information: Include file: "QColor" not found. [missingInclude] + +^ +src/Tool/IntelliToolPlain.cpp:2:0: information: Include file: "Layer/PaintingArea.h" not found. [missingInclude] + +^ +src/Tool/IntelliToolPlain.cpp:3:0: information: Include file: "QColorDialog" not found. [missingInclude] + +^ +src/Tool/IntelliToolPolygon.h:5:0: information: Include file: "IntelliHelper/IntelliTriangulation.h" not found. [missingInclude] + +^ +src/Tool/IntelliToolPolygon.h:6:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Tool/IntelliToolPolygon.h:7:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Tool/IntelliToolPolygon.cpp:2:0: information: Include file: "Layer/PaintingArea.h" not found. [missingInclude] + +^ +src/Tool/IntelliToolPolygon.cpp:3:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Tool/IntelliToolPolygon.cpp:4:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Tool/IntelliToolPolygon.cpp:5:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Tool/IntelliToolRectangle.h:6:0: information: Include file: "QColor" not found. [missingInclude] + +^ +src/Tool/IntelliToolRectangle.h:7:0: information: Include file: "QPoint" not found. [missingInclude] + +^ +src/Tool/IntelliToolRectangle.cpp:2:0: information: Include file: "Layer/PaintingArea.h" not found. [missingInclude] + +^ +src/Tool/IntelliToolRectangle.cpp:3:0: information: Include file: "QInputDialog" not found. [missingInclude] + +^ +src/main.cpp:2:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/main.cpp:3:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/main.cpp:4:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ diff --git a/cppcheck_errors.txt b/cppcheck_errors.txt index e5f712f..0276a5e 100644 --- a/cppcheck_errors.txt +++ b/cppcheck_errors.txt @@ -7,9 +7,9 @@ src/IntelliHelper/IntelliColorPicker.cpp:5:3: performance: Variable 'secondColor src/IntelliHelper/IntelliTriangulation.cpp:116:63: style: Parameter 'triangles' can be declared with const [constParameter] bool IntelliTriangulation::isInPolygon(std::vector &triangles, QPoint &point){ ^ -src/Layer/PaintingArea.cpp:334:28: style: Redundant condition: If 'activeLayer > 0', the comparison 'activeLayer != -1' is always true. [redundantCondition] - if(activeLayer!=-1 && activeLayer>0) { - ^ +src/Layer/PaintingArea.cpp:334:22: style: Redundant condition: If 'activeLayer > 0', the comparison 'activeLayer != -1' is always true. [redundantCondition] + if(activeLayer!=-1 && activeLayer>0) { + ^ src/Tool/IntelliTool.cpp:4:14: warning: Member variable 'IntelliTool::ActiveType' is not initialized in the constructor. [uninitMemberVar] IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings){ ^ @@ -20,26 +20,23 @@ src/Tool/IntelliTool.cpp:4:14: warning: Member variable 'IntelliTool::Canvas' is IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings){ ^ src/Tool/IntelliToolCircle.cpp:42:9: style: Local variable 'yMin' shadows outer variable [shadowVariable] - int yMin = static_cast(centerPoint.y()-sqrt(pow(radius,2)-pow(i-centerPoint.x(),2))); + int yMin = static_cast(centerPoint.y() - sqrt(pow(radius,2) - pow(i - centerPoint.x(),2))); ^ src/Tool/IntelliToolCircle.cpp:18:7: note: Shadowed declaration int yMin, yMax, xMin, xMax; ^ src/Tool/IntelliToolCircle.cpp:42:9: note: Shadow variable - int yMin = static_cast(centerPoint.y()-sqrt(pow(radius,2)-pow(i-centerPoint.x(),2))); + int yMin = static_cast(centerPoint.y() - sqrt(pow(radius,2) - pow(i - centerPoint.x(),2))); ^ src/Tool/IntelliToolCircle.cpp:43:9: style: Local variable 'yMax' shadows outer variable [shadowVariable] - int yMax = static_cast(centerPoint.y()+sqrt(pow(radius,2)-pow(i-centerPoint.x(),2))); + int yMax = static_cast(centerPoint.y() + sqrt(pow(radius,2) - pow(i - centerPoint.x(),2))); ^ src/Tool/IntelliToolCircle.cpp:18:13: note: Shadowed declaration int yMin, yMax, xMin, xMax; ^ src/Tool/IntelliToolCircle.cpp:43:9: note: Shadow variable - int yMax = static_cast(centerPoint.y()+sqrt(pow(radius,2)-pow(i-centerPoint.x(),2))); + int yMax = static_cast(centerPoint.y() + sqrt(pow(radius,2) - pow(i - centerPoint.x(),2))); ^ -src/Tool/IntelliToolLine.cpp:51:13: style: Variable 'c' is assigned a value that is never used. [unreadVariable] - int c = lineStartingPoint.y()-lineStartingPoint.x()*m; - ^ src/Tool/IntelliToolPolygon.h:25:6: warning: The class 'IntelliToolPolygon' defines member variable with name 'isDrawing' also defined in its parent class 'IntelliTool'. [duplInheritedMember] bool isDrawing; ^ diff --git a/mergeprep.sh b/mergeprep.sh new file mode 100755 index 0000000..efdb194 --- /dev/null +++ b/mergeprep.sh @@ -0,0 +1,15 @@ +# Run CPP Check +echo "Running CPPCheck..." +cppcheck --enable=all --output-file=cppcheck_errors.txt src/ +cppcheck --check-config --output-file=cppcheck_config.txt src/ +echo "CPPCheck finished" +# Uncrustify Files +echo "Running Uncrustify..." +find . \( -name "*.cpp" -o -name "*.c" -o -name "*.h" \) -exec uncrustify -c conf/uncrustify.cfg --no-backup {} + +echo "Uncrustify finished." +# Adding changes to git +echo "Committing Changes to Git..." +git add '*' +git commit -m "Automated Merge Preparation" +echo "Committed." +echo "Finished." diff --git a/releaseprep.sh b/releaseprep.sh new file mode 100755 index 0000000..5392a6f --- /dev/null +++ b/releaseprep.sh @@ -0,0 +1,34 @@ +# Discarding local changes +echo "This will discard all your uncommited changes and restore the last commit. Continue?" +read +git reset --hard +# Run CPP Check +echo "Running CPPCheck..." +cppcheck --enable=all --output-file=cppcheck_errors.txt src/ +cppcheck --check-config --output-file=cppcheck_config.txt src/ +echo "CPPCheck finished" +# Uncrustify Files +echo "Running Uncrustify..." +find . \( -name "*.cpp" -o -name "*.c" -o -name "*.h" \) -exec uncrustify -c conf/uncrustify.cfg --no-backup {} + +echo "Uncrustify finished." +# Run Unit Tests +echo "Running unit tests..." + +echo "Finished unit testing." +# Remove Overhead Folders/ Files +echo "Cleaning directory..." +rm -r src/build-* +rm -r build-*/ +rm -r Examples/ +rm src/*.pro.user +echo "Directory cleaned." +# Run Doxygen +echo "Running Doxygen..." +doxygen conf/intelliphoto_dox +echo "Doxygen finished." +# Adding changes to git +echo "Committing Changes to Git..." +git add '*' +git commit -m "Automated Release Preparation" +echo "Committed." +echo "Finished." diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index c05fce8..fef39bd 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -101,16 +101,12 @@ void IntelliPhotoGui::slotCreateNewShapedLayer(){ QInputDialog Input; Input.setPalette(Palette); - int width = Input.getInt(this, tr("New Layer"), - tr("Width:"), - 200,1, 500, 1, &ok1); + int width = Input.getInt(this, tr("New Layer"), tr("Width:"), 200, 1, 500, 1, &ok1); - int height = QInputDialog::getInt(this, tr("New Layer"), - tr("Height:"), - 200,1, 500, 1, &ok2); + int height = QInputDialog::getInt(this, tr("New Layer"), tr("Height:"), 200, 1, 500, 1, &ok2); // Create New Layer if (ok1&&ok2) { - paintingArea->addLayer(width,height,0,0,IntelliImage::ImageType::SHAPEDIMAGE); + paintingArea->addLayer(width, height, 0, 0, IntelliImage::ImageType::SHAPEDIMAGE); UpdateGui(); } } @@ -125,10 +121,10 @@ void IntelliPhotoGui::slotDeleteLayer(){ // Define the standard Value, min, max, step and ok button int layerNumber = QInputDialog::getInt(this, tr("delete Layer"), tr("Number:"), - paintingArea->getNumberOfActiveLayer()+1,1, 501, 1, &ok); + paintingArea->getNumberOfActiveLayer() + 1,1, 501, 1, &ok); // Create New Layer if (ok) { - paintingArea->deleteLayer(layerNumber-1); + paintingArea->deleteLayer(layerNumber - 1); UpdateGui(); } } @@ -149,7 +145,7 @@ void IntelliPhotoGui::slotSetActiveAlpha(){ 255,0, 255, 1, &ok2); if (ok1&&ok2) { - paintingArea->setLayerAlpha(layer-1,alpha); + paintingArea->setLayerAlpha(layer - 1,alpha); UpdateGui(); } } @@ -167,7 +163,7 @@ void IntelliPhotoGui::slotSetPolygon(){ if (ok1) { - paintingArea->setPolygon(layer-1); + paintingArea->setPolygon(layer - 1); UpdateGui(); } } @@ -211,10 +207,10 @@ void IntelliPhotoGui::slotSetActiveLayer(){ // Define the standard Value, min, max, step and ok button int layer = QInputDialog::getInt(this, tr("Layer to set on"), tr("Layer:"), - 1,1,500,1, &ok1); + 1, 1, 500, 1, &ok1); if (ok1) { - paintingArea->setLayerActive(layer-1); + paintingArea->setLayerActive(layer - 1); UpdateGui(); } } @@ -405,17 +401,17 @@ void IntelliPhotoGui::createActions(){ actionMoveLayerUp->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Up)); connect(actionMoveLayerUp, SIGNAL(triggered()), this, SLOT(slotMoveLayerUp())); - actionMoveLayerDown= new QAction(tr("&move Layer Down"), this); + actionMoveLayerDown = new QAction(tr("&move Layer Down"), this); actionMoveLayerDown->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Down)); connect(actionMoveLayerDown, SIGNAL(triggered()), this, SLOT(slotMoveLayerDown())); //Create Update RenderSettings Actions here actionUpdateRenderSettingsOn = new QAction(tr("&On"), this); - actionUpdateRenderSettingsOn->setShortcut(QKeySequence(Qt::ALT +Qt::SHIFT + +Qt::Key_A)); + actionUpdateRenderSettingsOn->setShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + +Qt::Key_A)); connect(actionUpdateRenderSettingsOn, SIGNAL(triggered()),this, SLOT(slotUpdateRenderSettingsOn())); actionUpdateRenderSettingsOff = new QAction(tr("&Off"), this); - actionUpdateRenderSettingsOff->setShortcut(QKeySequence(Qt::ALT +Qt::SHIFT + +Qt::Key_D)); + actionUpdateRenderSettingsOff->setShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + +Qt::Key_D)); connect(actionUpdateRenderSettingsOff, SIGNAL(triggered()),this, SLOT(slotUpdateRenderSettingsOff())); //Create Color Actions here @@ -436,38 +432,38 @@ void IntelliPhotoGui::createActions(){ //Create Tool actions down here actionCreatePlainTool = new QAction(tr("&Plain"), this); - actionCreatePlainTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT +Qt::Key_P)); + actionCreatePlainTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_P)); connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotResetTools())); connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotCreatePlainTool())); actionCreatePenTool = new QAction(tr("&Pen"),this); - actionCreatePenTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT +Qt::Key_S)); + actionCreatePenTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_S)); connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotResetTools())); connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotCreatePenTool())); actionCreateLineTool = new QAction(tr("&Line"), this); - actionCreateLineTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT +Qt::Key_L)); + actionCreateLineTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_L)); connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotResetTools())); connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotCreateLineTool())); actionCreateCircleTool = new QAction(tr("&Circle"), this); - actionCreateCircleTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT +Qt::Key_C)); + actionCreateCircleTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_C)); connect(actionCreateCircleTool, SIGNAL(triggered()), this, SLOT(slotResetTools())); connect(actionCreateCircleTool, SIGNAL(triggered()), this, SLOT(slotCreateCircleTool())); actionCreateRectangleTool = new QAction(tr("&Rectangle"), this); - actionCreateRectangleTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT +Qt::Key_R)); + actionCreateRectangleTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_R)); connect(actionCreateRectangleTool, SIGNAL(triggered()), this, SLOT(slotResetTools())); connect(actionCreateRectangleTool, SIGNAL(triggered()), this, SLOT(slotCreateRectangleTool())); actionCreatePolygonTool = new QAction(tr("&Polygon"), this); - actionCreatePolygonTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT +Qt::Key_V)); + actionCreatePolygonTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_V)); connect(actionCreatePolygonTool, SIGNAL(triggered()), this, SLOT(slotResetTools())); connect(actionCreatePolygonTool, SIGNAL(triggered()), this, SLOT(slotCreatePolygonTool())); actionCreateFloodFillTool = new QAction(tr("&FloodFill"), this); - actionCreateFloodFillTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT +Qt::Key_F)); + actionCreateFloodFillTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_F)); connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotResetTools())); connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotCreateFloodFillTool())); @@ -518,7 +514,7 @@ void IntelliPhotoGui::createActions(){ void IntelliPhotoGui::createMenus(){ // Create Save As option and the list of file types saveAsMenu = new QMenu(tr("&Save As"), this); - foreach (QAction *action, actionSaveAs) + foreach (QAction * action, actionSaveAs) saveAsMenu->addAction(action); @@ -665,10 +661,10 @@ void IntelliPhotoGui::createGui(){ WidthLine = new QLabel(); WidthLine->setText("Width"); - WidthLine->setFixedSize(Buttonsize.width(),Buttonsize.height()/3); + WidthLine->setFixedSize(Buttonsize.width(),Buttonsize.height() / 3); EditLineWidth = new QLineEdit(); - EditLineWidth->setFixedSize(Buttonsize.width(),Buttonsize.height()/3); + EditLineWidth->setFixedSize(Buttonsize.width(),Buttonsize.height() / 3); EditLineWidth->setText("5"); ValidatorLineWidth = new QIntValidator(); ValidatorLineWidth->setTop(99); @@ -677,10 +673,10 @@ void IntelliPhotoGui::createGui(){ innerAlphaLine = new QLabel(); innerAlphaLine->setText("Inner Alpha"); - innerAlphaLine->setFixedSize(Buttonsize.width(),Buttonsize.height()/3); + innerAlphaLine->setFixedSize(Buttonsize.width(),Buttonsize.height() / 3); EditLineInnerAlpha = new QLineEdit(); - EditLineInnerAlpha->setFixedSize(Buttonsize.width(),Buttonsize.height()/3); + EditLineInnerAlpha->setFixedSize(Buttonsize.width(),Buttonsize.height() / 3); EditLineInnerAlpha->setText("255"); ValidatorInnerAlpha = new QIntValidator(); ValidatorInnerAlpha->setTop(999); @@ -688,21 +684,21 @@ void IntelliPhotoGui::createGui(){ EditLineInnerAlpha->setValidator(ValidatorInnerAlpha); FirstColorButton = new QPushButton(); - FirstColorButton->setFixedSize(Buttonsize/2); + FirstColorButton->setFixedSize(Buttonsize / 2); SecondColorButton = new QPushButton(); - SecondColorButton->setFixedSize(Buttonsize/2); + SecondColorButton->setFixedSize(Buttonsize / 2); preview = QPixmap(":/Icons/Buttons/icons/Wechselpfeile.png"); SwitchColorButton = new QPushButton(); - SwitchColorButton->setFixedSize(Buttonsize.width(),Buttonsize.height()/2); + SwitchColorButton->setFixedSize(Buttonsize.width(),Buttonsize.height() / 2); SwitchColorButton->setIcon(preview); - SwitchColorButton->setIconSize(QSize(Buttonsize.width(),Buttonsize.height()/2)); + SwitchColorButton->setIconSize(QSize(Buttonsize.width(),Buttonsize.height() / 2)); ActiveLayerLine = new QLabel(); QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer() + 1); ActiveLayerLine->setText(string); - ActiveLayerLine->setFixedSize(Buttonsize.width()+10,Buttonsize.height()/3); + ActiveLayerLine->setFixedSize(Buttonsize.width() + 10,Buttonsize.height() / 3); IntelliImage* activePicture = paintingArea->getImageOfActiveLayer(); if(activePicture) { diff --git a/src/GUI/IntelliPhotoGui.h b/src/GUI/IntelliPhotoGui.h index 52a022a..c0a0707 100644 --- a/src/GUI/IntelliPhotoGui.h +++ b/src/GUI/IntelliPhotoGui.h @@ -11,7 +11,6 @@ #include #include -// PaintingArea used to paint the image class PaintingArea; class IntelliTool; @@ -19,12 +18,9 @@ class IntelliTool; class IntelliColorPicker; /*! - * \brief The IntelliPhotoGui class handles the graphical user interface for the intelliPhoto program + * \brief The IntelliPhotoGui base class handles the graphical user interface and events for the intelliPhoto program */ class IntelliPhotoGui : public QMainWindow { -// Declares our class as a QObject which is the base class -// for all Qt objects -// QObjects handle events Q_OBJECT public: /*! @@ -35,11 +31,12 @@ IntelliPhotoGui(); void UpdateGui(); protected: -// Function used to close an event +/*! + * \brief The closeEvent function handles closing events + */ void closeEvent(QCloseEvent*event) override; private slots: -// meta slots here (need further ) void slotOpen(); void slotSave(); @@ -57,16 +54,13 @@ void slotPositionMoveRight(); void slotMoveLayerUp(); void slotMoveLayerDown(); -//Rendersetting slots here void slotUpdateRenderSettingsOn(); void slotUpdateRenderSettingsOff(); -// color Picker slots here void slotSetFirstColor(); void slotSetSecondColor(); void slotSwapColor(); -// tool slots here void slotCreatePenTool(); void slotCreatePlainTool(); void slotCreateLineTool(); @@ -75,7 +69,6 @@ void slotCreateCircleTool(); void slotCreatePolygonTool(); void slotCreateFloodFillTool(); -// slots for dialogs void slotAboutDialog(); void slotEnterPressed(); @@ -86,12 +79,10 @@ void slotSetInnerAlpha(); void slotResetTools(); private: -// Will tie user actions to functions void createActions(); void createMenus(); -// setup GUI elements void createGui(); -// set style of the GUI +// Set the style of the GUI void setIntelliStyle(); // Will check if changes have occurred since last save diff --git a/src/Image/IntelliImage.h b/src/Image/IntelliImage.h index 185063d..0d2fe42 100644 --- a/src/Image/IntelliImage.h +++ b/src/Image/IntelliImage.h @@ -104,7 +104,7 @@ virtual QImage getDisplayable(const QSize& displaySize, int alpha) = 0; * @param alpha - The maximum alpha value, a pixel can have. * @return A QImage which is ready to be displayed. */ -virtual QImage getDisplayable(int alpha=255) = 0; +virtual QImage getDisplayable(int alpha = 255) = 0; /*! * \brief A function that copys all that returns a [allocated] Image diff --git a/src/Image/IntelliRasterImage.cpp b/src/Image/IntelliRasterImage.cpp index b055f3f..a63a767 100644 --- a/src/Image/IntelliRasterImage.cpp +++ b/src/Image/IntelliRasterImage.cpp @@ -47,6 +47,6 @@ QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){ } void IntelliRasterImage::setPolygon(const std::vector& polygonData){ - qDebug() << "Raster Image has no polygon data " << polygonData.size() <<"\n"; + qDebug() << "Raster Image has no polygon data " << polygonData.size() << "\n"; return; } diff --git a/src/Image/IntelliRasterImage.h b/src/Image/IntelliRasterImage.h index f589843..79338c4 100644 --- a/src/Image/IntelliRasterImage.h +++ b/src/Image/IntelliRasterImage.h @@ -40,7 +40,7 @@ virtual QImage getDisplayable(const QSize& displaySize,int alpha) override; * @param alpha - The maximum alpha value, a pixel can have. * @return A QImage which is ready to be displayed. */ -virtual QImage getDisplayable(int alpha=255) override; +virtual QImage getDisplayable(int alpha = 255) override; /*! * \brief A function that copys all that returns a [allocated] Image diff --git a/src/Image/IntelliShapedImage.cpp b/src/Image/IntelliShapedImage.cpp index b8a7bec..14c7b71 100644 --- a/src/Image/IntelliShapedImage.cpp +++ b/src/Image/IntelliShapedImage.cpp @@ -36,8 +36,8 @@ void IntelliShapedImage::calculateVisiblity(){ if(polygonData.size()<=2) { QColor clr; - for(int y=0; yinnerAlpha = innerAlpha; } - -IntelliToolsettings::LineStyle IntelliToolsettings::getLinestyle(){ - return Linestyle; -} diff --git a/src/IntelliHelper/IntelliToolsettings.h b/src/IntelliHelper/IntelliToolsettings.h index 1a63bbc..4238945 100644 --- a/src/IntelliHelper/IntelliToolsettings.h +++ b/src/IntelliHelper/IntelliToolsettings.h @@ -3,13 +3,6 @@ class IntelliToolsettings { public: -/*! - * \brief The LineStyle enum classifing all ways of drawing a line. - */ -enum class LineStyle { - SOLID_LINE, - DOTTED_LINE -}; IntelliToolsettings(); virtual ~IntelliToolsettings(); int getLineWidth(); @@ -18,12 +11,10 @@ void setLineWidth(int LineWidth); int getInnerAlpha(); void setInnerAlpha(); void setInnerAlpha(int innerAlpha); -LineStyle getLinestyle(); private: int lineWidth; int innerAlpha; -LineStyle Linestyle; }; -#endif // INTELLITOOLSETTINGS_H +#endif diff --git a/src/IntelliHelper/IntelliTriangulation.cpp b/src/IntelliHelper/IntelliTriangulation.cpp index d46288a..c1222b7 100644 --- a/src/IntelliHelper/IntelliTriangulation.cpp +++ b/src/IntelliHelper/IntelliTriangulation.cpp @@ -14,46 +14,46 @@ std::vector IntelliTriangulation::calculateTriangles(std::vector(sqrt(pow(AP.x(),2.)+pow(AP.y(),2.))*sqrt(pow(BP.x(),2.)+pow(BP.y(),2.))); - return acos(topSclar/absolute); + float topSclar = AP.x() * BP.x() + AP.y() * BP.y(); + float absolute = static_cast(sqrt(pow(AP.x(),2.) + pow(AP.y(),2.)) * sqrt(pow(BP.x(),2.) + pow(BP.y(),2.))); + return acos(topSclar / absolute); }; // gets the first element of vec for which element.isTip == true holds - auto getTip= [](const std::vector& vec){ - size_t min = 0; - for(size_t i=0; i& vec) { + size_t min = 0; + for(size_t i = 0; i=0 ? (idx-1) : (length-1); + auto getPrev = [] (int idx, int length) { + return (idx - 1)>=0 ? (idx - 1) : (length - 1); }; // get the vertex idx after idx in relation to the container lenght - auto getPost = [](int idx, int length){ - return (idx+1)%length; + auto getPost = [] (int idx, int length) { + return (idx + 1) % length; }; // return if the vertex is a tip - auto isTip = [](float angle){ - return static_cast(angle)<(pi/2.); + auto isTip = [] (float angle) { + return static_cast(angle)<(pi / 2.); }; std::vector Vertices; std::vector Triangles; // set up all vertices and calculate intirior angle - for(int i=0; i(polyPoints.size()); i++) { + for(int i = 0; i(polyPoints.size()); i++) { TriangleHelper helper; int prev = getPrev(i, static_cast(polyPoints.size())); int post = getPost(i, static_cast(polyPoints.size())); @@ -69,7 +69,7 @@ std::vector IntelliTriangulation::calculateTriangles(std::vector(Vertices.size())); @@ -82,14 +82,14 @@ std::vector IntelliTriangulation::calculateTriangles(std::vector(smallest.idx); i(smallest.idx); i(Vertices.size())); diff --git a/src/IntelliHelper/IntelliTriangulation.h b/src/IntelliHelper/IntelliTriangulation.h index 21ebfa3..3678953 100644 --- a/src/IntelliHelper/IntelliTriangulation.h +++ b/src/IntelliHelper/IntelliTriangulation.h @@ -21,7 +21,7 @@ namespace IntelliTriangulation { * \return Returns the area of the traingle*2 */ inline float sign(QPoint& p1, QPoint& p2, QPoint& p3){ - return (p1.x()-p3.x())*(p2.y()-p3.y())-(p2.x()-p3.x())*(p1.y()-p3.y()); + return (p1.x() - p3.x()) * (p2.y() - p3.y()) - (p2.x() - p3.x()) * (p1.y() - p3.y()); } /*! diff --git a/src/Layer/PaintingArea.cpp b/src/Layer/PaintingArea.cpp index e36df4b..6a93d3e 100644 --- a/src/Layer/PaintingArea.cpp +++ b/src/Layer/PaintingArea.cpp @@ -24,7 +24,7 @@ PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget*parent) this->Tool = nullptr; this->setLayerDimensions(maxWidth, maxHeight); - activeLayer=-1; + activeLayer = -1; } PaintingArea::~PaintingArea(){ @@ -65,7 +65,7 @@ int PaintingArea::addLayer(int width, int height, int widthOffset, int heightOff } newLayer.alpha = 255; this->layerBundle.push_back(newLayer); - activeLayer = static_cast(layerBundle.size())-1; + activeLayer = static_cast(layerBundle.size()) - 1; return activeLayer; } @@ -75,19 +75,19 @@ void PaintingArea::deleteLayer(int idx, bool isTool){ updateTools(); } if(idx(layerBundle.size())) { - this->layerBundle.erase(layerBundle.begin()+idx); + this->layerBundle.erase(layerBundle.begin() + idx); if(activeLayer>=idx) { activeLayer--; } if(activeLayer < 0 && layerBundle.size()) { - activeLayer=0; + activeLayer = 0; } } } void PaintingArea::slotDeleteActiveLayer(){ if(activeLayer>=0 && activeLayer < static_cast(layerBundle.size())) { - this->layerBundle.erase(layerBundle.begin()+activeLayer); + this->layerBundle.erase(layerBundle.begin() + activeLayer); activeLayer--; } } @@ -95,13 +95,13 @@ void PaintingArea::slotDeleteActiveLayer(){ void PaintingArea::setLayerActive(int idx){ updateTools(); if(idx>=0&&idx(layerBundle.size())) { - this->activeLayer=idx; + this->activeLayer = idx; } } void PaintingArea::setLayerAlpha(int idx, int alpha){ if(idx>=0&&idx(layerBundle.size())) { - layerBundle[static_cast(idx)].alpha=alpha; + layerBundle[static_cast(idx)].alpha = alpha; } } void PaintingArea::setPolygon(int idx){ @@ -245,8 +245,8 @@ void PaintingArea::mousePressEvent(QMouseEvent*event){ } if(Tool == nullptr) return; - int x = event->x()-layerBundle[static_cast(activeLayer)].widthOffset; - int y = event->y()-layerBundle[static_cast(activeLayer)].heightOffset; + int x = event->x() - layerBundle[static_cast(activeLayer)].widthOffset; + int y = event->y() - layerBundle[static_cast(activeLayer)].heightOffset; if(event->button() == Qt::LeftButton) { Tool->onMouseLeftPressed(x, y); }else if(event->button() == Qt::RightButton) { @@ -264,8 +264,8 @@ void PaintingArea::mouseMoveEvent(QMouseEvent*event){ } if(Tool == nullptr) return; - int x = event->x()-layerBundle[static_cast(activeLayer)].widthOffset; - int y = event->y()-layerBundle[static_cast(activeLayer)].heightOffset; + int x = event->x() - layerBundle[static_cast(activeLayer)].widthOffset; + int y = event->y() - layerBundle[static_cast(activeLayer)].heightOffset; Tool->onMouseMoved(x, y); update(); } @@ -276,8 +276,8 @@ void PaintingArea::mouseReleaseEvent(QMouseEvent*event){ return; if(Tool == nullptr) return; - int x = event->x()-layerBundle[static_cast(activeLayer)].widthOffset; - int y = event->y()-layerBundle[static_cast(activeLayer)].heightOffset; + int x = event->x() - layerBundle[static_cast(activeLayer)].widthOffset; + int y = event->y() - layerBundle[static_cast(activeLayer)].heightOffset; if(event->button() == Qt::LeftButton) { Tool->onMouseLeftReleased(x, y); }else if(event->button() == Qt::RightButton) { @@ -293,7 +293,7 @@ void PaintingArea::wheelEvent(QWheelEvent*event){ QPoint numDegrees = event->angleDelta() / 8; if(!numDegrees.isNull()) { QPoint numSteps = numDegrees / 15; - Tool->onWheelScrolled(numSteps.y()* -1); + Tool->onWheelScrolled(numSteps.y() * -1); } } } @@ -323,8 +323,8 @@ void PaintingArea::resizeLayer(QImage*image_res, const QSize &newSize){ void PaintingArea::selectLayerUp(){ updateTools(); - if(activeLayer!=-1 && static_cast(activeLayer)(activeLayer)], layerBundle[static_cast(activeLayer+1)]); + if(activeLayer!=-1 && static_cast(activeLayer)(activeLayer)], layerBundle[static_cast(activeLayer + 1)]); activeLayer++; } } @@ -332,7 +332,7 @@ void PaintingArea::selectLayerUp(){ void PaintingArea::selectLayerDown(){ updateTools(); if(activeLayer!=-1 && activeLayer>0) { - std::swap(layerBundle[static_cast(activeLayer)], layerBundle[static_cast(activeLayer-1)]); + std::swap(layerBundle[static_cast(activeLayer)], layerBundle[static_cast(activeLayer - 1)]); activeLayer--; } } @@ -343,30 +343,30 @@ void PaintingArea::drawLayers(bool forSaving){ }else{ Canvas->fill(Qt::GlobalColor::black); } - for(size_t i=0; igetDisplayable(layer.alpha); QColor clr_0; QColor clr_1; - for(int y=0; y=maxHeight) break; - for(int x=0; x=maxWidth) break; - clr_0=Canvas->pixelColor(layer.widthOffset+x, layer.heightOffset+y); - clr_1=cpy.pixelColor(x,y); - float t = static_cast(clr_1.alpha())/255.f; - int r =static_cast(static_cast(clr_1.red())*(t)+static_cast(clr_0.red())*(1.f-t)+0.5f); - int g =static_cast(static_cast(clr_1.green())*(t)+static_cast(clr_0.green())*(1.f-t)+0.5f); - int b =static_cast(static_cast(clr_1.blue())*(t)+static_cast(clr_0.blue()*(1.f-t))+0.5f); - int a =std::min(clr_0.alpha()+clr_1.alpha(), 255); + for(int y = 0; y=maxHeight) break; + for(int x = 0; x=maxWidth) break; + clr_0 = Canvas->pixelColor(layer.widthOffset + x, layer.heightOffset + y); + clr_1 = cpy.pixelColor(x,y); + float t = static_cast(clr_1.alpha()) / 255.f; + int r = static_cast(static_cast(clr_1.red()) * (t) + static_cast(clr_0.red()) * (1.f - t) + 0.5f); + int g = static_cast(static_cast(clr_1.green()) * (t) + static_cast(clr_0.green()) * (1.f - t) + 0.5f); + int b = static_cast(static_cast(clr_1.blue()) * (t) + static_cast(clr_0.blue() * (1.f - t)) + 0.5f); + int a = std::min(clr_0.alpha() + clr_1.alpha(), 255); clr_0.setRed(r); clr_0.setGreen(g); clr_0.setBlue(b); clr_0.setAlpha(a); - Canvas->setPixelColor(layer.widthOffset+x, layer.heightOffset+y, clr_0); + Canvas->setPixelColor(layer.widthOffset + x, layer.heightOffset + y, clr_0); } } } @@ -381,7 +381,7 @@ bool PaintingArea::createTempTopLayer(int idx){ newLayer.heightOffset = layerBundle[static_cast(idx)].heightOffset; newLayer.widthOffset = layerBundle[static_cast(idx)].widthOffset; newLayer.image = layerBundle[static_cast(idx)].image->getDeepCopy(); - layerBundle.insert(layerBundle.begin()+idx+1,newLayer); + layerBundle.insert(layerBundle.begin() + idx + 1,newLayer); return true; } return false; diff --git a/src/Layer/PaintingArea.h b/src/Layer/PaintingArea.h index 782a1b7..daee426 100644 --- a/src/Layer/PaintingArea.h +++ b/src/Layer/PaintingArea.h @@ -28,7 +28,7 @@ struct LayerObject { int height; int widthOffset; int heightOffset; - int alpha=255; + int alpha = 255; }; /*! @@ -36,9 +36,6 @@ struct LayerObject { */ class PaintingArea : public QWidget { -// Declares our class as a QObject which is the base class -// for all Qt objects -// QObjects handle events Q_OBJECT friend IntelliTool; friend IntelliPhotoGui; @@ -49,15 +46,13 @@ public: * \param maxHeight - The maximum amount of pixles that are inside painting area from top to bottom (default=600px) * \param parent - The parent window of the main window (default=nullptr) */ -PaintingArea(int maxWidth=600, int maxHeight=600, QWidget*parent = nullptr); +PaintingArea(int maxWidth = 600, int maxHeight = 600, QWidget*parent = nullptr); /*! * \brief This deconstructor is used to clear up the memory and remove the currently active window */ ~PaintingArea() override; -// Handles all events - /*! * \brief setRenderSettings updates all Images to the new Rendersetting. * \param isFastRenderingOn is the new given flag for the FastRenderer. @@ -87,7 +82,7 @@ bool save(const QString &filePath, const char*fileFormat); * \param type - Defining the ImageType of the new layer * \return Returns the number of layers in the project */ -int addLayer(int width, int height, int widthOffset=0, int heightOffset=0, IntelliImage::ImageType type = IntelliImage::ImageType::RASTERIMAGE); +int addLayer(int width, int height, int widthOffset = 0, int heightOffset = 0, IntelliImage::ImageType type = IntelliImage::ImageType::RASTERIMAGE); /*! * \brief The addLayerAt adds a layer to the current project/ painting area at a specific position in the layer stack * \param idx - Index of the position the new layer should be added @@ -98,7 +93,7 @@ int addLayer(int width, int height, int widthOffset=0, int heightOffset=0, Intel * \param type - Defining the ImageType of the new layer * \return Returns the id of the layer position */ -int addLayerAt(int idx, int width, int height, int widthOffset=0, int heightOffset=0, IntelliImage::ImageType type = IntelliImage::ImageType::RASTERIMAGE); +int addLayerAt(int idx, int width, int height, int widthOffset = 0, int heightOffset = 0, IntelliImage::ImageType type = IntelliImage::ImageType::RASTERIMAGE); /*! * \brief The deleteLayer method removes a layer at a given idx * \param idx - The index of the layer to be removed @@ -133,7 +128,6 @@ void movePositionActive(int x, int y); */ void moveActiveLayer(int idx); -//change properties of colorPicker /*! * \brief The colorPickerSetFirstColor calls the QTColorPicker to determine the primary drawing color */ @@ -147,7 +141,6 @@ void colorPickerSetSecondColor(); */ void colorPickerSwapColors(); -// Create tools void createPenTool(); void createPlainTool(); void createLineTool(); @@ -185,7 +178,6 @@ IntelliToolsettings Toolsettings; IntelliColorPicker colorPicker; public slots: -// Events to handle /*! * \brief The slotActivateLayer method handles the event of selecting one layer as active * \param a - idx of the layer to be active @@ -202,11 +194,9 @@ void mouseMoveEvent(QMouseEvent*event) override; void mouseReleaseEvent(QMouseEvent*event) override; void wheelEvent(QWheelEvent*event) override; -// Updates the painting area where we are painting + void paintEvent(QPaintEvent*event) override; -// Makes sure the area we are drawing on remains -// as large as the widget void resizeEvent(QResizeEvent*event) override; private: @@ -226,16 +216,14 @@ IntelliTool* Tool; IntelliPhotoGui* DummyGui; std::vector layerBundle; -int activeLayer=-1; +int activeLayer = -1; -void drawLayers(bool forSaving=false); +void drawLayers(bool forSaving = false); void resizeLayer(QImage*image_res, const QSize &newSize); -// Helper for Tool bool createTempTopLayer(int idx); -//this function is needed to avoid errors in inputhandeling if a layer has changed void updateTools(); }; diff --git a/src/Tool/IntelliTool.cpp b/src/Tool/IntelliTool.cpp index e09f2c7..9481290 100644 --- a/src/Tool/IntelliTool.cpp +++ b/src/Tool/IntelliTool.cpp @@ -2,9 +2,9 @@ #include "Layer/PaintingArea.h" IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings){ - this->Area=Area; - this->colorPicker=colorPicker; - this->Toolsettings=Toolsettings; + this->Area = Area; + this->colorPicker = colorPicker; + this->Toolsettings = Toolsettings; } @@ -14,7 +14,7 @@ IntelliTool::~IntelliTool(){ void IntelliTool::onMouseRightPressed(int x, int y){ if(isDrawing) { - isDrawing=false; + isDrawing = false; this->deleteToolLayer(); } } @@ -24,7 +24,7 @@ void IntelliTool::onMouseRightReleased(int x, int y){ } void IntelliTool::onMouseLeftPressed(int x, int y){ - this->isDrawing=this->createToolLayer(); + this->isDrawing = this->createToolLayer(); if(isDrawing) { Canvas->image->calculateVisiblity(); } @@ -32,7 +32,7 @@ void IntelliTool::onMouseLeftPressed(int x, int y){ void IntelliTool::onMouseLeftReleased(int x, int y){ if(isDrawing) { - isDrawing=false; + isDrawing = false; this->mergeToolLayer(); this->deleteToolLayer(); activeLayer->image->calculateVisiblity(); @@ -51,8 +51,8 @@ void IntelliTool::onWheelScrolled(int value){ bool IntelliTool::createToolLayer(){ if(Area->createTempTopLayer(Area->activeLayer)) { - this->activeLayer=&Area->layerBundle[static_cast(Area->activeLayer)]; - this->Canvas=&Area->layerBundle[static_cast(Area->activeLayer+1)]; + this->activeLayer = &Area->layerBundle[static_cast(Area->activeLayer)]; + this->Canvas = &Area->layerBundle[static_cast(Area->activeLayer + 1)]; return true; } return false; @@ -63,15 +63,15 @@ void IntelliTool::mergeToolLayer(){ QColor clr_1; QImage updatedImage = activeLayer->image->getImageData(); - for(int y=0; yheight; y++) { - for(int x=0; xwidth; x++) { - clr_0=updatedImage.pixelColor(x,y); - clr_1=Canvas->image->imageData.pixelColor(x,y); - float t = static_cast(clr_1.alpha())/255.f; - int r =static_cast(static_cast(clr_1.red())*(t)+static_cast(clr_0.red())*(1.f-t)+0.5f); - int g =static_cast(static_cast(clr_1.green())*(t)+static_cast(clr_0.green())*(1.f-t)+0.5f); - int b =static_cast(static_cast(clr_1.blue())*(t)+static_cast(clr_0.blue()*(1.f-t))+0.5f); - int a =std::min(clr_0.alpha()+clr_1.alpha(), 255); + for(int y = 0; yheight; y++) { + for(int x = 0; xwidth; x++) { + clr_0 = updatedImage.pixelColor(x,y); + clr_1 = Canvas->image->imageData.pixelColor(x,y); + float t = static_cast(clr_1.alpha()) / 255.f; + int r = static_cast(static_cast(clr_1.red()) * (t) + static_cast(clr_0.red()) * (1.f - t) + 0.5f); + int g = static_cast(static_cast(clr_1.green()) * (t) + static_cast(clr_0.green()) * (1.f - t) + 0.5f); + int b = static_cast(static_cast(clr_1.blue()) * (t) + static_cast(clr_0.blue() * (1.f - t)) + 0.5f); + int a = std::min(clr_0.alpha() + clr_1.alpha(), 255); clr_0.setRed(r); clr_0.setGreen(g); clr_0.setBlue(b); @@ -88,8 +88,8 @@ void IntelliTool::mergeToolLayer(){ } void IntelliTool::deleteToolLayer(){ - Area->deleteLayer(Area->activeLayer+1, true); - this->Canvas=nullptr; + Area->deleteLayer(Area->activeLayer + 1, true); + this->Canvas = nullptr; } IntelliTool::Tooltype IntelliTool::getTooltype(){ diff --git a/src/Tool/IntelliToolCircle.cpp b/src/Tool/IntelliToolCircle.cpp index d2a09d1..644c6ea 100644 --- a/src/Tool/IntelliToolCircle.cpp +++ b/src/Tool/IntelliToolCircle.cpp @@ -16,31 +16,31 @@ void IntelliToolCircle::drawCircle(int radius){ QColor inner = this->colorPicker->getSecondColor(); inner.setAlpha(Toolsettings->getInnerAlpha()); int yMin, yMax, xMin, xMax; - yMin = centerPoint.y()-radius; - yMax = centerPoint.y()+radius; + yMin = centerPoint.y() - radius; + yMax = centerPoint.y() + radius; // x = x0+-sqrt(r2-(y-y0)2) - for(int i=yMin; i<=yMax; i++) { - xMin = static_cast(centerPoint.x()-sqrt(pow(radius,2)-pow(i-centerPoint.y(),2))); - xMax = static_cast(centerPoint.x()+sqrt(pow(radius,2)-pow(i-centerPoint.y(),2))); + for(int i = yMin; i<=yMax; i++) { + xMin = static_cast(centerPoint.x() - sqrt(pow(radius,2) - pow(i - centerPoint.y(),2))); + xMax = static_cast(centerPoint.x() + sqrt(pow(radius,2) - pow(i - centerPoint.y(),2))); this->Canvas->image->drawLine(QPoint(xMin,i), QPoint(xMax,i),inner,1); } //TODO implement circle drawing algorithm bresenham - radius = static_cast(radius +(Toolsettings->getLineWidth()/2.)); - yMin = (centerPoint.y()-radius); - yMax = (centerPoint.y()+radius); - for(int i=yMin; i<=yMax; i++) { - xMin = static_cast(centerPoint.x()-sqrt(pow(radius,2)-pow(i-centerPoint.y(),2))); - xMax = static_cast(centerPoint.x()+sqrt(pow(radius,2)-pow(i-centerPoint.y(),2))); + radius = static_cast(radius + (Toolsettings->getLineWidth() / 2.)); + yMin = (centerPoint.y() - radius); + yMax = (centerPoint.y() + radius); + for(int i = yMin; i<=yMax; i++) { + xMin = static_cast(centerPoint.x() - sqrt(pow(radius,2) - pow(i - centerPoint.y(),2))); + xMax = static_cast(centerPoint.x() + sqrt(pow(radius,2) - pow(i - centerPoint.y(),2))); this->Canvas->image->drawPoint(QPoint(xMin,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth()); this->Canvas->image->drawPoint(QPoint(xMax,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth()); } - xMin = (centerPoint.x()-radius); - xMax = (centerPoint.x()+radius); - for(int i=xMin; i<=xMax; i++) { - int yMin = static_cast(centerPoint.y()-sqrt(pow(radius,2)-pow(i-centerPoint.x(),2))); - int yMax = static_cast(centerPoint.y()+sqrt(pow(radius,2)-pow(i-centerPoint.x(),2))); + xMin = (centerPoint.x() - radius); + xMax = (centerPoint.x() + radius); + for(int i = xMin; i<=xMax; i++) { + int yMin = static_cast(centerPoint.y() - sqrt(pow(radius,2) - pow(i - centerPoint.x(),2))); + int yMax = static_cast(centerPoint.y() + sqrt(pow(radius,2) - pow(i - centerPoint.x(),2))); this->Canvas->image->drawPoint(QPoint(i, yMin), colorPicker->getFirstColor(),Toolsettings->getLineWidth()); this->Canvas->image->drawPoint(QPoint(i, yMax), colorPicker->getFirstColor(),Toolsettings->getLineWidth()); } @@ -57,7 +57,7 @@ void IntelliToolCircle::onMouseRightReleased(int x, int y){ void IntelliToolCircle::onMouseLeftPressed(int x, int y){ IntelliTool::onMouseLeftPressed(x,y); if(this->isDrawing) { - this->centerPoint=QPoint(x,y); + this->centerPoint = QPoint(x,y); int radius = 1; drawCircle(radius); Canvas->image->calculateVisiblity(); @@ -70,14 +70,14 @@ void IntelliToolCircle::onMouseLeftReleased(int x, int y){ void IntelliToolCircle::onWheelScrolled(int value){ IntelliTool::onWheelScrolled(value); - Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value); + Toolsettings->setLineWidth(Toolsettings->getLineWidth() + value); } void IntelliToolCircle::onMouseMoved(int x, int y){ if(this->isDrawing) { this->Canvas->image->drawPlain(Qt::transparent); QPoint next(x,y); - int radius = static_cast(sqrt(pow((centerPoint.x()-x),2)+pow((centerPoint.y()-y),2))); + int radius = static_cast(sqrt(pow((centerPoint.x() - x),2) + pow((centerPoint.y() - y),2))); drawCircle(radius); } IntelliTool::onMouseMoved(x,y); diff --git a/src/Tool/IntelliToolCircle.h b/src/Tool/IntelliToolCircle.h index d75665d..46a4340 100644 --- a/src/Tool/IntelliToolCircle.h +++ b/src/Tool/IntelliToolCircle.h @@ -74,4 +74,4 @@ virtual void onWheelScrolled(int value) override; virtual void onMouseMoved(int x, int y) override; }; -#endif // INTELLITOOLCIRCLE_H +#endif diff --git a/src/Tool/IntelliToolFloodFill.cpp b/src/Tool/IntelliToolFloodFill.cpp index cb135f8..5301eee 100644 --- a/src/Tool/IntelliToolFloodFill.cpp +++ b/src/Tool/IntelliToolFloodFill.cpp @@ -41,10 +41,10 @@ void IntelliToolFloodFill::onMouseLeftPressed(int x, int y){ QPoint Current = Q.front(); Q.pop(); - left = QPoint(Current.x()-1,Current.y() ); - right = QPoint(Current.x()+1,Current.y() ); - top = QPoint(Current.x(),Current.y()-1); - down = QPoint(Current.x(),Current.y()+1); + left = QPoint(Current.x() - 1,Current.y() ); + right = QPoint(Current.x() + 1,Current.y() ); + top = QPoint(Current.x(),Current.y() - 1); + down = QPoint(Current.x(),Current.y() + 1); if((right.x() < Canvas->width) && (Canvas->image->getPixelColor(right) != newColor) && (activeLayer->image->getPixelColor(right) == oldColor)) { Canvas->image->drawPixel(right,newColor); Q.push(right); diff --git a/src/Tool/IntelliToolFloodFill.h b/src/Tool/IntelliToolFloodFill.h index 3e93699..21b7c94 100644 --- a/src/Tool/IntelliToolFloodFill.h +++ b/src/Tool/IntelliToolFloodFill.h @@ -64,4 +64,4 @@ virtual void onWheelScrolled(int value) override; virtual void onMouseMoved(int x, int y) override; }; -#endif // INTELLITOOLFLOODFILL_H +#endif diff --git a/src/Tool/IntelliToolLine.cpp b/src/Tool/IntelliToolLine.cpp index 120d3a2..17720ff 100644 --- a/src/Tool/IntelliToolLine.cpp +++ b/src/Tool/IntelliToolLine.cpp @@ -22,7 +22,7 @@ void IntelliToolLine::onMouseRightReleased(int x, int y){ void IntelliToolLine::onMouseLeftPressed(int x, int y){ IntelliTool::onMouseLeftPressed(x,y); - this->lineStartingPoint=QPoint(x,y); + this->lineStartingPoint = QPoint(x,y); this->Canvas->image->drawPoint(lineStartingPoint, colorPicker->getFirstColor(),Toolsettings->getLineWidth()); Canvas->image->calculateVisiblity(); } @@ -33,25 +33,14 @@ void IntelliToolLine::onMouseLeftReleased(int x, int y){ void IntelliToolLine::onWheelScrolled(int value){ IntelliTool::onWheelScrolled(value); - Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value); + Toolsettings->setLineWidth(Toolsettings->getLineWidth() + value); } void IntelliToolLine::onMouseMoved(int x, int y){ if(this->isDrawing) { this->Canvas->image->drawPlain(Qt::transparent); QPoint next(x,y); - switch(Toolsettings->getLinestyle()) { - case IntelliToolsettings::LineStyle::SOLID_LINE: - this->Canvas->image->drawLine(lineStartingPoint,next,colorPicker->getFirstColor(),Toolsettings->getLineWidth()); - break; - case IntelliToolsettings::LineStyle::DOTTED_LINE: - QPoint p1 =lineStartingPoint.x() <= next.x() ? lineStartingPoint : next; - QPoint p2 =lineStartingPoint.x() < next.x() ? next : lineStartingPoint; - int m = static_cast(static_cast(p2.y()-p1.y())/static_cast(p2.x()-p1.x())+0.5f); - int c = lineStartingPoint.y()-lineStartingPoint.x()*m; - //TODO implement dotted algorithm - break; - } + this->Canvas->image->drawLine(lineStartingPoint,next,colorPicker->getFirstColor(),Toolsettings->getLineWidth()); } IntelliTool::onMouseMoved(x,y); } diff --git a/src/Tool/IntelliToolLine.h b/src/Tool/IntelliToolLine.h index 1bae946..f5e7e34 100644 --- a/src/Tool/IntelliToolLine.h +++ b/src/Tool/IntelliToolLine.h @@ -16,7 +16,7 @@ QPoint lineStartingPoint; public: /*! - * \brief A constructor setting the general paintingArea and colorPicker. And reading in the lineWidth and lineStyle. + * \brief A constructor setting the general paintingArea and colorPicker. * \param Area - The general paintingArea used by the project. * \param colorPicker - The general colorPicker used by the project. */ @@ -69,4 +69,4 @@ virtual void onWheelScrolled(int value) override; virtual void onMouseMoved(int x, int y) override; }; -#endif // INTELLITOOLLINE_H +#endif diff --git a/src/Tool/IntelliToolPen.cpp b/src/Tool/IntelliToolPen.cpp index 70f2dc3..42ed590 100644 --- a/src/Tool/IntelliToolPen.cpp +++ b/src/Tool/IntelliToolPen.cpp @@ -23,7 +23,7 @@ void IntelliToolPen::onMouseRightReleased(int x, int y){ void IntelliToolPen::onMouseLeftPressed(int x, int y){ IntelliTool::onMouseLeftPressed(x,y); - this->previousPoint=QPoint(x,y); + this->previousPoint = QPoint(x,y); this->Canvas->image->drawPoint(previousPoint, colorPicker->getFirstColor(), Toolsettings->getLineWidth()); Canvas->image->calculateVisiblity(); } @@ -36,12 +36,12 @@ void IntelliToolPen::onMouseMoved(int x, int y){ if(this->isDrawing) { QPoint newPoint(x,y); this->Canvas->image->drawLine(this->previousPoint, newPoint, colorPicker->getFirstColor(), Toolsettings->getLineWidth()); - this->previousPoint=newPoint; + this->previousPoint = newPoint; } IntelliTool::onMouseMoved(x,y); } void IntelliToolPen::onWheelScrolled(int value){ IntelliTool::onWheelScrolled(value); - Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value); + Toolsettings->setLineWidth(Toolsettings->getLineWidth() + value); } diff --git a/src/Tool/IntelliToolPen.h b/src/Tool/IntelliToolPen.h index 39aab9e..cee28ed 100644 --- a/src/Tool/IntelliToolPen.h +++ b/src/Tool/IntelliToolPen.h @@ -67,4 +67,4 @@ virtual void onWheelScrolled(int value) override; virtual void onMouseMoved(int x, int y) override; }; -#endif // INTELLITOOLPEN_H +#endif diff --git a/src/Tool/IntelliToolPlain.h b/src/Tool/IntelliToolPlain.h index c4b294c..8baca3c 100644 --- a/src/Tool/IntelliToolPlain.h +++ b/src/Tool/IntelliToolPlain.h @@ -62,4 +62,4 @@ virtual void onMouseMoved(int x, int y) override; }; -#endif // INTELLITOOLFLOODFILLTOOL_H +#endif diff --git a/src/Tool/IntelliToolPolygon.cpp b/src/Tool/IntelliToolPolygon.cpp index c784669..c7afdd2 100644 --- a/src/Tool/IntelliToolPolygon.cpp +++ b/src/Tool/IntelliToolPolygon.cpp @@ -101,8 +101,8 @@ void IntelliToolPolygon::onMouseLeftReleased(int x, int y){ } } } - for(int i=0; i(QPointList.size()); i++) { - int next = static_cast((i+static_cast(1))%static_cast(QPointList.size())); + for(int i = 0; i(QPointList.size()); i++) { + int next = static_cast((i + static_cast(1)) % static_cast(QPointList.size())); this->Canvas->image->drawLine(QPointList[static_cast(i)], QPointList[static_cast(next)], colorPicker->getFirstColor(), Toolsettings->getLineWidth()); } diff --git a/src/Tool/IntelliToolPolygon.h b/src/Tool/IntelliToolPolygon.h index d50adc4..08a91d9 100644 --- a/src/Tool/IntelliToolPolygon.h +++ b/src/Tool/IntelliToolPolygon.h @@ -99,4 +99,4 @@ virtual void onMouseMoved(int x, int y) override; }; -#endif // INTELLITOOLPOLYGON_H +#endif diff --git a/src/Tool/IntelliToolRectangle.cpp b/src/Tool/IntelliToolRectangle.cpp index 29fa038..924ed6c 100644 --- a/src/Tool/IntelliToolRectangle.cpp +++ b/src/Tool/IntelliToolRectangle.cpp @@ -20,7 +20,7 @@ void IntelliToolRectangle::drawRectangle(QPoint otherCorner){ QColor clr = colorPicker->getSecondColor(); clr.setAlpha(Toolsettings->getInnerAlpha()); - for(int y=yMin; y<=yMax; y++) { + for(int y = yMin; y<=yMax; y++) { this->Canvas->image->drawLine(QPoint(xMin,y), QPoint(xMax, y), clr, 1); } this->Canvas->image->drawLine(QPoint(xMin, yMin),QPoint(xMin, yMax), this->colorPicker->getFirstColor(), Toolsettings->getLineWidth()); @@ -39,7 +39,7 @@ void IntelliToolRectangle::onMouseRightReleased(int x, int y){ void IntelliToolRectangle::onMouseLeftPressed(int x, int y){ IntelliTool::onMouseLeftPressed(x,y); - this->originCorner=QPoint(x,y); + this->originCorner = QPoint(x,y); drawRectangle(originCorner); Canvas->image->calculateVisiblity(); } @@ -59,5 +59,5 @@ void IntelliToolRectangle::onMouseMoved(int x, int y){ void IntelliToolRectangle::onWheelScrolled(int value){ IntelliTool::onWheelScrolled(value); - Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value); + Toolsettings->setLineWidth(Toolsettings->getLineWidth() + value); } diff --git a/src/Tool/IntelliToolRectangle.h b/src/Tool/IntelliToolRectangle.h index 041e860..2ead165 100644 --- a/src/Tool/IntelliToolRectangle.h +++ b/src/Tool/IntelliToolRectangle.h @@ -73,4 +73,4 @@ virtual void onWheelScrolled(int value) override; virtual void onMouseMoved(int x, int y) override; }; -#endif // INTELLIRECTANGLETOOL_H +#endif