diff --git a/.clang-format b/.clang-format index f775df4..8985e75 100644 --- a/.clang-format +++ b/.clang-format @@ -2,7 +2,7 @@ Language: Cpp # BasedOnStyle: Chromium ColumnLimit: 100 -AccessModifierOffset: -1 +AccessModifierOffset: -2 AlignAfterOpenBracket: Align AlignConsecutiveAssignments: false AlignConsecutiveDeclarations: false @@ -36,7 +36,7 @@ BraceWrapping: BreakBeforeBinaryOperators: None #BreakBeforeBraces: Attach BreakBeforeBraces: Allman -#BreakBeforeInheritanceComma: true +BreakBeforeInheritanceComma: false BreakBeforeTernaryOperators: true BreakConstructorInitializersBeforeComma: true BreakConstructorInitializersBeforeComma: true @@ -59,7 +59,7 @@ IncludeCategories: - Regex: '.*' Priority: 3 IncludeIsMainRegex: '([-_](test|unittest))?$' -IndentCaseLabels: true +IndentCaseLabels: false IndentWidth: 2 IndentWrappedFunctionNames: false JavaScriptQuotes: Leave diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..0481a03 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +language: cpp +dist: xenial +before_install: + - sudo apt-get -qq update + - sudo apt-get install build-essential cmake qtbase5-dev libavcodec-dev libavformat-dev libavutil-dev libopencv-dev libopencv-video-dev +script: mkdir -p build && cd build && cmake .. && make && cd .. diff --git a/CMakeLists.txt b/CMakeLists.txt index 1dd5758..a70a9f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ ### CMakeLists for playuver ### -cmake_minimum_required( VERSION 2.8.9 ) +cmake_minimum_required( VERSION 3.2.0 ) ###################################################################################### # CMake functions @@ -10,6 +10,7 @@ cmake_minimum_required( VERSION 2.8.9 ) SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ) INCLUDE( cmake/ModulesFct.cmake ) INCLUDE(FeatureSummary) +INCLUDE(GNUInstallDirs) ###################################################################################### # Project Definition @@ -19,9 +20,9 @@ set( PROJECT_NAME "playuver" CACHE INTERNAL "" FORCE ) PROJECT( ${PROJECT_NAME} ) SET( PLAYUVER_VERSION_MAJOR "0" ) -SET( PLAYUVER_VERSION_MINOR "13" ) +SET( PLAYUVER_VERSION_MINOR "14" ) SET( PLAYUVER_VERSION_PATCH "0" ) -set( PLAYUVER_VERSION "${PLAYUVER_VERSION_MAJOR}.${PLAYUVER_VERSION_MINOR}.${PLAYUVER_VERSION_PATCH}" CACHE INTERNAL "" FORCE ) +SET( PLAYUVER_VERSION "${PLAYUVER_VERSION_MAJOR}.${PLAYUVER_VERSION_MINOR}.${PLAYUVER_VERSION_PATCH}" CACHE INTERNAL "" FORCE ) ###################################################################################### # Variables @@ -31,6 +32,7 @@ OPTION( BUILD_APP "Build GUI Application" ON ) OPTION( BUILD_TOOLS "Build Command Line Application" ON ) OPTION( BUILD_EXAMPLES "Build Examples" OFF ) OPTION( BUILD_DOC "Build Documentation" OFF ) +OPTION( BUILD_TESTS "Build Google Tests" ON ) OPTION( USE_FERVOR "Add Fervor support" OFF ) @@ -88,10 +90,20 @@ IF( BUILD_DOC ) ENDIF() SET_PACKAGE_PROPERTIES(Doxygen PROPERTIES URL "http://www.doxygen.org/" DESCRIPTION "Doxygen" TYPE OPTIONAL) + +IF( BUILD_TESTS ) + FIND_PACKAGE(GTest) + SET( BUILD_DOC ${GTEST_FOUND} ) + IF( GTEST_FOUND ) + ENABLE_TESTING() + INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIRS}) + ENDIF() +ENDIF() + OPTION( USE_OPENCV "Add OpenCV support" ON ) SET( OPENCV_OPTFLOW_FOUND OFF ) IF( USE_OPENCV ) - LIST(APPEND OPENCV_MODULES core highgui imgproc video ) + LIST(APPEND OPENCV_MODULES core highgui imgproc video videoio ) FIND_PACKAGE( OpenCV COMPONENTS ${OPENCV_MODULES} ) SET(USE_OPENCV ${OpenCV_FOUND}) ENDIF() @@ -133,6 +145,7 @@ SET( CMAKE_CXX_FLAGS "" ) # Configure targets ###################################################################################### +SET(CMAKE_CXX_STANDARD 14) if(CMAKE_COMPILER_IS_GNUCXX) ADD_DEFINITIONS(-std=gnu++0x) endif() @@ -173,14 +186,6 @@ IF( ${BUILD_EXAMPLES} ) ADD_SUBDIRECTORY( examples ) ENDIF() -# add a target to generate API documentation with Doxygen -# IF(BUILD_DOC) -# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) -# add_custom_target(doc ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile -# WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -# COMMENT "Generating API documentation with Doxygen" VERBATIM ) -# ENDIF(BUILD_DOC) - ###################################################################################### # Final information dump diff --git a/Doxyfile b/Doxyfile index d9522cd..90b1bf5 100644 --- a/Doxyfile +++ b/Doxyfile @@ -1,4 +1,4 @@ -# Doxyfile 1.8.9.1 +# Doxyfile 1.8.13 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -38,20 +38,20 @@ PROJECT_NAME = PlaYUVer # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = +PROJECT_NUMBER = # 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 a # quick idea about the purpose of the project. Keep the description short. -PROJECT_BRIEF = +PROJECT_BRIEF = # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy # the logo to the output directory. -PROJECT_LOGO = resources/playuver.png +PROJECT_LOGO = /home/joaoc/Programming/PlaYUVerDev/playuver/app/resources/playuver.ico # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # into which the generated documentation will be written. If a relative path is @@ -162,7 +162,7 @@ FULL_PATH_NAMES = YES # will be relative from the directory where doxygen is started. # This tag requires that the tag FULL_PATH_NAMES is set to YES. -STRIP_FROM_PATH = +STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which @@ -171,7 +171,7 @@ STRIP_FROM_PATH = # specify the list of include paths that are normally passed to the compiler # using the -I flag. -STRIP_FROM_INC_PATH = +STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but # less readable) file names. This can be useful is your file systems doesn't @@ -244,7 +244,7 @@ ALIASES = "returns=\"\par Returns\" " # A mapping has the form "name=value". For example adding "class=itcl::class" # will allow you to use the command class in the itcl::class meaning. -TCL_SUBST = +TCL_SUBST = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For @@ -291,7 +291,7 @@ OPTIMIZE_OUTPUT_VHDL = NO # Note that for custom extensions you also need to set FILE_PATTERNS otherwise # the files are not read by doxygen. -EXTENSION_MAPPING = +EXTENSION_MAPPING = # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable @@ -303,6 +303,15 @@ EXTENSION_MAPPING = MARKDOWN_SUPPORT = YES +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 0. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 0 + # 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 putting a % sign in front of the word or @@ -353,6 +362,13 @@ IDL_PROPERTY_SUPPORT = YES DISTRIBUTE_GROUP_DOC = NO +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + # Set the SUBGROUPING tag to YES to allow class member groups of the same type # (for instance a group of public functions) to be put as a subgroup of that # type (e.g. under the Public Functions section). Set it to NO to prevent @@ -632,7 +648,7 @@ GENERATE_DEPRECATEDLIST= YES # sections, marked by \if ... \endif and \cond # ... \endcond blocks. -ENABLED_SECTIONS = +ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the # initial value of a variable or macro / define can have for it to appear in the @@ -674,7 +690,7 @@ SHOW_NAMESPACES = YES # by doxygen. Whatever the program writes to standard output is used as the file # version. For an example see the documentation. -FILE_VERSION_FILTER = +FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated @@ -687,7 +703,7 @@ FILE_VERSION_FILTER = # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE # tag is left empty. -LAYOUT_FILE = +LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib @@ -697,7 +713,7 @@ LAYOUT_FILE = # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. See also \cite for info how to create references. -CITE_BIB_FILES = +CITE_BIB_FILES = #--------------------------------------------------------------------------- # Configuration options related to warning and progress messages @@ -742,6 +758,12 @@ WARN_IF_DOC_ERROR = YES WARN_NO_PARAMDOC = NO +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. +# The default value is: NO. + +WARN_AS_ERROR = NO + # The WARN_FORMAT tag determines the format of the warning messages that doxygen # can produce. The string should contain the $file, $line, and $text tags, which # will be replaced by the file and line number from which the warning originated @@ -756,7 +778,7 @@ WARN_FORMAT = "$file:$line: $text" # messages should be written. If left blank the output is written to standard # error (stderr). -WARN_LOGFILE = +WARN_LOGFILE = #--------------------------------------------------------------------------- # Configuration options related to the input files @@ -765,10 +787,10 @@ WARN_LOGFILE = # The INPUT tag is used to specify the files and/or directories that contain # documented source files. You may enter file names like myfile.cpp or # directories like /usr/src/myproject. Separate the files or directories with -# spaces. +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = +INPUT = # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -781,12 +803,17 @@ INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank the -# following patterns are tested:*.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, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, -# *.qsf, *.as and *.js. +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# If left blank the following patterns are tested:*.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 and *.qsf. FILE_PATTERNS = *.c \ *.cc \ @@ -869,7 +896,7 @@ EXCLUDE_SYMLINKS = NO # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories for example use the pattern */test/* -EXCLUDE_PATTERNS = +EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the @@ -880,13 +907,13 @@ EXCLUDE_PATTERNS = # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories use the pattern */test/* -EXCLUDE_SYMBOLS = +EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or directories # that contain example code fragments that are included (see the \include # command). -EXAMPLE_PATH = +EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and @@ -906,7 +933,7 @@ EXAMPLE_RECURSIVE = NO # that contain images that are to be included in the documentation (see the # \image command). -IMAGE_PATH = +IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program @@ -922,8 +949,12 @@ IMAGE_PATH = # Note that the filter must not add or remove lines; it is applied before the # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. -INPUT_FILTER = +INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the @@ -931,8 +962,12 @@ INPUT_FILTER = # (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how # filters are used. If the FILTER_PATTERNS tag is empty or if none of the # patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. -FILTER_PATTERNS = +FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will also be used to filter the input files that are used for @@ -947,14 +982,14 @@ FILTER_SOURCE_FILES = NO # *.ext= (so without naming a filter). # This tag requires that the tag FILTER_SOURCE_FILES is set to YES. -FILTER_SOURCE_PATTERNS = +FILTER_SOURCE_PATTERNS = # If the USE_MDFILE_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 to reuse the introduction page also for the doxygen output. -USE_MDFILE_AS_MAINPAGE = +USE_MDFILE_AS_MAINPAGE = #--------------------------------------------------------------------------- # Configuration options related to source browsing @@ -1066,7 +1101,7 @@ COLS_IN_ALPHA_INDEX = 5 # while generating the index headers. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. -IGNORE_PREFIX = +IGNORE_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the HTML output @@ -1110,7 +1145,7 @@ HTML_FILE_EXTENSION = .html # of the possible markers and block names see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_HEADER = +HTML_HEADER = # The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each # generated HTML page. If the tag is left blank doxygen will generate a standard @@ -1120,7 +1155,7 @@ HTML_HEADER = # that doxygen normally uses. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_FOOTER = +HTML_FOOTER = # 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 @@ -1132,7 +1167,7 @@ HTML_FOOTER = # obsolete. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_STYLESHEET = +HTML_STYLESHEET = # The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined # cascading style sheets that are included after the standard style sheets @@ -1145,7 +1180,7 @@ HTML_STYLESHEET = # list). For an example see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_EXTRA_STYLESHEET = +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 @@ -1155,7 +1190,7 @@ HTML_EXTRA_STYLESHEET = # files will be copied as-is; there are no commands or markers available. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_EXTRA_FILES = +HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to @@ -1189,8 +1224,9 @@ HTML_COLORSTYLE_GAMMA = 98 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting this -# to NO can help when comparing the output of multiple runs. -# The default value is: YES. +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_TIMESTAMP = YES @@ -1283,7 +1319,7 @@ GENERATE_HTMLHELP = NO # written to the html output directory. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. -CHM_FILE = +CHM_FILE = # The HHC_LOCATION tag can be used to specify the location (absolute path # including file name) of the HTML help compiler (hhc.exe). If non-empty, @@ -1291,7 +1327,7 @@ CHM_FILE = # The file has to be specified with full path. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. -HHC_LOCATION = +HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated # (YES) or that it should be included in the master .chm file (NO). @@ -1304,7 +1340,7 @@ GENERATE_CHI = NO # and project file content. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. -CHM_INDEX_ENCODING = +CHM_INDEX_ENCODING = # The BINARY_TOC flag controls whether a binary table of contents is generated # (YES) or a normal table of contents (NO) in the .chm file. Furthermore it @@ -1335,7 +1371,7 @@ GENERATE_QHP = NO # the HTML output folder. # This tag requires that the tag GENERATE_QHP is set to YES. -QCH_FILE = +QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace @@ -1360,7 +1396,7 @@ QHP_VIRTUAL_FOLDER = doc # filters). # This tag requires that the tag GENERATE_QHP is set to YES. -QHP_CUST_FILTER_NAME = +QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom @@ -1368,21 +1404,21 @@ QHP_CUST_FILTER_NAME = # filters). # This tag requires that the tag GENERATE_QHP is set to YES. -QHP_CUST_FILTER_ATTRS = +QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: # http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. -QHP_SECT_FILTER_ATTRS = +QHP_SECT_FILTER_ATTRS = # The QHG_LOCATION tag can be used to specify the location of Qt's # qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the # generated .qhp file. # This tag requires that the tag GENERATE_QHP is set to YES. -QHG_LOCATION = +QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be # generated, together with the HTML files, they form an Eclipse help plugin. To @@ -1515,7 +1551,7 @@ MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest # MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols # This tag requires that the tag USE_MATHJAX is set to YES. -MATHJAX_EXTENSIONS = +MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site @@ -1523,7 +1559,7 @@ MATHJAX_EXTENSIONS = # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. -MATHJAX_CODEFILE = +MATHJAX_CODEFILE = # When the SEARCHENGINE tag is enabled doxygen will generate a search box for # the HTML output. The underlying search engine uses javascript and DHTML and @@ -1583,7 +1619,7 @@ EXTERNAL_SEARCH = NO # Searching" for details. # This tag requires that the tag SEARCHENGINE is set to YES. -SEARCHENGINE_URL = +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 @@ -1599,7 +1635,7 @@ SEARCHDATA_FILE = searchdata.xml # projects and redirect the results back to the right project. # This tag requires that the tag SEARCHENGINE is set to YES. -EXTERNAL_SEARCH_ID = +EXTERNAL_SEARCH_ID = # The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen # projects other than the one defined by this configuration file, but that are @@ -1609,7 +1645,7 @@ EXTERNAL_SEARCH_ID = # EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ... # This tag requires that the tag SEARCHENGINE is set to YES. -EXTRA_SEARCH_MAPPINGS = +EXTRA_SEARCH_MAPPINGS = #--------------------------------------------------------------------------- # Configuration options related to the LaTeX output @@ -1664,13 +1700,16 @@ COMPACT_LATEX = NO PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names -# that should be included in the LaTeX output. To get the times font for -# instance you can specify -# EXTRA_PACKAGES=times +# that should be included in the LaTeX output. The package can be specified just +# by its name or with the correct syntax as to be used with the LaTeX +# \usepackage command. To get the times font for instance you can specify : +# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times} +# To use the option intlimits with the amsmath package you can specify: +# EXTRA_PACKAGES=[intlimits]{amsmath} # If left blank no extra packages will be included. # This tag requires that the tag GENERATE_LATEX is set to YES. -EXTRA_PACKAGES = +EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for the # generated LaTeX document. The header should contain everything until the first @@ -1686,7 +1725,7 @@ EXTRA_PACKAGES = # to HTML_HEADER. # This tag requires that the tag GENERATE_LATEX is set to YES. -LATEX_HEADER = +LATEX_HEADER = # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the # generated LaTeX document. The footer should contain everything after the last @@ -1697,7 +1736,7 @@ LATEX_HEADER = # Note: Only use a user-defined footer if you know what you are doing! # This tag requires that the tag GENERATE_LATEX is set to YES. -LATEX_FOOTER = +LATEX_FOOTER = # The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined # LaTeX style sheets that are included after the standard style sheets created @@ -1708,7 +1747,7 @@ LATEX_FOOTER = # list). # This tag requires that the tag GENERATE_LATEX is set to YES. -LATEX_EXTRA_STYLESHEET = +LATEX_EXTRA_STYLESHEET = # The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the LATEX_OUTPUT output @@ -1716,7 +1755,7 @@ LATEX_EXTRA_STYLESHEET = # markers available. # This tag requires that the tag GENERATE_LATEX is set to YES. -LATEX_EXTRA_FILES = +LATEX_EXTRA_FILES = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is # prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will @@ -1769,6 +1808,14 @@ LATEX_SOURCE_CODE = NO LATEX_BIB_STYLE = plain +# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated +# page will contain the date and time when the page was generated. Setting this +# to NO can help when comparing the output of multiple runs. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_TIMESTAMP = NO + #--------------------------------------------------------------------------- # Configuration options related to the RTF output #--------------------------------------------------------------------------- @@ -1816,14 +1863,14 @@ RTF_HYPERLINKS = NO # default style sheet that doxygen normally uses. # This tag requires that the tag GENERATE_RTF is set to YES. -RTF_STYLESHEET_FILE = +RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an RTF document. Syntax is # similar to doxygen's config file. A template extensions file can be generated # using doxygen -e rtf extensionFile. # This tag requires that the tag GENERATE_RTF is set to YES. -RTF_EXTENSIONS_FILE = +RTF_EXTENSIONS_FILE = # If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code # with syntax highlighting in the RTF output. @@ -1868,7 +1915,7 @@ MAN_EXTENSION = .3 # MAN_EXTENSION with the initial . removed. # This tag requires that the tag GENERATE_MAN is set to YES. -MAN_SUBDIR = +MAN_SUBDIR = # If the MAN_LINKS tag is set to YES and doxygen generates man output, then it # will generate one additional man file for each entity documented in the real @@ -1981,7 +2028,7 @@ PERLMOD_PRETTY = YES # overwrite each other's variables. # This tag requires that the tag GENERATE_PERLMOD is set to YES. -PERLMOD_MAKEVAR_PREFIX = +PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor @@ -2022,7 +2069,7 @@ SEARCH_INCLUDES = YES # preprocessor. # This tag requires that the tag SEARCH_INCLUDES is set to YES. -INCLUDE_PATH = +INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the @@ -2030,7 +2077,7 @@ INCLUDE_PATH = # used. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -INCLUDE_FILE_PATTERNS = +INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that are # defined before the preprocessor is started (similar to the -D option of e.g. @@ -2040,7 +2087,7 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = +PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The @@ -2049,7 +2096,7 @@ PREDEFINED = # definition found in the source code. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -EXPAND_AS_DEFINED = +EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will # remove all references to function-like macros that are alone on a line, have @@ -2078,13 +2125,13 @@ SKIP_FUNCTION_MACROS = YES # the path). If a tag file is not located in the directory in which doxygen is # run, you must also specify the path to the tagfile here. -TAGFILES = +TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create a # tag file that is based on the input files it reads. See section "Linking to # external documentation" for more information about the usage of tag files. -GENERATE_TAGFILE = +GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES, all external class will be listed in # the class index. If set to NO, only the inherited external classes will be @@ -2133,14 +2180,14 @@ CLASS_DIAGRAMS = YES # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. -MSCGEN_PATH = +MSCGEN_PATH = # You can include diagrams made with dia in doxygen documentation. Doxygen will # then run dia to produce the diagram and insert it in the documentation. The # DIA_PATH tag allows you to specify the directory where the dia binary resides. # If left empty dia is assumed to be found in the default search path. -DIA_PATH = +DIA_PATH = # If set to YES the inheritance and collaboration graphs will hide inheritance # and usage relations if the target is undocumented or is not a class. @@ -2189,7 +2236,7 @@ DOT_FONTSIZE = 10 # the path where dot can find it using this tag. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_FONTPATH = +DOT_FONTPATH = # If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for # each documented class showing the direct and indirect inheritance relations. @@ -2267,7 +2314,8 @@ INCLUDED_BY_GRAPH = YES # # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. +# functions only using the \callgraph command. Disabling a call graph can be +# accomplished by means of the command \hidecallgraph. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2278,7 +2326,8 @@ CALL_GRAPH = NO # # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable caller graphs for selected -# functions only using the \callergraph command. +# functions only using the \callergraph command. Disabling a caller graph can be +# accomplished by means of the command \hidecallergraph. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2301,11 +2350,15 @@ GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. +# generated by dot. For an explanation of the image formats see the section +# output formats in the documentation of the dot tool (Graphviz (see: +# http://www.graphviz.org/)). # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # to make the SVG files visible in IE 9+ (other browsers do not have this # requirement). -# Possible values are: png, jpg, gif and svg. +# Possible values are: png, jpg, gif, svg, png:gd, png:gd:gd, png:cairo, +# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and +# png:gdiplus:gdiplus. # The default value is: png. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2327,26 +2380,26 @@ INTERACTIVE_SVG = NO # found. If left blank, it is assumed the dot tool can be found in the path. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_PATH = +DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the \dotfile # command). # This tag requires that the tag HAVE_DOT is set to YES. -DOTFILE_DIRS = +DOTFILE_DIRS = # The MSCFILE_DIRS tag can be used to specify one or more directories that # contain msc files that are included in the documentation (see the \mscfile # command). -MSCFILE_DIRS = +MSCFILE_DIRS = # The DIAFILE_DIRS tag can be used to specify one or more directories that # contain dia files that are included in the documentation (see the \diafile # command). -DIAFILE_DIRS = +DIAFILE_DIRS = # When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the # path where java can find the plantuml.jar file. If left blank, it is assumed @@ -2354,12 +2407,17 @@ DIAFILE_DIRS = # generate a warning when it encounters a \startuml command in this case and # will not generate output for the diagram. -PLANTUML_JAR_PATH = +PLANTUML_JAR_PATH = + +# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a +# configuration file for plantuml. + +PLANTUML_CFG_FILE = # When using plantuml, the specified paths are searched for files specified by # the !include statement in a plantuml block. -PLANTUML_INCLUDE_PATH = +PLANTUML_INCLUDE_PATH = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes # that will be shown in the graph. If the number of nodes in a graph becomes diff --git a/Mainpage.dox b/Mainpage.dox index fbec523..ebedfff 100644 --- a/Mainpage.dox +++ b/Mainpage.dox @@ -3,16 +3,19 @@ Description ---------------------------------------------------------------- -plaYUVer is an open-source video player with the following features: +PlaYUVer is an open-source video player with the following features: - Support for libavformat and libavcodec; - Support for wide range of raw video formats; -- Support for OpenCV imag/video processing library +- Support up to 16 bits per pixel +- Support for OpenCV image/video processing library - Advanced frame zoom with easy to use pan function -- Usefull information in status bar, *e.g.*, pixel information -- Usefull sidebars with stream and frame information, *e.g.*, frame histogram -- Constant growing libs for stream and frame processing (PlaYUVerStream PlaYUVerFrame) +- Synchronized zoom across several videos (perfect for comparison operations) +- Useful information in status bar, *e.g.*, pixel information + Useful sidebars with frame information, *e.g.*, frame histogram +- Constant growing libs for stream and frame processing (PlaYUVerStream and PlaYUVerFrame) - Advanced API for frame/video processing algorithms - Frame level quality measurement API based on the PlaYUVerFrame class +- Powefull command-line tool for quality and frame processing algorithms (uses the referred APIs) Modules ---------------------------------------------------------------- @@ -22,13 +25,42 @@ Modules - PlaYUVerTools: High level command line interface +Supported Quality Metrics +---------------------------------------------------------------- +- PSNR +- SSIM +- MSE + +Frame Processing Modules +---------------------------------------------------------------- +- Component filtering +- Frame difference, crop, shift, binarization +- Sub-sampling operations +- Measuring modules +- Modules based on opencv: + * Disparity estimation + * Motion estimation + +Supported Formats +---------------------------------------------------------------- +- Supports for the following pixel formats: + * YUV: 420, 44, 422, 400 + * RGB + * Gray +- Support containers: + * Raw video (yuv,rgb,gray) + * Portable Network Graphics (png) + * Joint Photographic Experts Group (jpeg) + * Windows Bitmap (bmp) + * Tagged Image File Format (tiff) + * Portable Map (ppm,pgm,pbm) + Developers ---------------------------------------------------------------- - Joao Carreira (jfmcarreira@gmail.com) - Lui­s Lucas (luisfrlucas@gmail.com) - Builds ---------------------------------------------------------------- Download update build for windows and linux from our SourceForge project page diff --git a/README.md b/README.md index b2ce418..1b09f52 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -PlaYUVer - Enhanced Raw Video Player -======== +# [PlaYUVer](https://github.com/pixlra/playuver) +## Enhanced YUV video player based on Qt focusing on image/video analysis -plaYUVer is an open-source video player with the following features: +## Features - Support for libavformat and libavcodec; - Support for wide range of raw video formats; - Support up to 16 bits per pixel @@ -11,35 +11,32 @@ plaYUVer is an open-source video player with the following features: - Synchronized zoom across several videos (perfect for comparison operations) - Useful information in status bar, *e.g.*, pixel information Useful sidebars with frame information, *e.g.*, frame histogram -- Constant growing libs for stream and frame processing (PlaYUVerStream PlaYUVerFrame) +- Constant growing libs for stream and frame processing (PlaYUVerStream and PlaYUVerFrame) - Advanced API for frame/video processing algorithms - Frame level quality measurement API based on the PlaYUVerFrame class - Powefull command-line tool for quality and frame processing algorithms (uses the referred APIs) -Libs and API ----------------------------------------------------------------- -- PlaYUVerFrame and PlaYUVerStream: Stream and frame handling lib -- PlaYUVerModules: Interface for processing modules (extensions) +## Modules +- PlaYUVerLib: Low level library +- PlaYUVerModules: Abstract interface for frame processing modules +- PlaYUVerApp: High level graphical interface +- PlaYUVerTools: High level command line interface - -Supported Quality Metrics ----------------------------------------------------------------- +## Supported Quality Metrics - PSNR - SSIM - MSE -Frame Processing Modules ----------------------------------------------------------------- +## Frame Processing Modules - Component filtering - Frame difference, crop, shift, binarization - Sub-sampling operations -- Measuring modules +- Measuring modules - Modules based on opencv: - * Disparity estimation - * Motion estimation + - Disparity estimation + - Motion estimation -Supported Formats ----------------------------------------------------------------- +## Supported Formats - Supports for the following pixel formats: * YUV: 420, 44, 422, 400 * RGB @@ -52,27 +49,19 @@ Supported Formats * Tagged Image File Format (tiff) * Portable Map (ppm,pgm,pbm) -Developers ----------------------------------------------------------------- - -- Joao Carreira (jfmcarreira@gmail.com) -- Lui­s Lucas (luisfrlucas@gmail.com) +## Developers +- **Joao Carreira** (jfmcarreira@gmail.com) +- **Lui­s Lucas** (luisfrlucas@gmail.com) -Build ----------------------------------------------------------------- -Download update build for windows and linux from our SourceForge project page - -Building yourself - -1. Dependencies - - an ordinary C++ development environment (g++, make, C++ libraries and headers, ...) - - cmake - - a Qt development environment (libraries, headers, qmake, ...): only QtCore, QtGui and QtWidgets are required, at least in version 4 - - QtDBus (optional) - - OpenCv (optional) - - FFmpeg (optional) -2. Example configuration command +### Binaries and Build +* **Daily builds** available for Windows and Linux in our [SourceForge page](https://sourceforge.net/projects/playuver/) +* **Dependencies** + 1. an ordinary C++ development environment (g++, make, C++ libraries and headers, ...) + 2. cmake + 3. a Qt development environment: QtCore, QtGui, QtWidgets, QtPrintSupport and QtConcurrent (version 4 or higher) + 4. Optional: QtDBus, OpenCV, FFmpeg +* **List of required commands** ``` mkdir build cd build diff --git a/app/AboutDialog.cpp b/app/AboutDialog.cpp index 475f14d..5871761 100644 --- a/app/AboutDialog.cpp +++ b/app/AboutDialog.cpp @@ -65,7 +65,7 @@ AboutDialog::AboutDialog( QWidget* parent ) : QDialog( parent ) QLabel* labelFeatures = new QLabel( featuresList ); QLabel* labelCopyright = - new QLabel( QStringLiteral( "Copyright © 2014–2015 Luis Lucas and Joao Carreira" ) ); + new QLabel( QStringLiteral( "Copyright © 2014–2017 Luis Lucas and Joao Carreira" ) ); QWidget* topWidget = new QWidget; QVBoxLayout* topLayout = new QVBoxLayout; diff --git a/app/AboutDialog.h b/app/AboutDialog.h index 9d316ed..5e9c8f3 100644 --- a/app/AboutDialog.h +++ b/app/AboutDialog.h @@ -33,7 +33,7 @@ class AboutDialog : public QDialog { Q_OBJECT - public: +public: AboutDialog( QWidget* parent = 0 ); }; diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 801e71e..bf73cd2 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -136,7 +136,7 @@ IF( USE_FERVOR ) ENDIF() ENDIF() -SET_PACKAGE_PROPERTIES(Fervor PROPERTIES URL "http://ffmpeg.org/" DESCRIPTION "Fervor lib includes check for updates feature" TYPE OPTIONAL ) +SET_PACKAGE_PROPERTIES(Fervor PROPERTIES URL "https://github.com/pypt/fervor" DESCRIPTION "Fervor lib includes check for updates feature" TYPE OPTIONAL ) ADD_FEATURE_INFO(Fervor USE_FERVOR "Fervor lib includes check for updates feature.") IF( USE_QT4 ) diff --git a/app/ConfigureFormatDialog.cpp b/app/ConfigureFormatDialog.cpp index 9a9f836..f2d674c 100644 --- a/app/ConfigureFormatDialog.cpp +++ b/app/ConfigureFormatDialog.cpp @@ -72,7 +72,7 @@ QDataStream& operator>>( QDataStream& in, PlaYUVerStdResolutionVector& array ) class AddCustomFormat : public QDialog { - public: +public: AddCustomFormat( QWidget* parent = NULL ) : QDialog( parent, Qt::Dialog | Qt::WindowTitleHint ) { setWindowModality( Qt::ApplicationModal ); @@ -130,7 +130,7 @@ class AddCustomFormat : public QDialog return stdResolution; } - private: +private: QLineEdit* m_lineEdtName; QSpinBox* m_spinWidth; QSpinBox* m_spinHeight; @@ -142,7 +142,7 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget* parent ) : QDialog( paren UInt uiWidth, uiHeight; readSettings(); - for( UInt i = 0; i < aRCustomFileFormats.size(); i++ ) + for( Int i = 0; i < aRCustomFileFormats.size(); i++ ) { Name = QString::fromStdString( aRCustomFileFormats[i].shortName ); uiWidth = aRCustomFileFormats[i].uiWidth; diff --git a/app/ConfigureFormatDialog.h b/app/ConfigureFormatDialog.h index d45abd5..5727f68 100644 --- a/app/ConfigureFormatDialog.h +++ b/app/ConfigureFormatDialog.h @@ -49,7 +49,7 @@ class ConfigureFormatDialog : public QDialog { Q_OBJECT - public: +public: ConfigureFormatDialog( QWidget* parent = 0 ); Int runConfigureFormatDialog( const QString& Filename, UInt& rWidth, @@ -62,13 +62,13 @@ class ConfigureFormatDialog : public QDialog Void readSettings(); Void writeSettings(); - private Q_SLOTS: +private Q_SLOTS: void slotStandardResolutionSelected( int ); void slotResolutionChange(); void slotColorSpaceChange( int ); void slotBitsChange( int ); - private: +private: QStringList standardResolutionNames; QVector standardResolutionSizes; PlaYUVerStdResolutionVector aRCustomFileFormats; diff --git a/app/DialogSubWindowSelector.h b/app/DialogSubWindowSelector.h index 3182942..948a5f6 100644 --- a/app/DialogSubWindowSelector.h +++ b/app/DialogSubWindowSelector.h @@ -52,7 +52,7 @@ class DialogSubWindowSelector : public QDialog { Q_OBJECT - public: +public: DialogSubWindowSelector( QWidget* parent, PlaYUVerSubWindowHandle* windowManager, UInt uiCategory, @@ -61,7 +61,8 @@ class DialogSubWindowSelector : public QDialog Void selectSubWindow( SubWindowAbstract* subWindow ); QList getSelectedWindows() { return m_apcSelectedSubWindowList; } - private: + +private: UInt m_uiCategory; Int m_iMinSelectedWindows; Int m_iMaxSlectedWindows; @@ -82,7 +83,7 @@ class DialogSubWindowSelector : public QDialog Void updateSubWindowList(); Void update(); - private Q_SLOTS: +private Q_SLOTS: void toggleSubWindow( int ); void addAllSubWindow(); void removeAllSubWindow(); diff --git a/app/FramePropertiesDock.cpp b/app/FramePropertiesDock.cpp index 315e0ea..2c9e426 100644 --- a/app/FramePropertiesDock.cpp +++ b/app/FramePropertiesDock.cpp @@ -530,31 +530,31 @@ Void FramePropertiesDock::slotChannelChanged( Int channel ) switch( channel ) { - case FirstChannel: - histogramWidget->m_channelType = HistogramWidget::FirstChannelHistogram; - colorsCB->setEnabled( false ); - break; - case SecondChannel: - histogramWidget->m_channelType = HistogramWidget::SecondChannelHistogram; - colorsCB->setEnabled( false ); - break; - case ThirdChannel: - histogramWidget->m_channelType = HistogramWidget::ThirdChannelHistogram; - colorsCB->setEnabled( false ); - break; - case AlphaChannel: - histogramWidget->m_channelType = HistogramWidget::AlphaChannelHistogram; - colorsCB->setEnabled( false ); - break; - case ColorChannels: - histogramWidget->m_channelType = HistogramWidget::ColorChannelsHistogram; - colorsCB->setEnabled( true ); - break; - default: // Luminance. - // histogramWidget->m_channelType = HistogramWidget::LumaHistogram; - histogramWidget->m_channelType = HistogramWidget::FirstChannelHistogram; - colorsCB->setEnabled( false ); - break; + case FirstChannel: + histogramWidget->m_channelType = HistogramWidget::FirstChannelHistogram; + colorsCB->setEnabled( false ); + break; + case SecondChannel: + histogramWidget->m_channelType = HistogramWidget::SecondChannelHistogram; + colorsCB->setEnabled( false ); + break; + case ThirdChannel: + histogramWidget->m_channelType = HistogramWidget::ThirdChannelHistogram; + colorsCB->setEnabled( false ); + break; + case AlphaChannel: + histogramWidget->m_channelType = HistogramWidget::AlphaChannelHistogram; + colorsCB->setEnabled( false ); + break; + case ColorChannels: + histogramWidget->m_channelType = HistogramWidget::ColorChannelsHistogram; + colorsCB->setEnabled( true ); + break; + default: // Luminance. + // histogramWidget->m_channelType = HistogramWidget::LumaHistogram; + histogramWidget->m_channelType = HistogramWidget::FirstChannelHistogram; + colorsCB->setEnabled( false ); + break; } histogramWidget->update(); updateStatistiques(); @@ -570,15 +570,15 @@ Void FramePropertiesDock::slotColorsChanged( Int color ) { switch( color ) { - case AllColorsGreen: - histogramWidget->m_colorType = HistogramWidget::SecondChannelColor; - break; - case AllColorsBlue: - histogramWidget->m_colorType = HistogramWidget::ThirdChannelColor; - break; - default: // Red. - histogramWidget->m_colorType = HistogramWidget::FirstChannelColor; - break; + case AllColorsGreen: + histogramWidget->m_colorType = HistogramWidget::SecondChannelColor; + break; + case AllColorsBlue: + histogramWidget->m_colorType = HistogramWidget::ThirdChannelColor; + break; + default: // Red. + histogramWidget->m_colorType = HistogramWidget::FirstChannelColor; + break; } histogramWidget->update(); diff --git a/app/FramePropertiesDock.h b/app/FramePropertiesDock.h index 1f69deb..3271d07 100644 --- a/app/FramePropertiesDock.h +++ b/app/FramePropertiesDock.h @@ -40,7 +40,7 @@ class FramePropertiesDock : public QWidget { Q_OBJECT - public: +public: FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitch ); ~FramePropertiesDock(); @@ -51,7 +51,7 @@ class FramePropertiesDock : public QWidget Void reset(); Void stopHistogram(); - private: +private: enum ColorChannel { LuminosityChannel = 0, @@ -107,7 +107,7 @@ class FramePropertiesDock : public QWidget Void updateStatistiques(); Void updateDataHistogram(); - private Q_SLOTS: +private Q_SLOTS: void slotRefreshOptions( int range ); void slotHistogramComputationFailed( void ); void slotChannelChanged( int channel ); diff --git a/app/GridManager.cpp b/app/GridManager.cpp index d78e5f6..594b446 100644 --- a/app/GridManager.cpp +++ b/app/GridManager.cpp @@ -65,71 +65,71 @@ void GridManager::drawGrid( QPixmap& image, const QRect& area, QPainter* painter style = Solid; switch( style ) { - case IntersectionDot: - case IntersectionCross: + case IntersectionDot: + case IntersectionCross: + { + painter->setPen( mainPen ); + // Draw crosses or dots on intersections + for( int x = offsetx; x <= area.right(); x += hSpacing ) { - painter->setPen( mainPen ); - // Draw crosses or dots on intersections - for( int x = offsetx; x <= area.right(); x += hSpacing ) - { - if( x >= imageWidth ) - break; + if( x >= imageWidth ) + break; - for( int y = offsety; y <= area.bottom(); y += vSpacing ) - { - if( y >= imageHeight ) - break; - - if( x >= area.x() && y >= area.y() ) - { - if( style == IntersectionDot ) - painter->drawPoint( x, y ); // Dot - else - { // Crosses: - painter->drawLine( x, y - 1, x, y + 1 ); // Ver.line - painter->drawLine( x - 1, y, x + 1, y ); // Hor.line - } - } - } - } - break; - } - case Dashed: - { - // Change pen to the dashed line - mainPen.setStyle( Qt::DashLine ); - } - default: // Solid: - { - painter->setPen( mainPen ); - - // Draw vertical line - for( int x = offsetx; x <= area.right(); x += hSpacing ) - { - if( x >= imageWidth ) - break; - - if( x >= area.x() ) - { - // Always draw the full line otherwise the line stippling - // varies with the location of view area and we get glitchy - // patterns. - painter->drawLine( x, 0, x, imageHeight - 1 ); - } - } - // Draw horizontal line for( int y = offsety; y <= area.bottom(); y += vSpacing ) { if( y >= imageHeight ) break; - if( y >= area.y() ) + if( x >= area.x() && y >= area.y() ) { - painter->drawLine( 0, y, imageWidth - 1, y ); + if( style == IntersectionDot ) + painter->drawPoint( x, y ); // Dot + else + { // Crosses: + painter->drawLine( x, y - 1, x, y + 1 ); // Ver.line + painter->drawLine( x - 1, y, x + 1, y ); // Hor.line + } } } - break; } + break; + } + case Dashed: + { + // Change pen to the dashed line + mainPen.setStyle( Qt::DashLine ); + } + default: // Solid: + { + painter->setPen( mainPen ); + + // Draw vertical line + for( int x = offsetx; x <= area.right(); x += hSpacing ) + { + if( x >= imageWidth ) + break; + + if( x >= area.x() ) + { + // Always draw the full line otherwise the line stippling + // varies with the location of view area and we get glitchy + // patterns. + painter->drawLine( x, 0, x, imageHeight - 1 ); + } + } + // Draw horizontal line + for( int y = offsety; y <= area.bottom(); y += vSpacing ) + { + if( y >= imageHeight ) + break; + + if( y >= area.y() ) + { + painter->drawLine( 0, y, imageWidth - 1, y ); + } + } + break; + } } } diff --git a/app/GridManager.h b/app/GridManager.h index 578aab3..33f5386 100644 --- a/app/GridManager.h +++ b/app/GridManager.h @@ -41,7 +41,7 @@ class QPainter; */ class GridManager { - public: +public: enum Style { IntersectionDot = 0, @@ -92,7 +92,7 @@ class GridManager */ QPoint nearPos( int x = -1, int y = -1 ); - private: +private: UInt m_uiHSpace; UInt m_uiVSpace; QColor m_cGridColor; diff --git a/app/HistogramWidget.cpp b/app/HistogramWidget.cpp index 6b404d5..c2fea98 100644 --- a/app/HistogramWidget.cpp +++ b/app/HistogramWidget.cpp @@ -33,11 +33,11 @@ class HistogramWorker : public QThread { - private: +private: QObject* m_parent; PlaYUVerFrame* m_pcFrame; - public: +public: HistogramWorker( QObject* parent ) { m_pcFrame = NULL; @@ -76,7 +76,7 @@ class HistogramWorker : public QThread */ class EventData : public QEvent { - public: + public: EventData() : QEvent( QEvent::User ) { starting = false; @@ -105,7 +105,7 @@ const QBrush g_eColorPallet[][3] = { class HistogramWidgetPrivate { - public: +public: enum RepaintType { HistogramNone = 0, // No current histogram values calculation. @@ -515,39 +515,39 @@ Void HistogramWidget::paintEvent( QPaintEvent* ) switch( m_channelType ) { - case HistogramWidget::FirstChannelHistogram: // Y channel. - max = frame->getMaximum( LUMA ); - break; - case HistogramWidget::SecondChannelHistogram: // Cb channel. - max = frame->getMaximum( CHROMA_U ); - break; - case HistogramWidget::ThirdChannelHistogram: // Cr channel. - max = frame->getMaximum( CHROMA_V ); - break; - case HistogramWidget::AlphaChannelHistogram: // Alpha channel. - max = frame->getMaximum( COLOR_A ); - break; + case HistogramWidget::FirstChannelHistogram: // Y channel. + max = frame->getMaximum( LUMA ); + break; + case HistogramWidget::SecondChannelHistogram: // Cb channel. + max = frame->getMaximum( CHROMA_U ); + break; + case HistogramWidget::ThirdChannelHistogram: // Cr channel. + max = frame->getMaximum( CHROMA_V ); + break; + case HistogramWidget::AlphaChannelHistogram: // Alpha channel. + max = frame->getMaximum( COLOR_A ); + break; - case HistogramWidget::ColorChannelsHistogram: // All color channels. - max = qMax( qMax( frame->getMaximum( LUMA ), frame->getMaximum( CHROMA_U ) ), - frame->getMaximum( CHROMA_V ) ); - break; - // case HistogramWidget::LumaHistogram: // Luminance. - // max = frame->getMaximum( LUMA ); - // break; + case HistogramWidget::ColorChannelsHistogram: // All color channels. + max = qMax( qMax( frame->getMaximum( LUMA ), frame->getMaximum( CHROMA_U ) ), + frame->getMaximum( CHROMA_V ) ); + break; + // case HistogramWidget::LumaHistogram: // Luminance. + // max = frame->getMaximum( LUMA ); + // break; } switch( m_scaleType ) { - case HistogramWidget::LinScaleHistogram: - break; + case HistogramWidget::LinScaleHistogram: + break; - case HistogramWidget::LogScaleHistogram: - if( max > 0.0 ) - max = log( max ); - else - max = 1.0; - break; + case HistogramWidget::LogScaleHistogram: + if( max > 0.0 ) + max = log( max ); + else + max = 1.0; + break; } // From Qt 4.0, QWidget automatically double-buffers its painting, @@ -579,26 +579,26 @@ Void HistogramWidget::paintEvent( QPaintEvent* ) switch( m_channelType ) { - case HistogramWidget::FirstChannelHistogram: // Y channel. - v = frame->getHistogramValue( LUMA, i++ ); - break; - case HistogramWidget::SecondChannelHistogram: // Cb channel. - v = frame->getHistogramValue( CHROMA_U, i++ ); - break; - case HistogramWidget::ThirdChannelHistogram: // Cr channel. - v = frame->getHistogramValue( CHROMA_V, i++ ); - break; - case HistogramWidget::AlphaChannelHistogram: // Alpha channel. - v = frame->getHistogramValue( COLOR_A, i++ ); - break; - case HistogramWidget::ColorChannelsHistogram: // All color. - vr = frame->getHistogramValue( LUMA, i ); - vg = frame->getHistogramValue( CHROMA_U, i ); - vb = frame->getHistogramValue( CHROMA_V, i++ ); - break; - // case HistogramWidget::LumaHistogram: // Luminance. - // v = frame->getHistogramValue( LUMA, i++ ); - // break; + case HistogramWidget::FirstChannelHistogram: // Y channel. + v = frame->getHistogramValue( LUMA, i++ ); + break; + case HistogramWidget::SecondChannelHistogram: // Cb channel. + v = frame->getHistogramValue( CHROMA_U, i++ ); + break; + case HistogramWidget::ThirdChannelHistogram: // Cr channel. + v = frame->getHistogramValue( CHROMA_V, i++ ); + break; + case HistogramWidget::AlphaChannelHistogram: // Alpha channel. + v = frame->getHistogramValue( COLOR_A, i++ ); + break; + case HistogramWidget::ColorChannelsHistogram: // All color. + vr = frame->getHistogramValue( LUMA, i ); + vg = frame->getHistogramValue( CHROMA_U, i ); + vb = frame->getHistogramValue( CHROMA_V, i++ ); + break; + // case HistogramWidget::LumaHistogram: // Luminance. + // v = frame->getHistogramValue( LUMA, i++ ); + // break; } if( m_channelType != HistogramWidget::ColorChannelsHistogram ) @@ -621,48 +621,48 @@ Void HistogramWidget::paintEvent( QPaintEvent* ) { switch( m_scaleType ) { - case HistogramWidget::LinScaleHistogram: - y = (int)( ( wHeight * value ) / max ); - break; + case HistogramWidget::LinScaleHistogram: + y = (int)( ( wHeight * value ) / max ); + break; - case HistogramWidget::LogScaleHistogram: - if( value <= 0.0 ) - value = 1.0; - y = (int)( ( wHeight * log( value ) ) / max ); - break; + case HistogramWidget::LogScaleHistogram: + if( value <= 0.0 ) + value = 1.0; + y = (int)( ( wHeight * log( value ) ) / max ); + break; - default: - y = 0; - break; + default: + y = 0; + break; } } else { switch( m_scaleType ) { - case HistogramWidget::LinScaleHistogram: - yr = (int)( ( wHeight * value_r ) / max ); - yg = (int)( ( wHeight * value_g ) / max ); - yb = (int)( ( wHeight * value_b ) / max ); - break; + case HistogramWidget::LinScaleHistogram: + yr = (int)( ( wHeight * value_r ) / max ); + yg = (int)( ( wHeight * value_g ) / max ); + yb = (int)( ( wHeight * value_b ) / max ); + break; - case HistogramWidget::LogScaleHistogram: - if( value_r <= 0.0 ) - value_r = 1.0; - if( value_g <= 0.0 ) - value_g = 1.0; - if( value_b <= 0.0 ) - value_b = 1.0; - yr = (int)( ( wHeight * log( value_r ) ) / max ); - yg = (int)( ( wHeight * log( value_g ) ) / max ); - yb = (int)( ( wHeight * log( value_b ) ) / max ); - break; + case HistogramWidget::LogScaleHistogram: + if( value_r <= 0.0 ) + value_r = 1.0; + if( value_g <= 0.0 ) + value_g = 1.0; + if( value_b <= 0.0 ) + value_b = 1.0; + yr = (int)( ( wHeight * log( value_r ) ) / max ); + yg = (int)( ( wHeight * log( value_g ) ) / max ); + yb = (int)( ( wHeight * log( value_b ) ) / max ); + break; - default: - yr = 0; - yg = 0; - yb = 0; - break; + default: + yr = 0; + yg = 0; + yb = 0; + break; } } @@ -721,17 +721,17 @@ Void HistogramWidget::paintEvent( QPaintEvent* ) // colors channel mode? switch( m_colorType ) { - case HistogramWidget::FirstChannelColor: - p1.drawLine( x, wHeight, x, wHeight - yr ); - break; + case HistogramWidget::FirstChannelColor: + p1.drawLine( x, wHeight, x, wHeight - yr ); + break; - case HistogramWidget::SecondChannelColor: - p1.drawLine( x, wHeight, x, wHeight - yg ); - break; + case HistogramWidget::SecondChannelColor: + p1.drawLine( x, wHeight, x, wHeight - yg ); + break; - default: - p1.drawLine( x, wHeight, x, wHeight - yb ); - break; + default: + p1.drawLine( x, wHeight, x, wHeight - yb ); + break; } } else @@ -740,56 +740,56 @@ Void HistogramWidget::paintEvent( QPaintEvent* ) // colors channel mode? switch( m_colorType ) { - case HistogramWidget::FirstChannelColor: - p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight, x, wHeight - yg ); - p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight, x, wHeight - yb ); - p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight, x, wHeight - yr ); + case HistogramWidget::FirstChannelColor: + p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight, x, wHeight - yg ); + p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight, x, wHeight - yb ); + p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight, x, wHeight - yr ); - p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 ); - p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg ); - p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb ); - p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr ); + p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 ); + p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg ); + p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb ); + p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr ); - break; + break; - case HistogramWidget::SecondChannelColor: - p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight, x, wHeight - yb ); - p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight, x, wHeight - yr ); - p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight, x, wHeight - yg ); + case HistogramWidget::SecondChannelColor: + p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight, x, wHeight - yb ); + p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight, x, wHeight - yr ); + p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight, x, wHeight - yg ); - p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 ); - p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb ); - p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr ); - p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg ); + p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 ); + p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb ); + p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr ); + p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg ); - break; + break; - default: - p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight, x, wHeight - yr ); - p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight, x, wHeight - yg ); - p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight, x, wHeight - yb ); + default: + p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight, x, wHeight - yr ); + p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight, x, wHeight - yg ); + p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight, x, wHeight - yb ); - p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 ); - p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr ); - p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg ); - p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb ); + p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 ); + p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr ); + p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg ); + p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb ); - break; + break; } if( x == wWidth / 4 || x == wWidth / 2 || x == 3 * wWidth / 4 ) @@ -805,65 +805,65 @@ Void HistogramWidget::paintEvent( QPaintEvent* ) // colors channel mode? switch( m_colorType ) { - case HistogramWidget::FirstChannelColor: - p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) ); - p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight, x, wHeight - yg ); - p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) ); - p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight, x, wHeight - yb ); - p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) ); - p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight, x, wHeight - yr ); + case HistogramWidget::FirstChannelColor: + p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) ); + p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight, x, wHeight - yg ); + p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) ); + p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight, x, wHeight - yb ); + p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) ); + p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight, x, wHeight - yr ); - p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 ); - p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg ); - p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb ); - p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr ); + p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 ); + p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg ); + p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb ); + p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr ); - break; + break; - case HistogramWidget::SecondChannelColor: - p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) ); - p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight, x, wHeight - yb ); - p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) ); - p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight, x, wHeight - yr ); - p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) ); - p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight, x, wHeight - yg ); + case HistogramWidget::SecondChannelColor: + p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) ); + p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight, x, wHeight - yb ); + p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) ); + p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight, x, wHeight - yr ); + p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) ); + p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight, x, wHeight - yg ); - p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 ); - p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb ); - p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr ); - p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg ); + p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 ); + p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb ); + p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr ); + p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg ); - break; + break; - default: - p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) ); - p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight, x, wHeight - yr ); - p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) ); - p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight, x, wHeight - yg ); - p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) ); - p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight, x, wHeight - yb ); + default: + p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) ); + p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight, x, wHeight - yr ); + p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) ); + p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight, x, wHeight - yg ); + p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) ); + p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight, x, wHeight - yb ); - p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 ); - p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) ); - p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr ); - p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg ); - p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb ); + p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 ); + p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) ); + p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr ); + p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg ); + p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb ); - break; + break; } if( x == wWidth / 4 || x == wWidth / 2 || x == 3 * wWidth / 4 ) @@ -884,26 +884,26 @@ Void HistogramWidget::paintEvent( QPaintEvent* ) { switch( m_channelType ) { - case HistogramWidget::FirstChannelHistogram: - guidePos = d->colorGuide.red(); - break; + case HistogramWidget::FirstChannelHistogram: + guidePos = d->colorGuide.red(); + break; - case HistogramWidget::SecondChannelHistogram: - guidePos = d->colorGuide.green(); - break; + case HistogramWidget::SecondChannelHistogram: + guidePos = d->colorGuide.green(); + break; - case HistogramWidget::ThirdChannelHistogram: - guidePos = d->colorGuide.blue(); - break; + case HistogramWidget::ThirdChannelHistogram: + guidePos = d->colorGuide.blue(); + break; - // case HistogramWidget::LumaHistogram: - // guidePos = qMax( qMax( d->colorGuide.red(), d->colorGuide.green() - // ), d->colorGuide.blue() ); - // break; + // case HistogramWidget::LumaHistogram: + // guidePos = qMax( qMax( d->colorGuide.red(), d->colorGuide.green() + // ), d->colorGuide.blue() ); + // break; - default: // Alpha. - guidePos = -1; - break; + default: // Alpha. + guidePos = -1; + break; } if( guidePos != -1 ) diff --git a/app/HistogramWidget.h b/app/HistogramWidget.h index 53ff76d..11d73d7 100644 --- a/app/HistogramWidget.h +++ b/app/HistogramWidget.h @@ -41,7 +41,7 @@ class HistogramWidget : public QWidget { Q_OBJECT - public: +public: enum HistogramChannel { /** Luminance */ @@ -95,7 +95,7 @@ class HistogramWidget : public QWidget }; Q_DECLARE_FLAGS( HistogramOptions, HistogramOption ) - public: +public: /** * Constructor without image data. Needed to use @p updateData() method * after to create instance. @@ -122,7 +122,7 @@ class HistogramWidget : public QWidget Void reset(); - public: +public: /** Channel type to draw */ Int m_channelType; /** Scale to use for drawing */ @@ -141,30 +141,30 @@ class HistogramWidget : public QWidget // PlaYUVerFrameStats* m_selectionHistogram; PlaYUVerFrame* m_selectionImage; - Q_SIGNALS: +Q_SIGNALS: void signalIntervalChanged( int min, int max ); void signalMaximumValueChanged( int ); void signalHistogramComputationDone( int ); void signalHistogramComputationFailed( void ); - public Q_SLOTS: +public Q_SLOTS: void slotMinValueChanged( int min ); void slotMaxValueChanged( int max ); - protected slots: +protected slots: void slotBlinkTimerDone( void ); - protected: +protected: Void paintEvent( QPaintEvent* ); Void mousePressEvent( QMouseEvent* e ); Void mouseReleaseEvent( QMouseEvent* e ); Void mouseMoveEvent( QMouseEvent* e ); - private: +private: Void customEvent( QEvent* event ); Void notifyValuesChanged(); - private: +private: HistogramWidgetPrivate* d; }; diff --git a/app/ModuleHandleDock.cpp b/app/ModuleHandleDock.cpp index f96cda1..aac0ce9 100644 --- a/app/ModuleHandleDock.cpp +++ b/app/ModuleHandleDock.cpp @@ -53,9 +53,7 @@ ModuleHandleDock::ModuleHandleDock( QWidget* parent, PlaYUVerAppModuleIf* module setEnabled( true ); } -ModuleHandleDock::~ModuleHandleDock() -{ -} +ModuleHandleDock::~ModuleHandleDock() {} Void ModuleHandleDock::setModulueReturnValue( Double value ) { diff --git a/app/ModuleHandleDock.h b/app/ModuleHandleDock.h index 4ae5819..ed00495 100644 --- a/app/ModuleHandleDock.h +++ b/app/ModuleHandleDock.h @@ -39,7 +39,7 @@ class PlaYUVerAppModuleIf; class ModuleHandleDock : public QWidget { Q_OBJECT - public: +public: ModuleHandleDock( QWidget* parent, PlaYUVerAppModuleIf* moduleIf ); ~ModuleHandleDock(); @@ -47,14 +47,14 @@ class ModuleHandleDock : public QWidget QSize sizeHint() const; - private: +private: PlaYUVerAppModuleIf* m_pcCurrModuleIf; Bool m_bIsVisible; QLabel* labelModulueValueLabel; QLabel* labelModulueReturnValue; - public Q_SLOTS: +public Q_SLOTS: void visibilityChangedSlot( bool ); }; diff --git a/app/ModulesHandle.cpp b/app/ModulesHandle.cpp index 0c13f68..7cd55ec 100644 --- a/app/ModulesHandle.cpp +++ b/app/ModulesHandle.cpp @@ -43,9 +43,7 @@ ModulesHandle::ModulesHandle( QWidget* parent, setParent( m_pcParent ); } -ModulesHandle::~ModulesHandle() -{ -} +ModulesHandle::~ModulesHandle() {} Void ModulesHandle::createActions() { @@ -232,16 +230,16 @@ Void ModulesHandle::processOpt( Int index ) PlaYUVerAppModuleIf* pcCurrModule = pcCurrentModule; switch( index ) { - case INVALID_OPT: - break; - case SWAP_FRAMES_ACT: - swapModulesWindowsIf( pcCurrModule ); - break; - case APPLY_ALL_ACT: - applyAllModuleIf( pcCurrModule ); - break; - default: - Q_ASSERT( 0 ); + case INVALID_OPT: + break; + case SWAP_FRAMES_ACT: + swapModulesWindowsIf( pcCurrModule ); + break; + case APPLY_ALL_ACT: + applyAllModuleIf( pcCurrModule ); + break; + default: + Q_ASSERT( 0 ); } } emit changed(); diff --git a/app/ModulesHandle.h b/app/ModulesHandle.h index 12afbbf..5a1e090 100644 --- a/app/ModulesHandle.h +++ b/app/ModulesHandle.h @@ -47,7 +47,7 @@ class SubWindowHandle; class ModulesHandle : public QWidget { Q_OBJECT - public: +public: ModulesHandle( QWidget*, PlaYUVerSubWindowHandle*, VideoHandle* ); ~ModulesHandle(); @@ -65,7 +65,7 @@ class ModulesHandle : public QWidget Bool isPlaying = false, Bool disableThreads = false ); - private: +private: QWidget* m_pcParent; PlaYUVerSubWindowHandle* m_pcMainWindowManager; VideoHandle* m_appModuleVideo; @@ -103,10 +103,10 @@ class ModulesHandle : public QWidget Void customEvent( QEvent* event ); - Q_SIGNALS: +Q_SIGNALS: void changed(); - private Q_SLOTS: +private Q_SLOTS: void loadExternalModule(); void activateModule(); void processOpt( int index ); diff --git a/app/ModulesHandleOptDialog.cpp b/app/ModulesHandleOptDialog.cpp index d316897..383d87e 100644 --- a/app/ModulesHandleOptDialog.cpp +++ b/app/ModulesHandleOptDialog.cpp @@ -34,7 +34,7 @@ class OpionConfiguration : public QWidget { - public: +public: OpionConfiguration( OptionBase* option ) { m_pcChecked = NULL; @@ -68,7 +68,8 @@ class OpionConfiguration : public QWidget return m_pcValue->text(); } const String& getName() { return m_cName; } - private: + +private: QLineEdit* m_pcValue; QCheckBox* m_pcChecked; QLabel* m_pcDescription; diff --git a/app/ModulesHandleOptDialog.h b/app/ModulesHandleOptDialog.h index 2451121..97760fc 100644 --- a/app/ModulesHandleOptDialog.h +++ b/app/ModulesHandleOptDialog.h @@ -40,11 +40,11 @@ class ModulesHandleOptDialog : public QDialog { Q_OBJECT - public: +public: ModulesHandleOptDialog( QWidget* parent, PlaYUVerAppModuleIf* pcCurrModuleIf ); Int runConfiguration(); - private: +private: PlaYUVerAppModuleIf* m_pcCurrModuleIf; QVector m_apcOptionList; }; diff --git a/app/PlaYUVerApp.cpp b/app/PlaYUVerApp.cpp index c1ef172..35d128f 100644 --- a/app/PlaYUVerApp.cpp +++ b/app/PlaYUVerApp.cpp @@ -152,28 +152,28 @@ Void PlaYUVerApp::closeEvent( QCloseEvent* event ) } switch( msgBoxCloseRet ) { - case QMessageBox::Yes: - mayCloseAll = true; - for( Int i = 0; i < subWindowList.size(); i++ ) - { - mayCloseAll &= subWindowList.at( i )->mayClose(); - } + case QMessageBox::Yes: + mayCloseAll = true; + for( Int i = 0; i < subWindowList.size(); i++ ) + { + mayCloseAll &= subWindowList.at( i )->mayClose(); + } - if( mayCloseAll ) - { - // m_pcPlayingTimer->stop(); - closeAll(); - writeSettings(); - event->accept(); - } - else - { - event->ignore(); - } - break; - case QMessageBox::No: - default: + if( mayCloseAll ) + { + // m_pcPlayingTimer->stop(); + closeAll(); + writeSettings(); + event->accept(); + } + else + { event->ignore(); + } + break; + case QMessageBox::No: + default: + event->ignore(); } } @@ -262,14 +262,17 @@ Void PlaYUVerApp::open() for( UInt i = 0; i < supportedFmts.size(); i++ ) { - QString currFmt; - supported.append( " *." ); - supported.append( QString::fromStdString( supportedFmts[i].formatExt ) ); - currFmt.append( QString::fromStdString( supportedFmts[i].formatName ) ); - currFmt.append( " (*." ); - currFmt.append( QString::fromStdString( supportedFmts[i].formatExt ) ); - currFmt.append( ")" ); - formatsList << currFmt; + if( supportedFmts[i].formatExt != "" ) + { + QString currFmt; + supported.append( " *." ); + supported.append( QString::fromStdString( supportedFmts[i].formatExt ) ); + currFmt.append( QString::fromStdString( supportedFmts[i].formatName ) ); + currFmt.append( " (*." ); + currFmt.append( QString::fromStdString( supportedFmts[i].formatExt ) ); + currFmt.append( ")" ); + formatsList << currFmt; + } } supported.append( " )" ); @@ -389,7 +392,8 @@ Void PlaYUVerApp::reload() Void PlaYUVerApp::reloadAll() { UInt windowCategoryOrder[] = { - SubWindowAbstract::VIDEO_STREAM_SUBWINDOW, SubWindowAbstract::MODULE_SUBWINDOW, + SubWindowAbstract::VIDEO_STREAM_SUBWINDOW, + SubWindowAbstract::MODULE_SUBWINDOW, SubWindowAbstract::MODULE_SUBWINDOW, }; @@ -717,7 +721,7 @@ Void PlaYUVerApp::createActions() m_appModuleExtensions->createActions(); m_pcWindowHandle->createActions(); -// ------------ About ------------ + // ------------ About ------------ #ifdef USE_FERVOR m_arrayActions[UPDATE_ACT] = new QAction( tr( "&Update" ), this ); diff --git a/app/PlaYUVerApp.h b/app/PlaYUVerApp.h index 0e041b0..7dcf84c 100644 --- a/app/PlaYUVerApp.h +++ b/app/PlaYUVerApp.h @@ -69,19 +69,19 @@ class PlaYUVerApp : public QMainWindow { Q_OBJECT - public: +public: PlaYUVerApp(); Bool parseArgs( Int argc, Char* argv[] ); Void loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo = NULL ); - public Q_SLOTS: +public Q_SLOTS: void printMessage( const QString& msg ); void printMessage( const QString& msg, UInt logLevel ); - protected: +protected: Void closeEvent( QCloseEvent* event ); - private Q_SLOTS: +private Q_SLOTS: void about(); @@ -115,7 +115,7 @@ class PlaYUVerApp : public QMainWindow void update(); void updateZoomFactorSBox(); - private: +private: PlaYUVerAppAdaptor* m_pDBusAdaptor; PlaYUVerOptions* m_pcCmdParser; /** diff --git a/app/PlaYUVerAppAdaptor.cpp b/app/PlaYUVerAppAdaptor.cpp index bdddbbb..e6211e8 100644 --- a/app/PlaYUVerAppAdaptor.cpp +++ b/app/PlaYUVerAppAdaptor.cpp @@ -30,8 +30,10 @@ PlaYUVerAppAdaptor::PlaYUVerAppAdaptor( PlaYUVerApp* app ) : QDBusAbstractAdaptor( app ), m_app( app ) { // application dbus interface - QDBusConnection::sessionBus().registerObject( QStringLiteral( PLAYUVER_DBUS_PATH ), this, - QDBusConnection::ExportAllSlots ); + Bool isRegistered = QDBusConnection::sessionBus().registerObject( + QStringLiteral( PLAYUVER_DBUS_PATH ), this, QDBusConnection::ExportAllSlots ); + + Q_ASSERT( isRegistered == true ); } PlaYUVerAppAdaptor::~PlaYUVerAppAdaptor() diff --git a/app/PlaYUVerAppAdaptor.h b/app/PlaYUVerAppAdaptor.h index d57236a..94d8566 100644 --- a/app/PlaYUVerAppAdaptor.h +++ b/app/PlaYUVerAppAdaptor.h @@ -33,16 +33,16 @@ #include #define PLAYUVER_DBUS_SESSION_NAME "org.pixlra.PlaYUVer.application" -#define PLAYUVER_DBUS_PATH "/MainApplication" +#define PLAYUVER_DBUS_PATH "/" class PlaYUVerApp; class PlaYUVerAppAdaptor : public QDBusAbstractAdaptor { Q_OBJECT - Q_CLASSINFO( "D-Bus Interface", "org.pixlra.PlaYUVer.application" ) + Q_CLASSINFO( "D-Bus Interface", PLAYUVER_DBUS_SESSION_NAME ) Q_PROPERTY( QString activeSession READ activeSession ) - public: +public: PlaYUVerAppAdaptor( PlaYUVerApp* app ); ~PlaYUVerAppAdaptor(); /** @@ -50,7 +50,7 @@ class PlaYUVerAppAdaptor : public QDBusAbstractAdaptor */ // void emitExiting(); // void emitDocumentClosed(const QString &token); - public Q_SLOTS: +public Q_SLOTS: /** * open a file with given url and encoding * will get view created @@ -65,7 +65,7 @@ class PlaYUVerAppAdaptor : public QDBusAbstractAdaptor */ void activate(); - Q_SIGNALS: +Q_SIGNALS: /** * Notify the world that this kate instance is exiting. * All apps should stop using the dbus interface of this instance after this @@ -73,10 +73,10 @@ class PlaYUVerAppAdaptor : public QDBusAbstractAdaptor */ // void exiting(); // void documentClosed(const QString &token); - public: +public: QString activeSession(); - private: +private: PlaYUVerApp* m_app; }; diff --git a/app/PlaYUVerAppModuleIf.cpp b/app/PlaYUVerAppModuleIf.cpp index 9d5c38a..fd8a1ac 100644 --- a/app/PlaYUVerAppModuleIf.cpp +++ b/app/PlaYUVerAppModuleIf.cpp @@ -152,23 +152,23 @@ Void PlaYUVerAppModuleIf::show() { switch( m_pcModule->m_iModuleType ) { - case FRAME_PROCESSING_MODULE: - if( m_pcDisplaySubWindow ) - { - m_pcDisplaySubWindow->setCurrFrame( m_pcProcessedFrame ); - m_pcDisplaySubWindow->setFillWindow( false ); - m_pcDisplaySubWindow->clearWindowBusy(); - } - else - { - m_pcSubWindow[0]->setCurrFrame( m_pcProcessedFrame ); - m_pcSubWindow[0]->setFillWindow( false ); - m_pcSubWindow[0]->clearWindowBusy(); - } - break; - case FRAME_MEASUREMENT_MODULE: - m_pcModuleDock->setModulueReturnValue( m_dMeasurementResult ); - break; + case FRAME_PROCESSING_MODULE: + if( m_pcDisplaySubWindow ) + { + m_pcDisplaySubWindow->setCurrFrame( m_pcProcessedFrame ); + m_pcDisplaySubWindow->setFillWindow( false ); + m_pcDisplaySubWindow->clearWindowBusy(); + } + else + { + m_pcSubWindow[0]->setCurrFrame( m_pcProcessedFrame ); + m_pcSubWindow[0]->setFillWindow( false ); + m_pcSubWindow[0]->clearWindowBusy(); + } + break; + case FRAME_MEASUREMENT_MODULE: + m_pcModuleDock->setModulueReturnValue( m_dMeasurementResult ); + break; } } diff --git a/app/PlaYUVerAppModuleIf.h b/app/PlaYUVerAppModuleIf.h index 4483e27..87c52af 100644 --- a/app/PlaYUVerAppModuleIf.h +++ b/app/PlaYUVerAppModuleIf.h @@ -52,7 +52,7 @@ class PlaYUVerAppModuleIf friend class ModuleHandleDock; friend class ModulesHandleOptDialog; - private: +private: Bool m_bIsRunning; Bool m_bSuccess; @@ -70,10 +70,10 @@ class PlaYUVerAppModuleIf PlaYUVerFrame* m_pcProcessedFrame; Double m_dMeasurementResult; - public: +public: class EventData : public QEvent { - public: + public: EventData( bool success, PlaYUVerAppModuleIf* module ) : QEvent( QEvent::User ) { m_bSuccess = success; @@ -101,7 +101,7 @@ class PlaYUVerAppModuleIf Void show(); Void destroy(); - protected: +protected: virtual void run(); }; diff --git a/app/PlaYUVerMdiSubWindow.h b/app/PlaYUVerMdiSubWindow.h index f622de7..8ced621 100644 --- a/app/PlaYUVerMdiSubWindow.h +++ b/app/PlaYUVerMdiSubWindow.h @@ -33,13 +33,13 @@ class PlaYUVerMdiSubWindow : public QMdiSubWindow { Q_OBJECT - public: +public: PlaYUVerMdiSubWindow( QWidget* parent = 0 ); - Q_SIGNALS: +Q_SIGNALS: void aboutToClose( PlaYUVerMdiSubWindow* ); - protected: +protected: QSize sizeHint() const; void closeEvent( QCloseEvent* event ); }; diff --git a/app/PlaYUVerSubWindowHandle.cpp b/app/PlaYUVerSubWindowHandle.cpp index 8132375..e091446 100644 --- a/app/PlaYUVerSubWindowHandle.cpp +++ b/app/PlaYUVerSubWindowHandle.cpp @@ -42,7 +42,7 @@ class PlaYUVerMdiArea : public QMdiArea { - public: +public: PlaYUVerMdiArea( QWidget* parent = 0 ) : QMdiArea( parent ), m_pixmapLogo( ":/images/playuver-backgroud-logo.png" ) { @@ -57,7 +57,7 @@ class PlaYUVerMdiArea : public QMdiArea update(); } - protected: +protected: void paintEvent( QPaintEvent* event ) { QMdiArea::paintEvent( event ); @@ -76,7 +76,7 @@ class PlaYUVerMdiArea : public QMdiArea // QPoint bottomLeftCorner( 0, viewport()->height() ); } - private: +private: QVector m_acLogMessages; QPixmap m_pixmapLogo; }; @@ -177,8 +177,8 @@ Void PlaYUVerSubWindowHandle::setWindowMode( Int iWindowMode ) // m_pcApp->resize( m_cMdiModeWindowSize ); if( m_pcActiveWindow ) { - m_pcApp->setWindowTitle( QApplication::applicationName() + " :: " + - m_pcActiveWindow->getWindowName() ); + m_pcApp->setWindowTitle( QApplication::applicationName() + + " :: " + m_pcActiveWindow->getWindowName() ); } } m_iWindowMode = iWindowMode; @@ -215,8 +215,8 @@ Void PlaYUVerSubWindowHandle::updateActiveSubWindow( SubWindowAbstract* window ) } if( m_pcActiveWindow ) { - m_pcApp->setWindowTitle( QApplication::applicationName() + " :: " + - m_pcActiveWindow->getWindowName() ); + m_pcApp->setWindowTitle( QApplication::applicationName() + + " :: " + m_pcActiveWindow->getWindowName() ); } } } diff --git a/app/PlaYUVerSubWindowHandle.h b/app/PlaYUVerSubWindowHandle.h index 5865e02..5ee3077 100644 --- a/app/PlaYUVerSubWindowHandle.h +++ b/app/PlaYUVerSubWindowHandle.h @@ -46,7 +46,7 @@ class PlaYUVerSubWindowHandle : public QWidget { Q_OBJECT - public: +public: PlaYUVerSubWindowHandle( QWidget* parent ); Void processLogMsg( const QString& msg ); @@ -71,7 +71,7 @@ class PlaYUVerSubWindowHandle : public QWidget MDISUBWINDOWMODE = 1, }; - private: +private: PlaYUVerApp* m_pcApp; Int m_iWindowMode; QList m_apcSubWindowList; @@ -111,7 +111,7 @@ class PlaYUVerSubWindowHandle : public QWidget Void resetWindowMode(); Void removeSubWindow( Int windowIdx ); - public Q_SLOTS: +public Q_SLOTS: void setWindowMode( int iWindowMode ); void updateActiveSubWindow( SubWindowAbstract* window = 0 ); void setActiveSubWindow( QWidget* window ); @@ -123,7 +123,7 @@ class PlaYUVerSubWindowHandle : public QWidget void cascadeSubWindows(); void updateMenu(); - Q_SIGNALS: +Q_SIGNALS: void changed(); void windowActivated(); }; diff --git a/app/PlotSubWindow.cpp b/app/PlotSubWindow.cpp index 6d26720..f7008d5 100644 --- a/app/PlotSubWindow.cpp +++ b/app/PlotSubWindow.cpp @@ -135,9 +135,7 @@ Void PlotSubWindow::zoomToFit() normalSize(); } -Void PlotSubWindow::zoomToFactor( Double factor, QPoint center ) -{ -} +Void PlotSubWindow::zoomToFactor( Double factor, QPoint center ) {} Void PlotSubWindow::scaleView( Double scale, QPoint center ) { diff --git a/app/PlotSubWindow.h b/app/PlotSubWindow.h index 8d5780d..d30931c 100644 --- a/app/PlotSubWindow.h +++ b/app/PlotSubWindow.h @@ -40,7 +40,7 @@ class PlotSubWindow : public SubWindowAbstract { Q_OBJECT - private: +private: QCustomPlot* m_cPlotArea; QVector m_arrayColorList; @@ -55,7 +55,7 @@ class PlotSubWindow : public SubWindowAbstract Double m_dScaleFactor; Int m_iNumberPlots; - public: +public: PlotSubWindow( const QString& windowTitle, QWidget* parent = NULL ); ~PlotSubWindow(); diff --git a/app/ProgressBar.h b/app/ProgressBar.h index 5a4079a..a8f4114 100644 --- a/app/ProgressBar.h +++ b/app/ProgressBar.h @@ -35,12 +35,12 @@ class ProgressBar : public QWidget { Q_OBJECT - public: +public: ProgressBar( QWidget* parent, UInt maxValue ); Void incrementProgress( UInt ); - private: +private: UInt m_uiTotalProgress; UInt m_uiProgress; QProgressBar* m_pcProgressBar; diff --git a/app/QualityHandle.cpp b/app/QualityHandle.cpp index 976776c..c0cdee3 100644 --- a/app/QualityHandle.cpp +++ b/app/QualityHandle.cpp @@ -39,9 +39,7 @@ QualityHandle::QualityHandle( QWidget* parent, PlaYUVerSubWindowHandle* windowMa { } -QualityHandle::~QualityHandle() -{ -} +QualityHandle::~QualityHandle() {} Void QualityHandle::createActions() { @@ -190,7 +188,7 @@ Void QualityHandle::measureQuality( QVector apcWindowList ) ProgressBar* pcProgressBar = new ProgressBar( m_pcParet, numberOfFrames ); - padQualityValues = new QVector[ numberOfWindows + 1 ]; + padQualityValues = new QVector[numberOfWindows + 1]; PlaYUVerFrame* pcReferenceFrame; PlaYUVerFrame* pcCurrFrame; diff --git a/app/QualityHandle.h b/app/QualityHandle.h index d36c97b..3c3f6dd 100644 --- a/app/QualityHandle.h +++ b/app/QualityHandle.h @@ -42,7 +42,7 @@ class VideoSubWindow; class QualityHandle : public QWidget { Q_OBJECT - public: +public: QualityHandle( QWidget*, PlaYUVerSubWindowHandle* ); ~QualityHandle(); @@ -56,7 +56,7 @@ class QualityHandle : public QWidget Void update( VideoSubWindow* currSubWindow ); - private: +private: QWidget* m_pcParet; PlaYUVerSubWindowHandle* m_pcMainWindowManager; @@ -81,10 +81,10 @@ class QualityHandle : public QWidget QFuture m_cMeasurementResult; Void measureQuality( QVector apcWindowList ); - Q_SIGNALS: +Q_SIGNALS: void changed(); - private Q_SLOTS: +private Q_SLOTS: void slotQualityMetricChanged( int ); void slotSelectCurrentAsReference(); void slotPlotQualitySingle(); diff --git a/app/QualityMeasurementSidebar.cpp b/app/QualityMeasurementSidebar.cpp index e9a5784..73d865a 100644 --- a/app/QualityMeasurementSidebar.cpp +++ b/app/QualityMeasurementSidebar.cpp @@ -103,9 +103,7 @@ QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent, SLOT( slotQualityMetricChanged( int ) ) ); } -QualityMeasurementSidebar::~QualityMeasurementSidebar() -{ -} +QualityMeasurementSidebar::~QualityMeasurementSidebar() {} QSize QualityMeasurementSidebar::sizeHint() const { diff --git a/app/QualityMeasurementSidebar.h b/app/QualityMeasurementSidebar.h index de41690..43eb27e 100644 --- a/app/QualityMeasurementSidebar.h +++ b/app/QualityMeasurementSidebar.h @@ -43,7 +43,7 @@ class VideoSubWindow; class QualityMeasurementSidebar : public QWidget { Q_OBJECT - public: +public: QualityMeasurementSidebar( QWidget*, PlaYUVerSubWindowHandle* ); ~QualityMeasurementSidebar(); @@ -56,7 +56,7 @@ class QualityMeasurementSidebar : public QWidget Void updateSidebarData(); Void updateQualityMetric( Int ); - private: +private: PlaYUVerSubWindowHandle* m_pcMainWindowManager; QVector m_pcVideoWindowList; @@ -75,10 +75,10 @@ class QualityMeasurementSidebar : public QWidget HistogramWidget* histogramWidget; - Q_SIGNALS: +Q_SIGNALS: void signalQualityMetricChanged( int ); - private Q_SLOTS: +private Q_SLOTS: void slotReferenceChanged( int ); void slotQualityMetricChanged( int ); }; diff --git a/app/SeekStreamDialog.h b/app/SeekStreamDialog.h index 7f4c9b1..fa71de0 100644 --- a/app/SeekStreamDialog.h +++ b/app/SeekStreamDialog.h @@ -38,11 +38,11 @@ class SeekStreamDialog : public QDialog { Q_OBJECT - public: +public: SeekStreamDialog( PlaYUVerStream* pcCurrStream, QWidget* parent = 0 ); Int runDialog(); - private: +private: QSpinBox* m_spinFrameNum; Int m_iSelectedFrameNum; }; diff --git a/app/SubWindowAbstract.h b/app/SubWindowAbstract.h index a326564..22a230c 100644 --- a/app/SubWindowAbstract.h +++ b/app/SubWindowAbstract.h @@ -54,14 +54,14 @@ class SubWindowAbstract : public QWidget { Q_OBJECT - private: +private: QHBoxLayout* m_pcLayout; UInt m_uiCategory; QString m_cWindowName; PlaYUVerMdiSubWindow* m_cSubWindow; - public: +public: enum SubWindowCategory { SUBWINDOW = 0, @@ -134,13 +134,13 @@ class SubWindowAbstract : public QWidget Void setSubWindow( PlaYUVerMdiSubWindow* subWindow ) { m_cSubWindow = subWindow; } Void closeSubWindow(); - protected: +protected: void focusInEvent( QFocusEvent* event ); void closeEvent( QCloseEvent* event ); Void setWidget( QWidget* widget ); - Q_SIGNALS: +Q_SIGNALS: /** * Notify that zoom factor was changed by internal event (e.g. by mouse wheel) */ @@ -158,7 +158,7 @@ class SubWindowAbstract : public QWidget void aboutToActivate( SubWindowAbstract* ); void aboutToClose( SubWindowAbstract* ); - public Q_SLOTS: +public Q_SLOTS: void onDestroyed(); }; diff --git a/app/VideoHandle.cpp b/app/VideoHandle.cpp index 2199474..7c06fcd 100644 --- a/app/VideoHandle.cpp +++ b/app/VideoHandle.cpp @@ -54,9 +54,7 @@ VideoHandle::VideoHandle( QWidget* parent, PlaYUVerSubWindowHandle* windowManage m_acPlayingSubWindows.clear(); } -VideoHandle::~VideoHandle() -{ -} +VideoHandle::~VideoHandle() {} Void VideoHandle::createActions() { diff --git a/app/VideoHandle.h b/app/VideoHandle.h index 8330a81..6e8cf7c 100644 --- a/app/VideoHandle.h +++ b/app/VideoHandle.h @@ -51,7 +51,7 @@ class WidgetFrameNumber; class VideoHandle : public QWidget { Q_OBJECT - public: +public: VideoHandle( QWidget*, PlaYUVerSubWindowHandle* ); ~VideoHandle(); @@ -70,7 +70,7 @@ class VideoHandle : public QWidget Void openSubWindow( VideoSubWindow* subWindow ); - private: +private: QWidget* m_pcParet; PlaYUVerSubWindowHandle* m_pcMainWindowManager; enum @@ -126,10 +126,10 @@ class VideoHandle : public QWidget UInt64 getMaxFrameNumber(); Void setTimerStatus(); - Q_SIGNALS: +Q_SIGNALS: void changed(); - private Q_SLOTS: +private Q_SLOTS: void update(); void updateSelectionArea( QRect area ); void closeSubWindow( SubWindowAbstract* subWindow ); diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index 56421ec..63e201e 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -84,13 +84,13 @@ Int findPlaYUVerStreamInfo( PlaYUVerStreamInfoVector array, QString filename ) class VideoInformation : public QWidget { - private: +private: QList m_cTopLeftTextList; QFont m_cTopLeftTextFont; QFont m_cCenterTextFont; Bool m_bBusyWindow; - public: +public: VideoInformation( QWidget* parent ) : QWidget( parent ), m_bBusyWindow( false ) { setPalette( Qt::transparent ); @@ -107,7 +107,8 @@ class VideoInformation : public QWidget } } Void setBusyWindow( Bool bFlag ) { m_bBusyWindow = bFlag; } - protected: + +protected: void paintEvent( QPaintEvent* event ) { QPainter painter( this ); @@ -207,18 +208,18 @@ Void VideoSubWindow::keyPressEvent( QKeyEvent* event ) Bool bRet = false; switch( event->key() ) { - case Qt::Key_A: - bRet = m_pcCurrentDisplayModule->getModule()->keyPressed( MODULE_KEY_LEFT ); - break; - case Qt::Key_D: - bRet = m_pcCurrentDisplayModule->getModule()->keyPressed( MODULE_KEY_RIGHT ); - break; - case Qt::Key_W: - bRet = m_pcCurrentDisplayModule->getModule()->keyPressed( MODULE_KEY_UP ); - break; - case Qt::Key_S: - bRet = m_pcCurrentDisplayModule->getModule()->keyPressed( MODULE_KEY_DOWN ); - break; + case Qt::Key_A: + bRet = m_pcCurrentDisplayModule->getModule()->keyPressed( MODULE_KEY_LEFT ); + break; + case Qt::Key_D: + bRet = m_pcCurrentDisplayModule->getModule()->keyPressed( MODULE_KEY_RIGHT ); + break; + case Qt::Key_W: + bRet = m_pcCurrentDisplayModule->getModule()->keyPressed( MODULE_KEY_UP ); + break; + case Qt::Key_S: + bRet = m_pcCurrentDisplayModule->getModule()->keyPressed( MODULE_KEY_DOWN ); + break; } if( bRet ) { diff --git a/app/VideoSubWindow.h b/app/VideoSubWindow.h index ffcb74e..7507b31 100644 --- a/app/VideoSubWindow.h +++ b/app/VideoSubWindow.h @@ -63,7 +63,7 @@ class VideoSubWindow : public SubWindowAbstract { Q_OBJECT - private: +private: Bool m_bWindowBusy; QScrollArea* m_pcScrollArea; @@ -118,7 +118,7 @@ class VideoSubWindow : public SubWindowAbstract QSize getScrollSize(); - public: +public: enum VideoSubWindowCategories { VIDEO_STREAM_SUBWINDOW = SubWindowAbstract::VIDEO_STREAM_SUBWINDOW, @@ -200,12 +200,12 @@ class VideoSubWindow : public SubWindowAbstract Void clearWindowBusy() { m_bWindowBusy = false; } Void setFillWindow( Bool bFlag ); - protected: +protected: Void keyPressEvent( QKeyEvent* event ); Void resizeEvent( QResizeEvent* event ); // void closeEvent( QCloseEvent *event ); - public Q_SLOTS: +public Q_SLOTS: void updateWindowOnTimeout(); void adjustScrollBarByScale( double scale, QPoint center ); void adjustScrollBarByOffset( QPoint Offset ); diff --git a/app/ViewArea.cpp b/app/ViewArea.cpp index 22d4058..04ee252 100644 --- a/app/ViewArea.cpp +++ b/app/ViewArea.cpp @@ -103,21 +103,21 @@ Void ViewArea::setTool( UInt view ) { switch( view ) { - case NavigationView: - m_eTool = NavigationTool; - m_snapToGrid = false; - m_blockTrackEnable = false; - break; - case NormalSelectionView: - m_eTool = SelectionTool; - m_snapToGrid = false; - m_blockTrackEnable = false; - break; - case BlockSelectionView: - m_eTool = SelectionTool; - m_snapToGrid = true; - m_blockTrackEnable = false; - break; + case NavigationView: + m_eTool = NavigationTool; + m_snapToGrid = false; + m_blockTrackEnable = false; + break; + case NormalSelectionView: + m_eTool = SelectionTool; + m_snapToGrid = false; + m_blockTrackEnable = false; + break; + case BlockSelectionView: + m_eTool = SelectionTool; + m_snapToGrid = true; + m_blockTrackEnable = false; + break; } if( m_eTool != SelectionTool ) @@ -514,9 +514,9 @@ Void ViewArea::paintEvent( QPaintEvent* event ) paInter.setPen( QColor( Qt::black ) ); paInter.drawText( pixelRect, Qt::AlignCenter, - "Y: " + QString::number( sPixelValue.Y() ) + "\n" + "U: " + - QString::number( sPixelValue.Cb() ) + "\n" + "V: " + - QString::number( sPixelValue.Cr() ) ); + "Y: " + QString::number( sPixelValue.Y() ) + "\n" + + "U: " + QString::number( sPixelValue.Cb() ) + "\n" + + "V: " + QString::number( sPixelValue.Cr() ) ); } if( frFormat == PlaYUVerPixel::COLOR_GRAY ) { @@ -541,9 +541,9 @@ Void ViewArea::paintEvent( QPaintEvent* event ) paInter.setPen( QColor( Qt::black ) ); paInter.drawText( pixelRect, Qt::AlignCenter, - "R: " + QString::number( sPixelValue.R() ) + "\n" + "G: " + - QString::number( sPixelValue.G() ) + "\n" + "B: " + - QString::number( sPixelValue.B() ) ); + "R: " + QString::number( sPixelValue.R() ) + "\n" + + "G: " + QString::number( sPixelValue.G() ) + "\n" + + "B: " + QString::number( sPixelValue.B() ) ); } } } @@ -692,22 +692,22 @@ Void ViewArea::paintEvent( QPaintEvent* event ) { switch( tool() ) { - case MaskTool: - { - if( m_maskColor.isValid() ) - color = m_maskColor; - else - color = imageMaskColor; + case MaskTool: + { + if( m_maskColor.isValid() ) + color = m_maskColor; + else + color = imageMaskColor; - break; - } - case EraserTool: - { - color = eraserColor; - break; - } - default: - color = selectionColor; // ?Problems! + break; + } + case EraserTool: + { + color = eraserColor; + break; + } + default: + color = selectionColor; // ?Problems! } color.setAlpha( 120 ); @@ -1077,27 +1077,27 @@ Void ViewArea::updateMask( const QRect& rect ) { switch( tool() ) { - case MaskTool: - { - // Add rect to the mask - QPainter paInter( &m_mask ); - paInter.setBrush( Qt::color1 ); - paInter.setPen( Qt::NoPen ); - paInter.drawRect( rect ); - paInter.end(); - break; - } - case EraserTool: - { - // Clears rect area in the mask - QPainter paInter( &m_mask ); - paInter.setBrush( Qt::color0 ); - paInter.setPen( Qt::NoPen ); - paInter.drawRect( rect ); - paInter.end(); - break; - } - default: /* Do Nothing */ - ; + case MaskTool: + { + // Add rect to the mask + QPainter paInter( &m_mask ); + paInter.setBrush( Qt::color1 ); + paInter.setPen( Qt::NoPen ); + paInter.drawRect( rect ); + paInter.end(); + break; + } + case EraserTool: + { + // Clears rect area in the mask + QPainter paInter( &m_mask ); + paInter.setBrush( Qt::color0 ); + paInter.setPen( Qt::NoPen ); + paInter.drawRect( rect ); + paInter.end(); + break; + } + default: /* Do Nothing */ + ; } } diff --git a/app/ViewArea.h b/app/ViewArea.h index 068d799..6732105 100644 --- a/app/ViewArea.h +++ b/app/ViewArea.h @@ -45,7 +45,7 @@ class ViewArea : public QWidget { Q_OBJECT - public: +public: enum ViewModes { NavigationView, @@ -88,13 +88,13 @@ class ViewArea : public QWidget // min or max zoom value) Double scaleZoomFactor( Double scale, QPoint center, QSize minimumSize ); - Q_SIGNALS: +Q_SIGNALS: void selectionChanged( const QRect& rect ); void positionChanged( const QPoint& pos ); void scrollBarMoved( QPoint offset ); void zoomFactorChanged_byWheel( const double factor, const QPoint center ); - public Q_SLOTS: +public Q_SLOTS: // Void setNormalMode(); // Void setMaskMode(); // Void setMaskTool(); @@ -104,7 +104,7 @@ class ViewArea : public QWidget void setSnapToGrid( bool enable ); // void setSelectedArea( QRect &rect ); - protected: +protected: Void paintEvent( QPaintEvent* event ); Void resizeEvent( QResizeEvent* event ); Void mousePressEvent( QMouseEvent* event ); @@ -115,7 +115,7 @@ class ViewArea : public QWidget Void updateSize(); Void updateOffset(); - private: +private: enum ViewMode { NormalMode, diff --git a/app/WidgetFrameNumber.h b/app/WidgetFrameNumber.h index afe3304..e1edd9d 100644 --- a/app/WidgetFrameNumber.h +++ b/app/WidgetFrameNumber.h @@ -36,13 +36,13 @@ class WidgetFrameNumber : public QWidget { - public: +public: WidgetFrameNumber( QWidget* parent = 0 ); Void setCurrFrameNum( Int number ); Void setTotalFrameNum( Int number ); Void clear(); - private: +private: QLabel* m_pcCurrFrameNumLabel; QLabel* m_pcTotalFrameNumLabel; }; diff --git a/app/external/qcustomplot.cpp b/app/external/qcustomplot.cpp index 7efd181..b4cc1ce 100644 --- a/app/external/qcustomplot.cpp +++ b/app/external/qcustomplot.cpp @@ -79,9 +79,7 @@ QCPPainter::QCPPainter( QPaintDevice* device ) #endif } -QCPPainter::~QCPPainter() -{ -} +QCPPainter::~QCPPainter() {} /*! Sets the pen of the painter and applies certain fixes to it, depending on the @@ -638,123 +636,123 @@ void QCPScatterStyle::drawShape( QCPPainter* painter, double x, double y ) const double w = mSize / 2.0; switch( mShape ) { - case ssNone: - break; - case ssDot: - { - painter->drawLine( QPointF( x, y ), QPointF( x + 0.0001, y ) ); - break; - } - case ssCross: - { - painter->drawLine( QLineF( x - w, y - w, x + w, y + w ) ); - painter->drawLine( QLineF( x - w, y + w, x + w, y - w ) ); - break; - } - case ssPlus: - { - painter->drawLine( QLineF( x - w, y, x + w, y ) ); - painter->drawLine( QLineF( x, y + w, x, y - w ) ); - break; - } - case ssCircle: - { - painter->drawEllipse( QPointF( x, y ), w, w ); - break; - } - case ssDisc: - { - QBrush b = painter->brush(); - painter->setBrush( painter->pen().color() ); - painter->drawEllipse( QPointF( x, y ), w, w ); - painter->setBrush( b ); - break; - } - case ssSquare: - { - painter->drawRect( QRectF( x - w, y - w, mSize, mSize ) ); - break; - } - case ssDiamond: - { - painter->drawLine( QLineF( x - w, y, x, y - w ) ); - painter->drawLine( QLineF( x, y - w, x + w, y ) ); - painter->drawLine( QLineF( x + w, y, x, y + w ) ); - painter->drawLine( QLineF( x, y + w, x - w, y ) ); - break; - } - case ssStar: - { - painter->drawLine( QLineF( x - w, y, x + w, y ) ); - painter->drawLine( QLineF( x, y + w, x, y - w ) ); - painter->drawLine( QLineF( x - w * 0.707, y - w * 0.707, x + w * 0.707, y + w * 0.707 ) ); - painter->drawLine( QLineF( x - w * 0.707, y + w * 0.707, x + w * 0.707, y - w * 0.707 ) ); - break; - } - case ssTriangle: - { - painter->drawLine( QLineF( x - w, y + 0.755 * w, x + w, y + 0.755 * w ) ); - painter->drawLine( QLineF( x + w, y + 0.755 * w, x, y - 0.977 * w ) ); - painter->drawLine( QLineF( x, y - 0.977 * w, x - w, y + 0.755 * w ) ); - break; - } - case ssTriangleInverted: - { - painter->drawLine( QLineF( x - w, y - 0.755 * w, x + w, y - 0.755 * w ) ); - painter->drawLine( QLineF( x + w, y - 0.755 * w, x, y + 0.977 * w ) ); - painter->drawLine( QLineF( x, y + 0.977 * w, x - w, y - 0.755 * w ) ); - break; - } - case ssCrossSquare: - { - painter->drawLine( QLineF( x - w, y - w, x + w * 0.95, y + w * 0.95 ) ); - painter->drawLine( QLineF( x - w, y + w * 0.95, x + w * 0.95, y - w ) ); - painter->drawRect( QRectF( x - w, y - w, mSize, mSize ) ); - break; - } - case ssPlusSquare: - { - painter->drawLine( QLineF( x - w, y, x + w * 0.95, y ) ); - painter->drawLine( QLineF( x, y + w, x, y - w ) ); - painter->drawRect( QRectF( x - w, y - w, mSize, mSize ) ); - break; - } - case ssCrossCircle: - { - painter->drawLine( QLineF( x - w * 0.707, y - w * 0.707, x + w * 0.670, y + w * 0.670 ) ); - painter->drawLine( QLineF( x - w * 0.707, y + w * 0.670, x + w * 0.670, y - w * 0.707 ) ); - painter->drawEllipse( QPointF( x, y ), w, w ); - break; - } - case ssPlusCircle: - { - painter->drawLine( QLineF( x - w, y, x + w, y ) ); - painter->drawLine( QLineF( x, y + w, x, y - w ) ); - painter->drawEllipse( QPointF( x, y ), w, w ); - break; - } - case ssPeace: - { - painter->drawLine( QLineF( x, y - w, x, y + w ) ); - painter->drawLine( QLineF( x, y, x - w * 0.707, y + w * 0.707 ) ); - painter->drawLine( QLineF( x, y, x + w * 0.707, y + w * 0.707 ) ); - painter->drawEllipse( QPointF( x, y ), w, w ); - break; - } - case ssPixmap: - { - painter->drawPixmap( x - mPixmap.width() * 0.5, y - mPixmap.height() * 0.5, mPixmap ); - break; - } - case ssCustom: - { - QTransform oldTransform = painter->transform(); - painter->translate( x, y ); - painter->scale( mSize / 6.0, mSize / 6.0 ); - painter->drawPath( mCustomPath ); - painter->setTransform( oldTransform ); - break; - } + case ssNone: + break; + case ssDot: + { + painter->drawLine( QPointF( x, y ), QPointF( x + 0.0001, y ) ); + break; + } + case ssCross: + { + painter->drawLine( QLineF( x - w, y - w, x + w, y + w ) ); + painter->drawLine( QLineF( x - w, y + w, x + w, y - w ) ); + break; + } + case ssPlus: + { + painter->drawLine( QLineF( x - w, y, x + w, y ) ); + painter->drawLine( QLineF( x, y + w, x, y - w ) ); + break; + } + case ssCircle: + { + painter->drawEllipse( QPointF( x, y ), w, w ); + break; + } + case ssDisc: + { + QBrush b = painter->brush(); + painter->setBrush( painter->pen().color() ); + painter->drawEllipse( QPointF( x, y ), w, w ); + painter->setBrush( b ); + break; + } + case ssSquare: + { + painter->drawRect( QRectF( x - w, y - w, mSize, mSize ) ); + break; + } + case ssDiamond: + { + painter->drawLine( QLineF( x - w, y, x, y - w ) ); + painter->drawLine( QLineF( x, y - w, x + w, y ) ); + painter->drawLine( QLineF( x + w, y, x, y + w ) ); + painter->drawLine( QLineF( x, y + w, x - w, y ) ); + break; + } + case ssStar: + { + painter->drawLine( QLineF( x - w, y, x + w, y ) ); + painter->drawLine( QLineF( x, y + w, x, y - w ) ); + painter->drawLine( QLineF( x - w * 0.707, y - w * 0.707, x + w * 0.707, y + w * 0.707 ) ); + painter->drawLine( QLineF( x - w * 0.707, y + w * 0.707, x + w * 0.707, y - w * 0.707 ) ); + break; + } + case ssTriangle: + { + painter->drawLine( QLineF( x - w, y + 0.755 * w, x + w, y + 0.755 * w ) ); + painter->drawLine( QLineF( x + w, y + 0.755 * w, x, y - 0.977 * w ) ); + painter->drawLine( QLineF( x, y - 0.977 * w, x - w, y + 0.755 * w ) ); + break; + } + case ssTriangleInverted: + { + painter->drawLine( QLineF( x - w, y - 0.755 * w, x + w, y - 0.755 * w ) ); + painter->drawLine( QLineF( x + w, y - 0.755 * w, x, y + 0.977 * w ) ); + painter->drawLine( QLineF( x, y + 0.977 * w, x - w, y - 0.755 * w ) ); + break; + } + case ssCrossSquare: + { + painter->drawLine( QLineF( x - w, y - w, x + w * 0.95, y + w * 0.95 ) ); + painter->drawLine( QLineF( x - w, y + w * 0.95, x + w * 0.95, y - w ) ); + painter->drawRect( QRectF( x - w, y - w, mSize, mSize ) ); + break; + } + case ssPlusSquare: + { + painter->drawLine( QLineF( x - w, y, x + w * 0.95, y ) ); + painter->drawLine( QLineF( x, y + w, x, y - w ) ); + painter->drawRect( QRectF( x - w, y - w, mSize, mSize ) ); + break; + } + case ssCrossCircle: + { + painter->drawLine( QLineF( x - w * 0.707, y - w * 0.707, x + w * 0.670, y + w * 0.670 ) ); + painter->drawLine( QLineF( x - w * 0.707, y + w * 0.670, x + w * 0.670, y - w * 0.707 ) ); + painter->drawEllipse( QPointF( x, y ), w, w ); + break; + } + case ssPlusCircle: + { + painter->drawLine( QLineF( x - w, y, x + w, y ) ); + painter->drawLine( QLineF( x, y + w, x, y - w ) ); + painter->drawEllipse( QPointF( x, y ), w, w ); + break; + } + case ssPeace: + { + painter->drawLine( QLineF( x, y - w, x, y + w ) ); + painter->drawLine( QLineF( x, y, x - w * 0.707, y + w * 0.707 ) ); + painter->drawLine( QLineF( x, y, x + w * 0.707, y + w * 0.707 ) ); + painter->drawEllipse( QPointF( x, y ), w, w ); + break; + } + case ssPixmap: + { + painter->drawPixmap( x - mPixmap.width() * 0.5, y - mPixmap.height() * 0.5, mPixmap ); + break; + } + case ssCustom: + { + QTransform oldTransform = painter->transform(); + painter->translate( x, y ); + painter->scale( mSize / 6.0, mSize / 6.0 ); + painter->drawPath( mCustomPath ); + painter->setTransform( oldTransform ); + break; + } } } @@ -885,9 +883,10 @@ QCPLayer::~QCPLayer() mChildren.last()->setLayer( 0 ); // removes itself from mChildren via removeChild() if( mParentPlot->currentLayer() == this ) - qDebug() << Q_FUNC_INFO << "The parent plot's mCurrentLayer will be a " - "dangling pointer. Should have been set to a " - "valid layer or 0 beforehand."; + qDebug() << Q_FUNC_INFO + << "The parent plot's mCurrentLayer will be a " + "dangling pointer. Should have been set to a " + "valid layer or 0 beforehand."; } /*! @@ -1402,10 +1401,7 @@ void QCPLayerable::applyAntialiasingHint( QCPPainter* painter, \see initializeParentPlot */ -void QCPLayerable::parentPlotInitialized( QCustomPlot* parentPlot ) -{ - Q_UNUSED( parentPlot ) -} +void QCPLayerable::parentPlotInitialized( QCustomPlot* parentPlot ){Q_UNUSED( parentPlot )} /*! \internal @@ -1560,9 +1556,7 @@ const double QCPRange::maxRange = 1e250; /*! Constructs a range with \a lower and \a upper set to zero. */ -QCPRange::QCPRange() : lower( 0 ), upper( 0 ) -{ -} +QCPRange::QCPRange() : lower( 0 ), upper( 0 ) {} /*! \overload Constructs a range with the specified \a lower and \a upper values. @@ -2467,10 +2461,11 @@ void QCPLayoutElement::update( UpdatePhase phase ) if( mAutoMargins.testFlag( side ) ) // this side's margin shall be calculated automatically { if( mMarginGroups.contains( side ) ) - QCP::setMarginValue( newMargins, side, mMarginGroups[side]->commonMargin( - side ) ); // this side is part of a margin - // group, so get the margin value - // from that group + QCP::setMarginValue( + newMargins, side, + mMarginGroups[side]->commonMargin( side ) ); // this side is part of a margin + // group, so get the margin value + // from that group else QCP::setMarginValue( newMargins, side, calculateAutoMargin( side ) ); // this side is not @@ -2700,9 +2695,7 @@ int QCPLayoutElement::calculateAutoMargin( QCP::MarginSide side ) QCPLayout is an abstract base class, it can't be instantiated directly. */ -QCPLayout::QCPLayout() -{ -} +QCPLayout::QCPLayout() {} /*! First calls the QCPLayoutElement::update base class implementation to update @@ -2761,9 +2754,7 @@ QList QCPLayout::elements( bool recursive ) const explicit simplification while QCPLayoutGrid does. */ -void QCPLayout::simplify() -{ -} +void QCPLayout::simplify() {} /*! Removes and deletes the element at the provided \a index. Returns true on @@ -2859,9 +2850,7 @@ void QCPLayout::sizeConstraintsChanged() const \see update */ -void QCPLayout::updateLayout() -{ -} +void QCPLayout::updateLayout() {} /*! \internal @@ -3060,8 +3049,9 @@ QVector QCPLayout::getSectionSizes( QVector maxSizes, } } if( innerIterations == sectionCount * 2 ) - qDebug() << Q_FUNC_INFO << "Exceeded maximum expected inner iteration " - "count, layouting aborted. Input was:" + qDebug() << Q_FUNC_INFO + << "Exceeded maximum expected inner iteration " + "count, layouting aborted. Input was:" << maxSizes << minSizes << stretchFactors << totalSize; // now check whether the resulting section sizes violate minimum @@ -3099,8 +3089,9 @@ QVector QCPLayout::getSectionSizes( QVector maxSizes, } } if( outerIterations == sectionCount * 2 ) - qDebug() << Q_FUNC_INFO << "Exceeded maximum expected outer iteration " - "count, layouting aborted. Input was:" + qDebug() << Q_FUNC_INFO + << "Exceeded maximum expected outer iteration " + "count, layouting aborted. Input was:" << maxSizes << minSizes << stretchFactors << totalSize; QVector result( sectionCount ); @@ -3140,9 +3131,7 @@ QVector QCPLayout::getSectionSizes( QVector maxSizes, /*! Creates an instance of QCPLayoutGrid and sets default values. */ -QCPLayoutGrid::QCPLayoutGrid() : mColumnSpacing( 5 ), mRowSpacing( 5 ) -{ -} +QCPLayoutGrid::QCPLayoutGrid() : mColumnSpacing( 5 ), mRowSpacing( 5 ) {} QCPLayoutGrid::~QCPLayoutGrid() { @@ -3803,9 +3792,7 @@ void QCPLayoutGrid::getMaximumRowColSizes( QVector* maxColWidths, /*! Creates an instance of QCPLayoutInset and sets default values. */ -QCPLayoutInset::QCPLayoutInset() -{ -} +QCPLayoutInset::QCPLayoutInset() {} QCPLayoutInset::~QCPLayoutInset() { @@ -4165,9 +4152,7 @@ void QCPLayoutInset::addElement( QCPLayoutElement* element, const QRectF& rect ) /*! Creates a QCPLineEnding instance with default values (style \ref esNone). */ -QCPLineEnding::QCPLineEnding() : mStyle( esNone ), mWidth( 8 ), mLength( 10 ), mInverted( false ) -{ -} +QCPLineEnding::QCPLineEnding() : mStyle( esNone ), mWidth( 8 ), mLength( 10 ), mInverted( false ) {} /*! Creates a QCPLineEnding instance with the specified values. @@ -4246,21 +4231,21 @@ double QCPLineEnding::boundingDistance() const { switch( mStyle ) { - case esNone: - return 0; + case esNone: + return 0; - case esFlatArrow: - case esSpikeArrow: - case esLineArrow: - case esSkewedBar: - return qSqrt( mWidth * mWidth + mLength * mLength ); // items that have width and length + case esFlatArrow: + case esSpikeArrow: + case esLineArrow: + case esSkewedBar: + return qSqrt( mWidth * mWidth + mLength * mLength ); // items that have width and length - case esDisc: - case esSquare: - case esDiamond: - case esBar: - case esHalfBar: - return mWidth * 1.42; // items that only have a width -> width*sqrt(2) + case esDisc: + case esSquare: + case esDiamond: + case esBar: + case esHalfBar: + return mWidth * 1.42; // items that only have a width -> width*sqrt(2) } return 0; } @@ -4285,23 +4270,23 @@ double QCPLineEnding::realLength() const { switch( mStyle ) { - case esNone: - case esLineArrow: - case esSkewedBar: - case esBar: - case esHalfBar: - return 0; + case esNone: + case esLineArrow: + case esSkewedBar: + case esBar: + case esHalfBar: + return 0; - case esFlatArrow: - return mLength; + case esFlatArrow: + return mLength; - case esDisc: - case esSquare: - case esDiamond: - return mWidth * 0.5; + case esDisc: + case esSquare: + case esDiamond: + return mWidth * 0.5; - case esSpikeArrow: - return mLength * 0.8; + case esSpikeArrow: + return mLength * 0.8; } return 0; } @@ -4331,110 +4316,108 @@ void QCPLineEnding::draw( QCPPainter* painter, const QVector2D& pos, const QVect QBrush brush( painter->pen().color(), Qt::SolidPattern ); switch( mStyle ) { - case esNone: - break; - case esFlatArrow: + case esNone: + break; + case esFlatArrow: + { + QPointF points[3] = {pos.toPointF(), ( pos - lengthVec + widthVec ).toPointF(), + ( pos - lengthVec - widthVec ).toPointF()}; + painter->setPen( miterPen ); + painter->setBrush( brush ); + painter->drawConvexPolygon( points, 3 ); + painter->setBrush( brushBackup ); + painter->setPen( penBackup ); + break; + } + case esSpikeArrow: + { + QPointF points[4] = {pos.toPointF(), ( pos - lengthVec + widthVec ).toPointF(), + ( pos - lengthVec * 0.8f ).toPointF(), + ( pos - lengthVec - widthVec ).toPointF()}; + painter->setPen( miterPen ); + painter->setBrush( brush ); + painter->drawConvexPolygon( points, 4 ); + painter->setBrush( brushBackup ); + painter->setPen( penBackup ); + break; + } + case esLineArrow: + { + QPointF points[3] = {( pos - lengthVec + widthVec ).toPointF(), pos.toPointF(), + ( pos - lengthVec - widthVec ).toPointF()}; + painter->setPen( miterPen ); + painter->drawPolyline( points, 3 ); + painter->setPen( penBackup ); + break; + } + case esDisc: + { + painter->setBrush( brush ); + painter->drawEllipse( pos.toPointF(), mWidth * 0.5, mWidth * 0.5 ); + painter->setBrush( brushBackup ); + break; + } + case esSquare: + { + QVector2D widthVecPerp( -widthVec.y(), widthVec.x() ); + QPointF points[4] = { + ( pos - widthVecPerp + widthVec ).toPointF(), ( pos - widthVecPerp - widthVec ).toPointF(), + ( pos + widthVecPerp - widthVec ).toPointF(), ( pos + widthVecPerp + widthVec ).toPointF()}; + painter->setPen( miterPen ); + painter->setBrush( brush ); + painter->drawConvexPolygon( points, 4 ); + painter->setBrush( brushBackup ); + painter->setPen( penBackup ); + break; + } + case esDiamond: + { + QVector2D widthVecPerp( -widthVec.y(), widthVec.x() ); + QPointF points[4] = {( pos - widthVecPerp ).toPointF(), ( pos - widthVec ).toPointF(), + ( pos + widthVecPerp ).toPointF(), ( pos + widthVec ).toPointF()}; + painter->setPen( miterPen ); + painter->setBrush( brush ); + painter->drawConvexPolygon( points, 4 ); + painter->setBrush( brushBackup ); + painter->setPen( penBackup ); + break; + } + case esBar: + { + painter->drawLine( ( pos + widthVec ).toPointF(), ( pos - widthVec ).toPointF() ); + break; + } + case esHalfBar: + { + painter->drawLine( ( pos + widthVec ).toPointF(), pos.toPointF() ); + break; + } + case esSkewedBar: + { + if( qFuzzyIsNull( painter->pen().widthF() ) && + !painter->modes().testFlag( QCPPainter::pmNonCosmetic ) ) { - QPointF points[3] = {pos.toPointF(), ( pos - lengthVec + widthVec ).toPointF(), - ( pos - lengthVec - widthVec ).toPointF()}; - painter->setPen( miterPen ); - painter->setBrush( brush ); - painter->drawConvexPolygon( points, 3 ); - painter->setBrush( brushBackup ); - painter->setPen( penBackup ); - break; + // if drawing with cosmetic pen (perfectly thin stroke, happens only in + // vector exports), draw bar exactly on tip + // of line + painter->drawLine( + ( pos + widthVec + lengthVec * 0.2f * ( mInverted ? -1 : 1 ) ).toPointF(), + ( pos - widthVec - lengthVec * 0.2f * ( mInverted ? -1 : 1 ) ).toPointF() ); } - case esSpikeArrow: + else { - QPointF points[4] = {pos.toPointF(), ( pos - lengthVec + widthVec ).toPointF(), - ( pos - lengthVec * 0.8f ).toPointF(), - ( pos - lengthVec - widthVec ).toPointF()}; - painter->setPen( miterPen ); - painter->setBrush( brush ); - painter->drawConvexPolygon( points, 4 ); - painter->setBrush( brushBackup ); - painter->setPen( penBackup ); - break; - } - case esLineArrow: - { - QPointF points[3] = {( pos - lengthVec + widthVec ).toPointF(), pos.toPointF(), - ( pos - lengthVec - widthVec ).toPointF()}; - painter->setPen( miterPen ); - painter->drawPolyline( points, 3 ); - painter->setPen( penBackup ); - break; - } - case esDisc: - { - painter->setBrush( brush ); - painter->drawEllipse( pos.toPointF(), mWidth * 0.5, mWidth * 0.5 ); - painter->setBrush( brushBackup ); - break; - } - case esSquare: - { - QVector2D widthVecPerp( -widthVec.y(), widthVec.x() ); - QPointF points[4] = {( pos - widthVecPerp + widthVec ).toPointF(), - ( pos - widthVecPerp - widthVec ).toPointF(), - ( pos + widthVecPerp - widthVec ).toPointF(), - ( pos + widthVecPerp + widthVec ).toPointF()}; - painter->setPen( miterPen ); - painter->setBrush( brush ); - painter->drawConvexPolygon( points, 4 ); - painter->setBrush( brushBackup ); - painter->setPen( penBackup ); - break; - } - case esDiamond: - { - QVector2D widthVecPerp( -widthVec.y(), widthVec.x() ); - QPointF points[4] = {( pos - widthVecPerp ).toPointF(), ( pos - widthVec ).toPointF(), - ( pos + widthVecPerp ).toPointF(), ( pos + widthVec ).toPointF()}; - painter->setPen( miterPen ); - painter->setBrush( brush ); - painter->drawConvexPolygon( points, 4 ); - painter->setBrush( brushBackup ); - painter->setPen( penBackup ); - break; - } - case esBar: - { - painter->drawLine( ( pos + widthVec ).toPointF(), ( pos - widthVec ).toPointF() ); - break; - } - case esHalfBar: - { - painter->drawLine( ( pos + widthVec ).toPointF(), pos.toPointF() ); - break; - } - case esSkewedBar: - { - if( qFuzzyIsNull( painter->pen().widthF() ) && - !painter->modes().testFlag( QCPPainter::pmNonCosmetic ) ) - { - // if drawing with cosmetic pen (perfectly thin stroke, happens only in - // vector exports), draw bar exactly on tip - // of line - painter->drawLine( - ( pos + widthVec + lengthVec * 0.2f * ( mInverted ? -1 : 1 ) ).toPointF(), - ( pos - widthVec - lengthVec * 0.2f * ( mInverted ? -1 : 1 ) ).toPointF() ); - } - else - { - // if drawing with thick (non-cosmetic) pen, shift bar a little in line - // direction to prevent line from sticking - // through bar slightly - painter->drawLine( - ( pos + widthVec + lengthVec * 0.2f * ( mInverted ? -1 : 1 ) + - dir.normalized() * qMax( 1.0f, (float)painter->pen().widthF() ) * 0.5f ) - .toPointF(), - ( pos - widthVec - lengthVec * 0.2f * ( mInverted ? -1 : 1 ) + - dir.normalized() * qMax( 1.0f, (float)painter->pen().widthF() ) * 0.5f ) - .toPointF() ); - } - break; + // if drawing with thick (non-cosmetic) pen, shift bar a little in line + // direction to prevent line from sticking + // through bar slightly + painter->drawLine( ( pos + widthVec + lengthVec * 0.2f * ( mInverted ? -1 : 1 ) + + dir.normalized() * qMax( 1.0f, (float)painter->pen().widthF() ) * 0.5f ) + .toPointF(), + ( pos - widthVec - lengthVec * 0.2f * ( mInverted ? -1 : 1 ) + + dir.normalized() * qMax( 1.0f, (float)painter->pen().widthF() ) * 0.5f ) + .toPointF() ); } + break; + } } } @@ -5662,8 +5645,9 @@ void QCPAxis::setNumberFormat( const QString& formatCode ) } else { - qDebug() << Q_FUNC_INFO << "Invalid number format code (second char not " - "'b' or first char neither 'e' nor 'g'):" + qDebug() << Q_FUNC_INFO + << "Invalid number format code (second char not " + "'b' or first char neither 'e' nor 'g'):" << formatCode; return; } @@ -6204,8 +6188,9 @@ void QCPAxis::scaleRange( double factor, double center ) mRange = newRange.sanitizedForLogScale(); } else - qDebug() << Q_FUNC_INFO << "Center of scaling operation doesn't lie in " - "same logarithmic sign domain as range:" + qDebug() << Q_FUNC_INFO + << "Center of scaling operation doesn't lie in " + "same logarithmic sign domain as range:" << center; } mCachedMarginValid = false; @@ -6425,13 +6410,13 @@ double QCPAxis::coordToPixel( double value ) const else { if( !mRangeReversed ) - return mAxisRect->bottom() - - baseLog( value / mRange.lower ) / baseLog( mRange.upper / mRange.lower ) * - mAxisRect->height(); + return mAxisRect->bottom() - baseLog( value / mRange.lower ) / + baseLog( mRange.upper / mRange.lower ) * + mAxisRect->height(); else - return mAxisRect->bottom() - - baseLog( mRange.upper / value ) / baseLog( mRange.upper / mRange.lower ) * - mAxisRect->height(); + return mAxisRect->bottom() - baseLog( mRange.upper / value ) / + baseLog( mRange.upper / mRange.lower ) * + mAxisRect->height(); } } } @@ -6558,16 +6543,16 @@ QCPAxis::AxisType QCPAxis::marginSideToAxisType( QCP::MarginSide side ) { switch( side ) { - case QCP::msLeft: - return atLeft; - case QCP::msRight: - return atRight; - case QCP::msTop: - return atTop; - case QCP::msBottom: - return atBottom; - default: - break; + case QCP::msLeft: + return atLeft; + case QCP::msRight: + return atRight; + case QCP::msTop: + return atTop; + case QCP::msBottom: + return atBottom; + default: + break; } qDebug() << Q_FUNC_INFO << "Invalid margin side passed:" << (int)side; return atLeft; @@ -6581,22 +6566,22 @@ QCPAxis::AxisType QCPAxis::opposite( QCPAxis::AxisType type ) { switch( type ) { - case atLeft: - return atRight; - break; - case atRight: - return atLeft; - break; - case atBottom: - return atTop; - break; - case atTop: - return atBottom; - break; - default: - qDebug() << Q_FUNC_INFO << "invalid axis type"; - return atLeft; - break; + case atLeft: + return atRight; + break; + case atRight: + return atLeft; + break; + case atBottom: + return atTop; + break; + case atTop: + return atBottom; + break; + default: + qDebug() << Q_FUNC_INFO << "invalid axis type"; + return atLeft; + break; } } @@ -6851,33 +6836,33 @@ int QCPAxis::calculateAutoSubTickCount( double tickStep ) const ++intPart; switch( intPart ) { - case 1: - result = 4; - break; // 1.0 -> 0.2 substep - case 2: - result = 3; - break; // 2.0 -> 0.5 substep - case 3: - result = 2; - break; // 3.0 -> 1.0 substep - case 4: - result = 3; - break; // 4.0 -> 1.0 substep - case 5: - result = 4; - break; // 5.0 -> 1.0 substep - case 6: - result = 2; - break; // 6.0 -> 2.0 substep - case 7: - result = 6; - break; // 7.0 -> 1.0 substep - case 8: - result = 3; - break; // 8.0 -> 2.0 substep - case 9: - result = 2; - break; // 9.0 -> 3.0 substep + case 1: + result = 4; + break; // 1.0 -> 0.2 substep + case 2: + result = 3; + break; // 2.0 -> 0.5 substep + case 3: + result = 2; + break; // 3.0 -> 1.0 substep + case 4: + result = 3; + break; // 4.0 -> 1.0 substep + case 5: + result = 4; + break; // 5.0 -> 1.0 substep + case 6: + result = 2; + break; // 6.0 -> 2.0 substep + case 7: + result = 6; + break; // 7.0 -> 1.0 substep + case 8: + result = 3; + break; // 8.0 -> 2.0 substep + case 9: + result = 2; + break; // 9.0 -> 3.0 substep } } else @@ -6887,34 +6872,34 @@ int QCPAxis::calculateAutoSubTickCount( double tickStep ) const { switch( intPart ) { - case 1: - result = 2; - break; // 1.5 -> 0.5 substep - case 2: - result = 4; - break; // 2.5 -> 0.5 substep - case 3: - result = 4; - break; // 3.5 -> 0.7 substep - case 4: - result = 2; - break; // 4.5 -> 1.5 substep - case 5: - result = 4; - break; // 5.5 -> 1.1 substep (won't occur with autoTickStep from here - // on) - case 6: - result = 4; - break; // 6.5 -> 1.3 substep - case 7: - result = 2; - break; // 7.5 -> 2.5 substep - case 8: - result = 4; - break; // 8.5 -> 1.7 substep - case 9: - result = 4; - break; // 9.5 -> 1.9 substep + case 1: + result = 2; + break; // 1.5 -> 0.5 substep + case 2: + result = 4; + break; // 2.5 -> 0.5 substep + case 3: + result = 4; + break; // 3.5 -> 0.7 substep + case 4: + result = 2; + break; // 4.5 -> 1.5 substep + case 5: + result = 4; + break; // 5.5 -> 1.1 substep (won't occur with autoTickStep from here + // on) + case 6: + result = 4; + break; // 6.5 -> 1.3 substep + case 7: + result = 2; + break; // 7.5 -> 2.5 substep + case 8: + result = 4; + break; // 8.5 -> 1.7 substep + case 9: + result = 4; + break; // 9.5 -> 1.9 substep } } // if mantissa fraction isnt 0.0 or 0.5, don't bother finding good sub tick @@ -7317,9 +7302,7 @@ QCPAxisPainterPrivate::QCPAxisPainterPrivate( QCustomPlot* parentPlot ) { } -QCPAxisPainterPrivate::~QCPAxisPainterPrivate() -{ -} +QCPAxisPainterPrivate::~QCPAxisPainterPrivate() {} /*! \internal @@ -7341,32 +7324,32 @@ void QCPAxisPainterPrivate::draw( QCPPainter* painter ) QPoint origin; switch( type ) { - case QCPAxis::atLeft: - origin = alignmentRect.bottomLeft() + QPoint( -offset, 0 ); - break; - case QCPAxis::atRight: - origin = alignmentRect.bottomRight() + QPoint( +offset, 0 ); - break; - case QCPAxis::atTop: - origin = alignmentRect.topLeft() + QPoint( 0, -offset ); - break; - case QCPAxis::atBottom: - origin = alignmentRect.bottomLeft() + QPoint( 0, +offset ); - break; + case QCPAxis::atLeft: + origin = alignmentRect.bottomLeft() + QPoint( -offset, 0 ); + break; + case QCPAxis::atRight: + origin = alignmentRect.bottomRight() + QPoint( +offset, 0 ); + break; + case QCPAxis::atTop: + origin = alignmentRect.topLeft() + QPoint( 0, -offset ); + break; + case QCPAxis::atBottom: + origin = alignmentRect.bottomLeft() + QPoint( 0, +offset ); + break; } double xCor = 0, yCor = 0; // paint system correction, for pixel exact matches (affects // baselines and ticks of top/right axes) switch( type ) { - case QCPAxis::atTop: - yCor = -1; - break; - case QCPAxis::atRight: - xCor = 1; - break; - default: - break; + case QCPAxis::atTop: + yCor = -1; + break; + case QCPAxis::atRight: + xCor = 1; + break; + default: + break; } int margin = 0; @@ -7440,14 +7423,16 @@ void QCPAxisPainterPrivate::draw( QCPPainter* painter ) painter->setBrush( QBrush( basePen.color() ) ); QVector2D baseLineVector( baseLine.dx(), baseLine.dy() ); if( lowerEnding.style() != QCPLineEnding::esNone ) - lowerEnding.draw( painter, QVector2D( baseLine.p1() ) - - baseLineVector.normalized() * lowerEnding.realLength() * - ( lowerEnding.inverted() ? -1 : 1 ), + lowerEnding.draw( painter, + QVector2D( baseLine.p1() ) - baseLineVector.normalized() * + lowerEnding.realLength() * + ( lowerEnding.inverted() ? -1 : 1 ), -baseLineVector ); if( upperEnding.style() != QCPLineEnding::esNone ) - upperEnding.draw( painter, QVector2D( baseLine.p2() ) + - baseLineVector.normalized() * upperEnding.realLength() * - ( upperEnding.inverted() ? -1 : 1 ), + upperEnding.draw( painter, + QVector2D( baseLine.p2() ) + baseLineVector.normalized() * + upperEnding.realLength() * + ( upperEnding.inverted() ? -1 : 1 ), baseLineVector ); painter->setAntialiasing( antialiasingBackup ); @@ -7680,18 +7665,18 @@ void QCPAxisPainterPrivate::placeTickLabel( QCPPainter* painter, QPointF labelAnchor; switch( type ) { - case QCPAxis::atLeft: - labelAnchor = QPointF( alignmentRect.left() - distanceToAxis - offset, position ); - break; - case QCPAxis::atRight: - labelAnchor = QPointF( alignmentRect.right() + distanceToAxis + offset, position ); - break; - case QCPAxis::atTop: - labelAnchor = QPointF( position, alignmentRect.top() - distanceToAxis - offset ); - break; - case QCPAxis::atBottom: - labelAnchor = QPointF( position, alignmentRect.bottom() + distanceToAxis + offset ); - break; + case QCPAxis::atLeft: + labelAnchor = QPointF( alignmentRect.left() - distanceToAxis - offset, position ); + break; + case QCPAxis::atRight: + labelAnchor = QPointF( alignmentRect.right() + distanceToAxis + offset, position ); + break; + case QCPAxis::atTop: + labelAnchor = QPointF( position, alignmentRect.top() - distanceToAxis - offset ); + break; + case QCPAxis::atBottom: + labelAnchor = QPointF( position, alignmentRect.bottom() + distanceToAxis + offset ); + break; } if( mParentPlot->plottingHints().testFlag( QCP::phCacheLabels ) && !painter->modes().testFlag( QCPPainter::pmNoCaching ) ) // label caching enabled @@ -9281,8 +9266,9 @@ bool QCPItemPosition::setParentAnchor( QCPItemAnchor* parentAnchor, bool keepPix // because they're both on the same item: if( currentParent->mParentItem == mParentItem ) { - qDebug() << Q_FUNC_INFO << "can't set parent to be an anchor which " - "itself depends on this position" + qDebug() << Q_FUNC_INFO + << "can't set parent to be an anchor which " + "itself depends on this position" << reinterpret_cast( parentAnchor ); return false; } @@ -9362,110 +9348,110 @@ QPointF QCPItemPosition::pixelPoint() const { switch( mPositionType ) { - case ptAbsolute: - { - if( mParentAnchor ) - return QPointF( mKey, mValue ) + mParentAnchor->pixelPoint(); - else - return QPointF( mKey, mValue ); - } + case ptAbsolute: + { + if( mParentAnchor ) + return QPointF( mKey, mValue ) + mParentAnchor->pixelPoint(); + else + return QPointF( mKey, mValue ); + } - case ptViewportRatio: + case ptViewportRatio: + { + if( mParentAnchor ) + { + return QPointF( mKey * mParentPlot->viewport().width(), + mValue * mParentPlot->viewport().height() ) + + mParentAnchor->pixelPoint(); + } + else + { + return QPointF( mKey * mParentPlot->viewport().width(), + mValue * mParentPlot->viewport().height() ) + + mParentPlot->viewport().topLeft(); + } + } + + case ptAxisRectRatio: + { + if( mAxisRect ) { if( mParentAnchor ) { - return QPointF( mKey * mParentPlot->viewport().width(), - mValue * mParentPlot->viewport().height() ) + + return QPointF( mKey * mAxisRect.data()->width(), mValue * mAxisRect.data()->height() ) + mParentAnchor->pixelPoint(); } else { - return QPointF( mKey * mParentPlot->viewport().width(), - mValue * mParentPlot->viewport().height() ) + - mParentPlot->viewport().topLeft(); + return QPointF( mKey * mAxisRect.data()->width(), mValue * mAxisRect.data()->height() ) + + mAxisRect.data()->topLeft(); } } - - case ptAxisRectRatio: + else { - if( mAxisRect ) + qDebug() << Q_FUNC_INFO << "No axis rect defined"; + return QPointF( mKey, mValue ); + } + } + + case ptPlotCoords: + { + double x, y; + if( mKeyAxis && mValueAxis ) + { + // both key and value axis are given, translate key/value to x/y + // coordinates: + if( mKeyAxis.data()->orientation() == Qt::Horizontal ) { - if( mParentAnchor ) - { - return QPointF( mKey * mAxisRect.data()->width(), mValue * mAxisRect.data()->height() ) + - mParentAnchor->pixelPoint(); - } - else - { - return QPointF( mKey * mAxisRect.data()->width(), mValue * mAxisRect.data()->height() ) + - mAxisRect.data()->topLeft(); - } + x = mKeyAxis.data()->coordToPixel( mKey ); + y = mValueAxis.data()->coordToPixel( mValue ); } else { - qDebug() << Q_FUNC_INFO << "No axis rect defined"; - return QPointF( mKey, mValue ); + y = mKeyAxis.data()->coordToPixel( mKey ); + x = mValueAxis.data()->coordToPixel( mValue ); } } - - case ptPlotCoords: + else if( mKeyAxis ) { - double x, y; - if( mKeyAxis && mValueAxis ) + // only key axis is given, depending on orientation only transform x or y + // to key coordinate, other stays pixel: + if( mKeyAxis.data()->orientation() == Qt::Horizontal ) { - // both key and value axis are given, translate key/value to x/y - // coordinates: - if( mKeyAxis.data()->orientation() == Qt::Horizontal ) - { - x = mKeyAxis.data()->coordToPixel( mKey ); - y = mValueAxis.data()->coordToPixel( mValue ); - } - else - { - y = mKeyAxis.data()->coordToPixel( mKey ); - x = mValueAxis.data()->coordToPixel( mValue ); - } - } - else if( mKeyAxis ) - { - // only key axis is given, depending on orientation only transform x or y - // to key coordinate, other stays pixel: - if( mKeyAxis.data()->orientation() == Qt::Horizontal ) - { - x = mKeyAxis.data()->coordToPixel( mKey ); - y = mValue; - } - else - { - y = mKeyAxis.data()->coordToPixel( mKey ); - x = mValue; - } - } - else if( mValueAxis ) - { - // only value axis is given, depending on orientation only transform x or - // y to value coordinate, other stays - // pixel: - if( mValueAxis.data()->orientation() == Qt::Horizontal ) - { - x = mValueAxis.data()->coordToPixel( mValue ); - y = mKey; - } - else - { - y = mValueAxis.data()->coordToPixel( mValue ); - x = mKey; - } - } - else - { - // no axis given, basically the same as if mPositionType were ptAbsolute - qDebug() << Q_FUNC_INFO << "No axes defined"; - x = mKey; + x = mKeyAxis.data()->coordToPixel( mKey ); y = mValue; } - return QPointF( x, y ); + else + { + y = mKeyAxis.data()->coordToPixel( mKey ); + x = mValue; + } } + else if( mValueAxis ) + { + // only value axis is given, depending on orientation only transform x or + // y to value coordinate, other stays + // pixel: + if( mValueAxis.data()->orientation() == Qt::Horizontal ) + { + x = mValueAxis.data()->coordToPixel( mValue ); + y = mKey; + } + else + { + y = mValueAxis.data()->coordToPixel( mValue ); + x = mKey; + } + } + else + { + // no axis given, basically the same as if mPositionType were ptAbsolute + qDebug() << Q_FUNC_INFO << "No axes defined"; + x = mKey; + y = mValue; + } + return QPointF( x, y ); + } } return QPointF(); } @@ -9513,120 +9499,120 @@ void QCPItemPosition::setPixelPoint( const QPointF& pixelPoint ) { switch( mPositionType ) { - case ptAbsolute: - { - if( mParentAnchor ) - setCoords( pixelPoint - mParentAnchor->pixelPoint() ); - else - setCoords( pixelPoint ); - break; - } + case ptAbsolute: + { + if( mParentAnchor ) + setCoords( pixelPoint - mParentAnchor->pixelPoint() ); + else + setCoords( pixelPoint ); + break; + } - case ptViewportRatio: + case ptViewportRatio: + { + if( mParentAnchor ) + { + QPointF p( pixelPoint - mParentAnchor->pixelPoint() ); + p.rx() /= (double)mParentPlot->viewport().width(); + p.ry() /= (double)mParentPlot->viewport().height(); + setCoords( p ); + } + else + { + QPointF p( pixelPoint - mParentPlot->viewport().topLeft() ); + p.rx() /= (double)mParentPlot->viewport().width(); + p.ry() /= (double)mParentPlot->viewport().height(); + setCoords( p ); + } + break; + } + + case ptAxisRectRatio: + { + if( mAxisRect ) { if( mParentAnchor ) { QPointF p( pixelPoint - mParentAnchor->pixelPoint() ); - p.rx() /= (double)mParentPlot->viewport().width(); - p.ry() /= (double)mParentPlot->viewport().height(); + p.rx() /= (double)mAxisRect.data()->width(); + p.ry() /= (double)mAxisRect.data()->height(); setCoords( p ); } else { - QPointF p( pixelPoint - mParentPlot->viewport().topLeft() ); - p.rx() /= (double)mParentPlot->viewport().width(); - p.ry() /= (double)mParentPlot->viewport().height(); + QPointF p( pixelPoint - mAxisRect.data()->topLeft() ); + p.rx() /= (double)mAxisRect.data()->width(); + p.ry() /= (double)mAxisRect.data()->height(); setCoords( p ); } - break; } - - case ptAxisRectRatio: + else { - if( mAxisRect ) + qDebug() << Q_FUNC_INFO << "No axis rect defined"; + setCoords( pixelPoint ); + } + break; + } + + case ptPlotCoords: + { + double newKey, newValue; + if( mKeyAxis && mValueAxis ) + { + // both key and value axis are given, translate point to key/value + // coordinates: + if( mKeyAxis.data()->orientation() == Qt::Horizontal ) { - if( mParentAnchor ) - { - QPointF p( pixelPoint - mParentAnchor->pixelPoint() ); - p.rx() /= (double)mAxisRect.data()->width(); - p.ry() /= (double)mAxisRect.data()->height(); - setCoords( p ); - } - else - { - QPointF p( pixelPoint - mAxisRect.data()->topLeft() ); - p.rx() /= (double)mAxisRect.data()->width(); - p.ry() /= (double)mAxisRect.data()->height(); - setCoords( p ); - } + newKey = mKeyAxis.data()->pixelToCoord( pixelPoint.x() ); + newValue = mValueAxis.data()->pixelToCoord( pixelPoint.y() ); } else { - qDebug() << Q_FUNC_INFO << "No axis rect defined"; - setCoords( pixelPoint ); + newKey = mKeyAxis.data()->pixelToCoord( pixelPoint.y() ); + newValue = mValueAxis.data()->pixelToCoord( pixelPoint.x() ); } - break; } - - case ptPlotCoords: + else if( mKeyAxis ) { - double newKey, newValue; - if( mKeyAxis && mValueAxis ) + // only key axis is given, depending on orientation only transform x or y + // to key coordinate, other stays pixel: + if( mKeyAxis.data()->orientation() == Qt::Horizontal ) { - // both key and value axis are given, translate point to key/value - // coordinates: - if( mKeyAxis.data()->orientation() == Qt::Horizontal ) - { - newKey = mKeyAxis.data()->pixelToCoord( pixelPoint.x() ); - newValue = mValueAxis.data()->pixelToCoord( pixelPoint.y() ); - } - else - { - newKey = mKeyAxis.data()->pixelToCoord( pixelPoint.y() ); - newValue = mValueAxis.data()->pixelToCoord( pixelPoint.x() ); - } - } - else if( mKeyAxis ) - { - // only key axis is given, depending on orientation only transform x or y - // to key coordinate, other stays pixel: - if( mKeyAxis.data()->orientation() == Qt::Horizontal ) - { - newKey = mKeyAxis.data()->pixelToCoord( pixelPoint.x() ); - newValue = pixelPoint.y(); - } - else - { - newKey = mKeyAxis.data()->pixelToCoord( pixelPoint.y() ); - newValue = pixelPoint.x(); - } - } - else if( mValueAxis ) - { - // only value axis is given, depending on orientation only transform x or - // y to value coordinate, other stays - // pixel: - if( mValueAxis.data()->orientation() == Qt::Horizontal ) - { - newKey = pixelPoint.y(); - newValue = mValueAxis.data()->pixelToCoord( pixelPoint.x() ); - } - else - { - newKey = pixelPoint.x(); - newValue = mValueAxis.data()->pixelToCoord( pixelPoint.y() ); - } - } - else - { - // no axis given, basically the same as if mPositionType were ptAbsolute - qDebug() << Q_FUNC_INFO << "No axes defined"; - newKey = pixelPoint.x(); + newKey = mKeyAxis.data()->pixelToCoord( pixelPoint.x() ); newValue = pixelPoint.y(); } - setCoords( newKey, newValue ); - break; + else + { + newKey = mKeyAxis.data()->pixelToCoord( pixelPoint.y() ); + newValue = pixelPoint.x(); + } } + else if( mValueAxis ) + { + // only value axis is given, depending on orientation only transform x or + // y to value coordinate, other stays + // pixel: + if( mValueAxis.data()->orientation() == Qt::Horizontal ) + { + newKey = pixelPoint.y(); + newValue = mValueAxis.data()->pixelToCoord( pixelPoint.x() ); + } + else + { + newKey = pixelPoint.x(); + newValue = mValueAxis.data()->pixelToCoord( pixelPoint.y() ); + } + } + else + { + // no axis given, basically the same as if mPositionType were ptAbsolute + qDebug() << Q_FUNC_INFO << "No axes defined"; + newKey = pixelPoint.x(); + newValue = pixelPoint.y(); + } + setCoords( newKey, newValue ); + break; + } } } @@ -10157,8 +10143,9 @@ double QCPAbstractItem::rectSelectTest( const QRectF& rect, */ QPointF QCPAbstractItem::anchorPixelPoint( int anchorId ) const { - qDebug() << Q_FUNC_INFO << "called on item which shouldn't have any anchors " - "(this method not reimplemented). anchorId" + qDebug() << Q_FUNC_INFO + << "called on item which shouldn't have any anchors " + "(this method not reimplemented). anchorId" << anchorId; return QPointF(); } @@ -11759,15 +11746,17 @@ QCPGraph* QCustomPlot::addGraph( QCPAxis* keyAxis, QCPAxis* valueAxis ) valueAxis = yAxis; if( !keyAxis || !valueAxis ) { - qDebug() << Q_FUNC_INFO << "can't use default QCustomPlot xAxis or yAxis, " - "because at least one is invalid (has been " - "deleted)"; + qDebug() << Q_FUNC_INFO + << "can't use default QCustomPlot xAxis or yAxis, " + "because at least one is invalid (has been " + "deleted)"; return 0; } if( keyAxis->parentPlot() != this || valueAxis->parentPlot() != this ) { - qDebug() << Q_FUNC_INFO << "passed keyAxis or valueAxis doesn't have this " - "QCustomPlot as parent"; + qDebug() << Q_FUNC_INFO + << "passed keyAxis or valueAxis doesn't have this " + "QCustomPlot as parent"; return 0; } @@ -11917,8 +11906,9 @@ bool QCustomPlot::addItem( QCPAbstractItem* item ) } else { - qDebug() << Q_FUNC_INFO << "item either already in list or not created " - "with this QCustomPlot as parent:" + qDebug() << Q_FUNC_INFO + << "item either already in list or not created " + "with this QCustomPlot as parent:" << reinterpret_cast( item ); return false; } @@ -12411,7 +12401,7 @@ QCPLayoutElement* QCustomPlot::layoutElementAt( const QPointF& pos ) const */ QList QCustomPlot::selectedAxes() const { - QList result, allAxes; + QList result, allAxes; foreach( QCPAxisRect* rect, axisRects() ) allAxes << rect->axes(); @@ -12625,8 +12615,9 @@ bool QCustomPlot::savePdf( const QString& fileName, Q_UNUSED( noCosmeticPen ) Q_UNUSED( width ) Q_UNUSED( height ) - qDebug() << Q_FUNC_INFO << "Qt was built without printer support " - "(QT_NO_PRINTER). PDF not created."; + qDebug() << Q_FUNC_INFO + << "Qt was built without printer support " + "(QT_NO_PRINTER). PDF not created."; #else int newWidth, newHeight; if( width == 0 || height == 0 ) @@ -13768,102 +13759,102 @@ void QCPColorGradient::loadPreset( GradientPreset preset ) clearColorStops(); switch( preset ) { - case gpGrayscale: - setColorInterpolation( ciRGB ); - setColorStopAt( 0, Qt::black ); - setColorStopAt( 1, Qt::white ); - break; - case gpHot: - setColorInterpolation( ciRGB ); - setColorStopAt( 0, QColor( 50, 0, 0 ) ); - setColorStopAt( 0.2, QColor( 180, 10, 0 ) ); - setColorStopAt( 0.4, QColor( 245, 50, 0 ) ); - setColorStopAt( 0.6, QColor( 255, 150, 10 ) ); - setColorStopAt( 0.8, QColor( 255, 255, 50 ) ); - setColorStopAt( 1, QColor( 255, 255, 255 ) ); - break; - case gpCold: - setColorInterpolation( ciRGB ); - setColorStopAt( 0, QColor( 0, 0, 50 ) ); - setColorStopAt( 0.2, QColor( 0, 10, 180 ) ); - setColorStopAt( 0.4, QColor( 0, 50, 245 ) ); - setColorStopAt( 0.6, QColor( 10, 150, 255 ) ); - setColorStopAt( 0.8, QColor( 50, 255, 255 ) ); - setColorStopAt( 1, QColor( 255, 255, 255 ) ); - break; - case gpNight: - setColorInterpolation( ciHSV ); - setColorStopAt( 0, QColor( 10, 20, 30 ) ); - setColorStopAt( 1, QColor( 250, 255, 250 ) ); - break; - case gpCandy: - setColorInterpolation( ciHSV ); - setColorStopAt( 0, QColor( 0, 0, 255 ) ); - setColorStopAt( 1, QColor( 255, 250, 250 ) ); - break; - case gpGeography: - setColorInterpolation( ciRGB ); - setColorStopAt( 0, QColor( 70, 170, 210 ) ); - setColorStopAt( 0.20, QColor( 90, 160, 180 ) ); - setColorStopAt( 0.25, QColor( 45, 130, 175 ) ); - setColorStopAt( 0.30, QColor( 100, 140, 125 ) ); - setColorStopAt( 0.5, QColor( 100, 140, 100 ) ); - setColorStopAt( 0.6, QColor( 130, 145, 120 ) ); - setColorStopAt( 0.7, QColor( 140, 130, 120 ) ); - setColorStopAt( 0.9, QColor( 180, 190, 190 ) ); - setColorStopAt( 1, QColor( 210, 210, 230 ) ); - break; - case gpIon: - setColorInterpolation( ciHSV ); - setColorStopAt( 0, QColor( 50, 10, 10 ) ); - setColorStopAt( 0.45, QColor( 0, 0, 255 ) ); - setColorStopAt( 0.8, QColor( 0, 255, 255 ) ); - setColorStopAt( 1, QColor( 0, 255, 0 ) ); - break; - case gpThermal: - setColorInterpolation( ciRGB ); - setColorStopAt( 0, QColor( 0, 0, 50 ) ); - setColorStopAt( 0.15, QColor( 20, 0, 120 ) ); - setColorStopAt( 0.33, QColor( 200, 30, 140 ) ); - setColorStopAt( 0.6, QColor( 255, 100, 0 ) ); - setColorStopAt( 0.85, QColor( 255, 255, 40 ) ); - setColorStopAt( 1, QColor( 255, 255, 255 ) ); - break; - case gpPolar: - setColorInterpolation( ciRGB ); - setColorStopAt( 0, QColor( 50, 255, 255 ) ); - setColorStopAt( 0.18, QColor( 10, 70, 255 ) ); - setColorStopAt( 0.28, QColor( 10, 10, 190 ) ); - setColorStopAt( 0.5, QColor( 0, 0, 0 ) ); - setColorStopAt( 0.72, QColor( 190, 10, 10 ) ); - setColorStopAt( 0.82, QColor( 255, 70, 10 ) ); - setColorStopAt( 1, QColor( 255, 255, 50 ) ); - break; - case gpSpectrum: - setColorInterpolation( ciHSV ); - setColorStopAt( 0, QColor( 50, 0, 50 ) ); - setColorStopAt( 0.15, QColor( 0, 0, 255 ) ); - setColorStopAt( 0.35, QColor( 0, 255, 255 ) ); - setColorStopAt( 0.6, QColor( 255, 255, 0 ) ); - setColorStopAt( 0.75, QColor( 255, 30, 0 ) ); - setColorStopAt( 1, QColor( 50, 0, 0 ) ); - break; - case gpJet: - setColorInterpolation( ciRGB ); - setColorStopAt( 0, QColor( 0, 0, 100 ) ); - setColorStopAt( 0.15, QColor( 0, 50, 255 ) ); - setColorStopAt( 0.35, QColor( 0, 255, 255 ) ); - setColorStopAt( 0.65, QColor( 255, 255, 0 ) ); - setColorStopAt( 0.85, QColor( 255, 30, 0 ) ); - setColorStopAt( 1, QColor( 100, 0, 0 ) ); - break; - case gpHues: - setColorInterpolation( ciHSV ); - setColorStopAt( 0, QColor( 255, 0, 0 ) ); - setColorStopAt( 1.0 / 3.0, QColor( 0, 0, 255 ) ); - setColorStopAt( 2.0 / 3.0, QColor( 0, 255, 0 ) ); - setColorStopAt( 1, QColor( 255, 0, 0 ) ); - break; + case gpGrayscale: + setColorInterpolation( ciRGB ); + setColorStopAt( 0, Qt::black ); + setColorStopAt( 1, Qt::white ); + break; + case gpHot: + setColorInterpolation( ciRGB ); + setColorStopAt( 0, QColor( 50, 0, 0 ) ); + setColorStopAt( 0.2, QColor( 180, 10, 0 ) ); + setColorStopAt( 0.4, QColor( 245, 50, 0 ) ); + setColorStopAt( 0.6, QColor( 255, 150, 10 ) ); + setColorStopAt( 0.8, QColor( 255, 255, 50 ) ); + setColorStopAt( 1, QColor( 255, 255, 255 ) ); + break; + case gpCold: + setColorInterpolation( ciRGB ); + setColorStopAt( 0, QColor( 0, 0, 50 ) ); + setColorStopAt( 0.2, QColor( 0, 10, 180 ) ); + setColorStopAt( 0.4, QColor( 0, 50, 245 ) ); + setColorStopAt( 0.6, QColor( 10, 150, 255 ) ); + setColorStopAt( 0.8, QColor( 50, 255, 255 ) ); + setColorStopAt( 1, QColor( 255, 255, 255 ) ); + break; + case gpNight: + setColorInterpolation( ciHSV ); + setColorStopAt( 0, QColor( 10, 20, 30 ) ); + setColorStopAt( 1, QColor( 250, 255, 250 ) ); + break; + case gpCandy: + setColorInterpolation( ciHSV ); + setColorStopAt( 0, QColor( 0, 0, 255 ) ); + setColorStopAt( 1, QColor( 255, 250, 250 ) ); + break; + case gpGeography: + setColorInterpolation( ciRGB ); + setColorStopAt( 0, QColor( 70, 170, 210 ) ); + setColorStopAt( 0.20, QColor( 90, 160, 180 ) ); + setColorStopAt( 0.25, QColor( 45, 130, 175 ) ); + setColorStopAt( 0.30, QColor( 100, 140, 125 ) ); + setColorStopAt( 0.5, QColor( 100, 140, 100 ) ); + setColorStopAt( 0.6, QColor( 130, 145, 120 ) ); + setColorStopAt( 0.7, QColor( 140, 130, 120 ) ); + setColorStopAt( 0.9, QColor( 180, 190, 190 ) ); + setColorStopAt( 1, QColor( 210, 210, 230 ) ); + break; + case gpIon: + setColorInterpolation( ciHSV ); + setColorStopAt( 0, QColor( 50, 10, 10 ) ); + setColorStopAt( 0.45, QColor( 0, 0, 255 ) ); + setColorStopAt( 0.8, QColor( 0, 255, 255 ) ); + setColorStopAt( 1, QColor( 0, 255, 0 ) ); + break; + case gpThermal: + setColorInterpolation( ciRGB ); + setColorStopAt( 0, QColor( 0, 0, 50 ) ); + setColorStopAt( 0.15, QColor( 20, 0, 120 ) ); + setColorStopAt( 0.33, QColor( 200, 30, 140 ) ); + setColorStopAt( 0.6, QColor( 255, 100, 0 ) ); + setColorStopAt( 0.85, QColor( 255, 255, 40 ) ); + setColorStopAt( 1, QColor( 255, 255, 255 ) ); + break; + case gpPolar: + setColorInterpolation( ciRGB ); + setColorStopAt( 0, QColor( 50, 255, 255 ) ); + setColorStopAt( 0.18, QColor( 10, 70, 255 ) ); + setColorStopAt( 0.28, QColor( 10, 10, 190 ) ); + setColorStopAt( 0.5, QColor( 0, 0, 0 ) ); + setColorStopAt( 0.72, QColor( 190, 10, 10 ) ); + setColorStopAt( 0.82, QColor( 255, 70, 10 ) ); + setColorStopAt( 1, QColor( 255, 255, 50 ) ); + break; + case gpSpectrum: + setColorInterpolation( ciHSV ); + setColorStopAt( 0, QColor( 50, 0, 50 ) ); + setColorStopAt( 0.15, QColor( 0, 0, 255 ) ); + setColorStopAt( 0.35, QColor( 0, 255, 255 ) ); + setColorStopAt( 0.6, QColor( 255, 255, 0 ) ); + setColorStopAt( 0.75, QColor( 255, 30, 0 ) ); + setColorStopAt( 1, QColor( 50, 0, 0 ) ); + break; + case gpJet: + setColorInterpolation( ciRGB ); + setColorStopAt( 0, QColor( 0, 0, 100 ) ); + setColorStopAt( 0.15, QColor( 0, 50, 255 ) ); + setColorStopAt( 0.35, QColor( 0, 255, 255 ) ); + setColorStopAt( 0.65, QColor( 255, 255, 0 ) ); + setColorStopAt( 0.85, QColor( 255, 30, 0 ) ); + setColorStopAt( 1, QColor( 100, 0, 0 ) ); + break; + case gpHues: + setColorInterpolation( ciHSV ); + setColorStopAt( 0, QColor( 255, 0, 0 ) ); + setColorStopAt( 1.0 / 3.0, QColor( 0, 0, 255 ) ); + setColorStopAt( 2.0 / 3.0, QColor( 0, 255, 0 ) ); + setColorStopAt( 1, QColor( 255, 0, 0 ) ); + break; } } @@ -13933,35 +13924,35 @@ void QCPColorGradient::updateColorBuffer() ( position - low.key() ) / ( high.key() - low.key() ); // interpolation factor 0..1 switch( mColorInterpolation ) { - case ciRGB: - { - mColorBuffer[i] = qRgb( ( 1 - t ) * low.value().red() + t * high.value().red(), - ( 1 - t ) * low.value().green() + t * high.value().green(), - ( 1 - t ) * low.value().blue() + t * high.value().blue() ); - break; - } - case ciHSV: - { - QColor lowHsv = low.value().toHsv(); - QColor highHsv = high.value().toHsv(); - double hue = 0; - double hueDiff = highHsv.hueF() - lowHsv.hueF(); - if( hueDiff > 0.5 ) - hue = lowHsv.hueF() - t * ( 1.0 - hueDiff ); - else if( hueDiff < -0.5 ) - hue = lowHsv.hueF() + t * ( 1.0 + hueDiff ); - else - hue = lowHsv.hueF() + t * hueDiff; - if( hue < 0 ) - hue += 1.0; - else if( hue >= 1.0 ) - hue -= 1.0; - mColorBuffer[i] = - QColor::fromHsvF( hue, ( 1 - t ) * lowHsv.saturationF() + t * highHsv.saturationF(), - ( 1 - t ) * lowHsv.valueF() + t * highHsv.valueF() ) - .rgb(); - break; - } + case ciRGB: + { + mColorBuffer[i] = qRgb( ( 1 - t ) * low.value().red() + t * high.value().red(), + ( 1 - t ) * low.value().green() + t * high.value().green(), + ( 1 - t ) * low.value().blue() + t * high.value().blue() ); + break; + } + case ciHSV: + { + QColor lowHsv = low.value().toHsv(); + QColor highHsv = high.value().toHsv(); + double hue = 0; + double hueDiff = highHsv.hueF() - lowHsv.hueF(); + if( hueDiff > 0.5 ) + hue = lowHsv.hueF() - t * ( 1.0 - hueDiff ); + else if( hueDiff < -0.5 ) + hue = lowHsv.hueF() + t * ( 1.0 + hueDiff ); + else + hue = lowHsv.hueF() + t * hueDiff; + if( hue < 0 ) + hue += 1.0; + else if( hue >= 1.0 ) + hue -= 1.0; + mColorBuffer[i] = + QColor::fromHsvF( hue, ( 1 - t ) * lowHsv.saturationF() + t * highHsv.saturationF(), + ( 1 - t ) * lowHsv.valueF() + t * highHsv.valueF() ) + .rgb(); + break; + } } } } @@ -14546,20 +14537,20 @@ void QCPAxisRect::update( UpdatePhase phase ) switch( phase ) { - case upPreparation: - { - QList allAxes = axes(); - for( int i = 0; i < allAxes.size(); ++i ) - allAxes.at( i )->setupTickVectors(); - break; - } - case upLayout: - { - mInsetLayout->setOuterRect( rect() ); - break; - } - default: - break; + case upPreparation: + { + QList allAxes = axes(); + for( int i = 0; i < allAxes.size(); ++i ) + allAxes.at( i )->setupTickVectors(); + break; + } + case upLayout: + { + mInsetLayout->setOuterRect( rect() ); + break; + } + default: + break; } // pass update call on to inset layout (doesn't happen automatically, because @@ -15632,7 +15623,7 @@ void QCPLegend::setIconSize( const QSize& size ) } /*! \overload -*/ + */ void QCPLegend::setIconSize( int width, int height ) { mIconSize.setWidth( width ); @@ -15727,8 +15718,9 @@ void QCPLegend::setSelectedParts( const SelectableParts& selected ) if( !mSelectedParts.testFlag( spItems ) && newSelected.testFlag( spItems ) ) // attempt to set spItems flag (can't do that) { - qDebug() << Q_FUNC_INFO << "spItems flag can not be set, it can only be " - "unset with this function"; + qDebug() << Q_FUNC_INFO + << "spItems flag can not be set, it can only be " + "unset with this function"; newSelected &= ~spItems; } if( mSelectedParts.testFlag( spItems ) && @@ -16085,10 +16077,7 @@ QCP::Interaction QCPAbstractLegendItem::selectionCategory() const } /* inherits documentation from base class */ -void QCPLegend::parentPlotInitialized( QCustomPlot* parentPlot ) -{ - Q_UNUSED( parentPlot ) -} +void QCPLegend::parentPlotInitialized( QCustomPlot* parentPlot ){Q_UNUSED( parentPlot )} //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPPlotTitle @@ -16853,37 +16842,37 @@ void QCPColorScale::update( UpdatePhase phase ) switch( phase ) { - case upMargins: + case upMargins: + { + if( mType == QCPAxis::atBottom || mType == QCPAxis::atTop ) { - if( mType == QCPAxis::atBottom || mType == QCPAxis::atTop ) - { - setMaximumSize( QWIDGETSIZE_MAX, mBarWidth + mAxisRect.data()->margins().top() + - mAxisRect.data()->margins().bottom() + - margins().top() + margins().bottom() ); - setMinimumSize( 0, mBarWidth + mAxisRect.data()->margins().top() + - mAxisRect.data()->margins().bottom() + margins().top() + - margins().bottom() ); - } - else - { - setMaximumSize( mBarWidth + mAxisRect.data()->margins().left() + - mAxisRect.data()->margins().right() + margins().left() + - margins().right(), - QWIDGETSIZE_MAX ); - setMinimumSize( mBarWidth + mAxisRect.data()->margins().left() + - mAxisRect.data()->margins().right() + margins().left() + - margins().right(), - 0 ); - } - break; + setMaximumSize( QWIDGETSIZE_MAX, mBarWidth + mAxisRect.data()->margins().top() + + mAxisRect.data()->margins().bottom() + margins().top() + + margins().bottom() ); + setMinimumSize( 0, mBarWidth + mAxisRect.data()->margins().top() + + mAxisRect.data()->margins().bottom() + margins().top() + + margins().bottom() ); } - case upLayout: + else { - mAxisRect.data()->setOuterRect( rect() ); - break; + setMaximumSize( mBarWidth + mAxisRect.data()->margins().left() + + mAxisRect.data()->margins().right() + margins().left() + + margins().right(), + QWIDGETSIZE_MAX ); + setMinimumSize( mBarWidth + mAxisRect.data()->margins().left() + + mAxisRect.data()->margins().right() + margins().left() + + margins().right(), + 0 ); } - default: - break; + break; + } + case upLayout: + { + mAxisRect.data()->setOuterRect( rect() ); + break; + } + default: + break; } } @@ -16961,9 +16950,9 @@ QCPColorScaleAxisRectPrivate::QCPColorScaleAxisRectPrivate( QCPColorScale* paren { setParentLayerable( parentColorScale ); setMinimumMargins( QMargins( 0, 0, 0, 0 ) ); - foreach( QCPAxis::AxisType type, QList() << QCPAxis::atBottom << QCPAxis::atTop - << QCPAxis::atLeft - << QCPAxis::atRight ) + foreach( QCPAxis::AxisType type, QList() + << QCPAxis::atBottom << QCPAxis::atTop << QCPAxis::atLeft + << QCPAxis::atRight ) { axis( type )->setVisible( true ); axis( type )->grid()->setVisible( false ); @@ -16996,9 +16985,9 @@ QCPColorScaleAxisRectPrivate::QCPColorScaleAxisRectPrivate( QCPColorScale* paren // gradient drawn by axis rect: connect( parentColorScale, SIGNAL( layerChanged( QCPLayer* ) ), this, SLOT( setLayer( QCPLayer* ) ) ); - foreach( QCPAxis::AxisType type, QList() << QCPAxis::atBottom << QCPAxis::atTop - << QCPAxis::atLeft - << QCPAxis::atRight ) + foreach( QCPAxis::AxisType type, QList() + << QCPAxis::atBottom << QCPAxis::atTop << QCPAxis::atLeft + << QCPAxis::atRight ) connect( parentColorScale, SIGNAL( layerChanged( QCPLayer* ) ), axis( type ), SLOT( setLayer( QCPLayer* ) ) ); } @@ -17086,9 +17075,9 @@ void QCPColorScaleAxisRectPrivate::updateGradientImage() void QCPColorScaleAxisRectPrivate::axisSelectionChanged( QCPAxis::SelectableParts selectedParts ) { // axis bases of four axes shall always (de-)selected synchronously: - foreach( QCPAxis::AxisType type, QList() << QCPAxis::atBottom << QCPAxis::atTop - << QCPAxis::atLeft - << QCPAxis::atRight ) + foreach( QCPAxis::AxisType type, QList() + << QCPAxis::atBottom << QCPAxis::atTop << QCPAxis::atLeft + << QCPAxis::atRight ) { if( QCPAxis* senderAxis = qobject_cast( sender() ) ) if( senderAxis->axisType() == type ) @@ -17113,9 +17102,9 @@ void QCPColorScaleAxisRectPrivate::axisSelectionChanged( QCPAxis::SelectablePart void QCPColorScaleAxisRectPrivate::axisSelectableChanged( QCPAxis::SelectableParts selectableParts ) { // synchronize axis base selectability: - foreach( QCPAxis::AxisType type, QList() << QCPAxis::atBottom << QCPAxis::atTop - << QCPAxis::atLeft - << QCPAxis::atRight ) + foreach( QCPAxis::AxisType type, QList() + << QCPAxis::atBottom << QCPAxis::atTop << QCPAxis::atLeft + << QCPAxis::atRight ) { if( QCPAxis* senderAxis = qobject_cast( sender() ) ) if( senderAxis->axisType() == type ) @@ -18081,24 +18070,24 @@ void QCPGraph::getPlotData( QVector* lineData, QVector* scatte { switch( mLineStyle ) { - case lsNone: - getScatterPlotData( scatterData ); - break; - case lsLine: - getLinePlotData( lineData, scatterData ); - break; - case lsStepLeft: - getStepLeftPlotData( lineData, scatterData ); - break; - case lsStepRight: - getStepRightPlotData( lineData, scatterData ); - break; - case lsStepCenter: - getStepCenterPlotData( lineData, scatterData ); - break; - case lsImpulse: - getImpulsePlotData( lineData, scatterData ); - break; + case lsNone: + getScatterPlotData( scatterData ); + break; + case lsLine: + getLinePlotData( lineData, scatterData ); + break; + case lsStepLeft: + getStepLeftPlotData( lineData, scatterData ); + break; + case lsStepRight: + getStepRightPlotData( lineData, scatterData ); + break; + case lsStepCenter: + getStepCenterPlotData( lineData, scatterData ); + break; + case lsImpulse: + getImpulsePlotData( lineData, scatterData ); + break; } } @@ -20023,9 +20012,7 @@ QCPRange QCPGraph::getValueRange( bool& foundRange, /*! Constructs a curve data point with t, key and value set to zero. */ -QCPCurveData::QCPCurveData() : t( 0 ), key( 0 ), value( 0 ) -{ -} +QCPCurveData::QCPCurveData() : t( 0 ), key( 0 ), value( 0 ) {} /*! Constructs a curve data point with the specified \a t, \a key and \a value. @@ -20630,7 +20617,7 @@ void QCPCurve::getCurveData( QVector* lineData ) const ( lastRegion == 6 && currentRegion == 8 ) ) || // skip bottom right diagonal ( ( lastRegion == 6 && currentRegion == 2 ) || ( lastRegion == 2 && currentRegion == 6 ) ) // skip bottom left diagonal - ) + ) { // always add last point if not added already, original: if( !addedLastAlready ) @@ -20731,34 +20718,34 @@ QPointF QCPCurve::outsideCoordsToPixels( double key, QPointF result = coordsToPixels( key, value ); switch( region ) { - case 2: - result.setX( axisRect.left() - margin ); - break; // left - case 8: - result.setX( axisRect.right() + margin ); - break; // right - case 4: - result.setY( axisRect.top() - margin ); - break; // top - case 6: - result.setY( axisRect.bottom() + margin ); - break; // bottom - case 1: - result.setX( axisRect.left() - margin ); - result.setY( axisRect.top() - margin ); - break; // top left - case 7: - result.setX( axisRect.right() + margin ); - result.setY( axisRect.top() - margin ); - break; // top right - case 9: - result.setX( axisRect.right() + margin ); - result.setY( axisRect.bottom() + margin ); - break; // bottom right - case 3: - result.setX( axisRect.left() - margin ); - result.setY( axisRect.bottom() + margin ); - break; // bottom left + case 2: + result.setX( axisRect.left() - margin ); + break; // left + case 8: + result.setX( axisRect.right() + margin ); + break; // right + case 4: + result.setY( axisRect.top() - margin ); + break; // top + case 6: + result.setY( axisRect.bottom() + margin ); + break; // bottom + case 1: + result.setX( axisRect.left() - margin ); + result.setY( axisRect.top() - margin ); + break; // top left + case 7: + result.setX( axisRect.right() + margin ); + result.setY( axisRect.top() - margin ); + break; // top right + case 9: + result.setX( axisRect.right() + margin ); + result.setY( axisRect.bottom() + margin ); + break; // bottom right + case 3: + result.setX( axisRect.left() - margin ); + result.setY( axisRect.bottom() + margin ); + break; // bottom left } return result; } @@ -20850,16 +20837,12 @@ QCPRange QCPCurve::getValueRange( bool& foundRange, SignDomain inSignDomain ) co /*! Constructs a bar data point with key and value set to zero. */ -QCPBarData::QCPBarData() : key( 0 ), value( 0 ) -{ -} +QCPBarData::QCPBarData() : key( 0 ), value( 0 ) {} /*! Constructs a bar data point with the specified \a key and \a value. */ -QCPBarData::QCPBarData( double key, double value ) : key( key ), value( value ) -{ -} +QCPBarData::QCPBarData( double key, double value ) : key( key ), value( value ) {} //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPBars @@ -21029,8 +21012,9 @@ void QCPBars::moveBelow( QCPBars* bars ) return; if( bars && ( bars->keyAxis() != mKeyAxis.data() || bars->valueAxis() != mValueAxis.data() ) ) { - qDebug() << Q_FUNC_INFO << "passed QCPBars* doesn't have same key and " - "value axis as this QCPBars"; + qDebug() << Q_FUNC_INFO + << "passed QCPBars* doesn't have same key and " + "value axis as this QCPBars"; return; } // remove from stacking: @@ -21070,8 +21054,9 @@ void QCPBars::moveAbove( QCPBars* bars ) return; if( bars && ( bars->keyAxis() != mKeyAxis.data() || bars->valueAxis() != mValueAxis.data() ) ) { - qDebug() << Q_FUNC_INFO << "passed QCPBars* doesn't have same key and " - "value axis as this QCPBars"; + qDebug() << Q_FUNC_INFO + << "passed QCPBars* doesn't have same key and " + "value axis as this QCPBars"; return; } // remove from stacking: @@ -23079,9 +23064,7 @@ QCPItemStraightLine::QCPItemStraightLine( QCustomPlot* parentPlot ) setSelectedPen( QPen( Qt::blue, 2 ) ); } -QCPItemStraightLine::~QCPItemStraightLine() -{ -} +QCPItemStraightLine::~QCPItemStraightLine() {} /*! Sets the pen that will be used to draw the line @@ -23292,9 +23275,7 @@ QCPItemLine::QCPItemLine( QCustomPlot* parentPlot ) setSelectedPen( QPen( Qt::blue, 2 ) ); } -QCPItemLine::~QCPItemLine() -{ -} +QCPItemLine::~QCPItemLine() {} /*! Sets the pen that will be used to draw the line @@ -23548,9 +23529,7 @@ QCPItemCurve::QCPItemCurve( QCustomPlot* parentPlot ) setSelectedPen( QPen( Qt::blue, 2 ) ); } -QCPItemCurve::~QCPItemCurve() -{ -} +QCPItemCurve::~QCPItemCurve() {} /*! Sets the pen that will be used to draw the line @@ -23712,9 +23691,7 @@ QCPItemRect::QCPItemRect( QCustomPlot* parentPlot ) setSelectedBrush( Qt::NoBrush ); } -QCPItemRect::~QCPItemRect() -{ -} +QCPItemRect::~QCPItemRect() {} /*! Sets the pen that will be used to draw the line of the rectangle @@ -23797,18 +23774,18 @@ QPointF QCPItemRect::anchorPixelPoint( int anchorId ) const QRectF rect = QRectF( topLeft->pixelPoint(), bottomRight->pixelPoint() ); switch( anchorId ) { - case aiTop: - return ( rect.topLeft() + rect.topRight() ) * 0.5; - case aiTopRight: - return rect.topRight(); - case aiRight: - return ( rect.topRight() + rect.bottomRight() ) * 0.5; - case aiBottom: - return ( rect.bottomLeft() + rect.bottomRight() ) * 0.5; - case aiBottomLeft: - return rect.bottomLeft(); - case aiLeft: - return ( rect.topLeft() + rect.bottomLeft() ) * 0.5; + case aiTop: + return ( rect.topLeft() + rect.topRight() ) * 0.5; + case aiTopRight: + return rect.topRight(); + case aiRight: + return ( rect.topRight() + rect.bottomRight() ) * 0.5; + case aiBottom: + return ( rect.bottomLeft() + rect.bottomRight() ) * 0.5; + case aiBottomLeft: + return rect.bottomLeft(); + case aiLeft: + return ( rect.topLeft() + rect.bottomLeft() ) * 0.5; } qDebug() << Q_FUNC_INFO << "invalid anchorId" << anchorId; @@ -23891,9 +23868,7 @@ QCPItemText::QCPItemText( QCustomPlot* parentPlot ) setSelectedColor( Qt::blue ); } -QCPItemText::~QCPItemText() -{ -} +QCPItemText::~QCPItemText() {} /*! Sets the color of the text. @@ -24126,22 +24101,22 @@ QPointF QCPItemText::anchorPixelPoint( int anchorId ) const switch( anchorId ) { - case aiTopLeft: - return rectPoly.at( 0 ); - case aiTop: - return ( rectPoly.at( 0 ) + rectPoly.at( 1 ) ) * 0.5; - case aiTopRight: - return rectPoly.at( 1 ); - case aiRight: - return ( rectPoly.at( 1 ) + rectPoly.at( 2 ) ) * 0.5; - case aiBottomRight: - return rectPoly.at( 2 ); - case aiBottom: - return ( rectPoly.at( 2 ) + rectPoly.at( 3 ) ) * 0.5; - case aiBottomLeft: - return rectPoly.at( 3 ); - case aiLeft: - return ( rectPoly.at( 3 ) + rectPoly.at( 0 ) ) * 0.5; + case aiTopLeft: + return rectPoly.at( 0 ); + case aiTop: + return ( rectPoly.at( 0 ) + rectPoly.at( 1 ) ) * 0.5; + case aiTopRight: + return rectPoly.at( 1 ); + case aiRight: + return ( rectPoly.at( 1 ) + rectPoly.at( 2 ) ) * 0.5; + case aiBottomRight: + return rectPoly.at( 2 ); + case aiBottom: + return ( rectPoly.at( 2 ) + rectPoly.at( 3 ) ) * 0.5; + case aiBottomLeft: + return rectPoly.at( 3 ); + case aiLeft: + return ( rectPoly.at( 3 ) + rectPoly.at( 0 ) ) * 0.5; } qDebug() << Q_FUNC_INFO << "invalid anchorId" << anchorId; @@ -24268,9 +24243,7 @@ QCPItemEllipse::QCPItemEllipse( QCustomPlot* parentPlot ) setSelectedBrush( Qt::NoBrush ); } -QCPItemEllipse::~QCPItemEllipse() -{ -} +QCPItemEllipse::~QCPItemEllipse() {} /*! Sets the pen that will be used to draw the line of the ellipse @@ -24384,24 +24357,24 @@ QPointF QCPItemEllipse::anchorPixelPoint( int anchorId ) const QRectF rect = QRectF( topLeft->pixelPoint(), bottomRight->pixelPoint() ); switch( anchorId ) { - case aiTopLeftRim: - return rect.center() + ( rect.topLeft() - rect.center() ) * 1 / qSqrt( 2 ); - case aiTop: - return ( rect.topLeft() + rect.topRight() ) * 0.5; - case aiTopRightRim: - return rect.center() + ( rect.topRight() - rect.center() ) * 1 / qSqrt( 2 ); - case aiRight: - return ( rect.topRight() + rect.bottomRight() ) * 0.5; - case aiBottomRightRim: - return rect.center() + ( rect.bottomRight() - rect.center() ) * 1 / qSqrt( 2 ); - case aiBottom: - return ( rect.bottomLeft() + rect.bottomRight() ) * 0.5; - case aiBottomLeftRim: - return rect.center() + ( rect.bottomLeft() - rect.center() ) * 1 / qSqrt( 2 ); - case aiLeft: - return ( rect.topLeft() + rect.bottomLeft() ) * 0.5; - case aiCenter: - return ( rect.topLeft() + rect.bottomRight() ) * 0.5; + case aiTopLeftRim: + return rect.center() + ( rect.topLeft() - rect.center() ) * 1 / qSqrt( 2 ); + case aiTop: + return ( rect.topLeft() + rect.topRight() ) * 0.5; + case aiTopRightRim: + return rect.center() + ( rect.topRight() - rect.center() ) * 1 / qSqrt( 2 ); + case aiRight: + return ( rect.topRight() + rect.bottomRight() ) * 0.5; + case aiBottomRightRim: + return rect.center() + ( rect.bottomRight() - rect.center() ) * 1 / qSqrt( 2 ); + case aiBottom: + return ( rect.bottomLeft() + rect.bottomRight() ) * 0.5; + case aiBottomLeftRim: + return rect.center() + ( rect.bottomLeft() - rect.center() ) * 1 / qSqrt( 2 ); + case aiLeft: + return ( rect.topLeft() + rect.bottomLeft() ) * 0.5; + case aiCenter: + return ( rect.topLeft() + rect.bottomRight() ) * 0.5; } qDebug() << Q_FUNC_INFO << "invalid anchorId" << anchorId; @@ -24477,9 +24450,7 @@ QCPItemPixmap::QCPItemPixmap( QCustomPlot* parentPlot ) setScaled( false, Qt::KeepAspectRatio ); } -QCPItemPixmap::~QCPItemPixmap() -{ -} +QCPItemPixmap::~QCPItemPixmap() {} /*! Sets the pixmap that will be displayed. @@ -24571,19 +24542,19 @@ QPointF QCPItemPixmap::anchorPixelPoint( int anchorId ) const switch( anchorId ) { - case aiTop: - return ( rect.topLeft() + rect.topRight() ) * 0.5; - case aiTopRight: - return rect.topRight(); - case aiRight: - return ( rect.topRight() + rect.bottomRight() ) * 0.5; - case aiBottom: - return ( rect.bottomLeft() + rect.bottomRight() ) * 0.5; - case aiBottomLeft: - return rect.bottomLeft(); - case aiLeft: - return ( rect.topLeft() + rect.bottomLeft() ) * 0.5; - ; + case aiTop: + return ( rect.topLeft() + rect.topRight() ) * 0.5; + case aiTopRight: + return rect.topRight(); + case aiRight: + return ( rect.topRight() + rect.bottomRight() ) * 0.5; + case aiBottom: + return ( rect.bottomLeft() + rect.bottomRight() ) * 0.5; + case aiBottomLeft: + return rect.bottomLeft(); + case aiLeft: + return ( rect.topLeft() + rect.bottomLeft() ) * 0.5; + ; } qDebug() << Q_FUNC_INFO << "invalid anchorId" << anchorId; @@ -24771,9 +24742,7 @@ QCPItemTracer::QCPItemTracer( QCustomPlot* parentPlot ) setGraphKey( 0 ); } -QCPItemTracer::~QCPItemTracer() -{ -} +QCPItemTracer::~QCPItemTracer() {} /*! Sets the pen that will be used to draw the line of the tracer @@ -24922,53 +24891,53 @@ double QCPItemTracer::selectTest( const QPointF& pos, bool onlySelectable, QVari QRect clip = clipRect(); switch( mStyle ) { - case tsNone: - return -1; - case tsPlus: + case tsNone: + return -1; + case tsPlus: + { + if( clipRect().intersects( + QRectF( center - QPointF( w, w ), center + QPointF( w, w ) ).toRect() ) ) + return qSqrt( + qMin( distSqrToLine( center + QPointF( -w, 0 ), center + QPointF( w, 0 ), pos ), + distSqrToLine( center + QPointF( 0, -w ), center + QPointF( 0, w ), pos ) ) ); + break; + } + case tsCrosshair: + { + return qSqrt( qMin( distSqrToLine( QPointF( clip.left(), center.y() ), + QPointF( clip.right(), center.y() ), pos ), + distSqrToLine( QPointF( center.x(), clip.top() ), + QPointF( center.x(), clip.bottom() ), pos ) ) ); + } + case tsCircle: + { + if( clip.intersects( QRectF( center - QPointF( w, w ), center + QPointF( w, w ) ).toRect() ) ) { - if( clipRect().intersects( - QRectF( center - QPointF( w, w ), center + QPointF( w, w ) ).toRect() ) ) - return qSqrt( - qMin( distSqrToLine( center + QPointF( -w, 0 ), center + QPointF( w, 0 ), pos ), - distSqrToLine( center + QPointF( 0, -w ), center + QPointF( 0, w ), pos ) ) ); - break; - } - case tsCrosshair: - { - return qSqrt( qMin( distSqrToLine( QPointF( clip.left(), center.y() ), - QPointF( clip.right(), center.y() ), pos ), - distSqrToLine( QPointF( center.x(), clip.top() ), - QPointF( center.x(), clip.bottom() ), pos ) ) ); - } - case tsCircle: - { - if( clip.intersects( QRectF( center - QPointF( w, w ), center + QPointF( w, w ) ).toRect() ) ) + // distance to border: + double centerDist = QVector2D( center - pos ).length(); + double circleLine = w; + double result = qAbs( centerDist - circleLine ); + // filled ellipse, allow click inside to count as hit: + if( result > mParentPlot->selectionTolerance() * 0.99 && mBrush.style() != Qt::NoBrush && + mBrush.color().alpha() != 0 ) { - // distance to border: - double centerDist = QVector2D( center - pos ).length(); - double circleLine = w; - double result = qAbs( centerDist - circleLine ); - // filled ellipse, allow click inside to count as hit: - if( result > mParentPlot->selectionTolerance() * 0.99 && mBrush.style() != Qt::NoBrush && - mBrush.color().alpha() != 0 ) - { - if( centerDist <= circleLine ) - result = mParentPlot->selectionTolerance() * 0.99; - } - return result; + if( centerDist <= circleLine ) + result = mParentPlot->selectionTolerance() * 0.99; } - break; + return result; } - case tsSquare: + break; + } + case tsSquare: + { + if( clip.intersects( QRectF( center - QPointF( w, w ), center + QPointF( w, w ) ).toRect() ) ) { - if( clip.intersects( QRectF( center - QPointF( w, w ), center + QPointF( w, w ) ).toRect() ) ) - { - QRectF rect = QRectF( center - QPointF( w, w ), center + QPointF( w, w ) ); - bool filledRect = mBrush.style() != Qt::NoBrush && mBrush.color().alpha() != 0; - return rectSelectTest( rect, pos, filledRect ); - } - break; + QRectF rect = QRectF( center - QPointF( w, w ), center + QPointF( w, w ) ); + bool filledRect = mBrush.style() != Qt::NoBrush && mBrush.color().alpha() != 0; + return rectSelectTest( rect, pos, filledRect ); } + break; + } } return -1; } @@ -24987,37 +24956,37 @@ void QCPItemTracer::draw( QCPPainter* painter ) QRect clip = clipRect(); switch( mStyle ) { - case tsNone: - return; - case tsPlus: + case tsNone: + return; + case tsPlus: + { + if( clip.intersects( QRectF( center - QPointF( w, w ), center + QPointF( w, w ) ).toRect() ) ) { - if( clip.intersects( QRectF( center - QPointF( w, w ), center + QPointF( w, w ) ).toRect() ) ) - { - painter->drawLine( QLineF( center + QPointF( -w, 0 ), center + QPointF( w, 0 ) ) ); - painter->drawLine( QLineF( center + QPointF( 0, -w ), center + QPointF( 0, w ) ) ); - } - break; - } - case tsCrosshair: - { - if( center.y() > clip.top() && center.y() < clip.bottom() ) - painter->drawLine( QLineF( clip.left(), center.y(), clip.right(), center.y() ) ); - if( center.x() > clip.left() && center.x() < clip.right() ) - painter->drawLine( QLineF( center.x(), clip.top(), center.x(), clip.bottom() ) ); - break; - } - case tsCircle: - { - if( clip.intersects( QRectF( center - QPointF( w, w ), center + QPointF( w, w ) ).toRect() ) ) - painter->drawEllipse( center, w, w ); - break; - } - case tsSquare: - { - if( clip.intersects( QRectF( center - QPointF( w, w ), center + QPointF( w, w ) ).toRect() ) ) - painter->drawRect( QRectF( center - QPointF( w, w ), center + QPointF( w, w ) ) ); - break; + painter->drawLine( QLineF( center + QPointF( -w, 0 ), center + QPointF( w, 0 ) ) ); + painter->drawLine( QLineF( center + QPointF( 0, -w ), center + QPointF( 0, w ) ) ); } + break; + } + case tsCrosshair: + { + if( center.y() > clip.top() && center.y() < clip.bottom() ) + painter->drawLine( QLineF( clip.left(), center.y(), clip.right(), center.y() ) ); + if( center.x() > clip.left() && center.x() < clip.right() ) + painter->drawLine( QLineF( center.x(), clip.top(), center.x(), clip.bottom() ) ); + break; + } + case tsCircle: + { + if( clip.intersects( QRectF( center - QPointF( w, w ), center + QPointF( w, w ) ).toRect() ) ) + painter->drawEllipse( center, w, w ); + break; + } + case tsSquare: + { + if( clip.intersects( QRectF( center - QPointF( w, w ), center + QPointF( w, w ) ).toRect() ) ) + painter->drawRect( QRectF( center - QPointF( w, w ), center + QPointF( w, w ) ) ); + break; + } } } @@ -25166,9 +25135,7 @@ QCPItemBracket::QCPItemBracket( QCustomPlot* parentPlot ) setStyle( bsCalligraphic ); } -QCPItemBracket::~QCPItemBracket() -{ -} +QCPItemBracket::~QCPItemBracket() {} /*! Sets the pen that will be used to draw the bracket. @@ -25269,66 +25236,64 @@ void QCPItemBracket::draw( QCPPainter* painter ) painter->setPen( mainPen() ); switch( mStyle ) { - case bsSquare: - { - painter->drawLine( ( centerVec + widthVec ).toPointF(), - ( centerVec - widthVec ).toPointF() ); - painter->drawLine( ( centerVec + widthVec ).toPointF(), - ( centerVec + widthVec + lengthVec ).toPointF() ); - painter->drawLine( ( centerVec - widthVec ).toPointF(), - ( centerVec - widthVec + lengthVec ).toPointF() ); - break; - } - case bsRound: - { - painter->setBrush( Qt::NoBrush ); - QPainterPath path; - path.moveTo( ( centerVec + widthVec + lengthVec ).toPointF() ); - path.cubicTo( ( centerVec + widthVec ).toPointF(), ( centerVec + widthVec ).toPointF(), - centerVec.toPointF() ); - path.cubicTo( ( centerVec - widthVec ).toPointF(), ( centerVec - widthVec ).toPointF(), - ( centerVec - widthVec + lengthVec ).toPointF() ); - painter->drawPath( path ); - break; - } - case bsCurly: - { - painter->setBrush( Qt::NoBrush ); - QPainterPath path; - path.moveTo( ( centerVec + widthVec + lengthVec ).toPointF() ); - path.cubicTo( ( centerVec + widthVec - lengthVec * 0.8f ).toPointF(), - ( centerVec + 0.4f * widthVec + lengthVec ).toPointF(), - centerVec.toPointF() ); - path.cubicTo( ( centerVec - 0.4f * widthVec + lengthVec ).toPointF(), - ( centerVec - widthVec - lengthVec * 0.8f ).toPointF(), - ( centerVec - widthVec + lengthVec ).toPointF() ); - painter->drawPath( path ); - break; - } - case bsCalligraphic: - { - painter->setPen( Qt::NoPen ); - painter->setBrush( QBrush( mainPen().color() ) ); - QPainterPath path; - path.moveTo( ( centerVec + widthVec + lengthVec ).toPointF() ); + case bsSquare: + { + painter->drawLine( ( centerVec + widthVec ).toPointF(), ( centerVec - widthVec ).toPointF() ); + painter->drawLine( ( centerVec + widthVec ).toPointF(), + ( centerVec + widthVec + lengthVec ).toPointF() ); + painter->drawLine( ( centerVec - widthVec ).toPointF(), + ( centerVec - widthVec + lengthVec ).toPointF() ); + break; + } + case bsRound: + { + painter->setBrush( Qt::NoBrush ); + QPainterPath path; + path.moveTo( ( centerVec + widthVec + lengthVec ).toPointF() ); + path.cubicTo( ( centerVec + widthVec ).toPointF(), ( centerVec + widthVec ).toPointF(), + centerVec.toPointF() ); + path.cubicTo( ( centerVec - widthVec ).toPointF(), ( centerVec - widthVec ).toPointF(), + ( centerVec - widthVec + lengthVec ).toPointF() ); + painter->drawPath( path ); + break; + } + case bsCurly: + { + painter->setBrush( Qt::NoBrush ); + QPainterPath path; + path.moveTo( ( centerVec + widthVec + lengthVec ).toPointF() ); + path.cubicTo( ( centerVec + widthVec - lengthVec * 0.8f ).toPointF(), + ( centerVec + 0.4f * widthVec + lengthVec ).toPointF(), centerVec.toPointF() ); + path.cubicTo( ( centerVec - 0.4f * widthVec + lengthVec ).toPointF(), + ( centerVec - widthVec - lengthVec * 0.8f ).toPointF(), + ( centerVec - widthVec + lengthVec ).toPointF() ); + painter->drawPath( path ); + break; + } + case bsCalligraphic: + { + painter->setPen( Qt::NoPen ); + painter->setBrush( QBrush( mainPen().color() ) ); + QPainterPath path; + path.moveTo( ( centerVec + widthVec + lengthVec ).toPointF() ); - path.cubicTo( ( centerVec + widthVec - lengthVec * 0.8f ).toPointF(), - ( centerVec + 0.4f * widthVec + 0.8f * lengthVec ).toPointF(), - centerVec.toPointF() ); - path.cubicTo( ( centerVec - 0.4f * widthVec + 0.8f * lengthVec ).toPointF(), - ( centerVec - widthVec - lengthVec * 0.8f ).toPointF(), - ( centerVec - widthVec + lengthVec ).toPointF() ); + path.cubicTo( ( centerVec + widthVec - lengthVec * 0.8f ).toPointF(), + ( centerVec + 0.4f * widthVec + 0.8f * lengthVec ).toPointF(), + centerVec.toPointF() ); + path.cubicTo( ( centerVec - 0.4f * widthVec + 0.8f * lengthVec ).toPointF(), + ( centerVec - widthVec - lengthVec * 0.8f ).toPointF(), + ( centerVec - widthVec + lengthVec ).toPointF() ); - path.cubicTo( ( centerVec - widthVec - lengthVec * 0.5f ).toPointF(), - ( centerVec - 0.2f * widthVec + 1.2f * lengthVec ).toPointF(), - ( centerVec + lengthVec * 0.2f ).toPointF() ); - path.cubicTo( ( centerVec + 0.2f * widthVec + 1.2f * lengthVec ).toPointF(), - ( centerVec + widthVec - lengthVec * 0.5f ).toPointF(), - ( centerVec + widthVec + lengthVec ).toPointF() ); + path.cubicTo( ( centerVec - widthVec - lengthVec * 0.5f ).toPointF(), + ( centerVec - 0.2f * widthVec + 1.2f * lengthVec ).toPointF(), + ( centerVec + lengthVec * 0.2f ).toPointF() ); + path.cubicTo( ( centerVec + 0.2f * widthVec + 1.2f * lengthVec ).toPointF(), + ( centerVec + widthVec - lengthVec * 0.5f ).toPointF(), + ( centerVec + widthVec + lengthVec ).toPointF() ); - painter->drawPath( path ); - break; - } + painter->drawPath( path ); + break; + } } } } @@ -25348,8 +25313,8 @@ QPointF QCPItemBracket::anchorPixelPoint( int anchorId ) const switch( anchorId ) { - case aiCenter: - return centerVec.toPointF(); + case aiCenter: + return centerVec.toPointF(); } qDebug() << Q_FUNC_INFO << "invalid anchorId" << anchorId; return QPointF(); diff --git a/app/external/qcustomplot.h b/app/external/qcustomplot.h index d6b5721..ad89ffd 100644 --- a/app/external/qcustomplot.h +++ b/app/external/qcustomplot.h @@ -256,23 +256,23 @@ inline void setMarginValue( QMargins& margins, QCP::MarginSide side, int value ) { switch( side ) { - case QCP::msLeft: - margins.setLeft( value ); - break; - case QCP::msRight: - margins.setRight( value ); - break; - case QCP::msTop: - margins.setTop( value ); - break; - case QCP::msBottom: - margins.setBottom( value ); - break; - case QCP::msAll: - margins = QMargins( value, value, value, value ); - break; - default: - break; + case QCP::msLeft: + margins.setLeft( value ); + break; + case QCP::msRight: + margins.setRight( value ); + break; + case QCP::msTop: + margins.setTop( value ); + break; + case QCP::msBottom: + margins.setBottom( value ); + break; + case QCP::msAll: + margins = QMargins( value, value, value, value ); + break; + default: + break; } } @@ -288,16 +288,16 @@ inline int getMarginValue( const QMargins& margins, QCP::MarginSide side ) { switch( side ) { - case QCP::msLeft: - return margins.left(); - case QCP::msRight: - return margins.right(); - case QCP::msTop: - return margins.top(); - case QCP::msBottom: - return margins.bottom(); - default: - break; + case QCP::msLeft: + return margins.left(); + case QCP::msRight: + return margins.right(); + case QCP::msTop: + return margins.top(); + case QCP::msBottom: + return margins.bottom(); + default: + break; } return 0; } @@ -312,7 +312,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS( QCP::Interactions ) class QCP_LIB_DECL QCPScatterStyle { Q_GADGET - public: +public: /*! Defines the shape used for scatter points. @@ -407,7 +407,7 @@ class QCP_LIB_DECL QCPScatterStyle void drawShape( QCPPainter* painter, QPointF pos ) const; void drawShape( QCPPainter* painter, double x, double y ) const; - protected: +protected: // property members: double mSize; ScatterShape mShape; @@ -424,7 +424,7 @@ Q_DECLARE_TYPEINFO( QCPScatterStyle, Q_MOVABLE_TYPE ); class QCP_LIB_DECL QCPPainter : public QPainter { Q_GADGET - public: +public: /*! Defines special modes the painter can operate in. They disable or enable certain subsets of @@ -476,7 +476,7 @@ class QCP_LIB_DECL QCPPainter : public QPainter // non-virtual methods: void makeNonCosmetic(); - protected: +protected: // property members: PainterModes mModes; bool mIsAntialiasing; @@ -496,7 +496,7 @@ class QCP_LIB_DECL QCPLayer : public QObject Q_PROPERTY( QList children READ children ) Q_PROPERTY( bool visible READ visible WRITE setVisible ) /// \endcond - public: +public: QCPLayer( QCustomPlot* parentPlot, const QString& layerName ); ~QCPLayer(); @@ -509,7 +509,7 @@ class QCP_LIB_DECL QCPLayer : public QObject // setters: void setVisible( bool visible ); - protected: +protected: // property members: QCustomPlot* mParentPlot; QString mName; @@ -521,7 +521,7 @@ class QCP_LIB_DECL QCPLayer : public QObject void addChild( QCPLayerable* layerable, bool prepend ); void removeChild( QCPLayerable* layerable ); - private: +private: Q_DISABLE_COPY( QCPLayer ) friend class QCustomPlot; @@ -538,7 +538,7 @@ class QCP_LIB_DECL QCPLayerable : public QObject Q_PROPERTY( QCPLayer* layer READ layer WRITE setLayer NOTIFY layerChanged ) Q_PROPERTY( bool antialiased READ antialiased WRITE setAntialiased ) /// \endcond - public: +public: QCPLayerable( QCustomPlot* plot, QString targetLayer = "", QCPLayerable* parentLayerable = 0 ); ~QCPLayerable(); @@ -560,10 +560,10 @@ class QCP_LIB_DECL QCPLayerable : public QObject // non-property methods: bool realVisibility() const; - signals: +signals: void layerChanged( QCPLayer* newLayer ); - protected: +protected: // property members: bool mVisible; QCustomPlot* mParentPlot; @@ -592,7 +592,7 @@ class QCP_LIB_DECL QCPLayerable : public QObject bool localAntialiased, QCP::AntialiasedElement overrideElement ) const; - private: +private: Q_DISABLE_COPY( QCPLayerable ) friend class QCustomPlot; @@ -601,7 +601,7 @@ class QCP_LIB_DECL QCPLayerable : public QObject class QCP_LIB_DECL QCPRange { - public: +public: double lower, upper; QCPRange(); @@ -743,7 +743,7 @@ inline const QCPRange operator/( const QCPRange& range, double value ) class QCP_LIB_DECL QCPMarginGroup : public QObject { Q_OBJECT - public: +public: QCPMarginGroup( QCustomPlot* parentPlot ); ~QCPMarginGroup(); @@ -755,7 +755,7 @@ class QCP_LIB_DECL QCPMarginGroup : public QObject bool isEmpty() const; void clear(); - protected: +protected: // non-property members: QCustomPlot* mParentPlot; QHash> mChildren; @@ -765,7 +765,7 @@ class QCP_LIB_DECL QCPMarginGroup : public QObject void addChild( QCP::MarginSide side, QCPLayoutElement* element ); void removeChild( QCP::MarginSide side, QCPLayoutElement* element ); - private: +private: Q_DISABLE_COPY( QCPMarginGroup ) friend class QCPLayoutElement; @@ -783,7 +783,7 @@ class QCP_LIB_DECL QCPLayoutElement : public QCPLayerable Q_PROPERTY( QSize minimumSize READ minimumSize WRITE setMinimumSize ) Q_PROPERTY( QSize maximumSize READ maximumSize WRITE setMaximumSize ) /// \endcond - public: +public: /*! Defines the phases of the update process, that happens just before a replot. At each phase, @@ -839,7 +839,7 @@ class QCP_LIB_DECL QCPLayoutElement : public QCPLayerable // reimplemented virtual methods: virtual double selectTest( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; - protected: +protected: // property members: QCPLayout* mParentLayout; QSize mMinimumSize, mMaximumSize; @@ -861,7 +861,7 @@ class QCP_LIB_DECL QCPLayoutElement : public QCPLayerable virtual void draw( QCPPainter* painter ) { Q_UNUSED( painter ) } virtual void parentPlotInitialized( QCustomPlot* parentPlot ); - private: +private: Q_DISABLE_COPY( QCPLayoutElement ) friend class QCustomPlot; @@ -872,7 +872,7 @@ class QCP_LIB_DECL QCPLayoutElement : public QCPLayerable class QCP_LIB_DECL QCPLayout : public QCPLayoutElement { Q_OBJECT - public: +public: explicit QCPLayout(); // reimplemented virtual methods: @@ -891,7 +891,7 @@ class QCP_LIB_DECL QCPLayout : public QCPLayoutElement bool remove( QCPLayoutElement* element ); void clear(); - protected: +protected: // introduced virtual methods: virtual void updateLayout(); @@ -904,7 +904,7 @@ class QCP_LIB_DECL QCPLayout : public QCPLayoutElement QVector stretchFactors, int totalSize ) const; - private: +private: Q_DISABLE_COPY( QCPLayout ) friend class QCPLayoutElement; }; @@ -921,7 +921,7 @@ class QCP_LIB_DECL QCPLayoutGrid : public QCPLayout Q_PROPERTY( int columnSpacing READ columnSpacing WRITE setColumnSpacing ) Q_PROPERTY( int rowSpacing READ rowSpacing WRITE setRowSpacing ) /// \endcond - public: +public: explicit QCPLayoutGrid(); virtual ~QCPLayoutGrid(); @@ -959,7 +959,7 @@ class QCP_LIB_DECL QCPLayoutGrid : public QCPLayout void insertRow( int newIndex ); void insertColumn( int newIndex ); - protected: +protected: // property members: QList> mElements; QList mColumnStretchFactors; @@ -970,14 +970,14 @@ class QCP_LIB_DECL QCPLayoutGrid : public QCPLayout void getMinimumRowColSizes( QVector* minColWidths, QVector* minRowHeights ) const; void getMaximumRowColSizes( QVector* maxColWidths, QVector* maxRowHeights ) const; - private: +private: Q_DISABLE_COPY( QCPLayoutGrid ) }; class QCP_LIB_DECL QCPLayoutInset : public QCPLayout { Q_OBJECT - public: +public: /*! Defines how the placement and sizing is handled for a certain element in a QCPLayoutInset. @@ -1017,21 +1017,21 @@ class QCP_LIB_DECL QCPLayoutInset : public QCPLayout void addElement( QCPLayoutElement* element, Qt::Alignment alignment ); void addElement( QCPLayoutElement* element, const QRectF& rect ); - protected: +protected: // property members: QList mElements; QList mInsetPlacement; QList mInsetAlignment; QList mInsetRect; - private: +private: Q_DISABLE_COPY( QCPLayoutInset ) }; class QCP_LIB_DECL QCPLineEnding { Q_GADGET - public: +public: /*! Defines the type of ending decoration for line-like items, e.g. an arrow. @@ -1093,7 +1093,7 @@ class QCP_LIB_DECL QCPLineEnding void draw( QCPPainter* painter, const QVector2D& pos, const QVector2D& dir ) const; void draw( QCPPainter* painter, const QVector2D& pos, double angle ) const; - protected: +protected: // property members: EndingStyle mStyle; double mWidth, mLength; @@ -1112,7 +1112,7 @@ class QCP_LIB_DECL QCPGrid : public QCPLayerable Q_PROPERTY( QPen subGridPen READ subGridPen WRITE setSubGridPen ) Q_PROPERTY( QPen zeroLinePen READ zeroLinePen WRITE setZeroLinePen ) /// \endcond - public: +public: QCPGrid( QCPAxis* parentAxis ); // getters: @@ -1130,7 +1130,7 @@ class QCP_LIB_DECL QCPGrid : public QCPLayerable void setSubGridPen( const QPen& pen ); void setZeroLinePen( const QPen& pen ); - protected: +protected: // property members: bool mSubGridVisible; bool mAntialiasedSubGrid, mAntialiasedZeroLine; @@ -1209,7 +1209,7 @@ class QCP_LIB_DECL QCPAxis : public QCPLayerable Q_PROPERTY( QCPLineEnding upperEnding READ upperEnding WRITE setUpperEnding ) Q_PROPERTY( QCPGrid* grid READ grid ) /// \endcond - public: +public: /*! Defines at which side of the axis rect the axis will appear. This also affects how the tick @@ -1415,7 +1415,7 @@ class QCP_LIB_DECL QCPAxis : public QCPLayerable } static AxisType opposite( AxisType type ); - signals: +signals: void ticksRequest(); void rangeChanged( const QCPRange& newRange ); void rangeChanged( const QCPRange& newRange, const QCPRange& oldRange ); @@ -1423,7 +1423,7 @@ class QCP_LIB_DECL QCPAxis : public QCPLayerable void selectionChanged( const QCPAxis::SelectableParts& parts ); void selectableChanged( const QCPAxis::SelectableParts& parts ); - protected: +protected: // property members: // axis base: AxisType mAxisType; @@ -1506,7 +1506,7 @@ class QCP_LIB_DECL QCPAxis : public QCPLayerable QColor getTickLabelColor() const; QColor getLabelColor() const; - private: +private: Q_DISABLE_COPY( QCPAxis ) friend class QCustomPlot; @@ -1519,7 +1519,7 @@ Q_DECLARE_METATYPE( QCPAxis::SelectablePart ) class QCPAxisPainterPrivate { - public: +public: explicit QCPAxisPainterPrivate( QCustomPlot* parentPlot ); virtual ~QCPAxisPainterPrivate(); @@ -1556,7 +1556,7 @@ class QCPAxisPainterPrivate QVector tickPositions; QVector tickLabels; - protected: +protected: struct CachedLabel { QPointF offset; @@ -1609,7 +1609,7 @@ class QCP_LIB_DECL QCPAbstractPlottable : public QCPLayerable Q_PROPERTY( bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged ) Q_PROPERTY( bool selected READ selected WRITE setSelected NOTIFY selectionChanged ) /// \endcond - public: +public: QCPAbstractPlottable( QCPAxis* keyAxis, QCPAxis* valueAxis ); // getters: @@ -1652,11 +1652,11 @@ class QCP_LIB_DECL QCPAbstractPlottable : public QCPLayerable void rescaleKeyAxis( bool onlyEnlarge = false ) const; void rescaleValueAxis( bool onlyEnlarge = false ) const; - signals: +signals: void selectionChanged( bool selected ); void selectableChanged( bool selectable ); - protected: +protected: /*! Represents negative and positive sign domain for passing to \ref getKeyRange and \ref getValueRange. @@ -1707,7 +1707,7 @@ class QCP_LIB_DECL QCPAbstractPlottable : public QCPLayerable void applyErrorBarsAntialiasingHint( QCPPainter* painter ) const; double distSqrToLine( const QPointF& start, const QPointF& end, const QPointF& point ) const; - private: +private: Q_DISABLE_COPY( QCPAbstractPlottable ) friend class QCustomPlot; @@ -1717,7 +1717,7 @@ class QCP_LIB_DECL QCPAbstractPlottable : public QCPLayerable class QCP_LIB_DECL QCPItemAnchor { - public: +public: QCPItemAnchor( QCustomPlot* parentPlot, QCPAbstractItem* parentItem, const QString name, @@ -1728,7 +1728,7 @@ class QCP_LIB_DECL QCPItemAnchor QString name() const { return mName; } virtual QPointF pixelPoint() const; - protected: +protected: // property members: QString mName; @@ -1745,7 +1745,7 @@ class QCP_LIB_DECL QCPItemAnchor void removeChild( QCPItemPosition* pos ); // called from pos when its parent // anchor is reset or pos deleted - private: +private: Q_DISABLE_COPY( QCPItemAnchor ) friend class QCPItemPosition; @@ -1753,7 +1753,7 @@ class QCP_LIB_DECL QCPItemAnchor class QCP_LIB_DECL QCPItemPosition : public QCPItemAnchor { - public: +public: /*! Defines the ways an item position can be specified. Thus it defines what the numbers passed to @@ -1811,7 +1811,7 @@ class QCP_LIB_DECL QCPItemPosition : public QCPItemAnchor void setAxisRect( QCPAxisRect* axisRect ); void setPixelPoint( const QPointF& pixelPoint ); - protected: +protected: // property members: PositionType mPositionType; QPointer mKeyAxis, mValueAxis; @@ -1821,7 +1821,8 @@ class QCP_LIB_DECL QCPItemPosition : public QCPItemAnchor // reimplemented virtual methods: virtual QCPItemPosition* toQCPItemPosition() { return this; } - private: + +private: Q_DISABLE_COPY( QCPItemPosition ) }; @@ -1834,7 +1835,7 @@ class QCP_LIB_DECL QCPAbstractItem : public QCPLayerable Q_PROPERTY( bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged ) Q_PROPERTY( bool selected READ selected WRITE setSelected NOTIFY selectionChanged ) /// \endcond - public: +public: QCPAbstractItem( QCustomPlot* parentPlot ); virtual ~QCPAbstractItem(); @@ -1861,11 +1862,11 @@ class QCP_LIB_DECL QCPAbstractItem : public QCPLayerable QCPItemAnchor* anchor( const QString& name ) const; bool hasAnchor( const QString& name ) const; - signals: +signals: void selectionChanged( bool selected ); void selectableChanged( bool selectable ); - protected: +protected: // property members: bool mClipToAxisRect; QPointer mClipAxisRect; @@ -1894,7 +1895,7 @@ class QCP_LIB_DECL QCPAbstractItem : public QCPLayerable QCPItemPosition* createPosition( const QString& name ); QCPItemAnchor* createAnchor( const QString& name, int anchorId ); - private: +private: Q_DISABLE_COPY( QCPAbstractItem ) friend class QCustomPlot; @@ -1918,7 +1919,7 @@ class QCP_LIB_DECL QCustomPlot : public QWidget Q_PROPERTY( Qt::KeyboardModifier multiSelectModifier READ multiSelectModifier WRITE setMultiSelectModifier ) /// \endcond - public: +public: /*! Defines how a layer should be inserted relative to an other layer. @@ -2081,7 +2082,7 @@ class QCP_LIB_DECL QCustomPlot : public QWidget QCPAxis *xAxis, *yAxis, *xAxis2, *yAxis2; QCPLegend* legend; - signals: +signals: void mouseDoubleClick( QMouseEvent* event ); void mousePress( QMouseEvent* event ); void mouseMove( QMouseEvent* event ); @@ -2103,7 +2104,7 @@ class QCP_LIB_DECL QCustomPlot : public QWidget void beforeReplot(); void afterReplot(); - protected: +protected: // property members: QRect mViewport; QCPLayoutGrid* mPlotLayout; @@ -2164,7 +2165,7 @@ class QCP_LIB_DECL QCustomPlot : public QWidget class QCP_LIB_DECL QCPColorGradient { Q_GADGET - public: +public: /*! Defines the color spaces in which color interpolation between gradient stops can be performed. @@ -2258,7 +2259,7 @@ class QCP_LIB_DECL QCPColorGradient void clearColorStops(); QCPColorGradient inverted() const; - protected: +protected: void updateColorBuffer(); // property members: @@ -2283,7 +2284,7 @@ class QCP_LIB_DECL QCPAxisRect : public QCPLayoutElement Q_PROPERTY( Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag ) Q_PROPERTY( Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom ) /// \endcond - public: +public: explicit QCPAxisRect( QCustomPlot* parentPlot, bool setupDefaultAxes = true ); virtual ~QCPAxisRect(); @@ -2343,7 +2344,7 @@ class QCP_LIB_DECL QCPAxisRect : public QCPLayoutElement virtual void update( UpdatePhase phase ); virtual QList elements( bool recursive ) const; - protected: +protected: // property members: QBrush mBackgroundBrush; QPixmap mBackgroundPixmap; @@ -2375,7 +2376,7 @@ class QCP_LIB_DECL QCPAxisRect : public QCPLayoutElement void drawBackground( QCPPainter* painter ); void updateAxesOffset( QCPAxis::AxisType type ); - private: +private: Q_DISABLE_COPY( QCPAxisRect ) friend class QCustomPlot; @@ -2393,7 +2394,7 @@ class QCP_LIB_DECL QCPAbstractLegendItem : public QCPLayoutElement Q_PROPERTY( bool selectable READ selectable WRITE setSelectable NOTIFY selectionChanged ) Q_PROPERTY( bool selected READ selected WRITE setSelected NOTIFY selectableChanged ) /// \endcond - public: +public: explicit QCPAbstractLegendItem( QCPLegend* parent ); // getters: @@ -2415,11 +2416,11 @@ class QCP_LIB_DECL QCPAbstractLegendItem : public QCPLayoutElement // reimplemented virtual methods: virtual double selectTest( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; - signals: +signals: void selectionChanged( bool selected ); void selectableChanged( bool selectable ); - protected: +protected: // property members: QCPLegend* mParentLegend; QFont mFont; @@ -2440,7 +2441,7 @@ class QCP_LIB_DECL QCPAbstractLegendItem : public QCPLayoutElement bool* selectionStateChanged ); virtual void deselectEvent( bool* selectionStateChanged ); - private: +private: Q_DISABLE_COPY( QCPAbstractLegendItem ) friend class QCPLegend; @@ -2449,12 +2450,13 @@ class QCP_LIB_DECL QCPAbstractLegendItem : public QCPLayoutElement class QCP_LIB_DECL QCPPlottableLegendItem : public QCPAbstractLegendItem { Q_OBJECT - public: +public: QCPPlottableLegendItem( QCPLegend* parent, QCPAbstractPlottable* plottable ); // getters: QCPAbstractPlottable* plottable() { return mPlottable; } - protected: + +protected: // property members: QCPAbstractPlottable* mPlottable; @@ -2489,7 +2491,7 @@ class QCP_LIB_DECL QCPLegend : public QCPLayoutGrid Q_PROPERTY( QFont selectedFont READ selectedFont WRITE setSelectedFont ) Q_PROPERTY( QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor ) /// \endcond - public: +public: /*! Defines the selectable parts of a legend @@ -2557,11 +2559,11 @@ class QCP_LIB_DECL QCPLegend : public QCPLayoutGrid void clearItems(); QList selectedItems() const; - signals: +signals: void selectionChanged( QCPLegend::SelectableParts parts ); void selectableChanged( QCPLegend::SelectableParts parts ); - protected: +protected: // property members: QPen mBorderPen, mIconBorderPen; QBrush mBrush; @@ -2591,7 +2593,7 @@ class QCP_LIB_DECL QCPLegend : public QCPLayoutGrid QPen getBorderPen() const; QBrush getBrush() const; - private: +private: Q_DISABLE_COPY( QCPLegend ) friend class QCustomPlot; @@ -2612,7 +2614,7 @@ class QCP_LIB_DECL QCPPlotTitle : public QCPLayoutElement Q_PROPERTY( bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged ) Q_PROPERTY( bool selected READ selected WRITE setSelected NOTIFY selectionChanged ) /// \endcond - public: +public: explicit QCPPlotTitle( QCustomPlot* parentPlot ); explicit QCPPlotTitle( QCustomPlot* parentPlot, const QString& text ); @@ -2636,11 +2638,11 @@ class QCP_LIB_DECL QCPPlotTitle : public QCPLayoutElement // reimplemented virtual methods: virtual double selectTest( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; - signals: +signals: void selectionChanged( bool selected ); void selectableChanged( bool selectable ); - protected: +protected: // property members: QString mText; QFont mFont; @@ -2666,28 +2668,28 @@ class QCP_LIB_DECL QCPPlotTitle : public QCPLayoutElement QFont mainFont() const; QColor mainTextColor() const; - private: +private: Q_DISABLE_COPY( QCPPlotTitle ) }; class QCPColorScaleAxisRectPrivate : public QCPAxisRect { Q_OBJECT - public: +public: explicit QCPColorScaleAxisRectPrivate( QCPColorScale* parentColorScale ); - protected: +protected: QCPColorScale* mParentColorScale; QImage mGradientImage; bool mGradientImageInvalidated; // re-using some methods of QCPAxisRect to make them available to friend class // QCPColorScale using QCPAxisRect::calculateAutoMargin; - using QCPAxisRect::mousePressEvent; using QCPAxisRect::mouseMoveEvent; + using QCPAxisRect::mousePressEvent; using QCPAxisRect::mouseReleaseEvent; - using QCPAxisRect::wheelEvent; using QCPAxisRect::update; + using QCPAxisRect::wheelEvent; virtual void draw( QCPPainter* painter ); void updateGradientImage(); Q_SLOT void axisSelectionChanged( QCPAxis::SelectableParts selectedParts ); @@ -2709,7 +2711,7 @@ class QCP_LIB_DECL QCPColorScale : public QCPLayoutElement Q_PROPERTY( bool rangeDrag READ rangeDrag WRITE setRangeDrag ) Q_PROPERTY( bool rangeZoom READ rangeZoom WRITE setRangeZoom ) /// \endcond - public: +public: explicit QCPColorScale( QCustomPlot* parentPlot ); virtual ~QCPColorScale(); @@ -2741,12 +2743,12 @@ class QCP_LIB_DECL QCPColorScale : public QCPLayoutElement // reimplemented virtual methods: virtual void update( UpdatePhase phase ); - signals: +signals: void dataRangeChanged( QCPRange newRange ); void dataScaleTypeChanged( QCPAxis::ScaleType scaleType ); void gradientChanged( QCPColorGradient newGradient ); - protected: +protected: // property members: QCPAxis::AxisType mType; QCPRange mDataRange; @@ -2766,7 +2768,7 @@ class QCP_LIB_DECL QCPColorScale : public QCPLayoutElement virtual void mouseReleaseEvent( QMouseEvent* event ); virtual void wheelEvent( QWheelEvent* event ); - private: +private: Q_DISABLE_COPY( QCPColorScale ) friend class QCPColorScaleAxisRectPrivate; @@ -2776,7 +2778,7 @@ class QCP_LIB_DECL QCPColorScale : public QCPLayoutElement class QCP_LIB_DECL QCPData { - public: +public: QCPData(); QCPData( double key, double value ); double key, value; @@ -2809,7 +2811,7 @@ class QCP_LIB_DECL QCPGraph : public QCPAbstractPlottable Q_PROPERTY( QCPGraph* channelFillGraph READ channelFillGraph WRITE setChannelFillGraph ) Q_PROPERTY( bool adaptiveSampling READ adaptiveSampling WRITE setAdaptiveSampling ) /// \endcond - public: +public: /*! Defines how the graph's line is represented visually in the plot. The line is drawn with the @@ -2926,7 +2928,7 @@ class QCP_LIB_DECL QCPGraph : public QCPAbstractPlottable void rescaleValueAxis( bool onlyEnlarge, bool includeErrorBars ) const; // overloads base class interface - protected: +protected: // property members: QCPDataMap* mData; QPen mErrorPen; @@ -2991,7 +2993,7 @@ class QCP_LIB_DECL QCPGraph : public QCPAbstractPlottable class QCP_LIB_DECL QCPCurveData { - public: +public: QCPCurveData(); QCPCurveData( double t, double key, double value ); double t, key, value; @@ -3018,7 +3020,7 @@ class QCP_LIB_DECL QCPCurve : public QCPAbstractPlottable Q_PROPERTY( QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle ) Q_PROPERTY( LineStyle lineStyle READ lineStyle WRITE setLineStyle ) /// \endcond - public: +public: /*! Defines how the curve's line is represented visually in the plot. The line is drawn with the @@ -3064,7 +3066,7 @@ class QCP_LIB_DECL QCPCurve : public QCPAbstractPlottable virtual void clearData(); virtual double selectTest( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; - protected: +protected: // property members: QCPCurveDataMap* mData; QCPScatterStyle mScatterStyle; @@ -3092,7 +3094,7 @@ class QCP_LIB_DECL QCPCurve : public QCPAbstractPlottable class QCP_LIB_DECL QCPBarData { - public: +public: QCPBarData(); QCPBarData( double key, double value ); double key, value; @@ -3118,7 +3120,7 @@ class QCP_LIB_DECL QCPBars : public QCPAbstractPlottable Q_PROPERTY( QCPBars* barBelow READ barBelow ) Q_PROPERTY( QCPBars* barAbove READ barAbove ) /// \endcond - public: +public: explicit QCPBars( QCPAxis* keyAxis, QCPAxis* valueAxis ); virtual ~QCPBars(); @@ -3148,7 +3150,7 @@ class QCP_LIB_DECL QCPBars : public QCPAbstractPlottable virtual void clearData(); virtual double selectTest( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; - protected: +protected: // property members: QCPBarDataMap* mData; double mWidth; @@ -3189,7 +3191,7 @@ class QCP_LIB_DECL QCPStatisticalBox : public QCPAbstractPlottable Q_PROPERTY( QPen medianPen READ medianPen WRITE setMedianPen ) Q_PROPERTY( QCPScatterStyle outlierStyle READ outlierStyle WRITE setOutlierStyle ) /// \endcond - public: +public: explicit QCPStatisticalBox( QCPAxis* keyAxis, QCPAxis* valueAxis ); // getters: @@ -3231,7 +3233,7 @@ class QCP_LIB_DECL QCPStatisticalBox : public QCPAbstractPlottable virtual void clearData(); virtual double selectTest( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; - protected: +protected: // property members: QVector mOutliers; double mKey, mMinimum, mLowerQuartile, mMedian, mUpperQuartile, mMaximum; @@ -3258,7 +3260,7 @@ class QCP_LIB_DECL QCPStatisticalBox : public QCPAbstractPlottable class QCP_LIB_DECL QCPColorMapData { - public: +public: QCPColorMapData( int keySize, int valueSize, const QCPRange& keyRange, @@ -3294,7 +3296,7 @@ class QCP_LIB_DECL QCPColorMapData void coordToCell( double key, double value, int* keyIndex, int* valueIndex ) const; void cellToCoord( int keyIndex, int valueIndex, double* key, double* value ) const; - protected: +protected: // property members: int mKeySize, mValueSize; QCPRange mKeyRange, mValueRange; @@ -3319,7 +3321,7 @@ class QCP_LIB_DECL QCPColorMap : public QCPAbstractPlottable Q_PROPERTY( bool tightBoundary READ tightBoundary WRITE setTightBoundary ) Q_PROPERTY( QCPColorScale* colorScale READ colorScale WRITE setColorScale ) /// \endcond - public: +public: explicit QCPColorMap( QCPAxis* keyAxis, QCPAxis* valueAxis ); virtual ~QCPColorMap(); @@ -3349,12 +3351,12 @@ class QCP_LIB_DECL QCPColorMap : public QCPAbstractPlottable virtual void clearData(); virtual double selectTest( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; - signals: +signals: void dataRangeChanged( QCPRange newRange ); void dataScaleTypeChanged( QCPAxis::ScaleType scaleType ); void gradientChanged( QCPColorGradient newGradient ); - protected: +protected: // property members: QCPRange mDataRange; QCPAxis::ScaleType mDataScaleType; @@ -3388,7 +3390,7 @@ class QCP_LIB_DECL QCPItemStraightLine : public QCPAbstractItem Q_PROPERTY( QPen pen READ pen WRITE setPen ) Q_PROPERTY( QPen selectedPen READ selectedPen WRITE setSelectedPen ) /// \endcond - public: +public: QCPItemStraightLine( QCustomPlot* parentPlot ); virtual ~QCPItemStraightLine(); @@ -3405,7 +3407,7 @@ class QCP_LIB_DECL QCPItemStraightLine : public QCPAbstractItem QCPItemPosition* const point1; QCPItemPosition* const point2; - protected: +protected: // property members: QPen mPen, mSelectedPen; @@ -3431,7 +3433,7 @@ class QCP_LIB_DECL QCPItemLine : public QCPAbstractItem Q_PROPERTY( QCPLineEnding head READ head WRITE setHead ) Q_PROPERTY( QCPLineEnding tail READ tail WRITE setTail ) /// \endcond - public: +public: QCPItemLine( QCustomPlot* parentPlot ); virtual ~QCPItemLine(); @@ -3452,7 +3454,7 @@ class QCP_LIB_DECL QCPItemLine : public QCPAbstractItem QCPItemPosition* const start; QCPItemPosition* const end; - protected: +protected: // property members: QPen mPen, mSelectedPen; QCPLineEnding mHead, mTail; @@ -3476,7 +3478,7 @@ class QCP_LIB_DECL QCPItemCurve : public QCPAbstractItem Q_PROPERTY( QCPLineEnding head READ head WRITE setHead ) Q_PROPERTY( QCPLineEnding tail READ tail WRITE setTail ) /// \endcond - public: +public: QCPItemCurve( QCustomPlot* parentPlot ); virtual ~QCPItemCurve(); @@ -3499,7 +3501,7 @@ class QCP_LIB_DECL QCPItemCurve : public QCPAbstractItem QCPItemPosition* const endDir; QCPItemPosition* const end; - protected: +protected: // property members: QPen mPen, mSelectedPen; QCPLineEnding mHead, mTail; @@ -3520,7 +3522,7 @@ class QCP_LIB_DECL QCPItemRect : public QCPAbstractItem Q_PROPERTY( QBrush brush READ brush WRITE setBrush ) Q_PROPERTY( QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush ) /// \endcond - public: +public: QCPItemRect( QCustomPlot* parentPlot ); virtual ~QCPItemRect(); @@ -3547,7 +3549,7 @@ class QCP_LIB_DECL QCPItemRect : public QCPAbstractItem QCPItemAnchor* const bottomLeft; QCPItemAnchor* const left; - protected: +protected: enum AnchorIndex { aiTop, @@ -3589,7 +3591,7 @@ class QCP_LIB_DECL QCPItemText : public QCPAbstractItem Q_PROPERTY( double rotation READ rotation WRITE setRotation ) Q_PROPERTY( QMargins padding READ padding WRITE setPadding ) /// \endcond - public: +public: QCPItemText( QCustomPlot* parentPlot ); virtual ~QCPItemText(); @@ -3635,7 +3637,7 @@ class QCP_LIB_DECL QCPItemText : public QCPAbstractItem QCPItemAnchor* const bottomLeft; QCPItemAnchor* const left; - protected: +protected: enum AnchorIndex { aiTopLeft, @@ -3682,7 +3684,7 @@ class QCP_LIB_DECL QCPItemEllipse : public QCPAbstractItem Q_PROPERTY( QBrush brush READ brush WRITE setBrush ) Q_PROPERTY( QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush ) /// \endcond - public: +public: QCPItemEllipse( QCustomPlot* parentPlot ); virtual ~QCPItemEllipse(); @@ -3712,7 +3714,7 @@ class QCP_LIB_DECL QCPItemEllipse : public QCPAbstractItem QCPItemAnchor* const left; QCPItemAnchor* const center; - protected: +protected: enum AnchorIndex { aiTopLeftRim, @@ -3749,7 +3751,7 @@ class QCP_LIB_DECL QCPItemPixmap : public QCPAbstractItem Q_PROPERTY( QPen pen READ pen WRITE setPen ) Q_PROPERTY( QPen selectedPen READ selectedPen WRITE setSelectedPen ) /// \endcond - public: +public: QCPItemPixmap( QCustomPlot* parentPlot ); virtual ~QCPItemPixmap(); @@ -3777,7 +3779,7 @@ class QCP_LIB_DECL QCPItemPixmap : public QCPAbstractItem QCPItemAnchor* const bottomLeft; QCPItemAnchor* const left; - protected: +protected: enum AnchorIndex { aiTop, @@ -3821,7 +3823,7 @@ class QCP_LIB_DECL QCPItemTracer : public QCPAbstractItem Q_PROPERTY( double graphKey READ graphKey WRITE setGraphKey ) Q_PROPERTY( bool interpolating READ interpolating WRITE setInterpolating ) /// \endcond - public: +public: /*! The different visual appearances a tracer item can have. Some styles size may be controlled with \ref setSize. @@ -3874,7 +3876,7 @@ class QCP_LIB_DECL QCPItemTracer : public QCPAbstractItem QCPItemPosition* const position; - protected: +protected: // property members: QPen mPen, mSelectedPen; QBrush mBrush, mSelectedBrush; @@ -3901,7 +3903,7 @@ class QCP_LIB_DECL QCPItemBracket : public QCPAbstractItem Q_PROPERTY( double length READ length WRITE setLength ) Q_PROPERTY( BracketStyle style READ style WRITE setStyle ) /// \endcond - public: +public: enum BracketStyle { bsSquare ///< A brace with angled edges @@ -3935,7 +3937,7 @@ class QCP_LIB_DECL QCPItemBracket : public QCPAbstractItem QCPItemPosition* const right; QCPItemAnchor* const center; - protected: +protected: // property members: enum AnchorIndex { diff --git a/app/main.cpp b/app/main.cpp index 7a3d9db..042a3af 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -56,8 +56,8 @@ int main( int argc, char* argv[] ) * use dbus, if available * allows for resuse of running Kate instances */ - QDBusConnectionInterface* const sessionBusInterface = QDBusConnection::sessionBus().interface(); - if( sessionBusInterface ) + if( QDBusConnectionInterface* const sessionBusInterface = + QDBusConnection::sessionBus().interface() ) { Bool force_new = false; QStringList filenameList; diff --git a/examples/modules/CMakeLists.txt b/examples/modules/CMakeLists.txt index 3a0aff7..f3c10b7 100644 --- a/examples/modules/CMakeLists.txt +++ b/examples/modules/CMakeLists.txt @@ -7,7 +7,7 @@ CMAKE_MINIMUM_REQUIRED( VERSION 2.8.9 ) PROJECT( "modules_example" ) -FIND_PACKAGE( PlaYUVer ) +# FIND_PACKAGE( PlaYUVer ) INCLUDE_DIRECTORIES( ${PLAYUVER_INCLUDE_DIRS} ) diff --git a/examples/modules/FrameBinarization_APIv1.cpp b/examples/modules/FrameBinarization_APIv1.cpp index 6f5c47d..273fe31 100644 --- a/examples/modules/FrameBinarization_APIv1.cpp +++ b/examples/modules/FrameBinarization_APIv1.cpp @@ -24,14 +24,14 @@ #include "FrameBinarization_APIv1.h" -REGISTER_CLASS_MAKER( FrameBinarization ) +REGISTER_CLASS_MAKER( FrameBinarization_APIv1 ) -FrameBinarization::FrameBinarization() +FrameBinarization_APIv1::FrameBinarization_APIv1() { /* Module Definition */ m_iModuleType = FRAME_PROCESSING_MODULE; m_pchModuleCategory = "Utilities"; - m_pchModuleName = "FrameBinarization"; + m_pchModuleName = "FrameBinarization_APIv1"; m_pchModuleTooltip = "Binarize frame"; m_uiNumberOfFrames = MODULE_REQUIRES_ONE_FRAME; m_uiModuleRequirements = MODULE_REQUIRES_OPTIONS; @@ -43,13 +43,13 @@ FrameBinarization::FrameBinarization() m_uiThreshold = 128; } -Void FrameBinarization::create( PlaYUVerFrame* frame ) +Void FrameBinarization_APIv1::create( PlaYUVerFrame* frame ) { m_pcBinFrame = NULL; m_pcBinFrame = new PlaYUVerFrame( frame->getWidth(), frame->getHeight(), PlaYUVerFrame::GRAY, 8 ); } -PlaYUVerFrame* FrameBinarization::process( PlaYUVerFrame* frame ) +PlaYUVerFrame* FrameBinarization_APIv1::process( PlaYUVerFrame* frame ) { Pel* pPelInput = frame->getPelBufferYUV()[0][0]; Pel* pPelBin = m_pcBinFrame->getPelBufferYUV()[0][0]; @@ -61,7 +61,7 @@ PlaYUVerFrame* FrameBinarization::process( PlaYUVerFrame* frame ) return m_pcBinFrame; } -Void FrameBinarization::destroy() +Void FrameBinarization_APIv1::destroy() { if( m_pcBinFrame ) delete m_pcBinFrame; diff --git a/examples/modules/FrameBinarization_APIv1.h b/examples/modules/FrameBinarization_APIv1.h index 6a67115..8658de8 100644 --- a/examples/modules/FrameBinarization_APIv1.h +++ b/examples/modules/FrameBinarization_APIv1.h @@ -22,25 +22,25 @@ * \brief Binarize frame module (example of APIv1) */ -#ifndef __FRAMEBINARIZATION_H__ -#define __FRAMEBINARIZATION_H__ +#ifndef __FRAMEBINARIZATION_APIV1_H__ +#define __FRAMEBINARIZATION_APIV1_H__ #include "PlaYUVerModuleIf.h" -class FrameBinarization : public PlaYUVerModuleIf +class FrameBinarization_APIv1 : public PlaYUVerModuleIf { - REGISTER_CLASS_FACTORY( FrameBinarization ) + REGISTER_CLASS_FACTORY( FrameBinarization_APIv1 ) private: PlaYUVerFrame* m_pcBinFrame; UInt m_uiThreshold; public: - FrameBinarization(); - virtual ~FrameBinarization() {} + FrameBinarization_APIv1(); + virtual ~FrameBinarization_APIv1() {} Void create( PlaYUVerFrame* ); PlaYUVerFrame* process( PlaYUVerFrame* ); Void destroy(); }; -#endif // __FRAMEBINARIZATION_H__ +#endif // __FRAMEBINARIZATION_APIV1_H__ diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 32af0ea..613297a 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -54,5 +54,5 @@ TARGET_LINK_LIBRARIES( PlaYUVerLib ${FFMPEG_LIBRARIES} ${OpenCV_LIBRARIES} ) IF( NOT USE_STATIC ) INSTALL(FILES ${PlaYUVer_Lib_HEADERS} DESTINATION include ) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/PlaYUVerConfig.cmake DESTINATION share/playuver ) - INSTALL(TARGETS PlaYUVerLib DESTINATION lib ) + INSTALL(TARGETS PlaYUVerLib DESTINATION ${CMAKE_INSTALL_LIBDIR} ) ENDIF() diff --git a/lib/LibMemory.h b/lib/LibMemory.h index 27fcf33..bf6e858 100644 --- a/lib/LibMemory.h +++ b/lib/LibMemory.h @@ -104,7 +104,7 @@ Int getMem2D( T*** array2D, Int dim0, Int dim1 ) template Int getMem3D( T**** array3D, Int dim0, Int dim1, Int dim2 ) { - Int i, mem_size = dim0 * sizeof( T ** ); + Int i, mem_size = dim0 * sizeof( T** ); if( ( ( *array3D ) = (T***)xMallocMem( dim0 * sizeof( T** ) ) ) == NULL ) printf( "get_mem3Dint: array3D" ); @@ -120,7 +120,7 @@ Int getMem3D( T**** array3D, Int dim0, Int dim1, Int dim2 ) template Int getMem4D( T***** array4D, Int dim0, Int dim1, Int dim2, Int dim3 ) { - int i, mem_size = dim0 * sizeof( int *** ); + int i, mem_size = dim0 * sizeof( int*** ); if( ( ( *array4D ) = (T****)xMallocMem( dim0 * sizeof( T*** ) ) ) == NULL ) printf( "get_mem4Dint: array4D" ); @@ -136,7 +136,7 @@ Int getMem4D( T***** array4D, Int dim0, Int dim1, Int dim2, Int dim3 ) template Int getMem5D( T****** array5D, Int dim0, Int dim1, Int dim2, Int dim3, Int dim4 ) { - int i, mem_size = dim0 * sizeof( T **** ); + int i, mem_size = dim0 * sizeof( T**** ); if( ( ( *array5D ) = (T*****)xMallocMem( dim0 * sizeof( T**** ) ) ) == NULL ) printf( "get_mem5Dint: array5D" ); diff --git a/lib/PlaYUVerFrame.cpp b/lib/PlaYUVerFrame.cpp index 3a1c13e..367f885 100644 --- a/lib/PlaYUVerFrame.cpp +++ b/lib/PlaYUVerFrame.cpp @@ -40,7 +40,9 @@ std::vector PlaYUVerFrame::supportedColorSpacesListNames() { return std::vector{ - "YUV", "RGB", "GRAY", + "YUV", + "RGB", + "GRAY", }; } @@ -84,9 +86,8 @@ static Int getImgMemory( Pel**** array3D, Int dim0 = 3; Int i; UInt64 total_mem_size = 0; - UInt64 mem_size = - ( dim1 * dim2 + - CHROMASHIFT( dim1, log2ChromaHeight ) * CHROMASHIFT( dim2, log2ChromaWidth ) * 2 ); + UInt64 mem_size = ( dim1 * dim2 + CHROMASHIFT( dim1, log2ChromaHeight ) * + CHROMASHIFT( dim2, log2ChromaWidth ) * 2 ); total_mem_size += getMem2D( array3D, dim0, dim1 ); @@ -157,9 +158,6 @@ struct PlaYUVerFramePrivate /** Numbers of histogram segments depending of image bytes depth*/ UInt m_uiHistoSegments; - /** Used to stop thread during calculations.*/ - Bool m_bRunningFlag; - Bool m_bHasHistogram; /** @@ -601,9 +599,8 @@ Void PlaYUVerFrame::frameFromBuffer( Byte* Buff, Int iEndianness ) { ratioW = i > 1 ? d->m_pcPelFormat->log2ChromaWidth : 0; ratioH = i > 1 ? d->m_pcPelFormat->log2ChromaHeight : 0; - ppBuff[i] = - ppBuff[i - 1] + - CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ) * bytesPixel; + ppBuff[i] = ppBuff[i - 1] + CHROMASHIFT( d->m_uiHeight, ratioH ) * + CHROMASHIFT( d->m_uiWidth, ratioW ) * bytesPixel; } for( ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ ) @@ -663,9 +660,8 @@ Void PlaYUVerFrame::frameToBuffer( Byte* output_buffer, Int iEndianness ) { ratioW = i > 1 ? d->m_pcPelFormat->log2ChromaWidth : 0; ratioH = i > 1 ? d->m_pcPelFormat->log2ChromaHeight : 0; - ppBuff[i] = - ppBuff[i - 1] + - CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ) * bytesPixel; + ppBuff[i] = ppBuff[i - 1] + CHROMASHIFT( d->m_uiHeight, ratioH ) * + CHROMASHIFT( d->m_uiWidth, ratioW ) * bytesPixel; } for( ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ ) @@ -797,7 +793,6 @@ Void PlaYUVerFrame::calcHistogram() return; } } - d->m_bRunningFlag = true; xMemSet( UInt, d->m_uiHistoSegments * d->m_uiHistoChannels, d->m_puiHistogram ); @@ -810,12 +805,12 @@ Void PlaYUVerFrame::calcHistogram() data[LUMA] = d->m_pppcInputPel[LUMA][0]; data[CHROMA_U] = d->m_pppcInputPel[CHROMA_U][0]; data[CHROMA_V] = d->m_pppcInputPel[CHROMA_V][0]; - for( i = 0; i < d->m_uiHeight * d->m_uiWidth && d->m_bRunningFlag; i++ ) + for( i = 0; i < d->m_uiHeight * d->m_uiWidth; i++ ) { d->m_puiHistogram[*( data[LUMA] ) + LUMA * d->m_uiHistoSegments]++; data[LUMA] += 1; } - for( i = 0; ( i < getChromaLength() ) && d->m_bRunningFlag; i++ ) + for( i = 0; ( i < getChromaLength() ); i++ ) { for( j = 1; j < numberChannels; j++ ) { @@ -832,7 +827,7 @@ Void PlaYUVerFrame::calcHistogram() data[COLOR_G] = d->m_pppcInputPel[COLOR_G][0]; data[COLOR_B] = d->m_pppcInputPel[COLOR_B][0]; - for( i = 0; ( i < d->m_uiHeight * d->m_uiWidth ) && d->m_bRunningFlag; i++ ) + for( i = 0; ( i < d->m_uiHeight * d->m_uiWidth ); i++ ) { for( j = 0; j < numberChannels; j++ ) { @@ -850,7 +845,6 @@ Void PlaYUVerFrame::calcHistogram() } } d->m_bHasHistogram = true; - d->m_bRunningFlag = false; } Int PlaYUVerFrame::getHistogramSegment() @@ -864,60 +858,60 @@ Int getRealHistoChannel( Int colorSpace, Int channel ) switch( colorSpace ) { - case PlaYUVerPixel::COLOR_GRAY: - if( channel != LUMA ) + case PlaYUVerPixel::COLOR_GRAY: + if( channel != LUMA ) + { + return -1; + } + histoChannel = 0; + break; + case PlaYUVerPixel::COLOR_RGB: + if( channel != COLOR_R && channel != COLOR_G && channel != COLOR_B && channel != LUMA ) + { + return -1; + } + else + { + // if( channel == LUMA ) + // { + // histoChannel = 3; + // } + // else { - return -1; + histoChannel = channel; } - histoChannel = 0; - break; - case PlaYUVerPixel::COLOR_RGB: - if( channel != COLOR_R && channel != COLOR_G && channel != COLOR_B && channel != LUMA ) + } + break; + case PlaYUVerPixel::COLOR_ARGB: + if( channel != COLOR_R && channel != COLOR_G && channel != COLOR_B && channel != COLOR_A && + channel != LUMA ) + { + return -1; + } + else + { + if( channel == LUMA ) { - return -1; - } - else - { - // if( channel == LUMA ) - // { - // histoChannel = 3; - // } - // else - { - histoChannel = channel; - } - } - break; - case PlaYUVerPixel::COLOR_ARGB: - if( channel != COLOR_R && channel != COLOR_G && channel != COLOR_B && channel != COLOR_A && - channel != LUMA ) - { - return -1; - } - else - { - if( channel == LUMA ) - { - histoChannel = 4; - } - else - { - histoChannel = channel; - } - } - break; - case PlaYUVerPixel::COLOR_YUV: - if( channel != LUMA && channel != CHROMA_U && channel != CHROMA_V ) - { - return -1; + histoChannel = 4; } else { histoChannel = channel; } - break; - default: - histoChannel = -1; + } + break; + case PlaYUVerPixel::COLOR_YUV: + if( channel != LUMA && channel != CHROMA_U && channel != CHROMA_V ) + { + return -1; + } + else + { + histoChannel = channel; + } + break; + default: + histoChannel = -1; } return histoChannel; } @@ -1188,9 +1182,8 @@ Bool PlaYUVerFrame::toMat( cv::Mat& cvMat, Bool convertToGray ) { Bool bRet = false; #ifdef USE_OPENCV - if( convertToGray && - !( d->m_pcPelFormat->colorSpace == PlaYUVerPixel::COLOR_YUV || - d->m_pcPelFormat->colorSpace == PlaYUVerPixel::COLOR_GRAY ) ) + if( convertToGray && !( d->m_pcPelFormat->colorSpace == PlaYUVerPixel::COLOR_YUV || + d->m_pcPelFormat->colorSpace == PlaYUVerPixel::COLOR_GRAY ) ) { return bRet; } @@ -1238,14 +1231,14 @@ Bool PlaYUVerFrame::fromMat( cv::Mat& cvMat ) { switch( cvMat.channels() ) { - case 1: - d->m_iPixelFormat = findPixelFormat( "GRAY" ); - break; - case 3: - d->m_iPixelFormat = findPixelFormat( "BGR24" ); - break; - default: - return false; + case 1: + d->m_iPixelFormat = findPixelFormat( "GRAY" ); + break; + case 3: + d->m_iPixelFormat = findPixelFormat( "BGR24" ); + break; + default: + return false; } } d->init( cvMat.cols, cvMat.rows, d->m_iPixelFormat, 8 ); @@ -1290,7 +1283,9 @@ Bool PlaYUVerFrame::fromMat( cv::Mat& cvMat ) std::vector PlaYUVerFrame::supportedQualityMetricsList() { return std::vector{ - "PSNR", "MSE", "SSIM", + "PSNR", + "MSE", + "SSIM", }; } @@ -1298,17 +1293,17 @@ Double PlaYUVerFrame::getQuality( Int Metric, PlaYUVerFrame* Org, Int component { switch( Metric ) { - case PSNR_METRIC: - return getPSNR( Org, component ); - break; - case MSE_METRIC: - return getMSE( Org, component ); - break; - case SSIM_METRIC: - return getSSIM( Org, component ); - break; - default: - assert( 0 ); + case PSNR_METRIC: + return getPSNR( Org, component ); + break; + case MSE_METRIC: + return getMSE( Org, component ); + break; + case SSIM_METRIC: + return getSSIM( Org, component ); + break; + default: + assert( 0 ); }; return 0; } diff --git a/lib/PlaYUVerFrame.h b/lib/PlaYUVerFrame.h index 9f460ce..eb31b52 100644 --- a/lib/PlaYUVerFrame.h +++ b/lib/PlaYUVerFrame.h @@ -45,7 +45,7 @@ struct PlaYUVerFramePrivate; */ class PlaYUVerFrame { - public: +public: /** ColorSpace Enum * List of supported pixel formats - do not change order */ @@ -63,18 +63,6 @@ class PlaYUVerFrame NUMBER_PEL_FORMATS }; - /** Format match opts - */ - enum FormatMatching - { - MATCH_COLOR_SPACE = 1, - MATCH_RESOLUTION = 2, - MATCH_PEL_FMT = 4, - MATCH_BITS = 8, - MATCH_COLOR_SPACE_IGNORE_GRAY = 16, - MATCH_ALL = 0xFFFF, - }; - /** * Function that handles the supported color space * of PlaYUVerFrame @@ -111,8 +99,7 @@ class PlaYUVerFrame PlaYUVerFrame( const PlaYUVerFrame* other ); /** - * Creates and new frame with the configuration of an - * existing one and copy its contents. + * Creates and new frame with the configuration of an existing one and copy its contents. * This function only copies a specific region from the existing frame * * @param other existing frame to copy from @@ -126,6 +113,24 @@ class PlaYUVerFrame ~PlaYUVerFrame(); + /** Format match opts + */ + enum FormatMatching + { + MATCH_COLOR_SPACE = 1, + MATCH_RESOLUTION = 2, + MATCH_PEL_FMT = 4, + MATCH_BITS = 8, + MATCH_COLOR_SPACE_IGNORE_GRAY = 16, + MATCH_ALL = 0xFFFF, + }; + + /** + * Check if two PlaYUVerFrames have the same fmt + * @param other frame to compare with + * @param match matching conditions (use enum FormatMatching) + * @return true if format matches + */ Bool haveSameFmt( const PlaYUVerFrame& other, UInt match = MATCH_ALL ) const; Bool haveSameFmt( const PlaYUVerFrame* other, UInt match = MATCH_ALL ) const; @@ -144,10 +149,13 @@ class PlaYUVerFrame /** * Get color space information * @return get color space index - * @ */ Int getColorSpace() const; + /** + * Get the number of channels + * @return number of channels + */ UInt getNumberChannels() const; /** @@ -156,12 +164,14 @@ class PlaYUVerFrame * @return number of pixels */ UInt getWidth( Int channel = 0 ) const; + /** * Get height of the frame * @param channel/component * @return number of pixels */ UInt getHeight( Int channel = 0 ) const; + /** * Get number of pixels of the frame * @param channel/component @@ -176,6 +186,10 @@ class PlaYUVerFrame UInt getChromaLength() const; UInt getChromaSize() const; + /** + * Get number of bits per pixel + * @return number of bits + */ UInt getBitsPel() const; /** @@ -185,8 +199,7 @@ class PlaYUVerFrame UInt64 getBytesPerFrame(); /** - * Get number of bytes per frame of a specific - * pixel format + * Get number of bytes per frame of a specific pixel format * @return number of bytes per frame */ static UInt64 getBytesPerFrame( UInt uiWidth, UInt uiHeight, Int iPixelFormat, UInt bitsPixel ); @@ -263,7 +276,7 @@ class PlaYUVerFrame /** @} */ - private: +private: PlaYUVerFramePrivate* d; }; diff --git a/lib/PlaYUVerModuleIf.h b/lib/PlaYUVerModuleIf.h index 1a42d78..0d04f59 100644 --- a/lib/PlaYUVerModuleIf.h +++ b/lib/PlaYUVerModuleIf.h @@ -42,7 +42,7 @@ #define REGISTER_CLASS_MAKER( X ) \ extern "C" PlaYUVerModuleIf* Maker() { return new X; } #define REGISTER_CLASS_FACTORY( X ) \ - public: \ +public: \ static PlaYUVerModuleIf* Create() { return new X(); } \ void Delete() { delete this; } #define _BASIC_MODULE_API_2_CHECK_ \ @@ -120,7 +120,7 @@ enum Module_Key_Supported */ class PlaYUVerModuleIf { - public: +public: Int m_iModuleAPI; Int m_iModuleType; const Char* m_pchModuleCategory; diff --git a/lib/PlaYUVerOptions.cpp b/lib/PlaYUVerOptions.cpp index d5158dc..762a345 100644 --- a/lib/PlaYUVerOptions.cpp +++ b/lib/PlaYUVerOptions.cpp @@ -59,7 +59,7 @@ struct ParseFailure : public std::exception /** Type specific option storage */ class BoolOption : public OptionBase { - public: +public: BoolOption( const String& name, const String& desc ) : OptionBase( name, desc ) { is_binary = true; @@ -71,7 +71,7 @@ class BoolOption : public OptionBase template class StandardOption : public OptionBase { - public: +public: StandardOption( const String& name, T& storage, const String& desc ) : OptionBase( name, desc ), opt_storage( storage ) { @@ -158,7 +158,7 @@ inline void StandardOption>::parse( const String& arg ) /** Option class for argument handling using a user provided function */ struct FunctionOption : public OptionBase { - public: +public: typedef Void( Func )( PlaYUVerOptions&, const String& ); FunctionOption( const String& name, PlaYUVerOptions& parent_, Func* func_, const String& desc ) @@ -173,7 +173,7 @@ struct FunctionOption : public OptionBase arg_count++; } - private: +private: PlaYUVerOptions& parent; void ( *func )( PlaYUVerOptions&, const String& ); }; @@ -774,12 +774,12 @@ Void PlaYUVerOptions::listModules() printf( " %-40s", ModuleNameString ); switch( pcCurrModuleIf->m_iModuleType ) { - case FRAME_PROCESSING_MODULE: - printf( " Processing " ); - break; - case FRAME_MEASUREMENT_MODULE: - printf( " Measurement " ); - break; + case FRAME_PROCESSING_MODULE: + printf( " Processing " ); + break; + case FRAME_MEASUREMENT_MODULE: + printf( " Measurement " ); + break; } printf( " %s", pcCurrModuleIf->m_pchModuleTooltip ); pcCurrModuleIf->Delete(); diff --git a/lib/PlaYUVerOptions.h b/lib/PlaYUVerOptions.h index a508e5a..40e1c7a 100644 --- a/lib/PlaYUVerOptions.h +++ b/lib/PlaYUVerOptions.h @@ -50,7 +50,7 @@ */ class OptionBase { - public: +public: OptionBase( const String& name, const String& desc ) : arg_count( 0 ), opt_string( name ), opt_desc( desc ) { @@ -68,7 +68,7 @@ class OptionBase class PlaYUVerOptions { - public: +public: struct Option { Option() : opt( 0 ) {} @@ -134,7 +134,7 @@ class PlaYUVerOptions Bool checkListingOpts(); Void listModules(); - private: +private: typedef std::map OptionMap; OptionMap opt_long_map; OptionMap opt_short_map; diff --git a/lib/PlaYUVerPixel.cpp b/lib/PlaYUVerPixel.cpp index 1599e6c..1a2af62 100644 --- a/lib/PlaYUVerPixel.cpp +++ b/lib/PlaYUVerPixel.cpp @@ -54,9 +54,7 @@ PlaYUVerPixel::PlaYUVerPixel( const Int& ColorSpace, const Pel& c0, const Pel& c PixelComponents[3] = 0; } -PlaYUVerPixel::~PlaYUVerPixel() -{ -} +PlaYUVerPixel::~PlaYUVerPixel() {} Int PlaYUVerPixel::ColorSpaceType() { diff --git a/lib/PlaYUVerPixel.h b/lib/PlaYUVerPixel.h index 21fb00c..9b8b07b 100644 --- a/lib/PlaYUVerPixel.h +++ b/lib/PlaYUVerPixel.h @@ -65,7 +65,7 @@ static inline Void rgbToYuv( const Int& iR, */ class PlaYUVerPixel { - public: +public: static const UInt MAX_NUMBER_COMPONENTS = 5; /** ColorSpace list @@ -119,7 +119,7 @@ class PlaYUVerPixel */ PlaYUVerPixel ConvertPixel( ColorSpace eOutputSpace ); - private: +private: Int m_iColorSpace; Pel PixelComponents[MAX_NUMBER_COMPONENTS]; }; diff --git a/lib/PlaYUVerStream.cpp b/lib/PlaYUVerStream.cpp index ac8b795..1b74083 100644 --- a/lib/PlaYUVerStream.cpp +++ b/lib/PlaYUVerStream.cpp @@ -45,9 +45,9 @@ std::vector PlaYUVerStream::supportedReadFormats() { INI_REGIST_PLAYUVER_SUPPORTED_FMT; - REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerRaw::Create, "Raw Video", "yuv" ); - REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerRaw::Create, "Raw Video", "gray" ); - REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerRaw::Create, "Raw Video", "rgb" ); + REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerRaw::Create, "Raw YUV Video", "yuv" ); + REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerRaw::Create, "Raw Gray Video", "gray" ); + REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerRaw::Create, "Raw RGB Video", "rgb" ); REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable BitMap ", "pbm" ); REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable GrayMap ", "pgm" ); REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable PixMap ", "ppm" ); diff --git a/lib/PlaYUVerStream.h b/lib/PlaYUVerStream.h index 8e140fc..6a48e02 100644 --- a/lib/PlaYUVerStream.h +++ b/lib/PlaYUVerStream.h @@ -43,6 +43,7 @@ typedef struct { String formatName; String formatExt; + String formatPattern; CreateStreamHandlerFn formatFct; } PlaYUVerSupportedFormat; @@ -58,6 +59,10 @@ typedef struct formatElem.formatFct = handler; \ formatsList.push_back( formatElem ); +#define REGIST_PLAYUVER_SUPPORTED_ABSTRACT_FMT( handler, name, pattern ) \ + formatElem.formatPattern = pattern; \ + REGIST_PLAYUVER_SUPPORTED_FMT( handler, name, "" ) + #define APPEND_PLAYUVER_SUPPORTED_FMT( class_name, fct ) \ { \ std::vector new_fmts = class_name::supported##fct##Formats(); \ @@ -71,7 +76,7 @@ typedef struct */ class PlaYUVerStream { - public: +public: static std::vector supportedReadFormats(); static std::vector supportedWriteFormats(); @@ -147,7 +152,7 @@ class PlaYUVerStream Bool isInit() { return m_bInit; } Void getDuration( Int* duration_array ); - private: +private: Bool m_bInit; CreateStreamHandlerFn m_pfctCreateHandler; PlaYUVerStreamHandlerIf* m_pcHandler; diff --git a/lib/PlaYUVerStreamHandlerIf.h b/lib/PlaYUVerStreamHandlerIf.h index cff5531..0a6dfa3 100644 --- a/lib/PlaYUVerStreamHandlerIf.h +++ b/lib/PlaYUVerStreamHandlerIf.h @@ -31,11 +31,9 @@ class PlaYUVerFrame; #define REGISTER_STREAM_HANDLER( X ) \ - public: \ +public: \ static PlaYUVerStreamHandlerIf* Create() { return new X(); } \ void Delete() { delete this; } - - /** * \class PlaYUVerStreamHandlerIf * \ingroup PlaYUVerLib_Stream @@ -45,7 +43,7 @@ class PlaYUVerStreamHandlerIf { friend class PlaYUVerStream; - public: +public: PlaYUVerStreamHandlerIf() { m_bIsInput = true; @@ -70,7 +68,8 @@ class PlaYUVerStreamHandlerIf Void setBytesPerFrame( UInt64 uiNBytes ) { m_uiNBytesPerFrame = uiNBytes; } String getFormatName() { return m_strFormatName; } String getCodecName() { return m_strCodecName; } - protected: + +protected: Bool m_bIsInput; String m_cFilename; UInt m_uiWidth; diff --git a/lib/StreamHandlerLibav.cpp b/lib/StreamHandlerLibav.cpp index 8b8aaf4..80804a7 100644 --- a/lib/StreamHandlerLibav.cpp +++ b/lib/StreamHandlerLibav.cpp @@ -28,6 +28,14 @@ #include "PlaYUVerFramePixelFormats.h" #include +#if( ( LIBAVCODEC_VERSION_MAJOR >= 57 ) && ( LIBAVCODEC_VERSION_MINOR >= 24 ) ) +#define FF_USER_CODEC_PARAM +#endif + +#if( ( LIBAVCODEC_VERSION_MAJOR >= 57 ) && ( LIBAVCODEC_VERSION_MINOR >= 37 ) ) +#define FF_SEND_RECEIVE_API +#endif + std::vector StreamHandlerLibav::supportedReadFormats() { INI_REGIST_PLAYUVER_SUPPORTED_FMT; @@ -112,10 +120,14 @@ Bool StreamHandlerLibav::openHandler( String strFilename, Bool bInput ) m_cStream = m_cFmtCtx->streams[m_iStreamIdx]; /* find decoder for the stream */ - AVCodecParameters* codec_param = m_cStream->codecpar; - // dec = avcodec_find_decoder( dec_ctx->codec_id ); +#ifdef FF_USER_CODEC_PARAM + AVCodecParameters* codec_param = m_cStream->codecpar; AVCodec* dec = avcodec_find_decoder( codec_param->codec_id ); +#else + AVCodec* dec = avcodec_find_decoder( m_cStream->codec->codec_id ); +#endif + if( !dec ) { printf( "Failed to find %s codec\n", av_get_media_type_string( AVMEDIA_TYPE_VIDEO ) ); @@ -130,12 +142,50 @@ Bool StreamHandlerLibav::openHandler( String strFilename, Bool bInput ) return false; } +#ifdef FF_USER_CODEC_PARAM m_uiFrameBufferSize = av_image_get_buffer_size( AVPixelFormat( codec_param->format ), codec_param->width, codec_param->height, 1 ); - getMem1D( &m_pchFrameBuffer, m_uiFrameBufferSize ); + + Int pix_fmt = codec_param->format; + m_uiWidth = codec_param->width; + m_uiHeight = codec_param->height; +#else + m_uiFrameBufferSize = av_image_get_buffer_size( + m_cStream->codec->pix_fmt, m_cStream->codec->width, m_cStream->codec->height, 1 ); + + Int pix_fmt = m_cStream->codec->pix_fmt; + m_uiWidth = m_cStream->codec->width; + m_uiHeight = m_cStream->codec->height; + +#endif + + /** + * Auxiliar conversation to re-use similar pixfmt + */ + switch( pix_fmt ) + { + case AV_PIX_FMT_YUVJ420P: + pix_fmt = AV_PIX_FMT_YUV420P; + break; + case AV_PIX_FMT_YUVJ422P: + pix_fmt = AV_PIX_FMT_YUV422P; + break; + case AV_PIX_FMT_YUVJ444P: + pix_fmt = AV_PIX_FMT_YUV444P; + break; + case AV_PIX_FMT_GRAY16LE: + m_uiBitsPerPixel = 16; + m_iEndianness = 1; + pix_fmt = AV_PIX_FMT_GRAY8; + break; + case AV_PIX_FMT_GRAY16BE: + m_uiBitsPerPixel = 16; + m_iEndianness = 0; + pix_fmt = AV_PIX_FMT_GRAY8; + } m_strFormatName = uppercase( strFilename.substr( strFilename.find_last_of( "." ) + 1 ) ); - const char* name = avcodec_get_name( m_cStream->codecpar->codec_id ); + const char* name = avcodec_get_name( m_cCodedCtx->codec_id ); // sprintf( m_acCodecName, "%s", name ); m_strCodecName = name; @@ -148,44 +198,16 @@ Bool StreamHandlerLibav::openHandler( String strFilename, Bool bInput ) #endif else if( m_cStream->time_base.den && m_cStream->time_base.num ) fr = 1 / av_q2d( m_cStream->time_base ); - else if( m_cCodedCtx->time_base.den && m_cCodedCtx->time_base.num ) - fr = 1 / av_q2d( m_cCodedCtx->time_base ); +#ifndef FF_USER_CODEC_PARAM + else if( m_cStream->codec->time_base.den && m_cStream->codec->time_base.num ) + fr = 1 / av_q2d( m_cStream->codec->time_base ); +#endif m_dFrameRate = fr; - Int pix_fmt = m_cStream->codecpar->format; - // Set bits per pixel to default (8 bits) m_uiBitsPerPixel = 8; - /** - * Auxiliar conversation to re-use similar pixfmt - */ - switch( pix_fmt ) - { - case AV_PIX_FMT_YUVJ420P: - pix_fmt = AV_PIX_FMT_YUV420P; - break; - case AV_PIX_FMT_YUVJ422P: - pix_fmt = AV_PIX_FMT_YUV422P; - break; - case AV_PIX_FMT_YUVJ444P: - pix_fmt = AV_PIX_FMT_YUV444P; - break; - case AV_PIX_FMT_GRAY16LE: - m_uiBitsPerPixel = 16; - m_iEndianness = 1; - pix_fmt = AV_PIX_FMT_GRAY8; - break; - case AV_PIX_FMT_GRAY16BE: - m_uiBitsPerPixel = 16; - m_iEndianness = 0; - pix_fmt = AV_PIX_FMT_GRAY8; - } - - m_uiWidth = m_cStream->codecpar->width; - m_uiHeight = m_cStream->codecpar->height; - m_iPixelFormat = PlaYUVerFrame::NO_FMT; for( Int i = 0; i < PlaYUVerFrame::NUMBER_PEL_FORMATS; i++ ) { @@ -211,7 +233,7 @@ Bool StreamHandlerLibav::openHandler( String strFilename, Bool bInput ) return false; } -#if( LIBAVFORMAT_VERSION_MAJOR >= 55 ) +#if( ( LIBAVCODEC_VERSION_MAJOR >= 56 ) && ( LIBAVCODEC_VERSION_MINOR >= 0 ) ) m_cFrame = av_frame_alloc(); #else m_cFrame = avcodec_alloc_frame(); @@ -223,9 +245,9 @@ Bool StreamHandlerLibav::openHandler( String strFilename, Bool bInput ) } /* initialize packet, set data to NULL, let the demuxer fill it */ - av_init_packet( &pkt ); - pkt.data = NULL; - pkt.size = 0; + av_init_packet( &m_cPacket ); + m_cPacket.data = NULL; + m_cPacket.size = 0; m_bHasStream = true; @@ -278,45 +300,62 @@ UInt64 StreamHandlerLibav::calculateFrameNumber() return num_frames; } -Bool StreamHandlerLibav::decodeVideoPkt() +Int StreamHandlerLibav::decodeVideoPkt( Bool& gotFrame ) { - Int got_frame = 0; - Int decResult; - if( pkt.stream_index == m_iStreamIdx ) + gotFrame = false; + + Int decResult = 0; + if( m_cPacket.stream_index == m_iStreamIdx ) { - decResult = avcodec_decode_video2( m_cCodedCtx, m_cFrame, &got_frame, &pkt ); +#ifdef FF_SEND_RECEIVE_API + decResult = avcodec_receive_frame( m_cCodedCtx, m_cFrame ); + if( decResult < 0 && decResult != AVERROR( EAGAIN ) && decResult != AVERROR_EOF ) + { + fprintf( stderr, "Error decoding video frame\n" ); + return decResult; + } + if( decResult >= 0 ) + gotFrame = true; +#else + Int got_frame = false; + decResult = avcodec_decode_video2( m_cCodedCtx, m_cFrame, &got_frame, &m_cPacket ); if( decResult < 0 ) { fprintf( stderr, "Error decoding video frame\n" ); - return false; + return decResult; } - pkt.data += decResult; - pkt.size -= decResult; + gotFrame = got_frame > 0 ? true : false; +#endif + m_cPacket.data += decResult; + m_cPacket.size -= decResult; } else { - pkt.size = 0; + m_cPacket.size = 0; } - return got_frame > 0 ? true : false; + return decResult; } Bool StreamHandlerLibav::read( PlaYUVerFrame* pcFrame ) { Bool bGotFrame = false; - AVPacket orig_pkt = pkt; + AVPacket orig_pkt = m_cPacket; - bGotFrame |= decodeVideoPkt(); + decodeVideoPkt( bGotFrame ); /* read frames from the file */ - while( !bGotFrame && ( av_read_frame( m_cFmtCtx, &pkt ) >= 0 ) ) + while( !bGotFrame && ( av_read_frame( m_cFmtCtx, &m_cPacket ) >= 0 ) ) { - orig_pkt = pkt; + orig_pkt = m_cPacket; +#ifdef FF_SEND_RECEIVE_API + avcodec_send_packet( m_cCodedCtx, &m_cPacket ); +#endif do { - bGotFrame |= decodeVideoPkt(); + decodeVideoPkt( bGotFrame ); if( bGotFrame ) break; - } while( pkt.size > 0 ); + } while( m_cPacket.size > 0 ); if( bGotFrame ) { @@ -327,23 +366,31 @@ Bool StreamHandlerLibav::read( PlaYUVerFrame* pcFrame ) /*! Try flush existing packets */ if( !bGotFrame ) { - bGotFrame |= decodeVideoPkt(); + decodeVideoPkt( bGotFrame ); } if( bGotFrame ) { +#ifdef FF_USER_CODEC_PARAM AVCodecParameters* codec_param = m_cStream->codecpar; av_image_copy_to_buffer( m_pStreamBuffer, m_uiFrameBufferSize, m_cFrame->data, m_cFrame->linesize, AVPixelFormat( codec_param->format ), codec_param->width, codec_param->height, 1 ); +#else + av_image_copy_to_buffer( m_pStreamBuffer, m_uiFrameBufferSize, m_cFrame->data, + m_cFrame->linesize, m_cCodedCtx->pix_fmt, m_cCodedCtx->width, + m_cCodedCtx->height, 1 ); + +#endif + +#ifndef FF_SEND_RECEIVE_API if( orig_pkt.size ) av_free_packet( &orig_pkt ); +#endif pcFrame->frameFromBuffer( m_pStreamBuffer, m_iEndianness ); - return true; } - return false; } diff --git a/lib/StreamHandlerLibav.h b/lib/StreamHandlerLibav.h index 9b8eb28..514d1c4 100644 --- a/lib/StreamHandlerLibav.h +++ b/lib/StreamHandlerLibav.h @@ -22,8 +22,8 @@ * \brief Interface with libav libs */ -#ifndef __LIBAVCONTEXTHANDLE_H__ -#define __LIBAVCONTEXTHANDLE_H__ +#ifndef __STREAMHANDLERLIBAV_H__ +#define __STREAMHANDLERLIBAV_H__ #include #include @@ -58,7 +58,7 @@ class StreamHandlerLibav : public PlaYUVerStreamHandlerIf { REGISTER_STREAM_HANDLER( StreamHandlerLibav ) - public: +public: static std::vector supportedReadFormats(); static std::vector supportedWriteFormats(); @@ -76,7 +76,7 @@ class StreamHandlerLibav : public PlaYUVerStreamHandlerIf UChar* m_pchFrameBuffer; UInt64 m_uiFrameBufferSize; - private: +private: AVFormatContext* m_cFmtCtx; AVStream* m_cStream; Int m_iStreamIdx; @@ -84,14 +84,14 @@ class StreamHandlerLibav : public PlaYUVerStreamHandlerIf AVCodecContext* m_cCodedCtx; AVFrame* m_cFrame; - AVPacket pkt; + AVPacket m_cPacket; Bool m_bHasStream; UInt64 m_uiSecs; UInt64 m_uiMicroSec; - Bool decodeVideoPkt(); + Int decodeVideoPkt( Bool& gotFrame ); }; -#endif // __LIBAVCONTEXTHANDLE_H__ +#endif // __STREAMHANDLERLIBAV_H__ diff --git a/lib/StreamHandlerOpenCV.cpp b/lib/StreamHandlerOpenCV.cpp index 63abd02..bc64333 100644 --- a/lib/StreamHandlerOpenCV.cpp +++ b/lib/StreamHandlerOpenCV.cpp @@ -40,7 +40,9 @@ using cv::VideoCapture; std::vector StreamHandlerOpenCV::supportedReadFormats() { INI_REGIST_PLAYUVER_SUPPORTED_FMT; - REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, "Device", "/dev/" ); +#if( CV_MAJOR_VERSION >= 3 ) + REGIST_PLAYUVER_SUPPORTED_ABSTRACT_FMT( &StreamHandlerOpenCV::Create, "Device", "/dev/video*" ); +#endif END_REGIST_PLAYUVER_SUPPORTED_FMT; } @@ -65,6 +67,7 @@ Bool StreamHandlerOpenCV::openHandler( String strFilename, Bool bInput ) m_cFilename = strFilename; if( bInput ) { +#if( CV_VERSION_MAJOR >= 3 ) /* * Special filename to handle webcam input */ @@ -84,6 +87,7 @@ Bool StreamHandlerOpenCV::openHandler( String strFilename, Bool bInput ) m_dFrameRate = 25; } else +#endif { m_strCodecName = m_strFormatName = uppercase( strFilename.substr( strFilename.find_last_of( "." ) + 1 ) ); diff --git a/lib/StreamHandlerOpenCV.h b/lib/StreamHandlerOpenCV.h index 616491e..26ccf04 100644 --- a/lib/StreamHandlerOpenCV.h +++ b/lib/StreamHandlerOpenCV.h @@ -39,7 +39,7 @@ class StreamHandlerOpenCV : public PlaYUVerStreamHandlerIf { REGISTER_STREAM_HANDLER( StreamHandlerOpenCV ) - public: +public: static std::vector supportedReadFormats(); static std::vector supportedWriteFormats(); @@ -53,7 +53,7 @@ class StreamHandlerOpenCV : public PlaYUVerStreamHandlerIf Bool read( PlaYUVerFrame* pcFrame ); Bool write( PlaYUVerFrame* pcFrame ); - private: +private: cv::VideoCapture* pcVideoCapture; }; diff --git a/lib/StreamHandlerPortableMap.h b/lib/StreamHandlerPortableMap.h index dae1c02..ec1e711 100644 --- a/lib/StreamHandlerPortableMap.h +++ b/lib/StreamHandlerPortableMap.h @@ -34,7 +34,7 @@ class StreamHandlerPortableMap : public PlaYUVerStreamHandlerIf { REGISTER_STREAM_HANDLER( StreamHandlerPortableMap ) - public: +public: StreamHandlerPortableMap() {} ~StreamHandlerPortableMap() {} Bool openHandler( String strFilename, Bool bInput ); @@ -45,7 +45,7 @@ class StreamHandlerPortableMap : public PlaYUVerStreamHandlerIf Bool read( PlaYUVerFrame* pcFrame ); Bool write( PlaYUVerFrame* pcFrame ); - private: +private: FILE* m_pFile; /**< The input file pointer >*/ Int m_iMagicNumber; Int m_iMaxValue; diff --git a/lib/StreamHandlerRaw.h b/lib/StreamHandlerRaw.h index 536811d..c098aa6 100644 --- a/lib/StreamHandlerRaw.h +++ b/lib/StreamHandlerRaw.h @@ -36,10 +36,10 @@ class StreamHandlerRaw : public PlaYUVerStreamHandlerIf { REGISTER_STREAM_HANDLER( StreamHandlerRaw ) - private: +private: FILE* m_pFile; /**< The input file pointer >*/ - public: +public: StreamHandlerRaw() {} ~StreamHandlerRaw() {} Bool openHandler( String strFilename, Bool bInput ); diff --git a/modules/AbsoluteFrameDifference.h b/modules/AbsoluteFrameDifference.h index 5b8cfbc..cb07a27 100644 --- a/modules/AbsoluteFrameDifference.h +++ b/modules/AbsoluteFrameDifference.h @@ -32,10 +32,10 @@ class AbsoluteFrameDifference : public PlaYUVerModuleIf { REGISTER_CLASS_FACTORY( AbsoluteFrameDifference ) - private: +private: PlaYUVerFrame* m_pcFrameDifference; - public: +public: AbsoluteFrameDifference(); virtual ~AbsoluteFrameDifference() {} Bool create( std::vector apcFrameList ); diff --git a/modules/DisparityStereoBM.h b/modules/DisparityStereoBM.h index d92b275..932aab9 100644 --- a/modules/DisparityStereoBM.h +++ b/modules/DisparityStereoBM.h @@ -36,7 +36,7 @@ class DisparityStereoBM : public PlaYUVerModuleIf { REGISTER_CLASS_FACTORY( DisparityStereoBM ) - private: +private: PlaYUVerFrame* m_pcDisparityFrame; Int m_uiNumberOfDisparities; UInt m_uiBlockSize; @@ -46,7 +46,7 @@ class DisparityStereoBM : public PlaYUVerModuleIf cv::Ptr m_cStereoBM; #endif - public: +public: DisparityStereoBM(); virtual ~DisparityStereoBM() {} Bool create( std::vector apcFrameList ); diff --git a/modules/DisparityStereoSGBM.h b/modules/DisparityStereoSGBM.h index 22f9b4b..41317b3 100644 --- a/modules/DisparityStereoSGBM.h +++ b/modules/DisparityStereoSGBM.h @@ -55,7 +55,7 @@ class DisparityStereoSGBM : public PlaYUVerModuleIf { REGISTER_CLASS_FACTORY( DisparityStereoSGBM ) - private: +private: PlaYUVerFrame* m_pcDisparityFrame; Bool m_bUseHH; Int m_uiNumberOfDisparities; @@ -66,7 +66,7 @@ class DisparityStereoSGBM : public PlaYUVerModuleIf cv::StereoSGBM m_cStereoMatch; #endif - public: +public: DisparityStereoSGBM(); virtual ~DisparityStereoSGBM() {} Bool create( std::vector apcFrameList ); diff --git a/modules/DisparityStereoVar.h b/modules/DisparityStereoVar.h index e34ba15..811c55d 100644 --- a/modules/DisparityStereoVar.h +++ b/modules/DisparityStereoVar.h @@ -36,11 +36,11 @@ class DisparityStereoVar : public PlaYUVerModuleIf { REGISTER_CLASS_FACTORY( DisparityStereoVar ) - private: +private: PlaYUVerFrame* m_pcDisparityFrame; cv::StereoVar m_cStereoVar; - public: +public: DisparityStereoVar(); virtual ~DisparityStereoVar() {} Bool create( std::vector apcFrameList ); diff --git a/modules/EightBitsSampling.h b/modules/EightBitsSampling.h index 79cfc7b..179f2a3 100644 --- a/modules/EightBitsSampling.h +++ b/modules/EightBitsSampling.h @@ -32,10 +32,10 @@ class EightBitsSampling : public PlaYUVerModuleIf { REGISTER_CLASS_FACTORY( EightBitsSampling ) - private: +private: PlaYUVerFrame* m_pcSubSampledFrame; - public: +public: EightBitsSampling(); virtual ~EightBitsSampling() {} Bool create( std::vector apcFrameList ); diff --git a/modules/FilterComponent.h b/modules/FilterComponent.h index c8e7d89..260706d 100644 --- a/modules/FilterComponent.h +++ b/modules/FilterComponent.h @@ -30,10 +30,10 @@ class FilterComponentModule : public PlaYUVerModuleIf { - private: +private: PlaYUVerFrame* m_pcFilteredFrame; - public: +public: FilterComponentModule(); virtual ~FilterComponentModule() {} Bool create( std::vector apcFrameList ) = 0; @@ -47,7 +47,7 @@ class FilterComponentModule : public PlaYUVerModuleIf class FilterComponentLuma : public FilterComponentModule { REGISTER_CLASS_FACTORY( FilterComponentLuma ) - public: +public: FilterComponentLuma(); virtual ~FilterComponentLuma() {} Bool create( std::vector apcFrameList ); @@ -57,7 +57,7 @@ class FilterComponentLuma : public FilterComponentModule class FilterComponentChromaU : public FilterComponentModule { REGISTER_CLASS_FACTORY( FilterComponentChromaU ) - public: +public: FilterComponentChromaU(); virtual ~FilterComponentChromaU() {} Bool create( std::vector apcFrameList ); @@ -67,7 +67,7 @@ class FilterComponentChromaU : public FilterComponentModule class FilterComponentChromaV : public FilterComponentModule { REGISTER_CLASS_FACTORY( FilterComponentChromaV ) - public: +public: FilterComponentChromaV(); virtual ~FilterComponentChromaV() {} Bool create( std::vector apcFrameList ); diff --git a/modules/FrameBinarization.h b/modules/FrameBinarization.h index 54c5502..1f8dbd5 100644 --- a/modules/FrameBinarization.h +++ b/modules/FrameBinarization.h @@ -32,11 +32,11 @@ class FrameBinarization : public PlaYUVerModuleIf { REGISTER_CLASS_FACTORY( FrameBinarization ) - private: +private: PlaYUVerFrame* m_pcBinFrame; UInt m_uiThreshold; - public: +public: FrameBinarization(); virtual ~FrameBinarization() {} Void create( PlaYUVerFrame* ); diff --git a/modules/FrameCrop.h b/modules/FrameCrop.h index 07d1a22..f6be45f 100644 --- a/modules/FrameCrop.h +++ b/modules/FrameCrop.h @@ -32,14 +32,14 @@ class FrameCrop : public PlaYUVerModuleIf { REGISTER_CLASS_FACTORY( FrameCrop ) - private: +private: PlaYUVerFrame* m_pcCropedFrame; UInt m_uiXPosition; UInt m_uiYPosition; Int m_iXSize; Int m_iYSize; - public: +public: FrameCrop(); virtual ~FrameCrop() {} Void create( PlaYUVerFrame* ); diff --git a/modules/FrameDifference.h b/modules/FrameDifference.h index b70d417..5670a1c 100644 --- a/modules/FrameDifference.h +++ b/modules/FrameDifference.h @@ -32,13 +32,13 @@ class FrameDifference : public PlaYUVerModuleIf { REGISTER_CLASS_FACTORY( FrameDifference ) - private: +private: UInt m_uiBitsPixel; Int m_iDiffBitShift; Int m_iMaxDiffValue; PlaYUVerFrame* m_pcFrameDifference; - public: +public: FrameDifference(); virtual ~FrameDifference() {} Bool create( std::vector apcFrameList ); diff --git a/modules/FrameMask.cpp b/modules/FrameMask.cpp index 7b60963..8efb70e 100644 --- a/modules/FrameMask.cpp +++ b/modules/FrameMask.cpp @@ -68,15 +68,15 @@ Bool FrameMask::create( std::vector apcFrameList ) } switch( iColorSpace ) { - case PlaYUVerPixel::COLOR_GRAY: - iPelFmt = PlaYUVerFrame::GRAY; - break; - case PlaYUVerPixel::COLOR_YUV: - iPelFmt = PlaYUVerFrame::YUV444p; - break; - case PlaYUVerPixel::COLOR_RGB: - iPelFmt = PlaYUVerFrame::RGB24; - break; + case PlaYUVerPixel::COLOR_GRAY: + iPelFmt = PlaYUVerFrame::GRAY; + break; + case PlaYUVerPixel::COLOR_YUV: + iPelFmt = PlaYUVerFrame::YUV444p; + break; + case PlaYUVerPixel::COLOR_RGB: + iPelFmt = PlaYUVerFrame::RGB24; + break; } m_pcFrameProcessed = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), diff --git a/modules/FrameMask.h b/modules/FrameMask.h index 4eed0a5..9003dc8 100644 --- a/modules/FrameMask.h +++ b/modules/FrameMask.h @@ -32,11 +32,11 @@ class FrameMask : public PlaYUVerModuleIf { REGISTER_CLASS_FACTORY( FrameMask ) - private: +private: Int m_iWeight; PlaYUVerFrame* m_pcFrameProcessed; - public: +public: FrameMask(); virtual ~FrameMask() {} Bool create( std::vector apcFrameList ); diff --git a/modules/FrameShift.h b/modules/FrameShift.h index 43fc5a9..3b0022c 100644 --- a/modules/FrameShift.h +++ b/modules/FrameShift.h @@ -32,12 +32,12 @@ class FrameShift : public PlaYUVerModuleIf { REGISTER_CLASS_FACTORY( FrameShift ) - private: +private: PlaYUVerFrame* m_pcProcessedFrame; Int m_iShiftHor; Int m_iShiftVer; - public: +public: FrameShift(); virtual ~FrameShift() {} Bool create( std::vector apcFrameList ); diff --git a/modules/InterFrameVariance.h b/modules/InterFrameVariance.h index 7f96df4..bbb0955 100644 --- a/modules/InterFrameVariance.h +++ b/modules/InterFrameVariance.h @@ -32,11 +32,11 @@ class InterFrameVariance : public PlaYUVerModuleIf { REGISTER_CLASS_FACTORY( InterFrameVariance ) - private: +private: PlaYUVerFrame* m_pcFrameVariance; Double** m_pVariance; - public: +public: InterFrameVariance(); virtual ~InterFrameVariance() {} Bool create( std::vector apcFrameList ); diff --git a/modules/LumaAverage.cpp b/modules/LumaAverage.cpp index 219747f..71a9229 100644 --- a/modules/LumaAverage.cpp +++ b/modules/LumaAverage.cpp @@ -42,9 +42,7 @@ LumaAverage::LumaAverage() // Several requirements should be "or" between each others. } -Void LumaAverage::create( PlaYUVerFrame* frame ) -{ -} +Void LumaAverage::create( PlaYUVerFrame* frame ) {} Double LumaAverage::measure( PlaYUVerFrame* frame ) { @@ -59,6 +57,4 @@ Double LumaAverage::measure( PlaYUVerFrame* frame ) return average / Double( frame->getHeight() * frame->getWidth() ); } -Void LumaAverage::destroy() -{ -} +Void LumaAverage::destroy() {} diff --git a/modules/LumaAverage.h b/modules/LumaAverage.h index 48e9404..9eecfeb 100644 --- a/modules/LumaAverage.h +++ b/modules/LumaAverage.h @@ -32,8 +32,8 @@ class LumaAverage : public PlaYUVerModuleIf { REGISTER_CLASS_FACTORY( LumaAverage ) - private: - public: +private: +public: LumaAverage(); virtual ~LumaAverage() {} Void create( PlaYUVerFrame* ); diff --git a/modules/MeasureOpticalFlowDualTVL1.cpp b/modules/MeasureOpticalFlowDualTVL1.cpp index ce65c80..d224981 100644 --- a/modules/MeasureOpticalFlowDualTVL1.cpp +++ b/modules/MeasureOpticalFlowDualTVL1.cpp @@ -24,12 +24,12 @@ #include "MeasureOpticalFlowDualTVL1.h" -using cv::Scalar; using cv::Mat; using cv::Mat_; -using cv::Ptr; using cv::Point; using cv::Point2f; +using cv::Ptr; +using cv::Scalar; MeasureOpticalFlowDualTVL1::MeasureOpticalFlowDualTVL1() { diff --git a/modules/MeasureOpticalFlowDualTVL1.h b/modules/MeasureOpticalFlowDualTVL1.h index dbd72c9..db41ec6 100644 --- a/modules/MeasureOpticalFlowDualTVL1.h +++ b/modules/MeasureOpticalFlowDualTVL1.h @@ -35,7 +35,7 @@ class MeasureOpticalFlowDualTVL1 : public PlaYUVerModuleIf { REGISTER_CLASS_FACTORY( MeasureOpticalFlowDualTVL1 ) - private: +private: Bool m_bShowReconstruction; Int m_iStep; cv::Ptr m_cTvl1; @@ -47,7 +47,7 @@ class MeasureOpticalFlowDualTVL1 : public PlaYUVerModuleIf Void drawFlow(); Void compensateFlow(); - public: +public: MeasureOpticalFlowDualTVL1(); virtual ~MeasureOpticalFlowDualTVL1() {} Bool create( std::vector apcFrameList ); diff --git a/modules/OpticalFlow.cpp b/modules/OpticalFlow.cpp index c6803f8..5b965f7 100644 --- a/modules/OpticalFlow.cpp +++ b/modules/OpticalFlow.cpp @@ -31,12 +31,12 @@ // Opencv #include -using cv::Scalar; using cv::Mat; using cv::Mat_; -using cv::Ptr; using cv::Point; using cv::Point2f; +using cv::Ptr; +using cv::Scalar; OpticalFlowModule::OpticalFlowModule() { diff --git a/modules/OpticalFlow.h b/modules/OpticalFlow.h index 441103d..cd24dae 100644 --- a/modules/OpticalFlow.h +++ b/modules/OpticalFlow.h @@ -34,7 +34,7 @@ class OpticalFlowModule : public PlaYUVerModuleIf { - protected: +protected: Bool m_bShowReconstruction; Int m_iStep; cv::Ptr m_cOpticalFlow; @@ -46,7 +46,7 @@ class OpticalFlowModule : public PlaYUVerModuleIf Void compensateFlow(); Bool commonCreate( std::vector apcFrameList ); - public: +public: OpticalFlowModule(); virtual ~OpticalFlowModule() {} PlaYUVerFrame* process( std::vector apcFrameList ); @@ -56,7 +56,7 @@ class OpticalFlowModule : public PlaYUVerModuleIf class OpticalFlowDualTVL1 : public OpticalFlowModule { REGISTER_CLASS_FACTORY( OpticalFlowDualTVL1 ) - public: +public: OpticalFlowDualTVL1(); virtual ~OpticalFlowDualTVL1() {} Bool create( std::vector apcFrameList ); @@ -65,7 +65,7 @@ class OpticalFlowDualTVL1 : public OpticalFlowModule class OpticalFlowSparseToDense : public OpticalFlowModule { REGISTER_CLASS_FACTORY( OpticalFlowSparseToDense ) - public: +public: OpticalFlowSparseToDense(); virtual ~OpticalFlowSparseToDense() {} Bool create( std::vector apcFrameList ); @@ -74,7 +74,7 @@ class OpticalFlowSparseToDense : public OpticalFlowModule class OpticalFlowFarneback : public OpticalFlowModule { REGISTER_CLASS_FACTORY( OpticalFlowFarneback ) - public: +public: OpticalFlowFarneback(); virtual ~OpticalFlowFarneback() {} Bool create( std::vector apcFrameList ); @@ -83,7 +83,7 @@ class OpticalFlowFarneback : public OpticalFlowModule class OpticalDeepFlow : public OpticalFlowModule { REGISTER_CLASS_FACTORY( OpticalDeepFlow ) - public: +public: OpticalDeepFlow(); virtual ~OpticalDeepFlow() {} Bool create( std::vector apcFrameList ); diff --git a/modules/PlaYUVerModuleFactory.cpp b/modules/PlaYUVerModuleFactory.cpp index 198649e..a82d901 100644 --- a/modules/PlaYUVerModuleFactory.cpp +++ b/modules/PlaYUVerModuleFactory.cpp @@ -34,10 +34,7 @@ // Generated by cmake #include "ModulesListHeader.h" -PlaYUVerModuleFactory::PlaYUVerModuleFactory() -{ - REGISTER_ALL_MODULES -} +PlaYUVerModuleFactory::PlaYUVerModuleFactory(){REGISTER_ALL_MODULES} PlaYUVerModuleFactory::~PlaYUVerModuleFactory() { diff --git a/modules/PlaYUVerModuleFactory.h b/modules/PlaYUVerModuleFactory.h index 8cf993a..395126f 100644 --- a/modules/PlaYUVerModuleFactory.h +++ b/modules/PlaYUVerModuleFactory.h @@ -38,12 +38,12 @@ typedef std::map PlaYUVerModuleFactoryMap; // Factory for creating instances of PlaYUVerModuleIf class PlaYUVerModuleFactory { - private: +private: PlaYUVerModuleFactory(); PlaYUVerModuleFactory& operator=( const PlaYUVerModuleFactory& ) { return *this; } PlaYUVerModuleFactoryMap m_FactoryMap; - public: +public: ~PlaYUVerModuleFactory(); static PlaYUVerModuleFactory* Get() diff --git a/modules/SetChromaHalfScale.h b/modules/SetChromaHalfScale.h index 34ff622..60ee33b 100644 --- a/modules/SetChromaHalfScale.h +++ b/modules/SetChromaHalfScale.h @@ -32,10 +32,10 @@ class SetChromaHalfScale : public PlaYUVerModuleIf { REGISTER_CLASS_FACTORY( SetChromaHalfScale ) - private: +private: PlaYUVerFrame* m_pcProcessedFrame; - public: +public: SetChromaHalfScale(); virtual ~SetChromaHalfScale() {} Void create( PlaYUVerFrame* ); diff --git a/modules/WeightedPSNR.cpp b/modules/WeightedPSNR.cpp index ad904e4..7a9bfa9 100644 --- a/modules/WeightedPSNR.cpp +++ b/modules/WeightedPSNR.cpp @@ -111,6 +111,4 @@ Double WeightedPSNR::measure( std::vector apcFrameList ) return dPSNR; } -Void WeightedPSNR::destroy() -{ -} +Void WeightedPSNR::destroy() {} diff --git a/modules/WeightedPSNR.h b/modules/WeightedPSNR.h index dd8c149..b3af9ca 100644 --- a/modules/WeightedPSNR.h +++ b/modules/WeightedPSNR.h @@ -32,10 +32,10 @@ class WeightedPSNR : public PlaYUVerModuleIf { REGISTER_CLASS_FACTORY( WeightedPSNR ) - private: +private: UInt m_uiComponent; - public: +public: WeightedPSNR(); virtual ~WeightedPSNR() {} Bool create( std::vector apcFrameList ); diff --git a/tools/PlaYUVerTools.cpp b/tools/PlaYUVerTools.cpp index ce2467b..e768716 100644 --- a/tools/PlaYUVerTools.cpp +++ b/tools/PlaYUVerTools.cpp @@ -437,20 +437,20 @@ Int PlaYUVerTools::QualityOperation() String metric_fmt = " "; switch( m_uiQualityMetric ) { - case PlaYUVerFrame::PSNR_METRIC: - //"PSNR_0_0" - metric_fmt += " %6.3f "; - break; - case PlaYUVerFrame::SSIM_METRIC: - //"SSIM_0_0" - metric_fmt += " %6.4f "; - break; - case PlaYUVerFrame::MSE_METRIC: - //"MSE_0_0" - metric_fmt += "%7.2f"; - break; - default: - metric_fmt += " %6.3f "; + case PlaYUVerFrame::PSNR_METRIC: + //"PSNR_0_0" + metric_fmt += " %6.3f "; + break; + case PlaYUVerFrame::SSIM_METRIC: + //"SSIM_0_0" + metric_fmt += " %6.4f "; + break; + case PlaYUVerFrame::MSE_METRIC: + //"MSE_0_0" + metric_fmt += "%7.2f"; + break; + default: + metric_fmt += " %6.3f "; } metric_fmt += " "; diff --git a/tools/PlaYUVerTools.h b/tools/PlaYUVerTools.h index 8bdb859..164fd0b 100644 --- a/tools/PlaYUVerTools.h +++ b/tools/PlaYUVerTools.h @@ -38,7 +38,7 @@ class PlaYUVerModuleIf; class PlaYUVerTools : public PlaYUVerToolsCmdParser { - public: +public: PlaYUVerTools(); ~PlaYUVerTools(); @@ -46,7 +46,7 @@ class PlaYUVerTools : public PlaYUVerToolsCmdParser Int Process(); Int Close(); - private: +private: Bool m_bVerbose; UInt m_uiOperation; diff --git a/tools/PlaYUVerToolsCmdParser.cpp b/tools/PlaYUVerToolsCmdParser.cpp index 7c3aa60..7b2d30f 100644 --- a/tools/PlaYUVerToolsCmdParser.cpp +++ b/tools/PlaYUVerToolsCmdParser.cpp @@ -41,9 +41,7 @@ PlaYUVerToolsCmdParser::PlaYUVerToolsCmdParser() m_cOptions.addDefaultOptions(); } -PlaYUVerToolsCmdParser::~PlaYUVerToolsCmdParser() -{ -} +PlaYUVerToolsCmdParser::~PlaYUVerToolsCmdParser() {} Void PlaYUVerToolsCmdParser::log( UInt level, const char* fmt, ... ) { diff --git a/tools/PlaYUVerToolsCmdParser.h b/tools/PlaYUVerToolsCmdParser.h index 1b60e16..d860be0 100644 --- a/tools/PlaYUVerToolsCmdParser.h +++ b/tools/PlaYUVerToolsCmdParser.h @@ -31,7 +31,7 @@ class PlaYUVerToolsCmdParser { - public: +public: PlaYUVerToolsCmdParser(); ~PlaYUVerToolsCmdParser(); @@ -53,7 +53,8 @@ class PlaYUVerToolsCmdParser Int parseToolsArgs( Int argc, Char* argv[] ); PlaYUVerOptions& Opts() { return m_cOptions; } - protected: + +protected: PlaYUVerOptions m_cOptions; UInt m_uiLogLevel;