diff --git a/CMakeLists.txt b/CMakeLists.txt
index dc36ade8..a26d5ba4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -111,6 +111,11 @@ else()
add_subdirectory(external/spdlog)
endif()
+
+option(BUILD_STATIC_LIBS ON)
+option(BUILD_SHARED_LIBS OFF)
+add_subdirectory(external/Qt-Color-Widgets EXCLUDE_FROM_ALL)
+
if (APPLE)
add_subdirectory(external/QHotkey)
endif()
diff --git a/external/Qt-Color-Widgets/CMakeLists.txt b/external/Qt-Color-Widgets/CMakeLists.txt
new file mode 100644
index 00000000..560b1a4a
--- /dev/null
+++ b/external/Qt-Color-Widgets/CMakeLists.txt
@@ -0,0 +1,174 @@
+#
+# Copyright (C) 2013-2020 Mattia Basaglia
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see .
+#
+cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
+if ( ${CMAKE_VERSION} VERSION_GREATER "3.12.0")
+ cmake_policy(SET CMP0077 NEW)
+endif()
+
+set(COLORWIDGET_PROJECT_NAME QtColorWidgets)
+project(${COLORWIDGET_PROJECT_NAME} CXX)
+
+
+set (CMAKE_MODULE_PATH
+ ${CMAKE_MODULE_PATH}
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules
+ ${CMAKE_CURRENT_LIST_DIR})
+
+
+include (CheckCXXCompilerFlag)
+
+include (cmake/install.cmake)
+include (cmake/versioning.cmake)
+
+
+SET (${COLORWIDGET_PROJECT_NAME}_VERSION_MAJOR 2)
+SET (${COLORWIDGET_PROJECT_NAME}_VERSION_MINOR 2)
+SET (${COLORWIDGET_PROJECT_NAME}_VERSION_PATCH 0)
+SET (${COLORWIDGET_PROJECT_NAME}_VERSION "${${COLORWIDGET_PROJECT_NAME}_VERSION_MAJOR}.${${COLORWIDGET_PROJECT_NAME}_VERSION_MINOR}.${${COLORWIDGET_PROJECT_NAME}_VERSION_PATCH}")
+
+
+
+
+set(QT_VERSION_MAJOR 5)
+find_package(QT NAMES Qt5 Qt6 Qt4 COMPONENTS Core QUIET)
+find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Widgets REQUIRED)
+
+
+# Auto generate moc files
+set(CMAKE_AUTOMOC ON)
+# Auto generate moc files
+set(CMAKE_AUTOUIC ON)
+# Auto generate moc files
+set(CMAKE_AUTORCC ON)
+
+
+option(BUILD_SHARED_LIBS "Build the shared library" ON)
+option(BUILD_STATIC_LIBS "Build the static library" OFF)
+
+set (TARGET_NAME ${COLORWIDGET_PROJECT_NAME})
+option(COLOR_WIDGETS_QT_SUFFIX "Append qt version to the target output files" OFF)
+if ( COLOR_WIDGETS_QT_SUFFIX )
+ set (TARGET_OUTPUT_SUFFIX "-Qt${QT_VERSION}${${COLORWIDGET_PROJECT_NAME}_VERSION_MAJOR}")
+else()
+ set (TARGET_OUTPUT_SUFFIX "")
+endif()
+
+set (INCLUDE_PREFIX "QtColorWidgets")
+set (COLOR_WIDGETS_LIBRARY "${TARGET_NAME}")
+
+if ( ${BUILD_STATIC_LIBS} )
+ add_definitions(-DQTCOLORWIDGETS_STATICALLY_LINKED)
+endif()
+
+
+add_library (${TARGET_NAME} "")
+set_target_properties(${TARGET_NAME}
+ PROPERTIES
+ EXPORT_NAME "${TARGET_NAME}${TARGET_OUTPUT_SUFFIX}")
+
+
+set_target_properties (${TARGET_NAME}
+ PROPERTIES
+ CXX_STANDARD 11
+ CXX_STANDARD_REQUIRED ON
+ VERSION ${${COLORWIDGET_PROJECT_NAME}_VERSION}
+ SOVERSION ${${COLORWIDGET_PROJECT_NAME}_VERSION_MAJOR}
+ "INTERFACE_${COLORWIDGET_PROJECT_NAME}_MAJOR_VERSION" ${${COLORWIDGET_PROJECT_NAME}_VERSION_MAJOR}
+ COMPATIBLE_INTERFACE_STRING "${COLORWIDGET_PROJECT_NAME}_MAJOR_VERSION"
+ COMPILE_DEFINITIONS QTCOLORWIDGETS_LIBRARY
+ OUTPUT_NAME "${TARGET_NAME}${TARGET_OUTPUT_SUFFIX}")
+
+check_cxx_compiler_flag ("-Wall" Wall_FLAG_SUPPORTED)
+
+if (Wall_FLAG_SUPPORTED)
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
+endif (Wall_FLAG_SUPPORTED)
+
+check_cxx_compiler_flag ("-pedantic" pedantic_FLAG_SUPPORTED)
+
+if (pedantic_FLAG_SUPPORTED)
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pedantic")
+endif (pedantic_FLAG_SUPPORTED)
+
+check_cxx_compiler_flag ("-Wextra" Wextra_FLAG_SUPPORTED)
+
+if (Wextra_FLAG_SUPPORTED)
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wextra")
+endif (Wextra_FLAG_SUPPORTED)
+
+
+set (EXPORT_HEADER "${INCLUDE_PREFIX}/colorwidgets_global.hpp")
+
+
+generate_versioning_information (
+ TARGET_NAME ${TARGET_NAME}
+ EXPORT_HEADER ${EXPORT_HEADER}
+ EXPORT_MACRO QCP_EXPORT
+ VERSIONED_ENTITY ${COLORWIDGET_PROJECT_NAME}
+ INCLUDE_PREFIX ${INCLUDE_PREFIX}
+ COMPANY_NAME "Mattia Basaglia"
+ COMPANY_COPYRIGHT "Mattia Basaglia Copyright (C) 2013-2020"
+ FILE_DESCRIPTION "Color wheel widget and dialog for Qt${QT_VERSION}"
+)
+
+
+target_include_directories(${TARGET_NAME}
+ PUBLIC
+ $
+ $
+ PUBLIC
+ $
+ $
+ )
+
+
+add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/include/${INCLUDE_PREFIX})
+add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/resources/${INCLUDE_PREFIX})
+add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/src/${INCLUDE_PREFIX})
+
+
+target_link_libraries (${TARGET_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
+
+
+install_project (
+ PROJECT_NAME ${COLORWIDGET_PROJECT_NAME}
+ TARGET_NAME ${TARGET_NAME}
+ TARGET_OUTPUT_SUFFIX "${TARGET_OUTPUT_SUFFIX}"
+ EXPORT_HEADER ${EXPORT_HEADER}
+ INCLUDE_PREFIX ${INCLUDE_PREFIX}
+ HEADER_MATCHING_REGEX "^.*\.h$|^.*\.hpp$|^.*$"
+ VERSION_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${COLORWIDGET_PROJECT_NAME}_version.h
+ NAMESPACE "")
+
+
+add_subdirectory (gallery)
+
+option(QTCOLORWIDGETS_DESIGNER_PLUGIN "Build QtDesigner plugin" ON)
+if (${QTCOLORWIDGETS_DESIGNER_PLUGIN})
+ find_package (Qt5Designer QUIET)
+ if (Qt5Designer_FOUND)
+ add_subdirectory (color_widgets_designer_plugin)
+ endif(Qt5Designer_FOUND)
+endif()
+
+configure_file(Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
+add_custom_target(
+ ${COLORWIDGET_PROJECT_NAME}_docs
+ COMMAND doxygen Doxyfile
+ COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/gallery/*.png ${CMAKE_CURRENT_BINARY_DIR}/doxygen/html
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+)
diff --git a/external/Qt-Color-Widgets/Doxyfile.in b/external/Qt-Color-Widgets/Doxyfile.in
new file mode 100644
index 00000000..e07b4618
--- /dev/null
+++ b/external/Qt-Color-Widgets/Doxyfile.in
@@ -0,0 +1,2537 @@
+# Doxyfile 1.8.17
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the configuration
+# file that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# https://www.gnu.org/software/libiconv/ for the list of possible encodings.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME = "${COLORWIDGET_PROJECT_NAME}"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+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 =
+
+# 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 =
+
+# 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
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = doxygen
+
+# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS = NO
+
+# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
+# characters to appear in the names of generated files. If set to NO, non-ASCII
+# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
+# U+3044.
+# The default value is: NO.
+
+ALLOW_UNICODE_NAMES = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
+# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
+# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
+# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
+# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
+# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
+# Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE = English
+
+# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all generated output in the proper direction.
+# Possible values are: None, LTR, RTL and Context.
+# The default value is: None.
+
+OUTPUT_TEXT_DIRECTION = None
+
+# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES = YES
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# 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 =
+
+# 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
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+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
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line
+# such as
+# /***************
+# as being the beginning of a Javadoc-style comment "banner". If set to NO, the
+# Javadoc-style will behave just like regular comments and it will not be
+# interpreted by doxygen.
+# The default value is: NO.
+
+JAVADOC_BANNER = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new
+# page for each member. If set to NO, the documentation of a member will be part
+# of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines (in the resulting output). You can put ^^ in the value part of an
+# alias to insert a newline as if a physical newline was in the original file.
+# When you need a literal { or } or , in the value part of an alias you have to
+# escape them by means of a backslash (\), this can lead to conflicts with the
+# commands \{ and \} for these it is advised to use the version @{ and @} or use
+# a double escape (\\{ and \\})
+
+ALIASES =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# 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 =
+
+# 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
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice
+# sources only. Doxygen will then generate output that is more tailored for that
+# language. For instance, namespaces will be presented as modules, types will be
+# separated into more groups, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_SLICE = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,
+# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice,
+# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
+# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser
+# tries to guess whether the code is fixed or free formatted code, this is the
+# default for Fortran type files), VHDL, tcl. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is
+# Fortran), use: inc=Fortran f=C.
+#
+# Note: For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+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
+# documentation. See https://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+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: 5.
+# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
+
+TOC_INCLUDE_HEADINGS = 5
+
+# 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
+# globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+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
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual
+# methods of a class will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIV_VIRTUAL = NO
+
+# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE = NO
+
+# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO,
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. If set to YES, local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO, only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO, these classes will be included in the various overviews. This option
+# has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# declarations. If set to NO, these declarations will be included in the
+# documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO, these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES, upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# (including Cygwin) ands Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES, the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will
+# append additional text to a page's title, such as Class Reference. If set to
+# YES the compound reference will be hidden.
+# The default value is: NO.
+
+HIDE_COMPOUND_REFERENCE= NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
+# grouped member an include statement to the documentation, telling the reader
+# which file to include in order to use the member.
+# The default value is: NO.
+
+SHOW_GROUPED_MEMB_INC = NO
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo
+# list. This list is created by putting \todo commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test
+# list. This list is created by putting \test commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if ... \endif and \cond
+# ... \endcond blocks.
+
+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
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES, the
+# list will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+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
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+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
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. See also \cite for info how to create references.
+
+CITE_BIB_FILES =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO, doxygen will only warn about wrong or incomplete
+# parameter documentation, but not about the absence of documentation. If
+# EXTRACT_ALL is set to YES then this flag will automatically be disabled.
+# The default value is: NO.
+
+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
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# 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. See also FILE_PATTERNS and EXTENSION_MAPPING
+# Note: If this tag is empty the current directory is searched.
+
+INPUT = "${CMAKE_CURRENT_SOURCE_DIR}/include" \
+ "${CMAKE_CURRENT_SOURCE_DIR}/README.md" \
+ "${CMAKE_CURRENT_SOURCE_DIR}/gallery"
+
+# 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
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see: https://www.gnu.org/software/libiconv/) for the list of
+# possible encodings.
+# The default value is: UTF-8.
+
+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.
+#
+# 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 (to be provided as doxygen C comment),
+# *.doc (to be provided as doxygen C comment), *.txt (to be provided as doxygen
+# C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f, *.for, *.tcl, *.vhd,
+# *.vhdl, *.ucf, *.qsf and *.ice.
+
+FILE_PATTERNS = *.hpp \
+ *.md \
+ *.dox
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# 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 =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+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 =
+
+# 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
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+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
+# by executing (via popen()) the command:
+#
+#
+#
+# where is the value of the INPUT_FILTER tag, and is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# 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 =
+
+# 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
+# filter if there is a match. The filters are a list of the form: pattern=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 = *gallery/README.md="echo 'Color Widgets {#mainpage}\n====' | cat - "
+
+# 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
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+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 =
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# entity all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system
+# (see https://www.gnu.org/software/global/global.html). You will need version
+# 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS = YES
+
+# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
+# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
+# cost of reduced performance. This can be particularly helpful with template
+# rich C++ code for which doxygen's built-in parser lacks the necessary type
+# information.
+# Note: The availability of this option depends on whether or not doxygen was
+# generated with the -Duse_libclang=ON option for CMake.
+# The default value is: NO.
+
+CLANG_ASSISTED_PARSING = NO
+
+# If clang assisted parsing is enabled you can provide the compiler with command
+# line options that you would normally use when invoking the compiler. Note that
+# the include paths will already be set by doxygen for the files and directories
+# specified with INPUT and INCLUDE_PATH.
+# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
+
+CLANG_OPTIONS =
+
+# If clang assisted parsing is enabled you can provide the clang parser with the
+# path to the compilation database (see:
+# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) used when the files
+# were built. This is equivalent to specifying the "-p" option to a clang tool,
+# such as clang-check. These options will then be passed to the parser.
+# Note: The availability of this option depends on whether or not doxygen was
+# generated with the -Duse_libclang=ON option for CMake.
+
+CLANG_DATABASE_PATH =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX = YES
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+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
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+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
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+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
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefore more robust against future updates.
+# Doxygen will copy the style sheet files to the output directory.
+# Note: The order of the extra style sheet files is of importance (e.g. the last
+# style sheet in the list overrules the setting of the previous ones in the
+# list). For an example see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# 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 =
+
+# 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
+# this color. Hue is specified as an angle on a colorwheel, see
+# https://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA = 80
+
+# 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 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 = NO
+
+# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
+# documentation will contain a main index with vertical navigation menus that
+# are dynamically created via JavaScript. If disabled, the navigation index will
+# consists of multiple levels of tabs that are statically embedded in every HTML
+# page. Disable this option to support browsers that do not have JavaScript,
+# like the Qt help browser.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_MENUS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment (see: https://developer.apple.com/xcode/), introduced with OSX
+# 10.5 (Leopard). To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy
+# genXcode/_index.html for more information.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on
+# Windows.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP = NO
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+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,
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+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).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+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
+# enables the Previous and Next buttons.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+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
+# (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-
+# folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+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
+# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+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:
+# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+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 =
+
+# 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
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH = 250
+
+# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE = 10
+
+# Use the FORMULA_TRANSPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT = YES
+
+# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands
+# to create new LaTeX commands to be used in formulas as building blocks. See
+# the section "Including formulas" for details.
+
+FORMULA_MACROFILE =
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# https://www.mathjax.org) which uses client side JavaScript for the rendering
+# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. See the MathJax site (see:
+# http://docs.mathjax.org/en/latest/output.html) for more details.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from https://www.mathjax.org before deployment.
+# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+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
+# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+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
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use + S
+# (what the is depends on the OS and browser, but it is typically
+# , /, or both). Inside the search box use the to jump into the search results window, the results can be navigated
+# using the . Press to select an item or to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing +. Also here use the
+# to select a filter and or to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using JavaScript. There
+# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
+# setting. When disabled, doxygen will generate a PHP script for searching and
+# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
+# and searching needs to be provided by external tools. See the section
+# "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: https://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: https://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+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
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when not enabling USE_PDFLATEX the default is latex when enabling
+# USE_PDFLATEX the default is pdflatex and when in the later case latex is
+# chosen this is overwritten by pdflatex. For specific output languages the
+# default can have been set differently, this depends on the implementation of
+# the output language.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME =
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# Note: This tag is used in the Makefile / make.bat.
+# See also: LATEX_MAKEINDEX_CMD for the part in the generated output file
+# (.tex).
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to
+# generate index for LaTeX. In case there is no backslash (\) as first character
+# it will be automatically added in the LaTeX code.
+# Note: This tag is used in the generated output file (.tex).
+# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat.
+# The default value is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_MAKEINDEX_CMD = makeindex
+
+# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE = a4
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# 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 =
+
+# 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
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
+# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
+# string, for the replacement values of the other commands the user is referred
+# to HTML_HEADER.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+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
+# chapter. If it is left blank doxygen will generate a standard footer. See
+# LATEX_HEADER for more information on how to generate a default footer and what
+# special commands can be used inside the footer.
+#
+# 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 =
+
+# 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
+# by doxygen. Using this option one can overrule certain style aspects. Doxygen
+# will copy the style sheet files to the output directory.
+# Note: The order of the extra style sheet files is of importance (e.g. the last
+# style sheet in the list overrules the setting of the previous ones in the
+# list).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+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
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+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
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES, to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+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
+
+# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute)
+# path from which the emoji images will be read. If a relative path is entered,
+# it will be relative to the LATEX_OUTPUT directory. If left blank the
+# LATEX_OUTPUT directory will be used.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EMOJI_DIRECTORY =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# configuration file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's configuration 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 =
+
+# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
+# with syntax highlighting in the RTF output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION = .3
+
+# The MAN_SUBDIR tag determines the name of the directory created within
+# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
+# MAN_EXTENSION with the initial . removed.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+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
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT = xml
+
+# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING = YES
+
+# If the XML_NS_MEMB_FILE_SCOPE tag is set to YES, doxygen will include
+# namespace members in file scope as well, matching the HTML output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_NS_MEMB_FILE_SCOPE = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT = docbook
+
+# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
+# program listings (including syntax highlighting and cross-referencing
+# information) to the DOCBOOK output. Note that enabling this will significantly
+# increase the size of the DOCBOOK output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_PROGRAMLISTING = NO
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
+# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures
+# the structure of the code including all documentation. Note that this feature
+# is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO, the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
+# in the source code. If set to NO, only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES, the include files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+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
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+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.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+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
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+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
+# an all uppercase name, and do not end with a semicolon. Such function macros
+# are typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have a unique name (where the name does NOT include
+# 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 =
+
+# 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 =
+
+# 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
+# listed.
+# The default value is: NO.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS = YES
+
+# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
+# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
+# NO turns the diagrams off. Note that this option also works with HAVE_DOT
+# disabled, but it is recommended to install and use dot, since it yields more
+# powerful graphs.
+# The default value is: YES.
+
+CLASS_DIAGRAMS = YES
+
+# 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 =
+
+# 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.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz (see:
+# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: YES.
+
+HAVE_DOT = YES
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS = 0
+
+# When you want a differently looking font in the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+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.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS = NO
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH = YES
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# 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. 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.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# 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. 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.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# 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, png:cairo, png:cairo:cairo, png:cairo:gd, png:gd,
+# png:gd:gd, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd, gif, gif:cairo,
+# gif:cairo:gd, gif:gd, gif:gd:gd, 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.
+
+DOT_IMAGE_FORMAT = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# 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 =
+
+# 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 =
+
+# 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 =
+
+# 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 =
+
+# 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
+# PlantUML is not used or called during a preprocessing step. Doxygen will
+# generate a warning when it encounters a \startuml command in this case and
+# will not generate output for the diagram.
+
+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 =
+
+# 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
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_CLEANUP = YES
diff --git a/external/Qt-Color-Widgets/GITSHA b/external/Qt-Color-Widgets/GITSHA
new file mode 100644
index 00000000..12d247bf
--- /dev/null
+++ b/external/Qt-Color-Widgets/GITSHA
@@ -0,0 +1 @@
+dca164702ef1481ecef9bd80b9d8c07c3a91c008
diff --git a/external/Qt-Color-Widgets/QtColorWidgets.pc.in b/external/Qt-Color-Widgets/QtColorWidgets.pc.in
new file mode 100644
index 00000000..701b124d
--- /dev/null
+++ b/external/Qt-Color-Widgets/QtColorWidgets.pc.in
@@ -0,0 +1,10 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=@CMAKE_INSTALL_LIBDIR@
+includedir=${prefix}/include
+
+Name: QtColorWidgets
+Description: Color wheel widget and dialog for Qt
+Version: @QtColorWidgets_VERSION@
+Libs: -L${libdir} -l@i_target_name@@i_target_output_suffix@
+Cflags: -I${includedir}/@i_project_name@ -I${includedir}
diff --git a/external/Qt-Color-Widgets/README.md b/external/Qt-Color-Widgets/README.md
index b3c0b2a5..5890eec0 100644
--- a/external/Qt-Color-Widgets/README.md
+++ b/external/Qt-Color-Widgets/README.md
@@ -17,6 +17,8 @@ The provided widgets are:
* ColorPaletteWidget, A widget to use and manage a list of palettes
* Color2DSlider, An analog widget used to select 2 color components
* ColorLineEdit, A widget to manipulate a string representing a color
+* HarmonyColorWheel, A ColorWheel which allows defining multiple colors, separated by hue
+* GradientListModel, A QAbstractListModel used to list gradients (useful for combo boxes, list views and the like)
they are all in the color_widgets namespace.
@@ -28,10 +30,16 @@ Using it in a project
For QMake-based projects, include color_widgets.pri in the QMake project file.
For CMake-based projects, add this as subdirectory, it will be compiled as a
-library and you can link the required targets to ColorWidgets-qt5.
+library and you can link the required targets to ColorWidgets.
All the required files are in ./src and ./include.
+Documentation
+-------------
+
+See https://mattbas.gitlab.io/Qt-Color-Widgets/
+
+
Installing as a Qt Designer/Creator Plugin
------------------------------------------
@@ -41,7 +49,7 @@ Compile the library and install in
(Qt SDK)/Tools/QtCreator/bin/designer/
(Qt SDK)/(Qt Version)/(Toolchain)/plugins/designer
-cd build && cmake .. && make ColorWidgetsPlugin && make install
+ mkdir build && cd build && cmake .. && make QtColorWidgetsPlugin && make install
Latest Version
@@ -49,8 +57,8 @@ Latest Version
The latest version of the sources can be found at the following locations:
-* https://github.com/mbasaglia/Qt-Color-Widgets
-* git://github.com/mbasaglia/Qt-Color-Widgets.git
+* https://gitlab.com/mattbas/Qt-Color-Widgets
+* git@gitlab.com:mattbas/Qt-Color-Widgets.git
License
@@ -61,4 +69,4 @@ As a special exception, this library can be included in any project under the
terms of any of the GNU liceses, distributing the whole project under a
different GNU license, see LICENSE-EXCEPTION for details.
-Copyright (C) 2013-2017 Mattia Basaglia
+Copyright (C) 2013-2020 Mattia Basaglia
diff --git a/external/Qt-Color-Widgets/cmake/QtColorWidgets-config.cmake b/external/Qt-Color-Widgets/cmake/QtColorWidgets-config.cmake
new file mode 100644
index 00000000..9072b088
--- /dev/null
+++ b/external/Qt-Color-Widgets/cmake/QtColorWidgets-config.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/@CMAKE_BASE_FILE_NAME@@CMAKE_FILE_OUTPUT_SUFFIX@-targets.cmake")
diff --git a/external/Qt-Color-Widgets/cmake/install.cmake b/external/Qt-Color-Widgets/cmake/install.cmake
new file mode 100644
index 00000000..11942ff0
--- /dev/null
+++ b/external/Qt-Color-Widgets/cmake/install.cmake
@@ -0,0 +1,88 @@
+function (install_project
+ PROJECT_NAME i_project_name
+ TARGET_NAME i_target_name
+ TARGET_OUTPUT_SUFFIX i_target_output_suffix
+ EXPORT_HEADER i_export_header
+ INCLUDE_PREFIX i_include_prefix
+ HEADER_MATCHING_REGEX i_header_matching_regex
+ VERSION_HEADER i_version_header
+ NAMESPACE i_namespace)
+ install (TARGETS ${i_target_name}
+ EXPORT ${i_target_name}
+ RUNTIME DESTINATION bin
+ INCLUDES DESTINATION include
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib)
+
+ install (DIRECTORY include/
+ DESTINATION include
+ FILES_MATCHING
+ REGEX ${i_header_matching_regex}
+ REGEX "CMakeLists\.txt" EXCLUDE)
+
+ install (FILES ${i_version_header}
+ DESTINATION include/${i_include_prefix}
+ COMPONENT Devel)
+
+ install (FILES include/${i_export_header}
+ DESTINATION include/${i_include_prefix}
+ COMPONENT Devel)
+
+ install(
+ EXPORT ${i_target_name}
+ DESTINATION lib/cmake/${i_target_name}${i_target_output_suffix}
+ FILE "${i_target_name}${i_target_output_suffix}.cmake"
+ COMPONENT Devel)
+
+
+ include(CMakePackageConfigHelpers)
+
+ string (TOLOWER ${i_target_name} CMAKE_BASE_FILE_NAME)
+ string (TOLOWER "${i_target_output_suffix}" CMAKE_FILE_OUTPUT_SUFFIX)
+
+ write_basic_package_version_file(
+ "${CMAKE_CURRENT_BINARY_DIR}/${i_target_name}/${CMAKE_BASE_FILE_NAME}${CMAKE_FILE_OUTPUT_SUFFIX}-config-version.cmake"
+ VERSION ${${i_project_name}_VERSION}
+ COMPATIBILITY SameMajorVersion
+ )
+
+ export(EXPORT ${i_target_name}
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/${i_target_name}/${CMAKE_BASE_FILE_NAME}${CMAKE_FILE_OUTPUT_SUFFIX}-targets.cmake"
+ )
+
+ configure_file("cmake/${i_project_name}-config.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/${i_target_name}/${CMAKE_BASE_FILE_NAME}${CMAKE_FILE_OUTPUT_SUFFIX}-config.cmake"
+ @ONLY
+ )
+
+ set(ConfigPackageLocation "lib/cmake/${i_target_name}${i_target_output_suffix}")
+ install(EXPORT ${i_target_name}
+ FILE
+ "${CMAKE_BASE_FILE_NAME}${CMAKE_FILE_OUTPUT_SUFFIX}-targets.cmake"
+ NAMESPACE
+ "${i_namespace}"
+ DESTINATION
+ ${ConfigPackageLocation}
+ )
+ install(
+ FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/${i_target_name}/${CMAKE_BASE_FILE_NAME}${CMAKE_FILE_OUTPUT_SUFFIX}-config.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/${i_target_name}/${CMAKE_BASE_FILE_NAME}${CMAKE_FILE_OUTPUT_SUFFIX}-config-version.cmake"
+ DESTINATION
+ ${ConfigPackageLocation}
+ COMPONENT
+ Devel
+ )
+
+ configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/${i_project_name}.pc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${i_target_name}${i_target_output_suffix}.pc
+ @ONLY
+ )
+
+ install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/${i_target_name}${i_target_output_suffix}.pc
+ DESTINATION
+ lib/pkgconfig
+ )
+endfunction (install_project)
diff --git a/external/Qt-Color-Widgets/cmake/modules/ProjectVersioning.cmake b/external/Qt-Color-Widgets/cmake/modules/ProjectVersioning.cmake
new file mode 100644
index 00000000..6975a968
--- /dev/null
+++ b/external/Qt-Color-Widgets/cmake/modules/ProjectVersioning.cmake
@@ -0,0 +1,80 @@
+define_property (TARGET
+ PROPERTY GIT_DESCRIBE
+ BRIEF_DOCS "Advanced version info for developers"
+ FULL_DOCS "String with information that is important for developers during
+ development process. This information includes git commit hash, durty status
+ of repo, distance from the last tag.")
+
+define_property (TARGET
+ PROPERTY GIT_UNTRACKED_FILES
+ BRIEF_DOCS "Information about presence of untracked files"
+ FULL_DOCS "Used in helper functions generation to add .with-untracked suffix
+ to version string. Suffix is only added if there are some untracked not
+ ignored files in repository.")
+
+set(HERE_DIR ${CMAKE_CURRENT_LIST_DIR})
+
+
+function (target_version_information
+ TARGET_NAME i_target_name
+ EXPORT_HEADER i_export_header
+ EXPORT_MACRO i_export_macro
+ VERSIONED_ENTITY i_versioned_entity)
+
+ find_file (
+ headerFileTemplate
+ "ProjectVersioning/version.h.in"
+ PATHS ${CMAKE_MODULE_PATH})
+
+ if ( NOT ${headerFileTemplate} )
+ set(headerFileTemplate "${HERE_DIR}/ProjectVersioning/version.h.in")
+ endif()
+
+ find_file (
+ sourceFileTemplate
+ "ProjectVersioning/version.c.in"
+ PATHS ${CMAKE_MODULE_PATH})
+
+ if ( NOT ${sourceFileTemplate} )
+ set(sourceFileTemplate "${HERE_DIR}/ProjectVersioning/version.c.in")
+ endif()
+
+ exec_program (
+ "git"
+ ${CMAKE_SOURCE_DIR}
+ ARGS "describe --always --dirty --long --tags"
+ OUTPUT_VARIABLE gitDescribe)
+
+ exec_program (
+ "git"
+ ${CMAKE_SOURCE_DIR}
+ ARGS "ls-files --others --exclude-standard"
+ OUTPUT_VARIABLE gitUntracked)
+
+ if (gitUntracked)
+ set (gitUntracked ".with-untracked")
+ endif (gitUntracked)
+
+ configure_file (
+ "${headerFileTemplate}"
+ "${CMAKE_CURRENT_BINARY_DIR}/${i_versioned_entity}_version.h")
+
+ configure_file(
+ "${sourceFileTemplate}"
+ "${CMAKE_BINARY_DIR}/${i_versioned_entity}_version.c")
+
+ target_sources ("${i_target_name}"
+ PRIVATE
+ $
+ $
+ PRIVATE
+ "${CMAKE_BINARY_DIR}/${i_versioned_entity}_version.c")
+
+ set_target_properties (${i_target_name}
+ PROPERTIES
+ GIT_DESCRIBE "${gitDescribe}"
+ GIT_UNTRACKED_FILES "${gitUntracked}")
+
+ unset (headerFileTemplate PARENT_SCOPE)
+ unset (sourceFileTemplate PARENT_SCOPE)
+endfunction (target_version_information)
diff --git a/external/Qt-Color-Widgets/cmake/modules/ProjectVersioning/version.c.in b/external/Qt-Color-Widgets/cmake/modules/ProjectVersioning/version.c.in
new file mode 100644
index 00000000..5786e0db
--- /dev/null
+++ b/external/Qt-Color-Widgets/cmake/modules/ProjectVersioning/version.c.in
@@ -0,0 +1,34 @@
+#include "${i_versioned_entity}_version.h"
+
+
+unsigned int @i_versioned_entity@_versionMajor () {
+ return ${${i_versioned_entity}_VERSION_MAJOR};
+}
+
+
+unsigned int @i_versioned_entity@_versionMinor () {
+ return ${${i_versioned_entity}_VERSION_MINOR};
+}
+
+
+unsigned int @i_versioned_entity@_versionPatch () {
+ return ${${i_versioned_entity}_VERSION_PATCH};
+}
+
+
+const char* @i_versioned_entity@_versionGitInfo () {
+ return
+ "${gitDescribe}"
+ "${gitUntracked}";
+}
+
+
+const char* @i_versioned_entity@_versionFullString () {
+ return
+ "${${i_versioned_entity}_VERSION_MAJOR}."
+ "${${i_versioned_entity}_VERSION_MINOR}."
+ "${${i_versioned_entity}_VERSION_PATCH}"
+ "${${i_versioned_entity}_VERSION_PRE_RELEASE}"
+ "+${gitDescribe}"
+ "${gitUntracked}";
+}
diff --git a/external/Qt-Color-Widgets/cmake/modules/ProjectVersioning/version.h.in b/external/Qt-Color-Widgets/cmake/modules/ProjectVersioning/version.h.in
new file mode 100644
index 00000000..c4c57ab0
--- /dev/null
+++ b/external/Qt-Color-Widgets/cmake/modules/ProjectVersioning/version.h.in
@@ -0,0 +1,23 @@
+#ifndef @CMAKE_PROJECT_NAME@_VERSION_H
+#define @CMAKE_PROJECT_NAME@_VERSION_H
+
+
+#include "@i_export_header@"
+
+
+@i_export_macro@ unsigned int @i_versioned_entity@_versionMajor ();
+
+
+@i_export_macro@ unsigned int @i_versioned_entity@_versionMinor ();
+
+
+@i_export_macro@ unsigned int @i_versioned_entity@_versionPatch ();
+
+
+@i_export_macro@ const char* @i_versioned_entity@_versionGitInfo ();
+
+
+@i_export_macro@ const char* @i_versioned_entity@_versionFullString ();
+
+
+#endif /* @CMAKE_PROJECT_NAME@_VERSION_H */
diff --git a/external/Qt-Color-Widgets/cmake/modules/VersionInfo.in b/external/Qt-Color-Widgets/cmake/modules/VersionInfo.in
new file mode 100644
index 00000000..195863d0
--- /dev/null
+++ b/external/Qt-Color-Widgets/cmake/modules/VersionInfo.in
@@ -0,0 +1,113 @@
+/*
+ The MIT License (MIT)
+
+ Copyright (c) 2015, by [halex2005](mailto:akharlov@gmail.com)
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+
+#pragma once
+
+#ifndef PRODUCT_VERSION_MAJOR
+#define PRODUCT_VERSION_MAJOR @PRODUCT_VERSION_MAJOR@
+#endif
+
+#ifndef PRODUCT_VERSION_MINOR
+#define PRODUCT_VERSION_MINOR @PRODUCT_VERSION_MINOR@
+#endif
+
+#ifndef PRODUCT_VERSION_PATCH
+#define PRODUCT_VERSION_PATCH @PRODUCT_VERSION_PATCH@
+#endif
+
+#ifndef PRODUCT_VERSION_BUILD
+#define PRODUCT_VERSION_BUILD @PRODUCT_VERSION_REVISION@
+#endif
+
+#ifndef FILE_VERSION_MAJOR
+#define FILE_VERSION_MAJOR @PRODUCT_VERSION_MAJOR@
+#endif
+
+#ifndef FILE_VERSION_MINOR
+#define FILE_VERSION_MINOR @PRODUCT_VERSION_MINOR@
+#endif
+
+#ifndef FILE_VERSION_PATCH
+#define FILE_VERSION_PATCH @PRODUCT_VERSION_PATCH@
+#endif
+
+#ifndef FILE_VERSION_BUILD
+#define FILE_VERSION_BUILD @PRODUCT_VERSION_REVISION@
+#endif
+
+#ifndef __TO_STRING
+#define __TO_STRING_IMPL(x) #x
+#define __TO_STRING(x) __TO_STRING_IMPL(x)
+#endif
+
+#define PRODUCT_VERSION_MAJOR_MINOR_STR __TO_STRING(PRODUCT_VERSION_MAJOR) "." __TO_STRING(PRODUCT_VERSION_MINOR)
+#define PRODUCT_VERSION_MAJOR_MINOR_PATCH_STR PRODUCT_VERSION_MAJOR_MINOR_STR "." __TO_STRING(PRODUCT_VERSION_PATCH)
+#define PRODUCT_VERSION_FULL_STR PRODUCT_VERSION_MAJOR_MINOR_PATCH_STR "." __TO_STRING(PRODUCT_VERSION_BUILD)
+#define PRODUCT_VERSION_RESOURCE PRODUCT_VERSION_MAJOR,PRODUCT_VERSION_MINOR,PRODUCT_VERSION_PATCH,PRODUCT_VERSION_BUILD
+#define PRODUCT_VERSION_RESOURCE_STR PRODUCT_VERSION_FULL_STR "\0"
+
+#define FILE_VERSION_MAJOR_MINOR_STR __TO_STRING(FILE_VERSION_MAJOR) "." __TO_STRING(FILE_VERSION_MINOR)
+#define FILE_VERSION_MAJOR_MINOR_PATCH_STR FILE_VERSION_MAJOR_MINOR_STR "." __TO_STRING(FILE_VERSION_PATCH)
+#define FILE_VERSION_FULL_STR FILE_VERSION_MAJOR_MINOR_PATCH_STR "." __TO_STRING(FILE_VERSION_BUILD)
+#define FILE_VERSION_RESOURCE FILE_VERSION_MAJOR,FILE_VERSION_MINOR,FILE_VERSION_PATCH,FILE_VERSION_BUILD
+#define FILE_VERSION_RESOURCE_STR FILE_VERSION_FULL_STR "\0"
+
+#ifndef USE_ICON
+#define USE_ICON @USE_ICON@
+#endif
+
+#if USE_ICON
+#ifndef PRODUCT_ICON
+#define PRODUCT_ICON "@PRODUCT_ICON@"
+#endif
+#endif
+
+#ifndef PRODUCT_COMMENTS
+#define PRODUCT_COMMENTS "@PRODUCT_COMMENTS@\0"
+#endif
+
+#ifndef PRODUCT_COMPANY_NAME
+#define PRODUCT_COMPANY_NAME "@PRODUCT_COMPANY_NAME@\0"
+#endif
+
+#ifndef PRODUCT_COMPANY_COPYRIGHT
+#define PRODUCT_COMPANY_COPYRIGHT "@PRODUCT_COMPANY_COPYRIGHT@\0"
+#endif
+
+#ifndef PRODUCT_FILE_DESCRIPTION
+#define PRODUCT_FILE_DESCRIPTION "@PRODUCT_FILE_DESCRIPTION@\0"
+#endif
+
+#ifndef PRODUCT_INTERNAL_NAME
+#define PRODUCT_INTERNAL_NAME "@PRODUCT_NAME@\0"
+#endif
+
+#ifndef PRODUCT_ORIGINAL_FILENAME
+#define PRODUCT_ORIGINAL_FILENAME "@PRODUCT_ORIGINAL_FILENAME@\0"
+#endif
+
+#ifndef PRODUCT_BUNDLE
+#define PRODUCT_BUNDLE "@PRODUCT_BUNDLE@\0"
+#endif
diff --git a/external/Qt-Color-Widgets/cmake/modules/VersionResource.rc b/external/Qt-Color-Widgets/cmake/modules/VersionResource.rc
new file mode 100644
index 00000000..433c8656
--- /dev/null
+++ b/external/Qt-Color-Widgets/cmake/modules/VersionResource.rc
@@ -0,0 +1,66 @@
+/*
+ The MIT License (MIT)
+
+ Copyright (c) 2015, by [halex2005](mailto:akharlov@gmail.com)
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+#include "VersionInfo.h"
+#include "winresrc.h"
+
+#if USE_ICON
+IDI_ICON1 ICON PRODUCT_ICON
+#endif
+
+LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION FILE_VERSION_RESOURCE
+ PRODUCTVERSION PRODUCT_VERSION_RESOURCE
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "041904b0"
+ BEGIN
+ VALUE "Comments", PRODUCT_COMMENTS
+ VALUE "CompanyName", PRODUCT_COMPANY_NAME
+ VALUE "FileDescription", PRODUCT_FILE_DESCRIPTION
+ VALUE "FileVersion", FILE_VERSION_RESOURCE_STR
+ VALUE "InternalName", PRODUCT_INTERNAL_NAME
+ VALUE "LegalCopyright", PRODUCT_COMPANY_COPYRIGHT
+ VALUE "OriginalFilename", PRODUCT_ORIGINAL_FILENAME
+ VALUE "ProductName", PRODUCT_BUNDLE
+ VALUE "ProductVersion", PRODUCT_VERSION_RESOURCE_STR
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x419, 1200
+ END
+END
diff --git a/external/Qt-Color-Widgets/cmake/modules/generate_product_version.cmake b/external/Qt-Color-Widgets/cmake/modules/generate_product_version.cmake
new file mode 100644
index 00000000..0ca71d9c
--- /dev/null
+++ b/external/Qt-Color-Widgets/cmake/modules/generate_product_version.cmake
@@ -0,0 +1,136 @@
+# The MIT License (MIT)
+
+# Copyright (c) 2015, by [halex2005](mailto:akharlov@gmail.com)
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+include (CMakeParseArguments)
+
+set (GenerateProductVersionCurrentDir ${CMAKE_CURRENT_LIST_DIR})
+
+# generate_product_version() function
+#
+# This function uses VersionInfo.in template file and VersionResource.rc file
+# to generate WIN32 resource with version information and general resource strings.
+#
+# Usage:
+# generate_product_version(
+# SomeOutputResourceVariable
+# NAME MyGreatProject
+# ICON ${PATH_TO_APP_ICON}
+# VERSION_MAJOR 2
+# VERSION_MINOR 3
+# VERSION_PATH ${BUILD_COUNTER}
+# VERSION_REVISION ${BUILD_REVISION}
+# )
+# where BUILD_COUNTER and BUILD_REVISION could be values from your CI server.
+#
+# You can use generated resource for your executable targets:
+# add_executable(target-name ${target-files} ${SomeOutputResourceVariable})
+#
+# You can specify resource strings in arguments:
+# NAME - name of executable (no defaults, ex: Microsoft Word)
+# BUNDLE - bundle (${NAME} is default, ex: Microsoft Office)
+# USE_ICON - flag that shows whether icon is used or not
+# ICON - path to application icon (${CMAKE_SOURCE_DIR}/product.ico by default)
+# VERSION_MAJOR - 1 is default
+# VERSION_MINOR - 0 is default
+# VERSION_PATCH - 0 is default
+# VERSION_REVISION - 0 is default
+# COMPANY_NAME - your company name (no defaults)
+# COMPANY_COPYRIGHT - ${COMPANY_NAME} (C) Copyright ${CURRENT_YEAR} is default
+# COMMENTS - ${NAME} v${VERSION_MAJOR}.${VERSION_MINOR} is default
+# ORIGINAL_FILENAME - ${NAME} is default
+# INTERNAL_NAME - ${NAME} is default
+# FILE_DESCRIPTION - ${NAME} is default
+function(generate_product_version outfiles)
+ set (options)
+ set (oneValueArgs
+ NAME
+ BUNDLE
+ USE_ICON
+ ICON
+ VERSION_MAJOR
+ VERSION_MINOR
+ VERSION_PATCH
+ VERSION_REVISION
+ COMPANY_NAME
+ COMPANY_COPYRIGHT
+ COMMENTS
+ ORIGINAL_FILENAME
+ INTERNAL_NAME
+ FILE_DESCRIPTION)
+ set (multiValueArgs)
+ cmake_parse_arguments(PRODUCT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ if (NOT PRODUCT_BUNDLE OR "${PRODUCT_BUNDLE}" STREQUAL "")
+ set(PRODUCT_BUNDLE "${PRODUCT_NAME}")
+ endif()
+
+ if (USE_ICON)
+ if (NOT PRODUCT_ICON OR "${PRODUCT_ICON}" STREQUAL "")
+ set(PRODUCT_ICON "${CMAKE_SOURCE_DIR}/product.ico")
+ endif()
+ else ()
+ set (USE_ICON 0)
+ endif ()
+
+ if (NOT PRODUCT_VERSION_MAJOR EQUAL 0 AND (NOT PRODUCT_VERSION_MAJOR OR "${PRODUCT_VERSION_MAJOR}" STREQUAL ""))
+ set(PRODUCT_VERSION_MAJOR 1)
+ endif()
+ if (NOT PRODUCT_VERSION_MINOR EQUAL 0 AND (NOT PRODUCT_VERSION_MINOR OR "${PRODUCT_VERSION_MINOR}" STREQUAL ""))
+ set(PRODUCT_VERSION_MINOR 0)
+ endif()
+ if (NOT PRODUCT_VERSION_PATCH EQUAL 0 AND (NOT PRODUCT_VERSION_PATCH OR "${PRODUCT_VERSION_PATCH}" STREQUAL ""))
+ set(PRODUCT_VERSION_PATCH 0)
+ endif()
+ if (NOT PRODUCT_VERSION_REVISION EQUAL 0 AND (NOT PRODUCT_VERSION_REVISION OR "${PRODUCT_VERSION_REVISION}" STREQUAL ""))
+ set(PRODUCT_VERSION_REVISION 0)
+ endif()
+
+ if (NOT PRODUCT_COMPANY_COPYRIGHT OR "${PRODUCT_COMPANY_COPYRIGHT}" STREQUAL "")
+ string(TIMESTAMP PRODUCT_CURRENT_YEAR "%Y")
+ set(PRODUCT_COMPANY_COPYRIGHT "${PRODUCT_COMPANY_NAME} (C) Copyright ${PRODUCT_CURRENT_YEAR}")
+ endif()
+ if (NOT PRODUCT_COMMENTS OR "${PRODUCT_COMMENTS}" STREQUAL "")
+ set(PRODUCT_COMMENTS "${PRODUCT_NAME} v${PRODUCT_VERSION_MAJOR}.${PRODUCT_VERSION_MINOR}")
+ endif()
+ if (NOT PRODUCT_ORIGINAL_FILENAME OR "${PRODUCT_ORIGINAL_FILENAME}" STREQUAL "")
+ set(PRODUCT_ORIGINAL_FILENAME "${PRODUCT_NAME}")
+ endif()
+ if (NOT PRODUCT_INTERNAL_NAME OR "${PRODUCT_INTERNAL_NAME}" STREQUAL "")
+ set(PRODUCT_INTERNAL_NAME "${PRODUCT_NAME}")
+ endif()
+ if (NOT PRODUCT_FILE_DESCRIPTION OR "${PRODUCT_FILE_DESCRIPTION}" STREQUAL "")
+ set(PRODUCT_FILE_DESCRIPTION "${PRODUCT_NAME}")
+ endif()
+
+ set (_VersionInfoFile ${CMAKE_CURRENT_BINARY_DIR}/VersionInfo.h)
+ set (_VersionResourceFile ${CMAKE_CURRENT_BINARY_DIR}/VersionResource.rc)
+ configure_file(
+ ${GenerateProductVersionCurrentDir}/VersionInfo.in
+ ${_VersionInfoFile}
+ @ONLY)
+ configure_file(
+ ${GenerateProductVersionCurrentDir}/VersionResource.rc
+ ${_VersionResourceFile}
+ COPYONLY)
+ list(APPEND ${outfiles} ${_VersionInfoFile} ${_VersionResourceFile})
+ set (${outfiles} ${${outfiles}} PARENT_SCOPE)
+endfunction()
diff --git a/external/Qt-Color-Widgets/cmake/versioning.cmake b/external/Qt-Color-Widgets/cmake/versioning.cmake
new file mode 100644
index 00000000..4a5ccd32
--- /dev/null
+++ b/external/Qt-Color-Widgets/cmake/versioning.cmake
@@ -0,0 +1,43 @@
+include (ProjectVersioning)
+
+function (generate_versioning_information
+ TARGET_NAME i_target_name
+ EXPORT_HEADER i_export_header
+ EXPORT_MACRO i_export_macro
+ VERSIONED_ENTITY i_versioned_entity
+ INCLUDE_PREFIX i_include_prefix
+ COMPANY_NAME i_company_name
+ COMPANY_COPYRIGHT i_company_copyright
+ FILE_DESCRIPTION i_file_description
+)
+ target_version_information (
+ TARGET_NAME ${i_target_name}
+ EXPORT_HEADER ${i_export_header}
+ EXPORT_MACRO ${i_export_macro}
+ VERSIONED_ENTITY ${i_versioned_entity}
+ )
+
+ if (WIN32)
+ include (generate_product_version)
+
+ get_target_property (gitDescribe
+ ${i_target_name} GIT_DESCRIBE)
+
+ get_target_property (gitUntracked
+ ${i_target_name} GIT_UNTRACKED_FILES)
+
+ generate_product_version (
+ win32VersionInfoFiles
+ NAME ${i_versioned_entity}
+ VERSION_MAJOR ${${i_versioned_entity}_VERSION_MAJOR}
+ VERSION_MINOR ${${i_versioned_entity}_VERSION_MINOR}
+ VERSION_PATCH ${${i_versioned_entity}_VERSION_PATCH}
+ COMPANY_NAME ${i_company_name}
+ COMPANY_COPYRIGHT ${i_company_copyright}
+ COMMENTS "${gitDescribe}${gitUntracked}"
+ FILE_DESCRIPTION ${i_file_description}
+ )
+
+ target_sources (${i_target_name} PRIVATE ${win32VersionInfoFiles})
+ endif (WIN32)
+endfunction (generate_versioning_information)
diff --git a/external/Qt-Color-Widgets/color_widgets.pri b/external/Qt-Color-Widgets/color_widgets.pri
index 29175aa4..4f69ec30 100644
--- a/external/Qt-Color-Widgets/color_widgets.pri
+++ b/external/Qt-Color-Widgets/color_widgets.pri
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2017 Mattia Basaglia
+# Copyright (C) 2013-2019 Mattia Basaglia
#
#
# This software is free software: you can redistribute it and/or modify
@@ -19,13 +19,59 @@ CONFIG += c++11
INCLUDEPATH += $$PWD/src $$PWD/include
SOURCES += \
- $$PWD/src/color_wheel.cpp \
- $$PWD/src/color_utils.cpp
+ $$PWD/src/QtColorWidgets/abstract_widget_list.cpp \
+ $$PWD/src/QtColorWidgets/bound_color_selector.cpp \
+ $$PWD/src/QtColorWidgets/color_2d_slider.cpp \
+ $$PWD/src/QtColorWidgets/color_delegate.cpp \
+ $$PWD/src/QtColorWidgets/color_dialog.cpp \
+ $$PWD/src/QtColorWidgets/color_line_edit.cpp \
+ $$PWD/src/QtColorWidgets/color_list_widget.cpp \
+ $$PWD/src/QtColorWidgets/color_names.cpp \
+ $$PWD/src/QtColorWidgets/color_palette.cpp \
+ $$PWD/src/QtColorWidgets/color_palette_model.cpp \
+ $$PWD/src/QtColorWidgets/color_palette_widget.cpp \
+ $$PWD/src/QtColorWidgets/color_preview.cpp \
+ $$PWD/src/QtColorWidgets/color_selector.cpp \
+ $$PWD/src/QtColorWidgets/color_utils.cpp \
+ $$PWD/src/QtColorWidgets/color_wheel.cpp \
+ $$PWD/src/QtColorWidgets/gradient_editor.cpp \
+ $$PWD/src/QtColorWidgets/gradient_list_model.cpp \
+ $$PWD/src/QtColorWidgets/gradient_slider.cpp \
+ $$PWD/src/QtColorWidgets/harmony_color_wheel.cpp \
+ $$PWD/src/QtColorWidgets/hue_slider.cpp \
+ $$PWD/src/QtColorWidgets/swatch.cpp
HEADERS += \
- $$PWD/include/color_wheel.hpp \
- $$PWD/src/color_utils.hpp
+ $$PWD/include/QtColorWidgets/abstract_widget_list.hpp \
+ $$PWD/include/QtColorWidgets/bound_color_selector.hpp \
+ $$PWD/include/QtColorWidgets/color_2d_slider.hpp \
+ $$PWD/include/QtColorWidgets/color_delegate.hpp \
+ $$PWD/include/QtColorWidgets/color_dialog.hpp \
+ $$PWD/include/QtColorWidgets/color_line_edit.hpp \
+ $$PWD/include/QtColorWidgets/color_list_widget.hpp \
+ $$PWD/include/QtColorWidgets/color_names.hpp \
+ $$PWD/include/QtColorWidgets/color_palette.hpp \
+ $$PWD/include/QtColorWidgets/color_palette_model.hpp \
+ $$PWD/include/QtColorWidgets/color_palette_widget.hpp \
+ $$PWD/include/QtColorWidgets/color_preview.hpp \
+ $$PWD/include/QtColorWidgets/color_selector.hpp \
+ $$PWD/include/QtColorWidgets/color_utils.hpp \
+ $$PWD/include/QtColorWidgets/color_wheel.hpp \
+ $$PWD/include/QtColorWidgets/color_wheel_private.hpp \
+ $$PWD/include/QtColorWidgets/colorwidgets_global.hpp \
+ $$PWD/include/QtColorWidgets/gradient_delegate.hpp \
+ $$PWD/include/QtColorWidgets/gradient_editor.hpp \
+ $$PWD/include/QtColorWidgets/gradient_helper.hpp \
+ $$PWD/include/QtColorWidgets/gradient_list_model.hpp \
+ $$PWD/include/QtColorWidgets/gradient_slider.hpp \
+ $$PWD/include/QtColorWidgets/harmony_color_wheel.hpp \
+ $$PWD/include/QtColorWidgets/hue_slider.hpp \
+ $$PWD/include/QtColorWidgets/swatch.hpp
+
+FORMS += \
+ $$PWD/src/QtColorWidgets/color_dialog.ui \
+ $$PWD/src/QtColorWidgets/color_palette_widget.ui
RESOURCES += \
- $$PWD/src/color_widgets.qrc
+ $$PWD/resources/QtColorWidgets/color_widgets.qrc
diff --git a/external/Qt-Color-Widgets/color_widgets.pro b/external/Qt-Color-Widgets/color_widgets.pro
index 4241ac2d..ee1c6ed2 100644
--- a/external/Qt-Color-Widgets/color_widgets.pro
+++ b/external/Qt-Color-Widgets/color_widgets.pro
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2013-2017 Mattia Basaglia
+# Copyright (C) 2013-2020 Mattia Basaglia
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
@@ -15,13 +15,15 @@
# along with this program. If not, see .
#
TEMPLATE=lib
-CONFIG += dll
+#CONFIG += dll
QT += core gui widgets
DEFINES += QTCOLORWIDGETS_LIBRARY
-TARGET=ColorWidgets-qt5
+INCLUDEPATH += $$PWD/include
-VERSION=1.0.0
+TARGET=QtColorWidgets
+
+VERSION=2.2.0
OBJECTS_DIR = out/obj
MOC_DIR = out/generated
@@ -41,7 +43,12 @@ unix {
win32 {
LIB_TARGET = $${TARGET}.dll
}
-
+android {
+ OBJECTS_DIR = $$ANDROID_TARGET_ARCH/out/obj
+ MOC_DIR = $$ANDROID_TARGET_ARCH/out/generated
+ UI_DIR = $$ANDROID_TARGET_ARCH/out/generated
+ RCC_DIR = $$ANDROID_TARGET_ARCH/out/generated
+}
isEmpty(PREFIX) {
PREFIX = /usr/local
}
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/CMakeLists.txt b/external/Qt-Color-Widgets/color_widgets_designer_plugin/CMakeLists.txt
new file mode 100644
index 00000000..1c0504ef
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/CMakeLists.txt
@@ -0,0 +1,161 @@
+# Copyright (C) 2013-2020 Mattia Basaglia
+#
+#
+# This software is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Color Widgets. If not, see .
+
+cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
+
+project(QtColorWidgetsPlugin CXX)
+
+
+set (CMAKE_MODULE_PATH
+ ${CMAKE_MODULE_PATH}
+ ${CMAKE_SOURCE_DIR}/cmake/modules
+ ${CMAKE_CURRENT_LIST_DIR}/..)
+
+
+include (CheckCXXCompilerFlag)
+
+include (../cmake/versioning.cmake)
+
+
+SET (${PROJECT_NAME}_VERSION_MAJOR 2)
+SET (${PROJECT_NAME}_VERSION_MINOR 2)
+SET (${PROJECT_NAME}_VERSION_PATCH 0)
+SET (${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}")
+
+
+find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Designer REQUIRED)
+
+# Auto generate moc files
+set(CMAKE_AUTOMOC ON)
+# Auto generate moc files
+set(CMAKE_AUTOUIC ON)
+# Auto generate moc files
+set(CMAKE_AUTORCC ON)
+
+check_cxx_compiler_flag ("-Wall" Wall_FLAG_SUPPORTED)
+
+if (Wall_FLAG_SUPPORTED)
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
+endif (Wall_FLAG_SUPPORTED)
+
+check_cxx_compiler_flag ("-pedantic" pedantic_FLAG_SUPPORTED)
+
+if (pedantic_FLAG_SUPPORTED)
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pedantic")
+endif (pedantic_FLAG_SUPPORTED)
+
+check_cxx_compiler_flag ("-Wextra" Wextra_FLAG_SUPPORTED)
+
+if (Wextra_FLAG_SUPPORTED)
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wextra")
+endif (Wextra_FLAG_SUPPORTED)
+
+# Library
+set (TARGET_NAME ${PROJECT_NAME})
+set (TARGET_OUTPUT_SUFFIX "-Qt${QT_VERSION}${${PROJECT_NAME}_VERSION_MAJOR}")
+
+add_library (${TARGET_NAME} SHARED "")
+set_target_properties(${TARGET_NAME}
+ PROPERTIES
+ EXPORT_NAME "${TARGET_NAME}${TARGET_OUTPUT_SUFFIX}")
+
+set_target_properties (${TARGET_NAME}
+ PROPERTIES
+ CXX_STANDARD 11
+ CXX_STANDARD_REQUIRED ON
+ VERSION ${${PROJECT_NAME}_VERSION}
+ SOVERSION ${${PROJECT_NAME}_VERSION_MAJOR}
+ "INTERFACE_${PROJECT_NAME}_MAJOR_VERSION" ${${PROJECT_NAME}_VERSION_MAJOR}
+ COMPATIBLE_INTERFACE_STRING "${PROJECT_NAME}_MAJOR_VERSION"
+ OUTPUT_NAME "${TARGET_NAME}${TARGET_OUTPUT_SUFFIX}")
+
+
+target_link_libraries(${TARGET_NAME}
+ PRIVATE
+ ${COLOR_WIDGETS_LIBRARY}
+ Qt${QT_VERSION_MAJOR}::Designer
+ )
+
+
+# Sources
+set(SOURCES
+ color_preview_plugin.cpp
+ color_wheel_plugin.cpp
+ color_widget_plugin_collection.cpp
+ gradient_slider_plugin.cpp
+ hue_slider_plugin.cpp
+ color_selector_plugin.cpp
+ color_list_plugin.cpp
+ swatch_plugin.cpp
+ color_palette_widget_plugin.cpp
+ color_2d_slider_plugin.cpp
+ color_line_edit_plugin.cpp
+ gradient_editor_plugin.cpp
+ # add new sources above this line
+ )
+
+foreach (SOURCE IN LISTS SOURCES)
+ target_sources (${TARGET_NAME}
+ PRIVATE
+ $)
+endforeach (SOURCE IN SOURCES)
+
+set(HEADERS
+ color_preview_plugin.hpp
+ color_wheel_plugin.hpp
+ color_widget_plugin_collection.hpp
+ gradient_slider_plugin.hpp
+ hue_slider_plugin.hpp
+ color_selector_plugin.hpp
+ color_list_plugin.hpp
+ swatch_plugin.hpp
+ color_palette_widget_plugin.hpp
+ color_2d_slider_plugin.hpp
+ color_line_edit_plugin.hpp
+ gradient_editor_plugin.hpp
+ # add new headers above this line
+ )
+
+foreach (HEADER IN LISTS HEADERS)
+ target_sources (${TARGET_NAME}
+ PRIVATE
+ $)
+endforeach (HEADER IN HEADERS)
+
+
+# install
+get_target_property (QT_QMAKE_EXECUTABLE
+ Qt${QT_VERSION_MAJOR}::qmake LOCATION)
+
+execute_process (
+ COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_PLUGINS
+ OUTPUT_VARIABLE QT_INSTALL_PLUGINS
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+# install(TARGETS ${COLOR_WIDGETS_PLUGIN} DESTINATION ${QT_INSTALL_PLUGINS}/designer OPTIONAL)
+
+execute_process (
+ COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_LIBS
+ OUTPUT_VARIABLE QT_INSTALL_LIBS
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+# install(TARGETS ${COLOR_WIDGETS_PLUGIN} DESTINATION ${QT_INSTALL_LIBS}/qtcreator/plugins OPTIONAL)
+
+add_custom_target(${TARGET_NAME}_install
+ COMMAND cp $ ${QT_INSTALL_PLUGINS}/designer
+ COMMAND cp $ ${QT_INSTALL_LIBS}/qtcreator/plugins
+ DEPENDS ${TARGET_NAME}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_2d_slider_plugin.cpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_2d_slider_plugin.cpp
new file mode 100644
index 00000000..b56503c5
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_2d_slider_plugin.cpp
@@ -0,0 +1,90 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "color_2d_slider_plugin.hpp"
+#include "QtColorWidgets/color_2d_slider.hpp"
+
+Color2DSlider_Plugin::Color2DSlider_Plugin(QObject *parent) :
+ QObject(parent), initialized(false)
+{
+}
+
+void Color2DSlider_Plugin::initialize(QDesignerFormEditorInterface *)
+{
+ initialized = true;
+}
+
+bool Color2DSlider_Plugin::isInitialized() const
+{
+ return initialized;
+}
+
+QWidget *Color2DSlider_Plugin::createWidget(QWidget *parent)
+{
+ return new color_widgets::Color2DSlider(parent);
+}
+
+QString Color2DSlider_Plugin::name() const
+{
+ return "color_widgets::Color2DSlider";
+}
+
+QString Color2DSlider_Plugin::group() const
+{
+ return "Color Widgets";
+}
+
+QIcon Color2DSlider_Plugin::icon() const
+{
+ color_widgets::Color2DSlider w;
+ w.resize(64,64);
+ QPixmap pix(64,64);
+ w.render(&pix);
+ return QIcon(pix);
+}
+
+QString Color2DSlider_Plugin::toolTip() const
+{
+ return "An analog widget to select 2 color components at the same time";
+}
+
+QString Color2DSlider_Plugin::whatsThis() const
+{
+ return toolTip();
+}
+
+bool Color2DSlider_Plugin::isContainer() const
+{
+ return false;
+}
+
+QString Color2DSlider_Plugin::domXml() const
+{
+ return "\n"
+ " \n"
+ " \n"
+ " \n";
+}
+
+QString Color2DSlider_Plugin::includeFile() const
+{
+ return "QtColorWidgets/color_2d_slider.hpp";
+}
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_2d_slider_plugin.hpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_2d_slider_plugin.hpp
new file mode 100644
index 00000000..cc360d2e
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_2d_slider_plugin.hpp
@@ -0,0 +1,57 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_WIDGETS_COLOR_2D_SLIDER_PLUGIN_HPP
+#define COLOR_WIDGETS_COLOR_2D_SLIDER_PLUGIN_HPP
+
+#include
+#include
+
+class Color2DSlider_Plugin : public QObject, public QDesignerCustomWidgetInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+ Color2DSlider_Plugin(QObject *parent = 0);
+
+ void initialize(QDesignerFormEditorInterface *core);
+ bool isInitialized() const;
+
+ QWidget *createWidget(QWidget *parent);
+
+ QString name() const;
+ QString group() const;
+ QIcon icon() const;
+ QString toolTip() const;
+ QString whatsThis() const;
+ bool isContainer() const;
+
+ QString domXml() const;
+
+ QString includeFile() const;
+
+private:
+ bool initialized;
+};
+
+
+#endif // COLOR_WIDGETS_COLOR_2D_SLIDER_PLUGIN_HPP
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_line_edit_plugin.cpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_line_edit_plugin.cpp
new file mode 100644
index 00000000..56d7a5a2
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_line_edit_plugin.cpp
@@ -0,0 +1,87 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "color_line_edit_plugin.hpp"
+#include "QtColorWidgets/color_line_edit.hpp"
+
+QWidget* ColorLineEdit_Plugin::createWidget(QWidget *parent)
+{
+ color_widgets::ColorLineEdit *widget = new color_widgets::ColorLineEdit(parent);
+ return widget;
+}
+
+QIcon ColorLineEdit_Plugin::icon() const
+{
+ return QIcon::fromTheme("edit-rename");
+}
+
+QString ColorLineEdit_Plugin::domXml() const
+{
+ return "\n"
+ " \n"
+ " \n"
+ " \n";
+}
+
+bool ColorLineEdit_Plugin::isContainer() const
+{
+ return false;
+}
+
+ColorLineEdit_Plugin::ColorLineEdit_Plugin(QObject *parent) :
+ QObject(parent), initialized(false)
+{
+}
+
+void ColorLineEdit_Plugin::initialize(QDesignerFormEditorInterface *)
+{
+ initialized = true;
+}
+
+bool ColorLineEdit_Plugin::isInitialized() const
+{
+ return initialized;
+}
+
+QString ColorLineEdit_Plugin::name() const
+{
+ return "color_widgets::ColorLineEdit";
+}
+
+QString ColorLineEdit_Plugin::group() const
+{
+ return "Color Widgets";
+}
+
+QString ColorLineEdit_Plugin::toolTip() const
+{
+ return "A widget to manipulate a string representing a color";
+}
+
+QString ColorLineEdit_Plugin::whatsThis() const
+{
+ return toolTip();
+}
+
+QString ColorLineEdit_Plugin::includeFile() const
+{
+ return "QtColorWidgets/color_line_edit.hpp";
+}
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_line_edit_plugin.hpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_line_edit_plugin.hpp
new file mode 100644
index 00000000..1388b5bd
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_line_edit_plugin.hpp
@@ -0,0 +1,58 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_WIDGETS_COLOR_LINE_EDIT_PLUGIN_HPP
+#define COLOR_WIDGETS_COLOR_LINE_EDIT_PLUGIN_HPP
+
+#include
+#include
+
+class ColorLineEdit_Plugin : public QObject, public QDesignerCustomWidgetInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+ explicit ColorLineEdit_Plugin(QObject *parent = nullptr);
+
+ void initialize(QDesignerFormEditorInterface *core) Q_DECL_OVERRIDE;
+ bool isInitialized() const Q_DECL_OVERRIDE;
+
+ QWidget *createWidget(QWidget *parent) Q_DECL_OVERRIDE;
+
+ QString name() const Q_DECL_OVERRIDE;
+ QString group() const Q_DECL_OVERRIDE;
+ QIcon icon() const Q_DECL_OVERRIDE;
+ QString toolTip() const Q_DECL_OVERRIDE;
+ QString whatsThis() const Q_DECL_OVERRIDE;
+ bool isContainer() const Q_DECL_OVERRIDE;
+
+ QString domXml() const Q_DECL_OVERRIDE;
+
+ QString includeFile() const Q_DECL_OVERRIDE;
+
+private:
+ bool initialized;
+};
+
+
+#endif // COLOR_WIDGETS_COLOR_LINE_EDIT_PLUGIN_HPP
+
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_list_plugin.cpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_list_plugin.cpp
new file mode 100644
index 00000000..11768811
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_list_plugin.cpp
@@ -0,0 +1,88 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "color_list_plugin.hpp"
+#include "QtColorWidgets/color_list_widget.hpp"
+
+ColorListWidget_Plugin::ColorListWidget_Plugin(QObject *parent) :
+ QObject(parent)
+{
+}
+
+
+void ColorListWidget_Plugin::initialize(QDesignerFormEditorInterface *)
+{
+ initialized = true;
+}
+
+bool ColorListWidget_Plugin::isInitialized() const
+{
+ return initialized;
+}
+
+QWidget *ColorListWidget_Plugin::createWidget(QWidget *parent)
+{
+ return new color_widgets::ColorListWidget(parent);
+}
+
+QString ColorListWidget_Plugin::name() const
+{
+ return "color_widgets::ColorListWidget";
+}
+
+QString ColorListWidget_Plugin::group() const
+{
+ return "Color Widgets";
+}
+
+QIcon ColorListWidget_Plugin::icon() const
+{
+ return QIcon::fromTheme("format-stroke-color");
+}
+
+QString ColorListWidget_Plugin::toolTip() const
+{
+ return "An editable list of colors";
+}
+
+QString ColorListWidget_Plugin::whatsThis() const
+{
+ return toolTip();
+}
+
+bool ColorListWidget_Plugin::isContainer() const
+{
+ return false;
+}
+
+QString ColorListWidget_Plugin::domXml() const
+{
+
+ return "\n"
+ " \n"
+ " \n"
+ " \n";
+}
+
+QString ColorListWidget_Plugin::includeFile() const
+{
+ return "QtColorWidgets/color_list_widget.hpp";
+}
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_list_plugin.hpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_list_plugin.hpp
new file mode 100644
index 00000000..31508d97
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_list_plugin.hpp
@@ -0,0 +1,56 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_LIST_PLUGIN_HPP
+#define COLOR_LIST_PLUGIN_HPP
+
+#include
+
+class ColorListWidget_Plugin : public QObject, public QDesignerCustomWidgetInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+ explicit ColorListWidget_Plugin(QObject *parent = 0);
+
+ void initialize(QDesignerFormEditorInterface *core);
+ bool isInitialized() const;
+
+ QWidget *createWidget(QWidget *parent);
+
+ QString name() const;
+ QString group() const;
+ QIcon icon() const;
+ QString toolTip() const;
+ QString whatsThis() const;
+ bool isContainer() const;
+
+ QString domXml() const;
+
+ QString includeFile() const;
+
+private:
+ bool initialized;
+
+};
+
+#endif // COLOR_LIST_PLUGIN_HPP
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_palette_widget_plugin.cpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_palette_widget_plugin.cpp
new file mode 100644
index 00000000..05d80248
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_palette_widget_plugin.cpp
@@ -0,0 +1,120 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "color_palette_widget_plugin.hpp"
+#include "QtColorWidgets/color_palette_widget.hpp"
+
+ColorPaletteWidget_Plugin::ColorPaletteWidget_Plugin(QObject *parent) :
+ QObject(parent), initialized(false)
+{
+}
+
+void ColorPaletteWidget_Plugin::initialize(QDesignerFormEditorInterface *)
+{
+ initialized = true;
+}
+
+bool ColorPaletteWidget_Plugin::isInitialized() const
+{
+ return initialized;
+}
+
+QWidget* ColorPaletteWidget_Plugin::createWidget(QWidget *parent)
+{
+ color_widgets::ColorPaletteWidget *wid = new color_widgets::ColorPaletteWidget(parent);
+
+ color_widgets::ColorPalette palette1;
+ color_widgets::ColorPalette palette2;
+ int columns = 12;
+ palette1.setName("Palette 1");
+ palette2.setName("Palette 2");
+ palette1.setColumns(columns);
+ palette2.setColumns(columns);
+ for ( int i = 0; i < 6; i++ )
+ {
+ for ( int j = 0; j < columns; j++ )
+ {
+ float f = float(j)/columns;
+ palette1.appendColor(QColor::fromHsvF(i/8.0,1-f,0.5+f/2));
+ palette2.appendColor(QColor::fromHsvF(i/8.0,1-f,1-f));
+ }
+ }
+ color_widgets::ColorPaletteModel *model = new color_widgets::ColorPaletteModel;
+ model->setParent(wid);
+ model->addPalette(palette1, false);
+ model->addPalette(palette2, false);
+ wid->setModel(model);
+
+ return wid;
+}
+
+QString ColorPaletteWidget_Plugin::name() const
+{
+ return "color_widgets::ColorPaletteWidget";
+}
+
+QString ColorPaletteWidget_Plugin::group() const
+{
+ return "Color Widgets";
+}
+
+QIcon ColorPaletteWidget_Plugin::icon() const
+{
+ color_widgets::ColorPalette w;
+ w.setColumns(6);
+ for ( int i = 0; i < 4; i++ )
+ {
+ for ( int j = 0; j < w.columns(); j++ )
+ {
+ float f = float(j)/w.columns();
+ w.appendColor(QColor::fromHsvF(i/5.0,1-f,0.5+f/2));
+ }
+ }
+ return QIcon(w.preview(QSize(64,64)));
+}
+
+QString ColorPaletteWidget_Plugin::toolTip() const
+{
+ return "A widget that displays a color palette";
+}
+
+QString ColorPaletteWidget_Plugin::whatsThis() const
+{
+ return toolTip();
+}
+
+bool ColorPaletteWidget_Plugin::isContainer() const
+{
+ return false;
+}
+
+QString ColorPaletteWidget_Plugin::domXml() const
+{
+ return "\n"
+ " \n"
+ " \n"
+ " \n";
+}
+
+QString ColorPaletteWidget_Plugin::includeFile() const
+{
+ return "QtColorWidgets/color_palette_widget.hpp";
+}
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_palette_widget_plugin.hpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_palette_widget_plugin.hpp
new file mode 100644
index 00000000..06f6d72c
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_palette_widget_plugin.hpp
@@ -0,0 +1,57 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_WIDGETS_COLOR_PALETTE_WIDGET_PLUGIN_HPP
+#define COLOR_WIDGETS_COLOR_PALETTE_WIDGET_PLUGIN_HPP
+
+#include
+#include
+
+class ColorPaletteWidget_Plugin : public QObject, public QDesignerCustomWidgetInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+ ColorPaletteWidget_Plugin(QObject *parent = 0);
+
+ void initialize(QDesignerFormEditorInterface *core);
+ bool isInitialized() const;
+
+ QWidget *createWidget(QWidget *parent);
+
+ QString name() const;
+ QString group() const;
+ QIcon icon() const;
+ QString toolTip() const;
+ QString whatsThis() const;
+ bool isContainer() const;
+
+ QString domXml() const;
+
+ QString includeFile() const;
+
+private:
+ bool initialized;
+};
+
+
+#endif // COLOR_WIDGETS_COLOR_PALETTE_WIDGET_PLUGIN_HPP
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_preview_plugin.cpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_preview_plugin.cpp
new file mode 100644
index 00000000..1b424659
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_preview_plugin.cpp
@@ -0,0 +1,95 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "color_preview_plugin.hpp"
+#include "QtColorWidgets/color_preview.hpp"
+#include
+
+
+ColorPreview_Plugin::ColorPreview_Plugin(QObject *parent)
+ : QObject(parent), initialized(false)
+{
+}
+
+
+void ColorPreview_Plugin::initialize(QDesignerFormEditorInterface *)
+{
+ if (initialized)
+ return;
+
+ initialized = true;
+}
+
+bool ColorPreview_Plugin::isInitialized() const
+{
+ return initialized;
+}
+
+QWidget *ColorPreview_Plugin::createWidget(QWidget *parent)
+{
+ return new color_widgets::ColorPreview(parent);
+}
+
+QString ColorPreview_Plugin::name() const
+{
+ return "color_widgets::ColorPreview";
+}
+
+QString ColorPreview_Plugin::group() const
+{
+ return "Color Widgets";
+}
+
+QIcon ColorPreview_Plugin::icon() const
+{
+ return QIcon();
+}
+
+QString ColorPreview_Plugin::toolTip() const
+{
+ return "Display a color";
+}
+
+QString ColorPreview_Plugin::whatsThis() const
+{
+ return toolTip();
+}
+
+bool ColorPreview_Plugin::isContainer() const
+{
+ return false;
+}
+
+QString ColorPreview_Plugin::domXml() const
+{
+
+ return "\n"
+ " \n"
+ " \n"
+ " \n";
+}
+
+QString ColorPreview_Plugin::includeFile() const
+{
+ return "QtColorWidgets/color_preview.hpp";
+}
+
+//Q_EXPORT_PLUGIN2(color_widgets, ColorPreview_Plugin);
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_preview_plugin.hpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_preview_plugin.hpp
new file mode 100644
index 00000000..e1bd2c42
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_preview_plugin.hpp
@@ -0,0 +1,55 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_PREVIEW_PLUGIN_HPP
+#define COLOR_PREVIEW_PLUGIN_HPP
+
+#include
+
+class ColorPreview_Plugin : public QObject, public QDesignerCustomWidgetInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+ ColorPreview_Plugin(QObject *parent = 0);
+
+ void initialize(QDesignerFormEditorInterface *core);
+ bool isInitialized() const;
+
+ QWidget *createWidget(QWidget *parent);
+
+ QString name() const;
+ QString group() const;
+ QIcon icon() const;
+ QString toolTip() const;
+ QString whatsThis() const;
+ bool isContainer() const;
+
+ QString domXml() const;
+
+ QString includeFile() const;
+
+private:
+ bool initialized;
+};
+
+#endif // COLOR_PREVIEW_PLUGIN_HPP
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_selector_plugin.cpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_selector_plugin.cpp
new file mode 100644
index 00000000..24d831f8
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_selector_plugin.cpp
@@ -0,0 +1,92 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "color_selector_plugin.hpp"
+#include "QtColorWidgets/color_selector.hpp"
+#include
+
+ColorSelector_Plugin::ColorSelector_Plugin(QObject *parent)
+ : QObject(parent), initialized(false)
+{
+}
+
+
+void ColorSelector_Plugin::initialize(QDesignerFormEditorInterface *)
+{
+ if (initialized)
+ return;
+
+ initialized = true;
+}
+
+bool ColorSelector_Plugin::isInitialized() const
+{
+ return initialized;
+}
+
+QWidget *ColorSelector_Plugin::createWidget(QWidget *parent)
+{
+ return new color_widgets::ColorSelector(parent);
+}
+
+QString ColorSelector_Plugin::name() const
+{
+ return "color_widgets::ColorSelector";
+}
+
+QString ColorSelector_Plugin::group() const
+{
+ return "Color Widgets";
+}
+
+QIcon ColorSelector_Plugin::icon() const
+{
+ return QIcon();
+}
+
+QString ColorSelector_Plugin::toolTip() const
+{
+ return "Display a color and opens a color dialog on click";
+}
+
+QString ColorSelector_Plugin::whatsThis() const
+{
+ return toolTip();
+}
+
+bool ColorSelector_Plugin::isContainer() const
+{
+ return false;
+}
+
+QString ColorSelector_Plugin::domXml() const
+{
+
+ return "\n"
+ " \n"
+ " \n"
+ " \n";
+}
+
+QString ColorSelector_Plugin::includeFile() const
+{
+ return "QtColorWidgets/color_selector.hpp";
+}
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_selector_plugin.hpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_selector_plugin.hpp
new file mode 100644
index 00000000..a03ab155
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_selector_plugin.hpp
@@ -0,0 +1,55 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_SELECTOR_PLUGIN_HPP
+#define COLOR_SELECTOR_PLUGIN_HPP
+
+#include
+
+class ColorSelector_Plugin : public QObject, public QDesignerCustomWidgetInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+ ColorSelector_Plugin(QObject *parent = 0);
+
+ void initialize(QDesignerFormEditorInterface *core);
+ bool isInitialized() const;
+
+ QWidget *createWidget(QWidget *parent);
+
+ QString name() const;
+ QString group() const;
+ QIcon icon() const;
+ QString toolTip() const;
+ QString whatsThis() const;
+ bool isContainer() const;
+
+ QString domXml() const;
+
+ QString includeFile() const;
+
+private:
+ bool initialized;
+};
+
+#endif // COLOR_SELECTOR_PLUGIN_HPP
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_wheel_plugin.cpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_wheel_plugin.cpp
new file mode 100644
index 00000000..1cde3229
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_wheel_plugin.cpp
@@ -0,0 +1,97 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "color_wheel_plugin.hpp"
+#include "QtColorWidgets/color_wheel.hpp"
+
+ColorWheel_Plugin::ColorWheel_Plugin(QObject *parent) :
+ QObject(parent), initialized(false)
+{
+}
+
+void ColorWheel_Plugin::initialize(QDesignerFormEditorInterface *)
+{
+ initialized = true;
+}
+
+bool ColorWheel_Plugin::isInitialized() const
+{
+ return initialized;
+}
+
+QWidget *ColorWheel_Plugin::createWidget(QWidget *parent)
+{
+ return new color_widgets::ColorWheel(parent);
+}
+
+QString ColorWheel_Plugin::name() const
+{
+ return "color_widgets::ColorWheel";
+}
+
+QString ColorWheel_Plugin::group() const
+{
+ return "Color Widgets";
+}
+
+QIcon ColorWheel_Plugin::icon() const
+{
+ color_widgets::ColorWheel w;
+ w.resize(64,64);
+ w.setWheelWidth(8);
+ QPixmap pix(64,64);
+ w.render(&pix);
+ return QIcon(pix);
+}
+
+QString ColorWheel_Plugin::toolTip() const
+{
+ return "A widget that allows an intuitive selection of HSL parameters for a QColor";
+}
+
+QString ColorWheel_Plugin::whatsThis() const
+{
+ return toolTip();
+}
+
+bool ColorWheel_Plugin::isContainer() const
+{
+ return false;
+}
+
+QString ColorWheel_Plugin::domXml() const
+{
+ return "\n"
+ " \n"
+ " \n"
+ " \n"
+ " 0 \n"
+ " 0 \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n";
+}
+
+QString ColorWheel_Plugin::includeFile() const
+{
+ return "QtColorWidgets/color_wheel.hpp";
+}
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_wheel_plugin.hpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_wheel_plugin.hpp
new file mode 100644
index 00000000..921323f7
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_wheel_plugin.hpp
@@ -0,0 +1,57 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_WHEEL_PLUGIN_HPP
+#define COLOR_WHEEL_PLUGIN_HPP
+
+#include
+#include
+
+class ColorWheel_Plugin : public QObject, public QDesignerCustomWidgetInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+ ColorWheel_Plugin(QObject *parent = 0);
+
+ void initialize(QDesignerFormEditorInterface *core);
+ bool isInitialized() const;
+
+ QWidget *createWidget(QWidget *parent);
+
+ QString name() const;
+ QString group() const;
+ QIcon icon() const;
+ QString toolTip() const;
+ QString whatsThis() const;
+ bool isContainer() const;
+
+ QString domXml() const;
+
+ QString includeFile() const;
+
+private:
+ bool initialized;
+};
+
+
+#endif // COLOR_WHEEL_PLUGIN_HPP
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_widget_plugin_collection.cpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_widget_plugin_collection.cpp
new file mode 100644
index 00000000..10bf5e1a
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_widget_plugin_collection.cpp
@@ -0,0 +1,56 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "color_widget_plugin_collection.hpp"
+#include "color_preview_plugin.hpp"
+#include "color_wheel_plugin.hpp"
+#include "gradient_slider_plugin.hpp"
+#include "hue_slider_plugin.hpp"
+#include "color_selector_plugin.hpp"
+#include "color_list_plugin.hpp"
+#include "swatch_plugin.hpp"
+#include "color_palette_widget_plugin.hpp"
+#include "color_2d_slider_plugin.hpp"
+#include "color_line_edit_plugin.hpp"
+#include "gradient_editor_plugin.hpp"
+// add new plugin headers above this line
+
+ColorWidgets_PluginCollection::ColorWidgets_PluginCollection(QObject *parent) :
+ QObject(parent)
+{
+ widgets.push_back(new ColorPreview_Plugin(this));
+ widgets.push_back(new ColorWheel_Plugin(this));
+ widgets.push_back(new GradientSlider_Plugin(this));
+ widgets.push_back(new HueSlider_Plugin(this));
+ widgets.push_back(new ColorSelector_Plugin(this));
+ widgets.push_back(new ColorListWidget_Plugin(this));
+ widgets.push_back(new Swatch_Plugin(this));
+ widgets.push_back(new ColorPaletteWidget_Plugin(this));
+ widgets.push_back(new Color2DSlider_Plugin(this));
+ widgets.push_back(new ColorLineEdit_Plugin(this));
+ widgets.push_back(new GradientEditor_Plugin(this));
+ // add new plugins above this line
+}
+
+QList ColorWidgets_PluginCollection::customWidgets() const
+{
+ return widgets;
+}
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_widget_plugin_collection.hpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_widget_plugin_collection.hpp
new file mode 100644
index 00000000..d58ca5df
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/color_widget_plugin_collection.hpp
@@ -0,0 +1,43 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_WIDGET_PLUGIN_COLLECTION_HPP
+#define COLOR_WIDGET_PLUGIN_COLLECTION_HPP
+
+#include
+
+class ColorWidgets_PluginCollection : public QObject, public QDesignerCustomWidgetCollectionInterface
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "mattia.basaglia.ColorWidgetsPlugin")
+ Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)
+
+public:
+ explicit ColorWidgets_PluginCollection(QObject *parent = 0);
+
+ QList customWidgets() const;
+
+ private:
+ QList widgets;
+
+};
+
+#endif // COLOR_WIDGET_PLUGIN_COLLECTION_HPP
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/gradient_editor_plugin.cpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/gradient_editor_plugin.cpp
new file mode 100644
index 00000000..c679eb9c
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/gradient_editor_plugin.cpp
@@ -0,0 +1,98 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "gradient_editor_plugin.hpp"
+#include "QtColorWidgets/gradient_editor.hpp"
+
+QWidget* GradientEditor_Plugin::createWidget(QWidget *parent)
+{
+ color_widgets::GradientEditor *widget = new color_widgets::GradientEditor(parent);
+ return widget;
+}
+
+QIcon GradientEditor_Plugin::icon() const
+{
+ color_widgets::GradientEditor w;
+ w.resize(64,16);
+ QGradientStops cols;
+ cols.push_back({0.2, Qt::green});
+ cols.push_back({0.5, Qt::yellow});
+ cols.push_back({0.8, Qt::red});
+ w.setStops(cols);
+ QPixmap pix(64,64);
+ pix.fill(Qt::transparent);
+ w.render(&pix, QPoint(0,16));
+ return QIcon(pix);
+}
+
+QString GradientEditor_Plugin::domXml() const
+{
+ return "\n"
+ " \n"
+ " \n"
+ " \n";
+}
+
+bool GradientEditor_Plugin::isContainer() const
+{
+ return false;
+}
+
+GradientEditor_Plugin::GradientEditor_Plugin(QObject *parent) :
+ QObject(parent), initialized(false)
+{
+}
+
+void GradientEditor_Plugin::initialize(QDesignerFormEditorInterface *)
+{
+ initialized = true;
+}
+
+bool GradientEditor_Plugin::isInitialized() const
+{
+ return initialized;
+}
+
+QString GradientEditor_Plugin::name() const
+{
+ return "color_widgets::GradientEditor";
+}
+
+QString GradientEditor_Plugin::group() const
+{
+ return "Color Widgets";
+}
+
+QString GradientEditor_Plugin::toolTip() const
+{
+ return "Widget to edit gradient stops";
+}
+
+QString GradientEditor_Plugin::whatsThis() const
+{
+ return toolTip();
+}
+
+QString GradientEditor_Plugin::includeFile() const
+{
+ return "QtColorWidgets/gradient_editor.hpp";
+}
+
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/gradient_editor_plugin.hpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/gradient_editor_plugin.hpp
new file mode 100644
index 00000000..77fb19b7
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/gradient_editor_plugin.hpp
@@ -0,0 +1,58 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_WIDGETS_GRADIENT_EDITOR_PLUGIN_HPP
+#define COLOR_WIDGETS_GRADIENT_EDITOR_PLUGIN_HPP
+
+#include
+#include
+
+class GradientEditor_Plugin : public QObject, public QDesignerCustomWidgetInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+ explicit GradientEditor_Plugin(QObject *parent = nullptr);
+
+ void initialize(QDesignerFormEditorInterface *core) Q_DECL_OVERRIDE;
+ bool isInitialized() const Q_DECL_OVERRIDE;
+
+ QWidget *createWidget(QWidget *parent) Q_DECL_OVERRIDE;
+
+ QString name() const Q_DECL_OVERRIDE;
+ QString group() const Q_DECL_OVERRIDE;
+ QIcon icon() const Q_DECL_OVERRIDE;
+ QString toolTip() const Q_DECL_OVERRIDE;
+ QString whatsThis() const Q_DECL_OVERRIDE;
+ bool isContainer() const Q_DECL_OVERRIDE;
+
+ QString domXml() const Q_DECL_OVERRIDE;
+
+ QString includeFile() const Q_DECL_OVERRIDE;
+
+private:
+ bool initialized;
+};
+
+
+#endif // COLOR_WIDGETS_GRADIENT_EDITOR_PLUGIN_HPP
+
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/gradient_slider_plugin.cpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/gradient_slider_plugin.cpp
new file mode 100644
index 00000000..82e43571
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/gradient_slider_plugin.cpp
@@ -0,0 +1,102 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "gradient_slider_plugin.hpp"
+#include "QtColorWidgets/gradient_slider.hpp"
+#include
+
+GradientSlider_Plugin::GradientSlider_Plugin(QObject *parent)
+ : QObject(parent), initialized(false)
+{
+}
+
+
+void GradientSlider_Plugin::initialize(QDesignerFormEditorInterface *)
+{
+ if (initialized)
+ return;
+
+ initialized = true;
+}
+
+bool GradientSlider_Plugin::isInitialized() const
+{
+ return initialized;
+}
+
+QWidget *GradientSlider_Plugin::createWidget(QWidget *parent)
+{
+ return new color_widgets::GradientSlider(parent);
+}
+
+QString GradientSlider_Plugin::name() const
+{
+ return "color_widgets::GradientSlider";
+}
+
+QString GradientSlider_Plugin::group() const
+{
+ return "Color Widgets";
+}
+
+QIcon GradientSlider_Plugin::icon() const
+{
+ color_widgets::GradientSlider w;
+ w.resize(64,16);
+ QVector cols;
+ cols.push_back(Qt::green);
+ cols.push_back(Qt::yellow);
+ cols.push_back(Qt::red);
+ w.setColors(cols);
+ QPixmap pix(64,64);
+ pix.fill(Qt::transparent);
+ w.render(&pix,QPoint(0,16));
+ return QIcon(pix);
+}
+
+QString GradientSlider_Plugin::toolTip() const
+{
+ return "Slider over a gradient";
+}
+
+QString GradientSlider_Plugin::whatsThis() const
+{
+ return toolTip();
+}
+
+bool GradientSlider_Plugin::isContainer() const
+{
+ return false;
+}
+
+QString GradientSlider_Plugin::domXml() const
+{
+
+ return "\n"
+ " \n"
+ " \n"
+ " \n";
+}
+
+QString GradientSlider_Plugin::includeFile() const
+{
+ return "QtColorWidgets/gradient_slider.hpp";
+}
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/gradient_slider_plugin.hpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/gradient_slider_plugin.hpp
new file mode 100644
index 00000000..5d98035c
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/gradient_slider_plugin.hpp
@@ -0,0 +1,34 @@
+#ifndef GRADIENT_SLIDER_PLUGIN_HPP
+#define GRADIENT_SLIDER_PLUGIN_HPP
+
+#include
+
+class GradientSlider_Plugin : public QObject, public QDesignerCustomWidgetInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+ GradientSlider_Plugin(QObject *parent = 0);
+
+ void initialize(QDesignerFormEditorInterface *core);
+ bool isInitialized() const;
+
+ QWidget *createWidget(QWidget *parent);
+
+ QString name() const;
+ QString group() const;
+ QIcon icon() const;
+ QString toolTip() const;
+ QString whatsThis() const;
+ bool isContainer() const;
+
+ QString domXml() const;
+
+ QString includeFile() const;
+
+private:
+ bool initialized;
+};
+
+#endif // GRADIENT_SLIDER_PLUGIN_HPP
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/hue_slider_plugin.cpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/hue_slider_plugin.cpp
new file mode 100644
index 00000000..27cd6c6a
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/hue_slider_plugin.cpp
@@ -0,0 +1,98 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ * \copyright Copyright (C) 2014 Calle Laakkonen
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "hue_slider_plugin.hpp"
+#include "QtColorWidgets/hue_slider.hpp"
+#include
+
+HueSlider_Plugin::HueSlider_Plugin(QObject *parent)
+ : QObject(parent), initialized(false)
+{
+}
+
+
+void HueSlider_Plugin::initialize(QDesignerFormEditorInterface *)
+{
+ if (initialized)
+ return;
+
+ initialized = true;
+}
+
+bool HueSlider_Plugin::isInitialized() const
+{
+ return initialized;
+}
+
+QWidget *HueSlider_Plugin::createWidget(QWidget *parent)
+{
+ return new color_widgets::HueSlider(parent);
+}
+
+QString HueSlider_Plugin::name() const
+{
+ return "color_widgets::HueSlider";
+}
+
+QString HueSlider_Plugin::group() const
+{
+ return "Color Widgets";
+}
+
+QIcon HueSlider_Plugin::icon() const
+{
+ color_widgets::HueSlider w;
+ w.resize(64,16);
+ QPixmap pix(64,64);
+ pix.fill(Qt::transparent);
+ w.render(&pix,QPoint(0,16));
+ return QIcon(pix);
+}
+
+QString HueSlider_Plugin::toolTip() const
+{
+ return "Slider over a hue gradient";
+}
+
+QString HueSlider_Plugin::whatsThis() const
+{
+ return toolTip();
+}
+
+bool HueSlider_Plugin::isContainer() const
+{
+ return false;
+}
+
+QString HueSlider_Plugin::domXml() const
+{
+
+ return "\n"
+ " \n"
+ " \n"
+ " \n";
+}
+
+QString HueSlider_Plugin::includeFile() const
+{
+ return "QtColorWidgets/hue_slider.hpp";
+}
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/hue_slider_plugin.hpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/hue_slider_plugin.hpp
new file mode 100644
index 00000000..78f08ce8
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/hue_slider_plugin.hpp
@@ -0,0 +1,34 @@
+#ifndef HUE_SLIDER_PLUGIN_HPP
+#define HUE_SLIDER_PLUGIN_HPP
+
+#include
+
+class HueSlider_Plugin : public QObject, public QDesignerCustomWidgetInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+ HueSlider_Plugin(QObject *parent = 0);
+
+ void initialize(QDesignerFormEditorInterface *core);
+ bool isInitialized() const;
+
+ QWidget *createWidget(QWidget *parent);
+
+ QString name() const;
+ QString group() const;
+ QIcon icon() const;
+ QString toolTip() const;
+ QString whatsThis() const;
+ bool isContainer() const;
+
+ QString domXml() const;
+
+ QString includeFile() const;
+
+private:
+ bool initialized;
+};
+
+#endif // HUE_SLIDER_PLUGIN_HPP
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/new_plugin b/external/Qt-Color-Widgets/color_widgets_designer_plugin/new_plugin
new file mode 100755
index 00000000..285d8062
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/new_plugin
@@ -0,0 +1,236 @@
+#!/bin/bash
+#
+# Copyright (C) 2013-2020 Mattia Basaglia
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see .
+
+SELFDIR=$(dirname $(readlink -se "${BASH_SOURCE[0]}"))
+
+function class_to_underscore()
+{
+ echo "$1" | sed -r -e 's/([a-z])([A-Z])/\1_\L\2/g' -e 's/[A-Z]/\L\0/g'
+}
+
+function class_to_header()
+{
+ echo "$(class_to_underscore "$1").hpp"
+}
+
+function header_to_source()
+{
+ echo "$1" | sed -r -e 's/\.h(pp)?$/.cpp/i'
+}
+
+function read_arg()
+{
+ varname=$1
+ prompt="$2"
+ default="$3"
+ [ "$default" ] && prompt="${prompt} [$default]"
+ read -p "$prompt: " -i "$default" $varname
+ [ -z "${!varname}" ] && eval "$varname=\"$default\""
+}
+
+function header_to_guard()
+{
+ echo "$1" | tr [:lower:] [:upper:] | tr /. _
+}
+
+read_arg class "Class name"
+[ -z "$class" ] && exit 1
+read_arg description "Description"
+read_arg header "Header" "$(class_to_header "$class")"
+
+read_arg plugin "Plugin Class" "${class}_Plugin"
+read_arg plugin_header "Plugin Header" "$(class_to_header "$plugin")"
+read_arg plugin_source "Plugin Source" "$(header_to_source "$plugin_header")"
+read_arg plugin_path "Plugin Path" "$SELFDIR"
+read_arg plugin_author "Author" "$(git config user.name)"
+read_arg plugin_copyright "Copyright" "2013-$(date +%Y) $plugin_author"
+
+echo "Summary:"
+echo " Class: $class"
+echo " Description: $description"
+echo " Header: $header"
+echo " Plugin Class: $plugin"
+echo " Plugin Header: $plugin_header"
+echo " Plugin Source: $plugin_source"
+echo " Plugin Path: $plugin_path"
+echo " Author: $plugin_author"
+echo " Copyright: $plugin_copyright"
+
+object_name="$(class_to_underscore $class)"
+
+cat >"$plugin_path/$plugin_source" < .
+ *
+ */
+#include "$plugin_header"
+#include "QtColorWidgets/$header"
+
+QWidget* $plugin::createWidget(QWidget *parent)
+{
+ color_widgets::$class *widget = new color_widgets::$class(parent);
+ return widget;
+}
+
+QIcon $plugin::icon() const
+{
+ return QIcon();
+}
+
+QString $plugin::domXml() const
+{
+ return "\n"
+ " \n"
+ " \n"
+ " \n";
+}
+
+bool $plugin::isContainer() const
+{
+ return false;
+}
+
+$plugin::$plugin(QObject *parent) :
+ QObject(parent), initialized(false)
+{
+}
+
+void $plugin::initialize(QDesignerFormEditorInterface *)
+{
+ initialized = true;
+}
+
+bool $plugin::isInitialized() const
+{
+ return initialized;
+}
+
+QString $plugin::name() const
+{
+ return "color_widgets::$class";
+}
+
+QString $plugin::group() const
+{
+ return "Color Widgets";
+}
+
+QString $plugin::toolTip() const
+{
+ return "$description";
+}
+
+QString $plugin::whatsThis() const
+{
+ return toolTip();
+}
+
+QString $plugin::includeFile() const
+{
+ return "QtColorWidgets/$header";
+}
+
+PLUGIN
+
+header_guard="COLOR_WIDGETS_$(header_to_guard "$plugin_header")"
+cat >"$plugin_path/$plugin_header" < .
+ *
+ */
+#ifndef $header_guard
+#define $header_guard
+
+#include
+#include
+
+class $plugin : public QObject, public QDesignerCustomWidgetInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+ explicit $plugin(QObject *parent = nullptr);
+
+ void initialize(QDesignerFormEditorInterface *core) Q_DECL_OVERRIDE;
+ bool isInitialized() const Q_DECL_OVERRIDE;
+
+ QWidget *createWidget(QWidget *parent) Q_DECL_OVERRIDE;
+
+ QString name() const Q_DECL_OVERRIDE;
+ QString group() const Q_DECL_OVERRIDE;
+ QIcon icon() const Q_DECL_OVERRIDE;
+ QString toolTip() const Q_DECL_OVERRIDE;
+ QString whatsThis() const Q_DECL_OVERRIDE;
+ bool isContainer() const Q_DECL_OVERRIDE;
+
+ QString domXml() const Q_DECL_OVERRIDE;
+
+ QString includeFile() const Q_DECL_OVERRIDE;
+
+private:
+ bool initialized;
+};
+
+
+#endif // $header_guard
+
+PLUGIN
+
+sed -i -r \
+ -e "\\~# add new sources above this line~i\\$plugin_source" \
+ -e "\\~# add new headers above this line~i\\$plugin_header" \
+ "$plugin_path/CMakeLists.txt"
+
+sed -i -r \
+ -e "\\~// add new plugin headers above this line~i#include \"$plugin_header\"" \
+ -e "\\~// add new plugins above this line~i\ widgets.push_back(new $plugin(this));" \
+ "$plugin_path/color_widget_plugin_collection.cpp"
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/swatch_plugin.cpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/swatch_plugin.cpp
new file mode 100644
index 00000000..3c9b465a
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/swatch_plugin.cpp
@@ -0,0 +1,106 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "swatch_plugin.hpp"
+#include "QtColorWidgets/swatch.hpp"
+
+Swatch_Plugin::Swatch_Plugin(QObject *parent) :
+ QObject(parent), initialized(false)
+{
+}
+
+void Swatch_Plugin::initialize(QDesignerFormEditorInterface *)
+{
+ initialized = true;
+}
+
+bool Swatch_Plugin::isInitialized() const
+{
+ return initialized;
+}
+
+QWidget* Swatch_Plugin::createWidget(QWidget *parent)
+{
+ color_widgets::Swatch *wid = new color_widgets::Swatch(parent);
+ wid->palette().setColumns(12);
+ for ( int i = 0; i < 6; i++ )
+ {
+ for ( int j = 0; j < wid->palette().columns(); j++ )
+ {
+ float f = float(j)/wid->palette().columns();
+ wid->palette().appendColor(QColor::fromHsvF(i/8.0,1-f,0.5+f/2));
+ }
+ }
+ return wid;
+}
+
+QString Swatch_Plugin::name() const
+{
+ return "color_widgets::Swatch";
+}
+
+QString Swatch_Plugin::group() const
+{
+ return "Color Widgets";
+}
+
+QIcon Swatch_Plugin::icon() const
+{
+ color_widgets::ColorPalette w;
+ w.setColumns(6);
+ for ( int i = 0; i < 4; i++ )
+ {
+ for ( int j = 0; j < w.columns(); j++ )
+ {
+ float f = float(j)/w.columns();
+ w.appendColor(QColor::fromHsvF(i/5.0,1-f,0.5+f/2));
+ }
+ }
+ return QIcon(w.preview(QSize(64,64)));
+}
+
+QString Swatch_Plugin::toolTip() const
+{
+ return "A widget that displays a color palette";
+}
+
+QString Swatch_Plugin::whatsThis() const
+{
+ return toolTip();
+}
+
+bool Swatch_Plugin::isContainer() const
+{
+ return false;
+}
+
+QString Swatch_Plugin::domXml() const
+{
+ return "\n"
+ " \n"
+ " \n"
+ " \n";
+}
+
+QString Swatch_Plugin::includeFile() const
+{
+ return "QtColorWidgets/swatch.hpp";
+}
diff --git a/external/Qt-Color-Widgets/color_widgets_designer_plugin/swatch_plugin.hpp b/external/Qt-Color-Widgets/color_widgets_designer_plugin/swatch_plugin.hpp
new file mode 100644
index 00000000..4670c60d
--- /dev/null
+++ b/external/Qt-Color-Widgets/color_widgets_designer_plugin/swatch_plugin.hpp
@@ -0,0 +1,57 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_WIDGETS_SWATCH_PLUGIN_HPP
+#define COLOR_WIDGETS_SWATCH_PLUGIN_HPP
+
+#include
+#include
+
+class Swatch_Plugin : public QObject, public QDesignerCustomWidgetInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+ Swatch_Plugin(QObject *parent = 0);
+
+ void initialize(QDesignerFormEditorInterface *core);
+ bool isInitialized() const;
+
+ QWidget *createWidget(QWidget *parent);
+
+ QString name() const;
+ QString group() const;
+ QIcon icon() const;
+ QString toolTip() const;
+ QString whatsThis() const;
+ bool isContainer() const;
+
+ QString domXml() const;
+
+ QString includeFile() const;
+
+private:
+ bool initialized;
+};
+
+
+#endif // COLOR_WIDGETS_SWATCH_PLUGIN_HPP
diff --git a/external/Qt-Color-Widgets/gallery/CMakeLists.txt b/external/Qt-Color-Widgets/gallery/CMakeLists.txt
new file mode 100644
index 00000000..446b7dff
--- /dev/null
+++ b/external/Qt-Color-Widgets/gallery/CMakeLists.txt
@@ -0,0 +1,35 @@
+#
+# Copyright (C) 2013-2020 Mattia Basaglia
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see .
+set (QT_SUPPORTED_VERSIONS 5)
+
+
+set(SCREENSHOT_SOURCES screenshot.cpp)
+set(SCREENSHOT_BINARY screenshot_bin)
+
+add_executable(${SCREENSHOT_BINARY} EXCLUDE_FROM_ALL ${SCREENSHOT_SOURCES})
+
+target_link_libraries(
+ ${SCREENSHOT_BINARY}
+ PRIVATE
+ ${COLOR_WIDGETS_LIBRARY}
+ Qt${QT_VERSION_MAJOR}::Widgets
+)
+
+add_custom_target(gallery
+ COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${SCREENSHOT_BINARY}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ DEPENDS ${SCREENSHOT_BINARY}
+)
diff --git a/external/Qt-Color-Widgets/gallery/Color2DSlider.png b/external/Qt-Color-Widgets/gallery/Color2DSlider.png
new file mode 100644
index 00000000..caed3b2b
Binary files /dev/null and b/external/Qt-Color-Widgets/gallery/Color2DSlider.png differ
diff --git a/external/Qt-Color-Widgets/gallery/ColorDialog.png b/external/Qt-Color-Widgets/gallery/ColorDialog.png
new file mode 100644
index 00000000..b28de516
Binary files /dev/null and b/external/Qt-Color-Widgets/gallery/ColorDialog.png differ
diff --git a/external/Qt-Color-Widgets/gallery/ColorLineEdit.png b/external/Qt-Color-Widgets/gallery/ColorLineEdit.png
new file mode 100644
index 00000000..13439a85
Binary files /dev/null and b/external/Qt-Color-Widgets/gallery/ColorLineEdit.png differ
diff --git a/external/Qt-Color-Widgets/gallery/ColorLineEdit_with_color.png b/external/Qt-Color-Widgets/gallery/ColorLineEdit_with_color.png
new file mode 100644
index 00000000..052b0418
Binary files /dev/null and b/external/Qt-Color-Widgets/gallery/ColorLineEdit_with_color.png differ
diff --git a/external/Qt-Color-Widgets/gallery/ColorListWidget.png b/external/Qt-Color-Widgets/gallery/ColorListWidget.png
new file mode 100644
index 00000000..9f43dc70
Binary files /dev/null and b/external/Qt-Color-Widgets/gallery/ColorListWidget.png differ
diff --git a/external/Qt-Color-Widgets/gallery/ColorPaletteWidget.png b/external/Qt-Color-Widgets/gallery/ColorPaletteWidget.png
new file mode 100644
index 00000000..c9a06b3c
Binary files /dev/null and b/external/Qt-Color-Widgets/gallery/ColorPaletteWidget.png differ
diff --git a/external/Qt-Color-Widgets/gallery/ColorPaletteWidget_readonly.png b/external/Qt-Color-Widgets/gallery/ColorPaletteWidget_readonly.png
new file mode 100644
index 00000000..659e7ea8
Binary files /dev/null and b/external/Qt-Color-Widgets/gallery/ColorPaletteWidget_readonly.png differ
diff --git a/external/Qt-Color-Widgets/gallery/ColorPreview.png b/external/Qt-Color-Widgets/gallery/ColorPreview.png
new file mode 100644
index 00000000..0751b3f8
Binary files /dev/null and b/external/Qt-Color-Widgets/gallery/ColorPreview.png differ
diff --git a/external/Qt-Color-Widgets/gallery/ColorWheel.png b/external/Qt-Color-Widgets/gallery/ColorWheel.png
new file mode 100644
index 00000000..49212fc0
Binary files /dev/null and b/external/Qt-Color-Widgets/gallery/ColorWheel.png differ
diff --git a/external/Qt-Color-Widgets/gallery/GradientEditor.png b/external/Qt-Color-Widgets/gallery/GradientEditor.png
new file mode 100644
index 00000000..9a920749
Binary files /dev/null and b/external/Qt-Color-Widgets/gallery/GradientEditor.png differ
diff --git a/external/Qt-Color-Widgets/gallery/GradientListModel_combo.png b/external/Qt-Color-Widgets/gallery/GradientListModel_combo.png
new file mode 100644
index 00000000..417aeb7a
Binary files /dev/null and b/external/Qt-Color-Widgets/gallery/GradientListModel_combo.png differ
diff --git a/external/Qt-Color-Widgets/gallery/GradientListModel_view.png b/external/Qt-Color-Widgets/gallery/GradientListModel_view.png
new file mode 100644
index 00000000..2da2c3ac
Binary files /dev/null and b/external/Qt-Color-Widgets/gallery/GradientListModel_view.png differ
diff --git a/external/Qt-Color-Widgets/gallery/HueSlider.png b/external/Qt-Color-Widgets/gallery/HueSlider.png
new file mode 100644
index 00000000..58261670
Binary files /dev/null and b/external/Qt-Color-Widgets/gallery/HueSlider.png differ
diff --git a/external/Qt-Color-Widgets/gallery/README.md b/external/Qt-Color-Widgets/gallery/README.md
new file mode 100644
index 00000000..6c3c2576
--- /dev/null
+++ b/external/Qt-Color-Widgets/gallery/README.md
@@ -0,0 +1,91 @@
+Color Widgets Gallery
+=====================
+
+Color2DSlider
+-------------
+
+
+This widget allow the user to select 2 HSV color components at the same time,
+by default that is Saturation and Value but they can be changed.
+
+ColorDialog
+-----------
+
+
+This is a dialog analogous to QColorDialog but with a much nicer and friendlier
+user interface. It uses several of the other widgets.
+
+ColorLineEdit
+-------------
+
+
+
+This is a QLineEdit intended to be used to edit and display color names.
+It accepts several string formats:
+* #f00 (3 hexadecimal rgb digits)
+* #ff0000 (6 hexadecimal rgb digits)
+* rgb(255,0,0) (function-like)
+* red (color name)
+
+It can optionally display the color it represents on its background.
+
+ColorListWidget
+---------------
+
+
+It allows to display and edit a list of colors.
+
+ColorPaletteWidget and Swatch
+-----------------------------
+These widgets handle color palettes.
+
+
+
+**Swatch** only handles a single palette, can be used to just select colors from the
+palette or to modify the palette via drag and drop operations.
+
+**ColorPaletteModel** is a list model that represents palettes with can be used
+with the Qt item view widgets, it provides a name and a preview icon for
+each of the stored palettes.
+It also has functionality to load and save palettes from the filesystem.
+
+
+
+
+**ColorPaletteWidget** manages a list of palettes (via **ColorPaletteModel**).
+Has two modes: read-only only allows to select palettes and colors,
+otherwise it can be used to modify the list of palettes and the palette itself.
+
+ColorPreview and ColorSelector
+------------------------------
+
+
+**ColorPreview** is a widget that displays a color or compares two colors.
+
+**ColorSelector** is like **ColorPreview** but when clicked it shows a ColorDialog.
+
+GradientSlider and HueSlider
+----------------------------
+
+
+**GradientSlider** is a QSlider which uses a gradient as its background.
+
+**HueSlider** is specifically made to select a hue and has more information
+about the represented color.
+
+
+GradientEditor
+--------------
+
+
+**GradientEditor** is similar in appearance to **GradientSlider** but it's for editing the gradient.
+
+
+GradientListModel and GradientDelegate
+--------------------------------------
+
+
+
+**GradientListModel** is a QAbstractListModel used to list gradients (useful for combo boxes, item views and the like).
+
+**GradientDelegate** is an item delegate to edit gradients in an item view.
diff --git a/external/Qt-Color-Widgets/gallery/Swatch.png b/external/Qt-Color-Widgets/gallery/Swatch.png
new file mode 100644
index 00000000..68e8d4fd
Binary files /dev/null and b/external/Qt-Color-Widgets/gallery/Swatch.png differ
diff --git a/external/Qt-Color-Widgets/gallery/screenshot.cpp b/external/Qt-Color-Widgets/gallery/screenshot.cpp
new file mode 100644
index 00000000..723294ed
--- /dev/null
+++ b/external/Qt-Color-Widgets/gallery/screenshot.cpp
@@ -0,0 +1,222 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include "QtColorWidgets/color_2d_slider.hpp"
+#include "QtColorWidgets/color_delegate.hpp" /// \todo show it
+#include "QtColorWidgets/color_dialog.hpp"
+#include "QtColorWidgets/color_line_edit.hpp"
+#include "QtColorWidgets/color_list_widget.hpp"
+#include "QtColorWidgets/color_palette_widget.hpp"
+#include "QtColorWidgets/color_preview.hpp"
+#include "QtColorWidgets/color_wheel.hpp"
+#include "QtColorWidgets/harmony_color_wheel.hpp"
+#include "QtColorWidgets/hue_slider.hpp"
+#include "QtColorWidgets/gradient_editor.hpp"
+#include "QtColorWidgets/gradient_list_model.hpp"
+#include "QtColorWidgets/gradient_delegate.hpp"
+
+bool run = false;
+QStringList just_these;
+
+void screenshot(QWidget& widget, QString name = QString())
+{
+ if ( name.isEmpty() )
+ {
+ name = widget.metaObject()->className();
+ name.remove("color_widgets::");
+ }
+ if ( !just_these.isEmpty() && !just_these.contains(name) )
+ return;
+
+ widget.setWindowTitle(name);
+ QPixmap pic(widget.size());
+ widget.render(&pic);
+ name += ".png";
+ pic.save(name);
+ if ( run )
+ widget.show();
+}
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+ QCommandLineParser parser;
+ parser.addHelpOption();
+ parser.addPositionalArgument("just_these", "Only these widgets");
+ QCommandLineOption run_option("run", "Show widgets instead of saving to file");
+ parser.addOption(run_option);
+
+ parser.process(a);
+ run = parser.isSet(run_option);
+ just_these = parser.positionalArguments();
+
+ QColor demo_color(64,172,143,128);
+
+ color_widgets::ColorPalette palette1;
+ color_widgets::ColorPalette palette2;
+ color_widgets::ColorPalette palette3;
+ int palette_columns = 12;
+ palette1.setName("Palette 1");
+ palette2.setName("Palette 2");
+ palette3.setName("Palette 3");
+ palette1.setColumns(palette_columns);
+ palette2.setColumns(palette_columns);
+ for ( int i = 0; i < 6; i++ )
+ {
+ for ( int j = 0; j < palette_columns; j++ )
+ {
+ float f = float(j)/palette_columns;
+ palette1.appendColor(QColor::fromHsvF(i/8.0,1-f,0.5+f/2));
+ palette2.appendColor(QColor::fromHsvF(i/8.0,1-f,1-f));
+ }
+
+ palette3.appendColor(QColor::fromHsvF(i/8.0, 0.8, 1));
+ }
+ color_widgets::ColorPaletteModel palette_model;
+ palette_model.addPalette(palette1, false);
+ palette_model.addPalette(palette2, false);
+ palette_model.addPalette(palette3, false);
+
+
+
+ color_widgets::ColorPreview preview;
+ preview.setColor(demo_color);
+ preview.setDisplayMode(color_widgets::ColorPreview::SplitAlpha);
+ preview.resize(128,32);
+ screenshot(preview);
+
+ color_widgets::ColorDialog dialog;
+ dialog.setColorSpace(color_widgets::ColorWheel::ColorLCH);
+ dialog.setColor(demo_color);
+ screenshot(dialog);
+
+ color_widgets::Color2DSlider slider2d;
+ slider2d.setColor(demo_color);
+ slider2d.resize(128,192);
+ screenshot(slider2d);
+
+ color_widgets::ColorLineEdit line_edit;
+ line_edit.setColor(demo_color);
+ line_edit.resize(line_edit.sizeHint());
+ screenshot(line_edit);
+ line_edit.setPreviewColor(true);
+ screenshot(line_edit, "ColorLineEdit_with_color");
+
+ color_widgets::ColorWheel wheel;
+ wheel.resize(256, 256);
+ wheel.setColor(demo_color);
+ screenshot(wheel);
+
+ color_widgets::HarmonyColorWheel harwheel;
+ harwheel.resize(256, 256);
+ harwheel.setColor(demo_color);
+ harwheel.addHarmony(.333, true);
+ harwheel.addHarmony(.667, true);
+ screenshot(harwheel);
+
+ color_widgets::Swatch swatch;
+ swatch.setPalette(palette1);
+ swatch.resize(swatch.sizeHint());
+ screenshot(swatch);
+
+ color_widgets::ColorPaletteWidget palette_widget;
+ palette_widget.setModel(&palette_model);
+ screenshot(palette_widget);
+
+ color_widgets::ColorPaletteWidget palette_widget1;
+ palette_widget1.setModel(&palette_model);
+ palette_widget1.setReadOnly(true);
+ screenshot(palette_widget1, "ColorPaletteWidget_readonly");
+
+ color_widgets::HueSlider hue_slider;
+ hue_slider.setColor(demo_color);
+ hue_slider.resize(192, hue_slider.sizeHint().height());
+// hue_slider.setInvertedAppearance(true);
+// hue_slider.setOrientation(Qt::Vertical);
+ screenshot(hue_slider);
+
+ color_widgets::ColorListWidget list_widget;
+ list_widget.setColors({
+ demo_color,
+ palette1.colorAt(palette_columns*0),
+ palette1.colorAt(palette_columns*1),
+ palette1.colorAt(palette_columns*3),
+ palette1.colorAt(palette_columns*5),
+ });
+ list_widget.resize(list_widget.sizeHint());
+ screenshot(list_widget);
+
+ color_widgets::GradientEditor editor;
+ QGradientStops gradient_colors;
+ float n_colors = 4;
+ for ( int i = 0; i <= n_colors; ++i )
+ gradient_colors.append(QGradientStop(i/n_colors, QColor::fromHsvF(i/n_colors, 0.5, 1)));
+ editor.setStops(gradient_colors);
+ screenshot(editor);
+
+ QComboBox gradient_list;
+ color_widgets::GradientListModel gradient_model;
+ gradient_model.setGradient("Rainbow", gradient_colors);
+ gradient_model.setGradient("Black to Transparent", QGradientStops{{0, Qt::black}, {1, QColor(0, 0, 0, 0)}});
+ gradient_list.setModel(&gradient_model);
+ gradient_model.setIconSize(QSize(128, 24));
+ gradient_list.setIconSize(gradient_model.iconSize());
+ QObject::connect(&editor, &color_widgets::GradientEditor::stopsChanged, &gradient_model,
+ [&gradient_model](const QGradientStops& stops){ gradient_model.setGradient("Rainbow", stops); });
+ gradient_list.resize(gradient_list.sizeHint());
+ screenshot(gradient_list, "GradientListModel_combo");
+
+ QListView gradient_view;
+ color_widgets::GradientDelegate gradient_delegate;
+ gradient_view.setItemDelegate(&gradient_delegate);
+ gradient_view.setModel(&gradient_model);
+// gradient_model.setEditMode(color_widgets::GradientListModel::EditName);
+ gradient_model.setEditMode(color_widgets::GradientListModel::EditGradient);
+ gradient_view.resize(QSize(gradient_view.sizeHintForColumn(0) + 4, gradient_view.sizeHint().height()));
+ screenshot(gradient_view, "GradientListModel_view");
+
+ QTableWidget gradient_table;
+ gradient_table.setItemDelegate(&gradient_delegate);
+ gradient_table.setRowCount(2);
+ gradient_table.setColumnCount(2);
+ gradient_table.setItem(0, 0, new QTableWidgetItem());
+ gradient_table.item(0, 0)->setData(Qt::EditRole, QVariant::fromValue(gradient_model.gradientBrush(0)));
+ gradient_table.setItem(0, 1, new QTableWidgetItem(gradient_model.nameFromIndex(0)));
+ gradient_table.setItem(1, 0, new QTableWidgetItem());
+ gradient_table.item(1, 0)->setData(Qt::EditRole, QVariant::fromValue(gradient_model.gradientBrush(1)));
+ gradient_table.setItem(1, 1, new QTableWidgetItem(gradient_model.nameFromIndex(1)));
+ screenshot(gradient_table, "GradientDelegate_table");
+
+ if ( run )
+ return a.exec();
+
+ return 0;
+}
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/AbstractWidgetList b/external/Qt-Color-Widgets/include/QtColorWidgets/AbstractWidgetList
new file mode 100644
index 00000000..32d4d0e6
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/AbstractWidgetList
@@ -0,0 +1 @@
+#include "abstract_widget_list.hpp"
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/BoundColorSelector b/external/Qt-Color-Widgets/include/QtColorWidgets/BoundColorSelector
new file mode 100644
index 00000000..bd4d6514
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/BoundColorSelector
@@ -0,0 +1 @@
+#include "bound_color_selector.hpp"
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/CMakeLists.txt b/external/Qt-Color-Widgets/include/QtColorWidgets/CMakeLists.txt
new file mode 100644
index 00000000..e182d44c
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/CMakeLists.txt
@@ -0,0 +1,37 @@
+set (HEADERS
+abstract_widget_list.hpp
+bound_color_selector.hpp
+color_2d_slider.hpp
+color_delegate.hpp
+color_dialog.hpp
+color_line_edit.hpp
+color_list_widget.hpp
+color_names.hpp
+color_palette.hpp
+color_palette_model.hpp
+color_palette_widget.hpp
+color_preview.hpp
+color_selector.hpp
+color_wheel.hpp
+colorwidgets_global.hpp
+gradient_slider.hpp
+hue_slider.hpp
+swatch.hpp
+gradient_editor.hpp
+harmony_color_wheel.hpp
+gradient_list_model.hpp
+gradient_delegate.hpp
+)
+
+file(RELATIVE_PATH
+ PREFIX
+ ${PROJECT_SOURCE_DIR}
+ ${CMAKE_CURRENT_LIST_DIR})
+
+
+foreach (HEADER IN LISTS HEADERS)
+ target_sources (${TARGET_NAME}
+ PRIVATE
+ $
+ $)
+endforeach (HEADER IN HEADERS)
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/ColorDelegate b/external/Qt-Color-Widgets/include/QtColorWidgets/ColorDelegate
new file mode 100644
index 00000000..0068a341
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/ColorDelegate
@@ -0,0 +1 @@
+#include "color_delegate.hpp"
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/ColorDialog b/external/Qt-Color-Widgets/include/QtColorWidgets/ColorDialog
new file mode 100644
index 00000000..ffaa02b9
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/ColorDialog
@@ -0,0 +1 @@
+#include "color_dialog.hpp"
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/ColorListWidget b/external/Qt-Color-Widgets/include/QtColorWidgets/ColorListWidget
new file mode 100644
index 00000000..e0d281b4
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/ColorListWidget
@@ -0,0 +1 @@
+#include "color_list_widget.hpp"
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/ColorPreview b/external/Qt-Color-Widgets/include/QtColorWidgets/ColorPreview
new file mode 100644
index 00000000..bfd4165e
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/ColorPreview
@@ -0,0 +1 @@
+#include "color_preview.hpp"
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/ColorSelector b/external/Qt-Color-Widgets/include/QtColorWidgets/ColorSelector
new file mode 100644
index 00000000..9b09fc8a
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/ColorSelector
@@ -0,0 +1 @@
+#include "color_selector.hpp"
diff --git a/external/Qt-Color-Widgets/include/ColorWheel b/external/Qt-Color-Widgets/include/QtColorWidgets/ColorWheel
similarity index 100%
rename from external/Qt-Color-Widgets/include/ColorWheel
rename to external/Qt-Color-Widgets/include/QtColorWidgets/ColorWheel
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/GradientEditor b/external/Qt-Color-Widgets/include/QtColorWidgets/GradientEditor
new file mode 100644
index 00000000..b90265eb
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/GradientEditor
@@ -0,0 +1 @@
+#include "gradient_editor.hpp"
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/GradientListModel b/external/Qt-Color-Widgets/include/QtColorWidgets/GradientListModel
new file mode 100644
index 00000000..b6a5ef7b
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/GradientListModel
@@ -0,0 +1 @@
+#include "gradient_list_model.hpp"
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/GradientSlider b/external/Qt-Color-Widgets/include/QtColorWidgets/GradientSlider
new file mode 100644
index 00000000..b8035fda
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/GradientSlider
@@ -0,0 +1 @@
+#include "gradient_slider.hpp"
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/HarmonyColorWheel b/external/Qt-Color-Widgets/include/QtColorWidgets/HarmonyColorWheel
new file mode 100644
index 00000000..693e6478
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/HarmonyColorWheel
@@ -0,0 +1 @@
+#include "harmony_color_wheel.hpp"
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/HueSlider b/external/Qt-Color-Widgets/include/QtColorWidgets/HueSlider
new file mode 100644
index 00000000..df6786e3
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/HueSlider
@@ -0,0 +1 @@
+#include "hue_slider.hpp"
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/abstract_widget_list.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/abstract_widget_list.hpp
new file mode 100644
index 00000000..cd8d6f88
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/abstract_widget_list.hpp
@@ -0,0 +1,110 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef ABSTRACT_WIDGET_LIST_HPP
+#define ABSTRACT_WIDGET_LIST_HPP
+
+#include "colorwidgets_global.hpp"
+
+#include
+#include
+
+class QCP_EXPORT AbstractWidgetList : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit AbstractWidgetList(QWidget *parent = 0);
+ ~AbstractWidgetList();
+
+ /**
+ * \brief Get the number of items
+ */
+ int count() const;
+
+ /**
+ * \brief Swap row a and row b
+ */
+ virtual void swap(int a, int b) = 0;
+
+
+ /// Whether the given row index is valid
+ bool isValidRow(int i) const { return i >= 0 && i < count(); }
+
+ void setRowHeight(int row, int height);
+
+
+public Q_SLOTS:
+ /**
+ * \brief Remove row i
+ */
+ void remove(int i);
+
+ /**
+ * \brief append a default row
+ */
+ virtual void append() = 0;
+
+Q_SIGNALS:
+ void removed(int i);
+
+protected:
+
+ /**
+ * \brief Create a new row with the given widget
+ *
+ * Must be caled by implementations of append()
+ */
+ void appendWidget(QWidget* w);
+
+ /**
+ * \brief get the widget found at the given row
+ */
+ QWidget* widget(int i);
+
+
+ /**
+ * \brief get the widget found at the given row
+ */
+ template
+ T* widget_cast(int i) { return qobject_cast(widget(i)); }
+
+ /**
+ * \brief clear all rows without emitting signals
+ *
+ * May be useful when implementation want to set all values at once
+ */
+ void clear();
+
+private Q_SLOTS:
+ void remove_clicked(QWidget* w);
+ void up_clicked(QWidget* w);
+ void down_clicked(QWidget* w);
+
+private:
+ class Private;
+ Private * const p;
+
+ QWidget* create_button(QWidget* data, QSignalMapper*mapper,
+ QString icon_name, QString text,
+ QString tooltip = QString()) const;
+};
+
+#endif // ABSTRACT_WIDGET_LIST_HPP
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/bound_color_selector.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/bound_color_selector.hpp
new file mode 100644
index 00000000..5d782939
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/bound_color_selector.hpp
@@ -0,0 +1,44 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef BOUND_COLOR_SELECTOR_HPP
+#define BOUND_COLOR_SELECTOR_HPP
+
+#include "color_selector.hpp"
+
+namespace color_widgets {
+/**
+ * \brief A color selector bound to a color reference
+ * \todo Maybe this can be removed
+ */
+class QCP_EXPORT BoundColorSelector : public ColorSelector
+{
+ Q_OBJECT
+private:
+ QColor* ref;
+public:
+ explicit BoundColorSelector(QColor* reference, QWidget *parent = 0);
+
+private Q_SLOTS:
+ void update_reference(QColor);
+};
+} // namespace color_widgets
+#endif // BOUND_COLOR_SELECTOR_HPP
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/color_2d_slider.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/color_2d_slider.hpp
new file mode 100644
index 00000000..51c67d00
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/color_2d_slider.hpp
@@ -0,0 +1,128 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_WIDGETS_COLOR_2D_SLIDER_HPP
+#define COLOR_WIDGETS_COLOR_2D_SLIDER_HPP
+
+#include "colorwidgets_global.hpp"
+#include
+
+namespace color_widgets {
+
+/**
+ * \brief A 2D slider that edits 2 color components
+ */
+class QCP_EXPORT Color2DSlider : public QWidget
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged DESIGNABLE true STORED false )
+ Q_PROPERTY(qreal hue READ hue WRITE setHue DESIGNABLE false )
+ Q_PROPERTY(qreal saturation READ saturation WRITE setSaturation DESIGNABLE false )
+ Q_PROPERTY(qreal value READ value WRITE setValue DESIGNABLE false )
+ /**
+ * \brief Which color component is used on the x axis
+ */
+ Q_PROPERTY(Component componentX READ componentX WRITE setComponentX NOTIFY componentXChanged)
+ /**
+ * \brief Which color component is used on the y axis
+ */
+ Q_PROPERTY(Component componentY READ componentY WRITE setComponentY NOTIFY componentYChanged)
+
+
+public:
+ enum Component {
+ Hue, Saturation, Value
+ };
+ Q_ENUMS(Component)
+
+ explicit Color2DSlider(QWidget *parent = nullptr);
+ ~Color2DSlider();
+
+ /// Get current color
+ QColor color() const;
+
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+
+ /// Get current hue in the range [0-1]
+ qreal hue() const;
+
+ /// Get current saturation in the range [0-1]
+ qreal saturation() const;
+
+ /// Get current value in the range [0-1]
+ qreal value() const;
+
+ Component componentX() const;
+ Component componentY() const;
+
+public Q_SLOTS:
+
+ /// Set current color
+ void setColor(const QColor& c);
+
+ /**
+ * @param h Hue [0-1]
+ */
+ void setHue(qreal h);
+
+ /**
+ * @param s Saturation [0-1]
+ */
+ void setSaturation(qreal s);
+
+ /**
+ * @param v Value [0-1]
+ */
+ void setValue(qreal v);
+
+ void setComponentX(Component componentX);
+ void setComponentY(Component componentY);
+
+Q_SIGNALS:
+ /**
+ * Emitted when the user selects a color or setColor is called
+ */
+ void colorChanged(QColor);
+
+ /**
+ * Emitted when the user selects a color
+ */
+ void colorSelected(QColor);
+
+ void componentXChanged(Component componentX);
+ void componentYChanged(Component componentY);
+
+protected:
+ void paintEvent(QPaintEvent* event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent* event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent* event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent* event) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent* event) Q_DECL_OVERRIDE;
+
+private:
+ class Private;
+ Private * const p;
+};
+
+} // namespace color_widgets
+
+#endif // COLOR_WIDGETS_COLOR_2D_SLIDER_HPP
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/color_delegate.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/color_delegate.hpp
new file mode 100644
index 00000000..4a271e86
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/color_delegate.hpp
@@ -0,0 +1,83 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_DELEGATE_HPP
+#define COLOR_DELEGATE_HPP
+
+#include "colorwidgets_global.hpp"
+
+#include
+
+namespace color_widgets {
+
+
+class QCP_EXPORT ReadOnlyColorDelegate : public QStyledItemDelegate
+{
+ Q_OBJECT
+public:
+ using QStyledItemDelegate::QStyledItemDelegate;
+
+ void paint(QPainter *painter, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const Q_DECL_OVERRIDE;
+
+ QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
+
+ void setSizeHintForColor(const QSize& size_hint);
+ const QSize& sizeHintForColor() const;
+
+protected:
+ void paintItem(QPainter *painter, const QStyleOptionViewItem &option,
+ const QModelIndex &index, const QBrush& brush) const;
+private:
+ QSize size_hint{24, 16};
+};
+
+/**
+ Delegate to use a ColorSelector in a color list
+*/
+class QCP_EXPORT ColorDelegate : public ReadOnlyColorDelegate
+{
+ Q_OBJECT
+public:
+ using ReadOnlyColorDelegate::ReadOnlyColorDelegate;
+
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const Q_DECL_OVERRIDE;
+
+ void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
+
+ void setModelData(QWidget *editor, QAbstractItemModel *model,
+ const QModelIndex &index) const Q_DECL_OVERRIDE;
+
+ void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const Q_DECL_OVERRIDE;
+
+protected:
+ bool eventFilter(QObject * watched, QEvent * event) Q_DECL_OVERRIDE;
+
+private slots:
+ void close_editor();
+ void color_changed();
+};
+
+} // namespace color_widgets
+
+#endif // COLOR_DELEGATE_HPP
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/color_dialog.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/color_dialog.hpp
new file mode 100644
index 00000000..f2d49e5a
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/color_dialog.hpp
@@ -0,0 +1,165 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_DIALOG_HPP
+#define COLOR_DIALOG_HPP
+
+#include "colorwidgets_global.hpp"
+#include "color_preview.hpp"
+#include "color_wheel.hpp"
+
+#include
+
+class QAbstractButton;
+
+namespace color_widgets {
+
+class QCP_EXPORT ColorDialog : public QDialog
+{
+ Q_OBJECT
+ Q_ENUMS(ButtonMode)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged DESIGNABLE true)
+ Q_PROPERTY(ColorWheel::ShapeEnum wheelShape READ wheelShape WRITE setWheelShape NOTIFY wheelShapeChanged)
+ Q_PROPERTY(ColorWheel::ColorSpaceEnum colorSpace READ colorSpace WRITE setColorSpace NOTIFY colorSpaceChanged)
+ Q_PROPERTY(bool wheelRotating READ wheelRotating WRITE setWheelRotating NOTIFY wheelRotatingChanged)
+ /**
+ * \brief whether the color alpha channel can be edited.
+ *
+ * If alpha is disabled, the selected color's alpha will always be 255.
+ */
+ Q_PROPERTY(bool alphaEnabled READ alphaEnabled WRITE setAlphaEnabled NOTIFY alphaEnabledChanged)
+
+public:
+ enum ButtonMode {
+ OkCancel,
+ OkApplyCancel,
+ Close
+ };
+
+ explicit ColorDialog(QWidget *parent = 0, Qt::WindowFlags f = {});
+
+ ~ColorDialog();
+
+ /**
+ * Get currently selected color
+ */
+ QColor color() const;
+
+ /**
+ * Set the display mode for the color preview
+ */
+ void setPreviewDisplayMode(ColorPreview::DisplayMode mode);
+
+ /**
+ * Get the color preview diplay mode
+ */
+ ColorPreview::DisplayMode previewDisplayMode() const;
+
+ bool alphaEnabled() const;
+
+ /**
+ * Select which dialog buttons to show
+ *
+ * There are three predefined modes:
+ * OkCancel - this is useful when the dialog is modal and we just want to return a color
+ * OkCancelApply - this is for non-modal dialogs
+ * Close - for non-modal dialogs with direct color updates via colorChanged signal
+ */
+ void setButtonMode(ButtonMode mode);
+ ButtonMode buttonMode() const;
+
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+
+ ColorWheel::ShapeEnum wheelShape() const;
+ ColorWheel::ColorSpaceEnum colorSpace() const;
+ bool wheelRotating() const;
+
+ int exec() Q_DECL_OVERRIDE;
+
+public Q_SLOTS:
+
+ /**
+ * Change color
+ */
+ void setColor(const QColor &c);
+
+ /**
+ * Set the current color and show the dialog
+ */
+ void showColor(const QColor &oldcolor);
+
+ void setWheelShape(ColorWheel::ShapeEnum shape);
+ void setColorSpace(ColorWheel::ColorSpaceEnum space);
+ void setWheelRotating(bool rotating);
+
+ /**
+ * Set whether the color alpha channel can be edited.
+ * If alpha is disabled, the selected color's alpha will always be 255.
+ */
+ void setAlphaEnabled(bool a);
+
+Q_SIGNALS:
+ /**
+ * The current color was changed
+ */
+ void colorChanged(QColor);
+
+ /**
+ * The user selected the new color by pressing Ok/Apply
+ */
+ void colorSelected(QColor);
+
+ void wheelShapeChanged(ColorWheel::ShapeEnum shape);
+ void colorSpaceChanged(ColorWheel::ColorSpaceEnum space);
+ void wheelRotatingChanged(bool rotating);
+
+ void alphaEnabledChanged(bool alphaEnabled);
+
+private Q_SLOTS:
+ /// Update all the Ui elements to match the selected color
+ void setColorInternal(const QColor &color);
+ /// Update from HSV sliders
+ void set_hsv();
+ /// Update from RGB sliders
+ void set_rgb();
+ /// Update from Alpha slider
+ void set_alpha();
+
+ void on_edit_hex_colorChanged(const QColor& color);
+ void on_edit_hex_colorEditingFinished(const QColor& color);
+
+ void on_buttonBox_clicked(QAbstractButton*);
+
+protected:
+ void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
+ void dropEvent(QDropEvent * event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+
+private:
+ class Private;
+ Private * const p;
+};
+
+} // namespace color_widgets
+
+#endif // COLOR_DIALOG_HPP
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/color_line_edit.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/color_line_edit.hpp
new file mode 100644
index 00000000..05643adc
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/color_line_edit.hpp
@@ -0,0 +1,98 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_WIDGETS_COLOR_LINE_EDIT_HPP
+#define COLOR_WIDGETS_COLOR_LINE_EDIT_HPP
+
+#include "colorwidgets_global.hpp"
+#include
+#include
+
+namespace color_widgets {
+
+/**
+ * \brief A line edit used to define a color name
+ *
+ * Supported string formats:
+ * * Short hex strings #f00
+ * * Long hex strings #ff0000
+ * * Color names red
+ * * Function-like rgb(255,0,0)
+ *
+ * Additional string formats supported when showAlpha is true:
+ * * Long hex strings #ff0000ff
+ * * Function like rgba(255,0,0,255)
+ */
+class QCP_EXPORT ColorLineEdit : public QLineEdit
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+ /**
+ * \brief Whether the widget displays and edits the alpha channel
+ */
+ Q_PROPERTY(bool showAlpha READ showAlpha WRITE setShowAlpha NOTIFY showAlphaChanged)
+ /**
+ * \brief If \b true, the background of the widget is changed to show the color
+ */
+ Q_PROPERTY(bool previewColor READ previewColor WRITE setPreviewColor NOTIFY previewColorChanged)
+
+public:
+ explicit ColorLineEdit(QWidget* parent = nullptr);
+ ~ColorLineEdit();
+
+ QColor color() const;
+ bool showAlpha() const;
+ bool previewColor() const;
+
+public Q_SLOTS:
+ void setColor(const QColor& color);
+ void setShowAlpha(bool showAlpha);
+ void setPreviewColor(bool previewColor);
+
+Q_SIGNALS:
+ /**
+ * \brief Emitted when the color is changed by any means
+ */
+ void colorChanged(const QColor& color);
+ /**
+ * \brief Emitted when the user is typing a color but has not finished yet
+ */
+ void colorEdited(const QColor& color);
+ /**
+ * \brief Emitted when the user finished to edit a string
+ */
+ void colorEditingFinished(const QColor& color);
+
+ void showAlphaChanged(bool showAlpha);
+ void previewColorChanged(bool previewColor);
+
+protected:
+ void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
+ void dropEvent(QDropEvent * event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent* event) Q_DECL_OVERRIDE;
+
+private:
+ class Private;
+ Private* p;
+};
+
+} // namespace color_widgets
+#endif // COLOR_WIDGETS_COLOR_LINE_EDIT_HPP
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/color_list_widget.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/color_list_widget.hpp
new file mode 100644
index 00000000..1f7ca9a2
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/color_list_widget.hpp
@@ -0,0 +1,78 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_LIST_WIDGET_HPP
+#define COLOR_LIST_WIDGET_HPP
+
+#include "abstract_widget_list.hpp"
+#include "color_wheel.hpp"
+
+namespace color_widgets {
+
+class QCP_EXPORT ColorListWidget : public AbstractWidgetList
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QList colors READ colors WRITE setColors NOTIFY colorsChanged )
+ Q_PROPERTY(ColorWheel::ShapeEnum wheelShape READ wheelShape WRITE setWheelShape NOTIFY wheelShapeChanged)
+ Q_PROPERTY(ColorWheel::ColorSpaceEnum colorSpace READ colorSpace WRITE setColorSpace NOTIFY colorSpaceChanged)
+ Q_PROPERTY(bool wheelRotating READ wheelRotating WRITE setWheelRotating NOTIFY wheelRotatingChanged)
+
+public:
+ explicit ColorListWidget(QWidget *parent = 0);
+ ~ColorListWidget();
+
+ QList colors() const;
+ void setColors(const QList& colors);
+
+ void swap(int a, int b);
+
+ void append();
+
+ ColorWheel::ShapeEnum wheelShape() const;
+ ColorWheel::ColorSpaceEnum colorSpace() const;
+ bool wheelRotating() const;
+
+Q_SIGNALS:
+ void colorsChanged(const QList&);
+ void wheelShapeChanged(ColorWheel::ShapeEnum shape);
+ void colorSpaceChanged(ColorWheel::ColorSpaceEnum space);
+ void wheelRotatingChanged(bool rotating);
+
+public Q_SLOTS:
+ void setWheelShape(ColorWheel::ShapeEnum shape);
+ void setColorSpace(ColorWheel::ColorSpaceEnum space);
+ void setWheelRotating(bool rotating);
+
+private Q_SLOTS:
+ void emit_changed();
+ void handle_removed(int);
+ void color_changed(int row);
+
+private:
+ class Private;
+ Private * const p;
+ void append_widget(int col);
+};
+
+} // namespace color_widgets
+
+#endif // COLOR_LIST_WIDGET_HPP
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/color_names.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/color_names.hpp
new file mode 100644
index 00000000..1273999c
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/color_names.hpp
@@ -0,0 +1,57 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_WIDGETS_COLOR_NAMES_HPP
+#define COLOR_WIDGETS_COLOR_NAMES_HPP
+
+#include
+#include
+
+#include
+
+namespace color_widgets {
+
+/**
+ * \brief Convert a string into a color
+ *
+ * Supported string formats:
+ * * Short hex strings #f00
+ * * Long hex strings #ff0000
+ * * Color names red
+ * * Function-like rgb(255,0,0)
+ *
+ * Additional string formats supported only when \p alpha is true:
+ * * Long hex strings #ff0000ff
+ * * Function like rgba(255,0,0,255)
+ */
+QCP_EXPORT QColor colorFromString(const QString& string, bool alpha = true);
+
+/**
+ * \brief Convert a color into a string
+ *
+ * Format:
+ * * If the color has full alpha: #ff0000
+ * * If alpha is true and the color has non-full alpha: #ff000088
+ */
+QCP_EXPORT QString stringFromColor(const QColor& color, bool alpha = true);
+
+} // namespace color_widgets
+#endif // COLOR_WIDGETS_COLOR_NAMES_HPP
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/color_palette.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/color_palette.hpp
new file mode 100644
index 00000000..55797ba8
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/color_palette.hpp
@@ -0,0 +1,229 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_WIDGETS_COLOR_PALETTE_HPP
+#define COLOR_WIDGETS_COLOR_PALETTE_HPP
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include "colorwidgets_global.hpp"
+
+namespace color_widgets {
+
+class QCP_EXPORT ColorPalette : public QObject
+{
+ Q_OBJECT
+
+ /**
+ * \brief The list of colors
+ */
+ Q_PROPERTY(QVector colors READ colors WRITE setColors NOTIFY colorsChanged)
+ /**
+ * \brief Name of the palette
+ */
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+ /**
+ * \brief Number of colors to display in a row, if 0 unspecified
+ */
+ Q_PROPERTY(int columns READ columns WRITE setColumns NOTIFY columnsChanged)
+ /**
+ * \brief Number of colors
+ */
+ Q_PROPERTY(int count READ count)
+ /**
+ * \brief Name of the file the palette has been read from
+ */
+ Q_PROPERTY(QString fileName READ fileName WRITE setFileName NOTIFY fileNameChanged)
+ /**
+ * \brief Whether it has been modified and it might be advisable to save it
+ */
+ Q_PROPERTY(bool dirty READ dirty WRITE setDirty NOTIFY dirtyChanged)
+
+public:
+ typedef QPair value_type;
+
+ ColorPalette(const QVector& colors, const QString& name = QString(), int columns = 0);
+ ColorPalette(const QVector >& colors, const QString& name = QString(), int columns = 0);
+ explicit ColorPalette(const QString& name = QString());
+ ColorPalette(const ColorPalette& other);
+ ColorPalette& operator=(const ColorPalette& other);
+ ~ColorPalette();
+ ColorPalette(ColorPalette&& other);
+ ColorPalette& operator=(ColorPalette&& other);
+
+ /**
+ * \brief Color at the given index
+ */
+ Q_INVOKABLE QColor colorAt(int index) const;
+
+ /**
+ * \brief Color name at the given index
+ */
+ Q_INVOKABLE QString nameAt(int index) const;
+
+ QVector > colors() const;
+ QVector onlyColors() const;
+
+ int count() const;
+ int columns();
+
+ QString name() const;
+
+ /**
+ * \brief Use a color table to set the colors
+ */
+ Q_INVOKABLE void loadColorTable(const QVector& color_table);
+
+ /**
+ * \brief Convert to a color table
+ */
+ Q_INVOKABLE QVector colorTable() const;
+
+ /**
+ * \brief Creates a ColorPalette from a color table
+ */
+ static ColorPalette fromColorTable(const QVector& table);
+
+ /**
+ * \brief Use the pixels on an image to set the palette colors
+ */
+ Q_INVOKABLE bool loadImage(const QImage& image);
+
+ /**
+ * \brief Creates a ColorPalette from a Gimp palette (gpl) file
+ */
+ static ColorPalette fromImage(const QImage& image);
+
+ /**
+ * \brief Load contents from a Gimp palette (gpl) file
+ * \returns \b true On Success
+ * \note If this function returns \b false, the palette will become empty
+ */
+ Q_INVOKABLE bool load(const QString& name);
+
+ /**
+ * \brief Creates a ColorPalette from a Gimp palette (gpl) file
+ */
+ static ColorPalette fromFile(const QString& name);
+
+ QString fileName() const;
+
+ bool dirty() const;
+
+ /**
+ * \brief Returns a preview image of the colors in the palette
+ */
+ QPixmap preview(const QSize& size, const QColor& background=Qt::transparent) const;
+
+public Q_SLOTS:
+ void setColumns(int columns);
+
+ void setColors(const QVector& colors);
+ void setColors(const QVector >& colors);
+
+ /**
+ * \brief Change the color at the given index
+ */
+ void setColorAt(int index, const QColor& color);
+ /**
+ * \brief Change the color at the given index
+ */
+ void setColorAt(int index, const QColor& color, const QString& name);
+ /**
+ * \brief Change the name of a color
+ */
+ void setNameAt(int index, const QString& name = QString());
+ /**
+ * \brief Append a color at the end
+ */
+ void appendColor(const QColor& color, const QString& name = QString());
+ /**
+ * \brief Insert a color in an arbitrary location
+ */
+ void insertColor(int index, const QColor& color, const QString& name = QString());
+ /**
+ * \brief Remove the color at the given index
+ */
+ void eraseColor(int index);
+
+ /**
+ * \brief Change file name and save
+ * \returns \b true on success
+ */
+ bool save(const QString& filename);
+ /**
+ * \brief save to file, the filename is \c fileName or determined automatically
+ * \returns \b true on success
+ */
+ bool save();
+
+ void setName(const QString& name);
+ void setFileName(const QString& name);
+ void setDirty(bool dirty);
+
+Q_SIGNALS:
+ /**
+ * \brief Emitted when all the colors have changed
+ */
+ void colorsChanged(const QVector >&);
+ void columnsChanged(int);
+ void nameChanged(const QString&);
+ void fileNameChanged(const QString&);
+ void dirtyChanged(bool);
+ /**
+ * \brief Emitted when the color or the name at the given index has been modified
+ */
+ void colorChanged(int index);
+ /**
+ * \brief Emitted when the color at the given index has been removed
+ */
+ void colorRemoved(int index);
+ /**
+ * \brief Emitted when a single color has been added
+ */
+ void colorAdded(int index);
+ /**
+ * \brief Emitted when the colors have been modified with a simple operation (set, append etc.)
+ */
+ void colorsUpdated(const QVector>&);
+
+private:
+ /**
+ * \brief Returns \c name if it isn't null, otherwise a default value
+ */
+ QString unnamed(const QString& name = QString()) const;
+
+ /**
+ * \brief Emit all the necessary signals when the palette has been completely overwritten
+ */
+ void emitUpdate();
+
+ class Private;
+ Private *p;
+};
+
+} // namespace color_widgets
+
+#endif // COLOR_WIDGETS_COLOR_PALETTE_HPP
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/color_palette_model.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/color_palette_model.hpp
new file mode 100644
index 00000000..045786b9
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/color_palette_model.hpp
@@ -0,0 +1,140 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_WIDGETS_COLOR_PALETTE_MODEL_HPP
+#define COLOR_WIDGETS_COLOR_PALETTE_MODEL_HPP
+
+#include
+#include "color_palette.hpp"
+
+namespace color_widgets {
+
+class QCP_EXPORT ColorPaletteModel : public QAbstractListModel
+{
+ Q_OBJECT
+ /**
+ * \brief List of directories to be scanned for palette files
+ */
+ Q_PROPERTY(QStringList searchPaths READ searchPaths WRITE setSearchPaths NOTIFY searchPathsChanged)
+
+ /**
+ * \brief Default directory to be used when saving a palette
+ */
+ Q_PROPERTY(QString savePath READ savePath WRITE setSavePath NOTIFY savePathChanged)
+
+ /**
+ * \brief Size of the icon used for the palette previews
+ */
+ Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize NOTIFY iconSizeChanged)
+
+
+public:
+ ColorPaletteModel();
+ ~ColorPaletteModel();
+ int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
+ bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex()) Q_DECL_OVERRIDE;
+
+ QString savePath() const;
+ QStringList searchPaths() const;
+ QSize iconSize() const;
+
+ /**
+ * \brief Number of palettes
+ */
+ int count() const;
+
+ /**
+ * \brief Returns a reference to the first palette with the given name
+ * \pre hasPalette(name)
+ */
+ const ColorPalette& palette(const QString& name) const;
+
+ /**
+ * \brief Whether a palette with the given name exists in the model
+ */
+ bool hasPalette(const QString& name) const;
+
+ /**
+ * \brief Get the palette at the given index (row)
+ * \pre 0 <= index < count()
+ */
+ const ColorPalette& palette(int index) const;
+
+ /**
+ * \brief Updates an existing palette
+ * \param index Palette index
+ * \param palette New palette
+ * \param save Whether to save the palette to the filesystem
+ *
+ * Saving will try: (in this order)
+ * * To overwrite the file pointed by the old palette
+ * * To write to the new palette file name
+ * * To create a file in the save path
+ * If all of the above fail, the palette will be replaced interally
+ * but not on the filesystem
+ *
+ * \returns \b true if the palette has been successfully updated (and saved)
+ */
+ bool updatePalette(int index, const ColorPalette& palette, bool save = true);
+
+ /**
+ * \brief Remove a palette from the model and optionally from the filesystem
+ * \returns \b true if the palette has been successfully removed
+ */
+ bool removePalette(int index, bool remove_file = true);
+
+ /**
+ * \brief Remove a palette to the model and optionally to the filesystem
+ * \returns \b true if the palette has been successfully added
+ */
+ bool addPalette(const ColorPalette& palette, bool save = true);
+
+ /**
+ * \brief The index of the palette with the given file name
+ * \returns -1 if none is found
+ */
+ int indexFromFile(const QString& filename) const;
+
+public Q_SLOTS:
+ void setSavePath(const QString& savePath);
+ void setSearchPaths(const QStringList& searchPaths);
+ void addSearchPath(const QString& path);
+ void setIconSize(const QSize& iconSize);
+
+ /**
+ * \brief Load palettes files found in the search paths
+ */
+ void load();
+
+Q_SIGNALS:
+ void savePathChanged(const QString& savePath);
+ void searchPathsChanged(const QStringList& searchPaths);
+ void iconSizeChanged(const QSize& iconSize);
+
+private:
+ class Private;
+ Private* p;
+};
+
+} // namespace color_widgets
+
+#endif // COLOR_WIDGETS_COLOR_PALETTE_MODEL_HPP
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/color_palette_widget.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/color_palette_widget.hpp
new file mode 100644
index 00000000..8fc2e931
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/color_palette_widget.hpp
@@ -0,0 +1,204 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_WIDGETS_COLOR_PALETTE_WIDGET_HPP
+#define COLOR_WIDGETS_COLOR_PALETTE_WIDGET_HPP
+
+#include
+#include
+#include "color_palette_model.hpp"
+#include "swatch.hpp"
+
+namespace color_widgets {
+
+/**
+ * \brief A widget to use and modify palettes
+ */
+class QCP_EXPORT ColorPaletteWidget : public QWidget
+{
+ Q_OBJECT
+
+ /**
+ * \brief Model used to store the palettes
+ */
+ Q_PROPERTY(ColorPaletteModel* model READ model WRITE setModel NOTIFY modelChanged)
+
+ /**
+ * \brief Size of a single color in the swatch widget
+ */
+ Q_PROPERTY(QSize colorSize READ colorSize WRITE setColorSize NOTIFY colorSizeChanged)
+ /**
+ * \brief Policy for colorSize
+ **/
+ Q_PROPERTY(color_widgets::Swatch::ColorSizePolicy colorSizePolicy READ colorSizePolicy WRITE setColorSizePolicy NOTIFY colorSizePolicyChanged)
+
+ /**
+ * \brief Border around the colors
+ */
+ Q_PROPERTY(QPen border READ border WRITE setBorder NOTIFY borderChanged)
+
+ /**
+ * \brief Forces the Swatch to display that many rows of colors
+ *
+ * If there are too few elements, the widget will display less than this
+ * many rows.
+ *
+ * A value of0 means that the number of rows is automatic.
+ *
+ * \note Conflicts with forcedColumns
+ */
+ Q_PROPERTY(int forcedRows READ forcedRows WRITE setForcedRows NOTIFY forcedRowsChanged)
+
+ /**
+ * \brief Forces the Swatch to display that many columns of colors
+ *
+ * If there are too few elements, the widget will display less than this
+ * many columns.
+ *
+ * A value of 0 means that the number of columns is automatic.
+ *
+ * \note Conflicts with forcedRows
+ */
+ Q_PROPERTY(int forcedColumns READ forcedColumns WRITE setForcedColumns NOTIFY forcedColumnsChanged)
+
+ /**
+ * \brief Whether the palettes can be modified via user interaction
+ */
+ Q_PROPERTY(bool readOnly READ readOnly WRITE setReadOnly NOTIFY readOnlyChanged)
+
+ /**
+ * \brief Currently selected color
+ */
+ Q_PROPERTY(QColor currentColor READ currentColor WRITE setCurrentColor NOTIFY currentColorChanged)
+
+ /**
+ * \brief Currently selected model row
+ */
+ Q_PROPERTY(int currentRow READ currentRow WRITE setCurrentRow NOTIFY currentRowChanged)
+
+ /**
+ * \brief Palette shown by the widget
+ */
+ Q_PROPERTY(const ColorPalette& currentPalette READ currentPalette NOTIFY currentPaletteChanged)
+
+ /**
+ * \brief If a valid color, it's used when adding new colors to palettes
+ */
+ Q_PROPERTY(QColor defaultColor READ defaultColor WRITE setDefaultColor NOTIFY defaultColorChanged)
+
+public:
+ ColorPaletteWidget(QWidget* parent = nullptr);
+ ~ColorPaletteWidget();
+
+ ColorPaletteModel* model() const;
+
+ /**
+ * \brief Currently selected palette
+ * \pre model() != nullptr and there is a selected palette
+ */
+ const ColorPalette& currentPalette() const;
+
+ QSize colorSize() const;
+ Swatch::ColorSizePolicy colorSizePolicy() const;
+ QPen border() const;
+
+ int forcedRows() const;
+ int forcedColumns() const;
+
+ bool readOnly() const;
+ QColor currentColor() const;
+
+ int currentRow() const;
+
+ /**
+ * \brief Default color when adding a color to the current palette
+ */
+ QColor defaultColor() const;
+
+public Q_SLOTS:
+ void setModel(ColorPaletteModel* model);
+ void setColorSize(const QSize& colorSize);
+ void setColorSizePolicy(Swatch::ColorSizePolicy colorSizePolicy);
+ void setBorder(const QPen& border);
+ void setForcedRows(int forcedRows);
+ void setForcedColumns(int forcedColumns);
+ void setReadOnly(bool readOnly);
+ /**
+ * \brief Clear the selected color
+ */
+ void clearCurrentColor();
+ /**
+ * \brief Attempt to select a color
+ *
+ * If the given color is available in the current palete, it will be selected
+ * \return \b true on success
+ */
+ bool setCurrentColor(const QColor& color);
+ /**
+ * \brief Attempt to select a color by name
+ *
+ * If the given color is available in the current palete, it will be selected
+ * \return \b true on success
+ */
+ bool setCurrentColor(const QString& name);
+ /**
+ * \brief Attempt to select a color by index
+ *
+ * If the given color is available in the current palete, it will be selected
+ * \return \b true on success
+ */
+ bool setCurrentColor(int index);
+ /**
+ * \brief Set the selected row in the model
+ */
+ void setCurrentRow(int currentRow);
+
+ /**
+ * \brief Sets the default for new colors
+ * If invalid, it will show a dialog
+ */
+ void setDefaultColor(const QColor& color);
+
+Q_SIGNALS:
+ void modelChanged(ColorPaletteModel* model);
+ void colorSizeChanged(const QSize& colorSize);
+ void colorSizePolicyChanged(Swatch::ColorSizePolicy colorSizePolicy);
+ void forcedRowsChanged(int forcedRows);
+ void forcedColumnsChanged(int forcedColumns);
+ void readOnlyChanged(bool readOnly);
+ void currentColorChanged(const QColor& currentColor);
+ void currentColorChanged(int index);
+ void borderChanged(const QPen& border);
+ void currentRowChanged(int currentRow);
+ void currentPaletteChanged(const ColorPalette& palette);
+ void defaultColorChanged(const QColor& color);
+
+private Q_SLOTS:
+ void on_palette_list_currentIndexChanged(int index);
+ void on_swatch_doubleClicked(int index);
+
+private:
+ class Private;
+ std::unique_ptr p;
+};
+
+} // namespace color_widgets
+#endif // COLOR_WIDGETS_COLOR_PALETTE_WIDGET_HPP
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/color_preview.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/color_preview.hpp
new file mode 100644
index 00000000..8e1d87de
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/color_preview.hpp
@@ -0,0 +1,116 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ * \copyright Copyright (C) 2014 Calle Laakkonen
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_PREVIEW_HPP
+#define COLOR_PREVIEW_HPP
+
+#include "colorwidgets_global.hpp"
+
+#include
+
+namespace color_widgets {
+
+/**
+ * Simple widget that shows a preview of a color
+ */
+class QCP_EXPORT ColorPreview : public QWidget
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged DESIGNABLE true)
+ Q_PROPERTY(QColor comparisonColor READ comparisonColor WRITE setComparisonColor NOTIFY comparisonColorChanged DESIGNABLE true)
+ Q_PROPERTY(DisplayMode display_mode READ displayMode WRITE setDisplayMode NOTIFY displayModeChanged DESIGNABLE true)
+ Q_PROPERTY(QBrush background READ background WRITE setBackground NOTIFY backgroundChanged DESIGNABLE true)
+ Q_PROPERTY(bool drawFrame READ drawFrame WRITE setDrawFrame NOTIFY drawFrameChanged DESIGNABLE true)
+ Q_ENUMS(DisplayMode)
+public:
+ enum DisplayMode
+ {
+ NoAlpha, ///< Show current color with no transparency
+ AllAlpha, ///< show current color with transparency
+ SplitAlpha, ///< Show both solid and transparent side by side
+ SplitColor, ///< Show current and comparison colors side by side
+ SplitColorReverse, ///< Like Split color but swapped
+ };
+ Q_ENUMS(DisplayMode)
+
+ explicit ColorPreview(QWidget *parent = 0);
+ ~ColorPreview();
+
+ /// Get the background visible under transparent colors
+ QBrush background() const;
+
+ /// Change the background visible under transparent colors
+ void setBackground(const QBrush &bk);
+
+ /// Get color display mode
+ DisplayMode displayMode() const;
+
+ /// Set how transparent colors are handled
+ void setDisplayMode(DisplayMode dm);
+
+ /// Get current color
+ QColor color() const;
+
+ /// Get the comparison color
+ QColor comparisonColor() const;
+
+ QSize sizeHint () const Q_DECL_OVERRIDE;
+
+ void paint(QPainter &painter, QRect rect) const;
+
+ /// Whether to draw a frame around the color
+ bool drawFrame() const;
+ void setDrawFrame(bool);
+
+public Q_SLOTS:
+ /// Set current color
+ void setColor(const QColor &c);
+
+ /// Set the comparison color
+ void setComparisonColor(const QColor &c);
+
+Q_SIGNALS:
+ /// Emitted when the user clicks on the widget
+ void clicked();
+
+ /// Emitted on setColor
+ void colorChanged(QColor);
+
+ void comparisonColorChanged(QColor);
+ void displayModeChanged(DisplayMode);
+ void backgroundChanged(const QBrush&);
+ void drawFrameChanged(bool);
+protected:
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
+
+private:
+ class Private;
+ Private * const p;
+};
+
+} // namespace color_widgets
+Q_DECLARE_METATYPE(color_widgets::ColorPreview::DisplayMode)
+
+#endif // COLOR_PREVIEW_HPP
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/color_selector.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/color_selector.hpp
new file mode 100644
index 00000000..0b659aa8
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/color_selector.hpp
@@ -0,0 +1,99 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_SELECTOR_HPP
+#define COLOR_SELECTOR_HPP
+
+#include "color_preview.hpp"
+#include "color_wheel.hpp"
+
+namespace color_widgets {
+
+/**
+ * Color preview that opens a color dialog
+ */
+class QCP_EXPORT ColorSelector : public ColorPreview
+{
+ Q_OBJECT
+ Q_ENUMS(UpdateMode)
+ Q_PROPERTY(UpdateMode updateMode READ updateMode WRITE setUpdateMode NOTIFY updateModeChanged)
+ Q_PROPERTY(Qt::WindowModality dialogModality READ dialogModality WRITE setDialogModality NOTIFY dialogModalityChanged)
+ Q_PROPERTY(ColorWheel::ShapeEnum wheelShape READ wheelShape WRITE setWheelShape NOTIFY wheelShapeChanged)
+ Q_PROPERTY(ColorWheel::ColorSpaceEnum colorSpace READ colorSpace WRITE setColorSpace NOTIFY colorSpaceChanged)
+ Q_PROPERTY(bool wheelRotating READ wheelRotating WRITE setWheelRotating NOTIFY wheelRotatingChanged)
+
+public:
+ enum UpdateMode {
+ Confirm, ///< Update color only after the dialog has been accepted
+ Continuous ///< Update color as it's being modified in the dialog
+ };
+
+ explicit ColorSelector(QWidget *parent = 0);
+ ~ColorSelector();
+
+ void setUpdateMode(UpdateMode m);
+ UpdateMode updateMode() const;
+
+ Qt::WindowModality dialogModality() const;
+ void setDialogModality(Qt::WindowModality m);
+
+ ColorWheel::ShapeEnum wheelShape() const;
+ ColorWheel::ColorSpaceEnum colorSpace() const;
+ bool wheelRotating() const;
+
+Q_SIGNALS:
+ void wheelShapeChanged(ColorWheel::ShapeEnum shape);
+ void colorSpaceChanged(ColorWheel::ColorSpaceEnum space);
+ void wheelRotatingChanged(bool rotating);
+ void updateModeChanged(UpdateMode);
+ void dialogModalityChanged(Qt::WindowModality);
+ /// Emitted when a color is selected by the user
+ void colorSelected(const QColor& c);
+
+public Q_SLOTS:
+ void showDialog();
+ void setWheelShape(ColorWheel::ShapeEnum shape);
+ void setColorSpace(ColorWheel::ColorSpaceEnum space);
+ void setWheelRotating(bool rotating);
+
+private Q_SLOTS:
+ void accept_dialog();
+ void reject_dialog();
+ void update_old_color(const QColor &c);
+
+protected:
+ void dragEnterEvent(QDragEnterEvent *event);
+ void dropEvent(QDropEvent * event);
+
+private:
+ /// Connect/Disconnect colorChanged based on UpdateMode
+ void connect_dialog();
+
+ /// Disconnect from dialog update
+ void disconnect_dialog();
+
+ class Private;
+ Private * const p;
+};
+
+} // namespace color_widgets
+
+#endif // COLOR_SELECTOR_HPP
diff --git a/external/Qt-Color-Widgets/src/color_utils.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/color_utils.hpp
similarity index 64%
rename from external/Qt-Color-Widgets/src/color_utils.hpp
rename to external/Qt-Color-Widgets/include/QtColorWidgets/color_utils.hpp
index 5e61cdc9..9647db3d 100644
--- a/external/Qt-Color-Widgets/src/color_utils.hpp
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/color_utils.hpp
@@ -3,7 +3,7 @@
*
* \author Mattia Basaglia
*
- * \copyright Copyright (C) 2013-2017 Mattia Basaglia
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -19,43 +19,50 @@
* along with this program. If not, see .
*
*/
+#ifndef COLOR_UTILS_HPP
+#define COLOR_UTILS_HPP
+
#include
+#include
#include
+#include "QtColorWidgets/colorwidgets_global.hpp"
+
namespace color_widgets {
-namespace detail {
+namespace utils {
-inline qreal color_chromaF(const QColor& c)
+QCP_EXPORT inline qreal color_chromaF(const QColor& c)
{
qreal max = qMax(c.redF(), qMax(c.greenF(), c.blueF()));
qreal min = qMin(c.redF(), qMin(c.greenF(), c.blueF()));
return max - min;
}
-inline qreal color_lumaF(const QColor& c)
+QCP_EXPORT inline qreal color_lumaF(const QColor& c)
{
return 0.30 * c.redF() + 0.59 * c.greenF() + 0.11 * c.blueF();
}
-QColor color_from_lch(qreal hue, qreal chroma, qreal luma, qreal alpha = 1 );
-inline QColor rainbow_lch(qreal hue)
+QCP_EXPORT QColor color_from_lch(qreal hue, qreal chroma, qreal luma, qreal alpha = 1 );
+
+QCP_EXPORT inline QColor rainbow_lch(qreal hue)
{
return color_from_lch(hue,1,1);
}
-inline QColor rainbow_hsv(qreal hue)
+QCP_EXPORT inline QColor rainbow_hsv(qreal hue)
{
return QColor::fromHsvF(hue,1,1);
}
-inline qreal color_lightnessF(const QColor& c)
+QCP_EXPORT inline qreal color_lightnessF(const QColor& c)
{
return ( qMax(c.redF(),qMax(c.greenF(),c.blueF())) +
qMin(c.redF(),qMin(c.greenF(),c.blueF())) ) / 2;
}
-inline qreal color_HSL_saturationF(const QColor& col)
+QCP_EXPORT inline qreal color_HSL_saturationF(const QColor& col)
{
qreal c = color_chromaF(col);
qreal l = color_lightnessF(col);
@@ -64,7 +71,12 @@ inline qreal color_HSL_saturationF(const QColor& col)
return c / (1-qAbs(2*l-1));
}
-QColor color_from_hsl(qreal hue, qreal sat, qreal lig, qreal alpha = 1 );
-} // namespace detail
+QCP_EXPORT QColor color_from_hsl(qreal hue, qreal sat, qreal lig, qreal alpha = 1 );
+
+QCP_EXPORT QColor get_screen_color(const QPoint &global_pos);
+
+} // namespace utils
} // namespace color_widgets
+
+#endif // COLOR_UTILS_HPP
diff --git a/external/Qt-Color-Widgets/include/color_wheel.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/color_wheel.hpp
similarity index 58%
rename from external/Qt-Color-Widgets/include/color_wheel.hpp
rename to external/Qt-Color-Widgets/include/QtColorWidgets/color_wheel.hpp
index ea9668de..a5e7a168 100644
--- a/external/Qt-Color-Widgets/include/color_wheel.hpp
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/color_wheel.hpp
@@ -3,7 +3,7 @@
*
* \author Mattia Basaglia
*
- * \copyright Copyright (C) 2013-2017 Mattia Basaglia
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -24,6 +24,9 @@
#include
+#include "colorwidgets_global.hpp"
+
+
namespace color_widgets {
/**
@@ -32,7 +35,7 @@ namespace color_widgets {
* It has an outer wheel to select the Hue and an intenal square to select
* Saturation and Lightness.
*/
-class ColorWheel : public QWidget
+class QCP_EXPORT ColorWheel : public QWidget
{
Q_OBJECT
@@ -40,35 +43,36 @@ class ColorWheel : public QWidget
Q_PROPERTY(qreal hue READ hue WRITE setHue DESIGNABLE false )
Q_PROPERTY(qreal saturation READ saturation WRITE setSaturation DESIGNABLE false )
Q_PROPERTY(qreal value READ value WRITE setValue DESIGNABLE false )
- Q_PROPERTY(unsigned wheelWidth READ wheelWidth WRITE setWheelWidth DESIGNABLE true )
- Q_PROPERTY(DisplayFlags displayFlags READ displayFlags WRITE setDisplayFlags NOTIFY displayFlagsChanged DESIGNABLE true )
+ Q_PROPERTY(unsigned wheelWidth READ wheelWidth WRITE setWheelWidth NOTIFY wheelWidthChanged DESIGNABLE true )
+ Q_PROPERTY(ShapeEnum selectorShape READ selectorShape WRITE setSelectorShape NOTIFY selectorShapeChanged DESIGNABLE true )
+ Q_PROPERTY(bool rotatingSelector READ rotatingSelector WRITE setRotatingSelector NOTIFY rotatingSelectorChanged DESIGNABLE true )
+ Q_PROPERTY(ColorSpaceEnum colorSpace READ colorSpace WRITE setColorSpace NOTIFY colorSpaceChanged DESIGNABLE true )
public:
- enum DisplayEnum
+ enum ShapeEnum
{
- SHAPE_DEFAULT = 0x000, ///< Use the default shape
- SHAPE_TRIANGLE = 0x001, ///< A triangle
- SHAPE_SQUARE = 0x002, ///< A square
- SHAPE_FLAGS = 0x00f, ///< Mask for the shape flags
-
- ANGLE_DEFAULT = 0x000, ///< Use the default rotation style
- ANGLE_FIXED = 0x010, ///< The inner part doesn't rotate
- ANGLE_ROTATING = 0x020, ///< The inner part follows the hue selector
- ANGLE_FLAGS = 0x0f0, ///< Mask for the angle flags
-
- COLOR_DEFAULT = 0x000, ///< Use the default colorspace
- COLOR_HSV = 0x100, ///< Use the HSV color space
- COLOR_HSL = 0x200, ///< Use the HSL color space
- COLOR_LCH = 0x400, ///< Use Luma Chroma Hue (Y_601')
- COLOR_FLAGS = 0xf00, ///< Mask for the color space flags
-
- FLAGS_DEFAULT = 0x000, ///< Use all defaults
- FLAGS_ALL = 0xfff ///< Mask matching all flags
+ ShapeTriangle, ///< A triangle
+ ShapeSquare, ///< A square
};
- Q_DECLARE_FLAGS(DisplayFlags, DisplayEnum)
- Q_FLAGS(DisplayFlags)
- explicit ColorWheel(QWidget *parent = nullptr);
+ enum AngleEnum
+ {
+ AngleFixed, ///< The inner part doesn't rotate
+ AngleRotating, ///< The inner part follows the hue selector
+ };
+
+ enum ColorSpaceEnum
+ {
+ ColorHSV, ///< Use the HSV color space
+ ColorHSL, ///< Use the HSL color space
+ ColorLCH, ///< Use Luma Chroma Hue (Y_601')
+ };
+
+ Q_ENUM(ShapeEnum);
+ Q_ENUM(AngleEnum);
+ Q_ENUM(ColorSpaceEnum);
+
+ explicit ColorWheel(QWidget *parent = 0);
~ColorWheel();
/// Get current color
@@ -91,21 +95,14 @@ public:
/// Set the width in pixels of the outer wheel
void setWheelWidth(unsigned int w);
- /// Get display flags
- DisplayFlags displayFlags(DisplayFlags mask = FLAGS_ALL) const;
+ /// Shape of the internal selector
+ ShapeEnum selectorShape() const;
- /// Set the default display flags
- static void setDefaultDisplayFlags(DisplayFlags flags);
+ /// Whether the internal selector should rotare in accordance with the hue
+ bool rotatingSelector() const;
- /// Get default display flags
- static DisplayFlags defaultDisplayFlags(DisplayFlags mask = FLAGS_ALL);
-
- /**
- * @brief Set a specific display flag
- * @param flag Flag replacing the mask
- * @param mask Mask to be cleared
- */
- void setDisplayFlag(DisplayFlags flag, DisplayFlags mask);
+ /// Color space used to preview/edit the color
+ ColorSpaceEnum colorSpace() const;
public Q_SLOTS:
@@ -127,11 +124,14 @@ public Q_SLOTS:
*/
void setValue(qreal v);
- /**
- * @brief Set the display flags
- * @param flags which will replace the current ones
- */
- void setDisplayFlags(ColorWheel::DisplayFlags flags);
+ /// Sets the shape of the internal selector
+ void setSelectorShape(ShapeEnum shape);
+
+ /// Sets whether the internal selector should rotare in accordance with the hue
+ void setRotatingSelector(bool rotating);
+
+ /// Sets the color space used to preview/edit the color
+ void setColorSpace(ColorSpaceEnum space);
Q_SIGNALS:
/**
@@ -144,25 +144,37 @@ Q_SIGNALS:
*/
void colorSelected(QColor);
- void displayFlagsChanged(ColorWheel::DisplayFlags flags);
+ void wheelWidthChanged(unsigned);
- void mouseReleaseOnColor(QColor);
+ void selectorShapeChanged(ShapeEnum shape);
+
+ void rotatingSelectorChanged(bool rotating);
+
+ void colorSpaceChanged(ColorSpaceEnum space);
+
+ /**
+ * Emitted when the user releases from dragging
+ */
+ void editingFinished();
protected:
void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
void dragEnterEvent(QDragEnterEvent* event) Q_DECL_OVERRIDE;
void dropEvent(QDropEvent* event) Q_DECL_OVERRIDE;
-private:
+protected:
class Private;
- Private * const p;
-};
+ ColorWheel(QWidget *parent, Private* data);
+ Private* data() const { return p; }
-Q_DECLARE_OPERATORS_FOR_FLAGS(ColorWheel::DisplayFlags)
+private:
+ Private * const p;
+
+};
} // namespace color_widgets
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/color_wheel_private.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/color_wheel_private.hpp
new file mode 100644
index 00000000..4323ecb9
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/color_wheel_private.hpp
@@ -0,0 +1,291 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ * \copyright Copyright (C) 2017 caryoscelus
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+#include "QtColorWidgets/color_wheel.hpp"
+#include "QtColorWidgets/color_utils.hpp"
+
+#include
+#include
+#include
+
+namespace color_widgets {
+
+enum MouseStatus
+{
+ Nothing,
+ DragCircle,
+ DragSquare
+};
+
+class ColorWheel::Private
+{
+private:
+ ColorWheel * const w;
+
+public:
+ qreal hue, sat, val;
+ bool backgroundIsDark;
+ unsigned int wheel_width;
+ MouseStatus mouse_status;
+ QPixmap hue_ring;
+ QImage inner_selector;
+ std::vector inner_selector_buffer;
+ ColorSpaceEnum color_space = ColorHSV;
+ bool rotating_selector = true;
+ ShapeEnum selector_shape = ShapeTriangle;
+ QColor (*color_from)(qreal,qreal,qreal,qreal);
+ QColor (*rainbow_from_hue)(qreal);
+ int max_size = 128;
+
+ Private(ColorWheel *widget)
+ : w(widget), hue(0), sat(0), val(0),
+ wheel_width(20), mouse_status(Nothing),
+ color_from(&QColor::fromHsvF), rainbow_from_hue(&utils::rainbow_hsv)
+ {
+ }
+
+ void setup()
+ {
+ qreal backgroundValue = w->palette().window().color().valueF();
+ backgroundIsDark = backgroundValue < 0.5;
+ }
+
+ virtual ~Private(){}
+
+ /// Calculate outer wheel radius from idget center
+ qreal outer_radius() const
+ {
+ return qMin(w->geometry().width(), w->geometry().height())/2;
+ }
+
+ /// Calculate inner wheel radius from idget center
+ qreal inner_radius() const
+ {
+ return outer_radius()-wheel_width;
+ }
+
+ /// Calculate the edge length of the inner square
+ qreal square_size() const
+ {
+ return inner_radius()*qSqrt(2);
+ }
+
+ /// Calculate the height of the inner triangle
+ qreal triangle_height() const
+ {
+ return inner_radius()*3/2;
+ }
+
+ /// Calculate the side of the inner triangle
+ qreal triangle_side() const
+ {
+ return inner_radius()*qSqrt(3);
+ }
+
+ /// return line from center to given point
+ QLineF line_to_point(const QPoint &p) const
+ {
+ return QLineF (w->geometry().width()/2, w->geometry().height()/2, p.x(), p.y());
+ }
+
+ /**
+ * Ensures the internal image buffer is the correct size
+ * and that the QImage is associated to it
+ */
+ void init_buffer(QSize size)
+ {
+ std::size_t linear_size = size.width() * size.height();
+ if ( inner_selector_buffer.size() == linear_size )
+ return;
+ inner_selector_buffer.resize(linear_size);
+ inner_selector = QImage(
+ reinterpret_cast(inner_selector_buffer.data()),
+ size.width(),
+ size.height(),
+ QImage::Format_RGB32
+ );
+ }
+
+ void render_square()
+ {
+ int width = qMin(square_size(), max_size);
+ init_buffer(QSize(width, width));
+
+ for ( int y = 0; y < width; ++y )
+ {
+ for ( int x = 0; x < width; ++x )
+ {
+ QRgb color = color_from(hue,double(x)/width,double(y)/width,1).rgb();
+ inner_selector_buffer[width * y + x] = color;
+ }
+ }
+ }
+
+ /**
+ * \brief renders the selector as a triangle
+ * \note It's the same as a square with the edge with value=0 collapsed to a single point
+ */
+ void render_triangle()
+ {
+ QSizeF size = selector_size();
+ if ( size.height() > max_size )
+ size *= max_size / size.height();
+
+ qreal ycenter = size.height()/2;
+
+ QSize isize = size.toSize();
+ init_buffer(isize);
+
+ for (int x = 0; x < isize.width(); x++ )
+ {
+ qreal pval = x / size.height();
+ qreal slice_h = size.height() * pval;
+ for (int y = 0; y < isize.height(); y++ )
+ {
+ qreal ymin = ycenter-slice_h/2;
+ qreal psat = qBound(0.0,(y-ymin)/slice_h,1.0);
+ QRgb color = color_from(hue,psat,pval,1).rgb();
+ inner_selector_buffer[isize.width() * y + x] = color;
+ }
+ }
+ }
+
+ /// Updates the inner image that displays the saturation-value selector
+ void render_inner_selector()
+ {
+ if ( selector_shape == ShapeTriangle )
+ render_triangle();
+ else
+ render_square();
+ }
+
+ /// Offset of the selector image
+ QPointF selector_image_offset()
+ {
+ if ( selector_shape == ShapeTriangle )
+ return QPointF(-inner_radius(),-triangle_side()/2);
+ return QPointF(-square_size()/2,-square_size()/2);
+ }
+
+ /**
+ * \brief Size of the selector when rendered to the screen
+ */
+ QSizeF selector_size()
+ {
+ if ( selector_shape == ShapeTriangle )
+ return QSizeF(triangle_height(), triangle_side());
+ return QSizeF(square_size(), square_size());
+ }
+
+
+ /// Rotation of the selector image
+ qreal selector_image_angle()
+ {
+ if ( selector_shape == ShapeTriangle )
+ {
+ if ( rotating_selector )
+ return -hue*360-60;
+ return -150;
+ }
+ else
+ {
+ if ( rotating_selector )
+ return -hue*360-45;
+ else
+ return 180;
+ }
+ }
+
+ /// Updates the outer ring that displays the hue selector
+ void render_ring()
+ {
+ hue_ring = QPixmap(outer_radius()*2,outer_radius()*2);
+ hue_ring.fill(Qt::transparent);
+ QPainter painter(&hue_ring);
+ painter.setRenderHint(QPainter::Antialiasing);
+ painter.setCompositionMode(QPainter::CompositionMode_Source);
+
+
+ const int hue_stops = 24;
+ QConicalGradient gradient_hue(0, 0, 0);
+ if ( gradient_hue.stops().size() < hue_stops )
+ {
+ for ( double a = 0; a < 1.0; a+=1.0/(hue_stops-1) )
+ {
+ gradient_hue.setColorAt(a,rainbow_from_hue(a));
+ }
+ gradient_hue.setColorAt(1,rainbow_from_hue(0));
+ }
+
+ painter.translate(outer_radius(),outer_radius());
+
+ painter.setPen(Qt::NoPen);
+ painter.setBrush(QBrush(gradient_hue));
+ painter.drawEllipse(QPointF(0,0),outer_radius(),outer_radius());
+
+ painter.setBrush(Qt::transparent);//palette().background());
+ painter.drawEllipse(QPointF(0,0),inner_radius(),inner_radius());
+ }
+
+ void set_color(const QColor& c)
+ {
+ float nice_hue = c.hsvHueF();
+ if ( nice_hue < 0 )
+ nice_hue = c.hslHueF();
+ if ( nice_hue < 0 )
+ nice_hue = hue;
+
+ switch ( color_space )
+ {
+ case ColorHSV:
+ hue = nice_hue;
+ sat = c.hsvSaturationF();
+ val = c.valueF();
+ break;
+ case ColorHSL:
+ hue = nice_hue;
+ sat = utils::color_HSL_saturationF(c);
+ val = utils::color_lightnessF(c);
+ break;
+ case ColorLCH:
+ hue = nice_hue;
+ sat = utils::color_chromaF(c);
+ val = utils::color_lumaF(c);
+ break;
+ }
+ }
+
+ void draw_ring_editor(double editor_hue, QPainter& painter, QColor color) {
+ painter.setPen(QPen(color,3));
+ painter.setBrush(Qt::NoBrush);
+ QLineF ray(0, 0, outer_radius(), 0);
+ ray.setAngle(editor_hue*360);
+ QPointF h1 = ray.p2();
+ ray.setLength(inner_radius());
+ QPointF h2 = ray.p2();
+ painter.drawLine(h1,h2);
+ }
+
+};
+
+} // namespace color_widgets
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/colorwidgets_global.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/colorwidgets_global.hpp
new file mode 100644
index 00000000..ea1cf338
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/colorwidgets_global.hpp
@@ -0,0 +1,14 @@
+#ifndef QT_COLOR_WIDGETS_GLOBAL_H
+#define QT_COLOR_WIDGETS_GLOBAL_H
+
+#include
+
+#if defined(QTCOLORWIDGETS_STATICALLY_LINKED)
+# define QCP_EXPORT
+#elif defined(QTCOLORWIDGETS_LIBRARY)
+# define QCP_EXPORT Q_DECL_EXPORT
+#else
+# define QCP_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // QT_COLOR_WIDGETS_GLOBAL_H
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/gradient_delegate.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/gradient_delegate.hpp
new file mode 100644
index 00000000..7f2940f4
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/gradient_delegate.hpp
@@ -0,0 +1,103 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+#ifndef COLOR_WIDGETS_GRADIENT_DELEGATE_HPP
+#define COLOR_WIDGETS_GRADIENT_DELEGATE_HPP
+
+
+#include
+#include
+
+#include "QtColorWidgets/gradient_editor.hpp"
+
+namespace color_widgets {
+
+/**
+ * \brief Item delegate to edits gradients
+ *
+ * In order to make it work, return as edit data from the model a QBrush with a gradient
+ */
+class QCP_EXPORT GradientDelegate : public QStyledItemDelegate
+{
+ Q_OBJECT
+
+public:
+ QWidget * createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const Q_DECL_OVERRIDE
+ {
+ QVariant data = index.data(Qt::EditRole);
+ if ( data.canConvert() )
+ {
+ QBrush brush = data.value();
+ if ( brush.gradient() )
+ {
+ GradientEditor* editor = new GradientEditor(parent);
+ editor->setStops(brush.gradient()->stops());
+ return editor;
+ }
+ }
+
+ return QStyledItemDelegate::createEditor(parent, option, index);
+ }
+
+ void setModelData(QWidget * widget, QAbstractItemModel * model, const QModelIndex & index) const Q_DECL_OVERRIDE
+ {
+ if ( GradientEditor* editor = qobject_cast(widget) )
+ model->setData(index, QBrush(editor->gradient()), Qt::EditRole);
+ else
+ QStyledItemDelegate::setModelData(widget, model, index);
+ }
+
+ void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const Q_DECL_OVERRIDE
+ {
+ QVariant display_data = index.data(Qt::DisplayRole);
+ QVariant gradient_data = display_data.isValid() ? display_data : index.data(Qt::EditRole);
+ if ( gradient_data.canConvert() )
+ {
+ QBrush brush = gradient_data.value();
+ if ( brush.gradient() )
+ {
+ QBrush background;
+ background.setTexture(QPixmap(QStringLiteral(":/color_widgets/alphaback.png")));
+ painter->fillRect(option.rect, background);
+
+ QLinearGradient g(option.rect.topLeft(), option.rect.topRight());
+ g.setStops(brush.gradient()->stops());
+ painter->fillRect(option.rect, g);
+
+ if ( option.state & QStyle::State_Selected )
+ {
+ int border = 2;
+ painter->setBrush(Qt::transparent);
+ painter->setPen(QPen(option.palette.highlight(), border));
+ painter->drawRect(option.rect.adjusted(border/2, border/2, -border/2, -border/2));
+ }
+ return;
+ }
+ }
+
+ QStyledItemDelegate::paint(painter, option, index);
+ }
+};
+
+} // namespace color_widgets
+
+#endif // COLOR_WIDGETS_GRADIENT_DELEGATE_HPP
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/gradient_editor.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/gradient_editor.hpp
new file mode 100644
index 00000000..196f8670
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/gradient_editor.hpp
@@ -0,0 +1,123 @@
+/**
+ * \file gradient_editor.hpp
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef GRADIENT_EDITOR_HPP
+#define GRADIENT_EDITOR_HPP
+
+#include "colorwidgets_global.hpp"
+
+#include
+#include
+
+namespace color_widgets {
+
+class ColorDialog;
+
+/**
+ * \brief A slider that moves on top of a gradient
+ */
+class QCP_EXPORT GradientEditor : public QWidget
+{
+ Q_OBJECT
+ Q_PROPERTY(QBrush background READ background WRITE setBackground NOTIFY backgroundChanged)
+ Q_PROPERTY(QGradientStops stops READ stops WRITE setStops NOTIFY stopsChanged)
+ Q_PROPERTY(QLinearGradient gradient READ gradient WRITE setGradient)
+ Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
+ Q_PROPERTY(int selectedStop READ selectedStop WRITE setSelectedStop NOTIFY selectedStopChanged)
+ Q_PROPERTY(QColor selectedColor READ selectedColor WRITE setSelectedColor)
+
+public:
+ explicit GradientEditor(QWidget *parent = 0);
+ explicit GradientEditor(Qt::Orientation orientation, QWidget *parent = 0);
+ ~GradientEditor();
+
+ QSize sizeHint() const override;
+
+ /// Get the background, it's visible for transparent gradient stops
+ QBrush background() const;
+ /// Set the background, it's visible for transparent gradient stops
+ void setBackground(const QBrush &bg);
+
+ /// Get the colors that make up the gradient
+ QGradientStops stops() const;
+ /// Set the colors that make up the gradient
+ void setStops(const QGradientStops &colors);
+
+ /// Get the gradient
+ QLinearGradient gradient() const;
+ /// Set the gradient
+ void setGradient(const QLinearGradient &gradient);
+
+ Qt::Orientation orientation() const;
+
+ /**
+ * \brief Dialog shown when double clicking a stop
+ */
+ ColorDialog* dialog() const;
+
+ /**
+ * \brief Index of the currently selected gradient stop (or -1 if there is no selection)
+ */
+ int selectedStop() const;
+
+ /**
+ * \brief Color of the selected stop
+ */
+ QColor selectedColor() const;
+
+public Q_SLOTS:
+ void setOrientation(Qt::Orientation);
+ void setSelectedStop(int stop);
+ void setSelectedColor(const QColor& color);
+ void addStop();
+ void removeStop();
+
+Q_SIGNALS:
+ void backgroundChanged(const QBrush&);
+ void stopsChanged(const QGradientStops&);
+ void selectedStopChanged(int);
+
+protected:
+ void paintEvent(QPaintEvent *ev) override;
+
+ void mousePressEvent(QMouseEvent *ev) override;
+ void mouseMoveEvent(QMouseEvent *ev) override;
+ void mouseReleaseEvent(QMouseEvent *ev) override;
+ void leaveEvent(QEvent * event) override;
+ void mouseDoubleClickEvent(QMouseEvent *event) override;
+
+ void dragEnterEvent(QDragEnterEvent *event) override;
+ void dragMoveEvent(QDragMoveEvent* event) override;
+ void dragLeaveEvent(QDragLeaveEvent *event) override;
+ void dropEvent(QDropEvent* event) override;
+
+private Q_SLOTS:
+ void dialogUpdate(const QColor& c);
+
+private:
+ class Private;
+ Private * const p;
+};
+
+} // namespace color_widgets
+
+#endif // GRADIENT_EDITOR_HPP
+
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/gradient_helper.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/gradient_helper.hpp
new file mode 100644
index 00000000..a1a81112
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/gradient_helper.hpp
@@ -0,0 +1,98 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef GRADIENT_HELPER_HPP
+#define GRADIENT_HELPER_HPP
+
+#include "colorwidgets_global.hpp"
+
+#include
+
+namespace color_widgets {
+
+inline QColor blendColors(const QColor& a, const QColor& b, qreal ratio)
+{
+ return QColor::fromRgbF(
+ a.redF() * (1-ratio) + b.redF() * ratio,
+ a.greenF() * (1-ratio) + b.greenF() * ratio,
+ a.blueF() * (1-ratio) + b.blueF() * ratio,
+ a.alphaF() * (1-ratio) + b.alphaF() * ratio
+ );
+}
+
+
+/**
+ * \brief Get an insertion point in the gradient
+ * \param gradient Gradient stops to look into (must be properly set up)
+ * \param factor Value in [0, 1] to get the color for
+ * \return A pair whose first element is the index to insert the new value at, and a GradientStop
+ */
+inline QPair Q_DECL_EXPORT gradientBlendedColorInsert(const QGradientStops& gradient, qreal factor)
+{
+ if ( gradient.empty() )
+ return {0, {0, QColor()}};
+
+ if ( gradient.size() == 1 || factor <= 0 )
+ return {0, gradient.front()};
+
+ int i = 0;
+ QGradientStop s1;
+ for ( auto s2 : gradient )
+ {
+ if ( factor < s2.first )
+ {
+ qreal ratio = (factor - s1.first) / (s2.first - s1.first);
+ return {i, {factor, blendColors(s1.second, s2.second, ratio)}};
+ }
+ s1 = s2;
+ ++i;
+ }
+
+ return {gradient.size(), gradient.back()};
+}
+
+/**
+ * \brief Returns a color in the gradient
+ * \param gradient Gradient stops to look into (must be properly set up)
+ * \param factor Value in [0, 1] to get the color for
+ */
+inline QColor Q_DECL_EXPORT gradientBlendedColor(const QGradientStops& gradient, qreal factor)
+{
+ return gradientBlendedColorInsert(gradient, factor).second.second;
+}
+
+/**
+ * \brief Returns a color in the gradient
+ * \param gradient Gradient to look into
+ * \param factor Value in [0, 1] to get the color for
+ */
+inline QColor Q_DECL_EXPORT gradientBlendedColor(const QGradient& gradient, qreal factor)
+{
+ return gradientBlendedColor(gradient.stops(), factor);
+}
+
+} // namespace color_widgets
+
+
+
+
+#endif // GRADIENT_HELPER_HPP
+
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/gradient_list_model.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/gradient_list_model.hpp
new file mode 100644
index 00000000..9c711e09
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/gradient_list_model.hpp
@@ -0,0 +1,173 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_WIDGETS_GRADIENT_LIST_MODEL_HPP
+#define COLOR_WIDGETS_GRADIENT_LIST_MODEL_HPP
+
+#include "colorwidgets_global.hpp"
+
+#include
+#include
+#include
+
+namespace color_widgets {
+
+class QCP_EXPORT GradientListModel : public QAbstractListModel
+{
+ Q_OBJECT
+
+ /**
+ * \brief Size of the icon used for the gradient previews
+ */
+ Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize NOTIFY iconSizeChanged)
+
+ Q_PROPERTY(ItemEditMode editMode READ editMode WRITE setEditMode NOTIFY editModeChanged)
+
+public:
+ enum ItemEditMode
+ {
+ EditNone = 0,
+ EditName,
+ EditGradient,
+ };
+
+ Q_ENUM(ItemEditMode);
+
+ GradientListModel(QObject *parent = nullptr);
+ ~GradientListModel();
+ int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
+ Qt::ItemFlags flags(const QModelIndex & index) const Q_DECL_OVERRIDE;
+ bool setData(const QModelIndex & index, const QVariant & value, int role) Q_DECL_OVERRIDE;
+
+ QSize iconSize() const;
+
+ /**
+ * \brief Number of gradients
+ */
+ int count() const;
+
+ /**
+ * \brief Remove all gradients
+ */
+ void clear();
+
+ /**
+ * \brief Returns a reference to the first gradient with the given name
+ * \pre hasGradient(name)
+ */
+ const QLinearGradient& gradient(const QString& name) const;
+
+ /**
+ * \brief Returns a reference to the first gradient with the given name
+ * \pre hasGradient(name)
+ */
+ QGradientStops gradientStops(const QString& name) const;
+
+ /**
+ * \brief Whether a gradient with the given name exists in the model
+ */
+ bool hasGradient(const QString& name) const;
+
+ /**
+ * \brief Get the gradient at the given index (row)
+ * \pre 0 <= index < count()
+ */
+ const QLinearGradient& gradient(int index) const;
+
+ /**
+ * \brief Get the gradient stops at the given index (row)
+ * \pre 0 <= index < count()
+ */
+ QGradientStops gradientStops(int index) const;
+
+ /**
+ * \brief Inserts or updates a gradient
+ * \returns The index for the new gradient
+ */
+ int setGradient(const QString& name, const QGradient& gradient);
+
+ int setGradient(const QString& name, const QGradientStops& gradient);
+
+ /**
+ * \brief Updates the gradient at \p index
+ */
+ bool setGradient(int index, const QGradient& gradient);
+
+ bool setGradient(int index, const QGradientStops& gradient);
+
+ /**
+ * \brief Renames the gradient at \p index
+ * \returns \b true on success
+ */
+ bool rename(int index, const QString& new_name);
+
+ /**
+ * \brief Renames a gradient
+ * \returns \b true on success
+ */
+ bool rename(const QString& old_name, const QString& new_name);
+
+ /**
+ * \brief Remove a gradient from the model
+ * \returns \b true if the gradient has been successfully removed
+ */
+ bool removeGradient(const QString& name);
+
+
+ bool removeGradient(int index);
+
+ /**
+ * \brief The index of the gradient with the given name
+ * \returns -1 if none is found
+ */
+ int indexFromName(const QString& name) const;
+
+ /**
+ * \brief Name of the gradient at index
+ */
+ QString nameFromIndex(int index) const;
+
+ ItemEditMode editMode() const;
+
+ /**
+ * \brief Brush for a gradient
+ * \pre 0 <= \p index < count()
+ */
+ QBrush gradientBrush(int index) const;
+
+public Q_SLOTS:
+ void setIconSize(const QSize& iconSize);
+ void setEditMode(ItemEditMode mode);
+
+Q_SIGNALS:
+ void iconSizeChanged(const QSize& iconSize);
+ void editModeChanged(ItemEditMode mode);
+
+private:
+ class Private;
+ std::unique_ptr d;
+};
+
+} // namespace color_widgets
+
+#endif // COLOR_WIDGETS_GRADIENT_LIST_MODEL_HPP
+
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/gradient_slider.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/gradient_slider.hpp
new file mode 100644
index 00000000..ef7908dd
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/gradient_slider.hpp
@@ -0,0 +1,117 @@
+/**
+ * \file gradient_slider.hpp
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ * \copyright Copyright (C) 2014 Calle Laakkonen
+ * \copyright Copyright (C) 2017 caryoscelus
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef GRADIENT_SLIDER_HPP
+#define GRADIENT_SLIDER_HPP
+
+#include "colorwidgets_global.hpp"
+
+#include
+#include
+
+namespace color_widgets {
+
+/**
+ * \brief A slider that moves on top of a gradient
+ */
+class QCP_EXPORT GradientSlider : public QSlider
+{
+ Q_OBJECT
+ Q_PROPERTY(QBrush background READ background WRITE setBackground NOTIFY backgroundChanged)
+ Q_PROPERTY(QGradientStops colors READ colors WRITE setColors DESIGNABLE false)
+ Q_PROPERTY(QColor firstColor READ firstColor WRITE setFirstColor STORED false)
+ Q_PROPERTY(QColor lastColor READ lastColor WRITE setLastColor STORED false)
+ Q_PROPERTY(QLinearGradient gradient READ gradient WRITE setGradient)
+
+public:
+ explicit GradientSlider(QWidget *parent = 0);
+ explicit GradientSlider(Qt::Orientation orientation, QWidget *parent = 0);
+ ~GradientSlider();
+
+ /// Get the background, it's visible for transparent gradient stops
+ QBrush background() const;
+ /// Set the background, it's visible for transparent gradient stops
+ void setBackground(const QBrush &bg);
+
+ /// Get the colors that make up the gradient
+ QGradientStops colors() const;
+ /// Set the colors that make up the gradient
+ void setColors(const QGradientStops &colors);
+
+ /// Get the gradient
+ QLinearGradient gradient() const;
+ /// Set the gradient
+ void setGradient(const QLinearGradient &gradient);
+
+ /**
+ * Overload: create an evenly distributed gradient of the given colors
+ */
+ void setColors(const QVector &colors);
+
+ /**
+ * \brief Set the first color of the gradient
+ *
+ * If the gradient is currently empty it will create a stop with the given color
+ */
+ void setFirstColor(const QColor &c);
+
+ /**
+ * \brief Set the last color of the gradient
+ *
+ * If the gradient is has less than two colors,
+ * it will create a stop with the given color
+ */
+ void setLastColor(const QColor &c);
+
+ /**
+ * \brief Get the first color
+ *
+ * \returns QColor() con empty gradient
+ */
+ QColor firstColor() const;
+
+ /**
+ * \brief Get the last color
+ *
+ * \returns QColor() con empty gradient
+ */
+ QColor lastColor() const;
+
+Q_SIGNALS:
+ void backgroundChanged(const QBrush&);
+
+protected:
+ void paintEvent(QPaintEvent *ev) override;
+
+ void mousePressEvent(QMouseEvent *ev) override;
+ void mouseMoveEvent(QMouseEvent *ev) override;
+ void mouseReleaseEvent(QMouseEvent *ev) override;
+
+private:
+ class Private;
+ Private * const p;
+};
+
+} // namespace color_widgets
+
+#endif // GRADIENT_SLIDER_HPP
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/harmony_color_wheel.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/harmony_color_wheel.hpp
new file mode 100644
index 00000000..72e774eb
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/harmony_color_wheel.hpp
@@ -0,0 +1,95 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ * \copyright Copyright (C) 2017 caryoscelus
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef HARMONY_COLOR_WHEEL_HPP
+#define HARMONY_COLOR_WHEEL_HPP
+
+
+#include "color_wheel.hpp"
+
+namespace color_widgets {
+
+/**
+ * \brief ColorWheel with color harmonies
+ */
+class QCP_EXPORT HarmonyColorWheel : public ColorWheel
+{
+ Q_OBJECT
+
+public:
+ explicit HarmonyColorWheel(QWidget *parent = 0);
+ ~HarmonyColorWheel();
+
+ /// Get all harmony colors (including main)
+ QList harmonyColors() const;
+
+ /// Get number of harmony colors (including main)
+ unsigned int harmonyCount() const;
+
+ /// Clear harmony color scheme
+ void clearHarmonies();
+
+ /**
+ * @brief Add harmony color
+ * @param hue_diff Initial hue difference (in [0-1) range)
+ * @param editable Whether this harmony should be editable
+ * @returns Index of newly added harmony
+ */
+ unsigned addHarmony(double hue_diff, bool editable);
+
+ /**
+ * @brief Add symmetric harmony color
+ * @param relative_to Index of other harmony that should be symmetric relative to main hue
+ * @returns Index of newly added harmony
+ * Editability is inherited from symmetric editor
+ */
+ unsigned addSymmetricHarmony(unsigned relative_to);
+
+ /**
+ * @brief Add opposite harmony color
+ * @param relative_to Index of other harmony that should be opposite to this
+ * @returns Index of newly added harmony
+ * Editability is inherited from opposite editor
+ */
+ unsigned addOppositeHarmony(unsigned relative_to);
+
+Q_SIGNALS:
+ /**
+ * Emitted when harmony settings or harmony colors are changed (including due to main hue change)
+ */
+ void harmonyChanged();
+
+protected:
+ void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+
+private:
+ class Private;
+ Private * p;
+};
+
+} // namespace color_widgets
+
+#endif // COLOR_WHEEL_HPP
+
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/hue_slider.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/hue_slider.hpp
new file mode 100644
index 00000000..fd3fc939
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/hue_slider.hpp
@@ -0,0 +1,100 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2014 Calle Laakkonen
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef HUE_SLIDER_HPP
+#define HUE_SLIDER_HPP
+
+#include "gradient_slider.hpp"
+
+namespace color_widgets {
+
+/**
+ * \brief A slider for selecting a hue value
+ */
+class QCP_EXPORT HueSlider : public GradientSlider
+{
+ Q_OBJECT
+ /**
+ * \brief Saturation used in the rainbow gradient, as a [0-1] float
+ */
+ Q_PROPERTY(qreal colorSaturation READ colorSaturation WRITE setColorSaturation NOTIFY colorSaturationChanged)
+ /**
+ * \brief Value used in the rainbow gradient, as a [0-1] float
+ */
+ Q_PROPERTY(qreal colorValue READ colorValue WRITE setColorValue NOTIFY colorValueChanged)
+ /**
+ * \brief Alpha used in the rainbow gradient, as a [0-1] float
+ */
+ Q_PROPERTY(qreal colorAlpha READ colorAlpha WRITE setColorAlpha NOTIFY colorAlphaChanged)
+
+ /**
+ * \brief Color with corresponding color* components
+ */
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+
+ /**
+ * \brief Normalized Hue, as indicated from the slider
+ */
+ Q_PROPERTY(qreal colorHue READ colorHue WRITE setColorHue NOTIFY colorHueChanged)
+
+
+public:
+ explicit HueSlider(QWidget *parent = nullptr);
+ explicit HueSlider(Qt::Orientation orientation, QWidget *parent = nullptr);
+ ~HueSlider();
+
+ qreal colorSaturation() const;
+ qreal colorValue() const;
+ qreal colorAlpha() const;
+ QColor color() const;
+ qreal colorHue() const;
+
+public Q_SLOTS:
+ void setColorValue(qreal value);
+ void setColorSaturation(qreal value);
+ void setColorAlpha(qreal alpha);
+ void setColorHue(qreal colorHue);
+ /**
+ * \brief Set Hue Saturation and ColorValue, ignoring alpha
+ */
+ void setColor(const QColor& color);
+ /**
+ * \brief Set Hue Saturation, ColorValue and Alpha
+ */
+ void setFullColor(const QColor& color);
+
+Q_SIGNALS:
+ void colorHueChanged(qreal colorHue);
+ void colorChanged(QColor);
+ void colorAlphaChanged(qreal v);
+ void colorSaturationChanged(qreal v);
+ void colorValueChanged(qreal v);
+
+private:
+ class Private;
+ Private * const p;
+};
+
+} // namespace color_widgets
+
+#endif // HUE_SLIDER_HPP
+
diff --git a/external/Qt-Color-Widgets/include/QtColorWidgets/swatch.hpp b/external/Qt-Color-Widgets/include/QtColorWidgets/swatch.hpp
new file mode 100644
index 00000000..46e55ee0
--- /dev/null
+++ b/external/Qt-Color-Widgets/include/QtColorWidgets/swatch.hpp
@@ -0,0 +1,214 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#ifndef COLOR_WIDGETS_SWATCH_HPP
+#define COLOR_WIDGETS_SWATCH_HPP
+
+#include
+#include
+#include "color_palette.hpp"
+
+namespace color_widgets {
+
+/**
+ * \brief A widget drawing a palette
+ */
+class QCP_EXPORT Swatch : public QWidget
+{
+ Q_OBJECT
+
+ /**
+ * \brief Palette shown by the widget
+ */
+ Q_PROPERTY(const ColorPalette& palette READ palette WRITE setPalette NOTIFY paletteChanged)
+ /**
+ * \brief Currently selected color (-1 if no color is selected)
+ */
+ Q_PROPERTY(int selected READ selected WRITE setSelected NOTIFY selectedChanged)
+
+ /**
+ * \brief Preferred size for a color square
+ */
+ Q_PROPERTY(QSize colorSize READ colorSize WRITE setColorSize NOTIFY colorSizeChanged)
+
+ Q_PROPERTY(ColorSizePolicy colorSizePolicy READ colorSizePolicy WRITE setColorSizePolicy NOTIFY colorSizePolicyChanged)
+
+ /**
+ * \brief Border around the colors
+ */
+ Q_PROPERTY(QPen border READ border WRITE setBorder NOTIFY borderChanged)
+
+ /**
+ * \brief Forces the Swatch to display that many rows of colors
+ *
+ * If there are too few elements, the widget will display less than this
+ * many rows.
+ *
+ * A value of0 means that the number of rows is automatic.
+ *
+ * \note Conflicts with forcedColumns
+ */
+ Q_PROPERTY(int forcedRows READ forcedRows WRITE setForcedRows NOTIFY forcedRowsChanged)
+
+ /**
+ * \brief Forces the Swatch to display that many columns of colors
+ *
+ * If there are too few elements, the widget will display less than this
+ * many columns.
+ *
+ * A value of 0 means that the number of columns is automatic.
+ *
+ * \note Conflicts with forcedRows
+ */
+ Q_PROPERTY(int forcedColumns READ forcedColumns WRITE setForcedColumns NOTIFY forcedColumnsChanged)
+
+ /**
+ * \brief Whether the palette can be modified via user interaction
+ * \note Even when this is \b false, it can still be altered programmatically
+ */
+ Q_PROPERTY(bool readOnly READ readOnly WRITE setReadOnly NOTIFY readOnlyChanged)
+
+
+ /**
+ * \brief Maximum size a color square can have
+ */
+ Q_PROPERTY(QSize maxColorSize READ maxColorSize WRITE setMaxColorSize NOTIFY maxColorSizeChanged)
+
+ /**
+ * \brief Whether to show an extra color to perform a "clear" operation.
+ *
+ * Clicking on this extra pseudo-color will emit signals like clicked() etc with an index of -1.
+ */
+ Q_PROPERTY(bool showClearColor READ showClearColor WRITE setShowClearColor NOTIFY showClearColorChanged)
+
+public:
+ enum ColorSizePolicy
+ {
+ Hint, ///< The size is just a hint
+ Minimum, ///< Can expand but not contract
+ Fixed ///< Must be exactly as specified
+ };
+ Q_ENUMS(ColorSizePolicy)
+
+ Swatch(QWidget* parent = 0);
+ ~Swatch();
+
+ QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+
+ const ColorPalette& palette() const;
+ ColorPalette& palette();
+ int selected() const;
+ /**
+ * \brief Color at the currently selected index
+ */
+ QColor selectedColor() const;
+
+ /**
+ * \brief Color index at the given position within the widget
+ * \param p Point in local coordinates
+ * \returns -1 if the position doesn't represent any color
+ */
+ int indexAt(const QPoint& p);
+
+ /**
+ * \brief Color at the given position within the widget
+ * \param p Point in local coordinates
+ */
+ QColor colorAt(const QPoint& p);
+
+ QSize colorSize() const;
+ QSize maxColorSize() const;
+ ColorSizePolicy colorSizePolicy() const;
+ QPen border() const;
+
+ int forcedRows() const;
+ int forcedColumns() const;
+
+ bool readOnly() const;
+
+ bool showClearColor() const;
+
+public Q_SLOTS:
+ void setPalette(const ColorPalette& palette);
+ void setSelected(int selected);
+ void clearSelection();
+ void setColorSize(const QSize& colorSize);
+ void setMaxColorSize(const QSize& colorSize);
+ void setColorSizePolicy(ColorSizePolicy colorSizePolicy);
+ void setBorder(const QPen& border);
+ void setForcedRows(int forcedRows);
+ void setForcedColumns(int forcedColumns);
+ void setReadOnly(bool readOnly);
+ /**
+ * \brief Remove the currently seleceted color
+ **/
+ void removeSelected();
+ void setShowClearColor(bool show);
+
+Q_SIGNALS:
+ void paletteChanged(const ColorPalette& palette);
+ void selectedChanged(int selected);
+ void colorSelected(const QColor& color);
+ void colorSizeChanged(const QSize& colorSize);
+ void maxColorSizeChanged(const QSize& colorSize);
+ void colorSizePolicyChanged(ColorSizePolicy colorSizePolicy);
+ void doubleClicked(int index, Qt::KeyboardModifiers modifiers);
+ void rightClicked(int index, Qt::KeyboardModifiers modifiers);
+ void clicked(int index, Qt::KeyboardModifiers modifiers);
+ void forcedRowsChanged(int forcedRows);
+ void forcedColumnsChanged(int forcedColumns);
+ void readOnlyChanged(bool readOnly);
+ void borderChanged(const QPen& border);
+ void showClearColorChanged(bool show);
+
+protected:
+ bool event(QEvent* event) Q_DECL_OVERRIDE;
+
+ void paintEvent(QPaintEvent* event) Q_DECL_OVERRIDE;
+
+ void keyPressEvent(QKeyEvent* event) Q_DECL_OVERRIDE;
+
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void wheelEvent(QWheelEvent* event) Q_DECL_OVERRIDE;
+
+ void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
+ void dragMoveEvent(QDragMoveEvent* event) Q_DECL_OVERRIDE;
+ void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE;
+ void dropEvent(QDropEvent* event) Q_DECL_OVERRIDE;
+
+protected Q_SLOTS:
+ /**
+ * \brief Connected to the internal palette object to keep eveything consistent
+ */
+ void paletteModified();
+
+private:
+ class Private;
+ Private* p;
+};
+
+
+} // namespace color_widgets
+#endif // COLOR_WIDGETS_SWATCH_HPP
diff --git a/external/Qt-Color-Widgets/refactor.sh b/external/Qt-Color-Widgets/refactor.sh
new file mode 100755
index 00000000..c44af522
--- /dev/null
+++ b/external/Qt-Color-Widgets/refactor.sh
@@ -0,0 +1,99 @@
+#!/bin/bash
+#
+# Copyright (C) 2013-2020 Mattia Basaglia
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see .
+
+################################################################################
+# This script is to refactor the old class names to the new ones #
+# eg: occurrences of Color_Dialog become color_widgets::ColorDialog #
+# This script does very simple text replacements and overwrites existing files #
+# Use with care #
+# Usage: #
+# ./refactor.sh /path/to/sources #
+# #
+################################################################################
+
+old_classes=(
+ Color_Delegate
+ Color_Dialog
+ Color_List_Widget
+ Color_Preview
+ Color_Selector
+ Color_Wheel
+ Gradient_Slider
+ Hue_Slider
+)
+old_enums=(
+ Button_Mode
+ Display_Mode
+ Update_Mode
+ Display_Enum
+ Display_Flags
+)
+file_extensions=(
+ ui
+ cpp
+ hpp
+ C
+ H
+ h
+ cxx
+ hxx
+)
+
+
+function new_class_name()
+{
+ echo "$1" | sed -e 's/_//g' -r -e 's/^/color_widgets::/'
+}
+
+
+function new_enum_name()
+{
+ echo "$1" | sed -e 's/_//g'
+}
+
+directory="$1"
+
+if [ -z "$directory" ]
+then
+ echo "Usage: $0 (directory)"
+ exit 1
+fi
+
+find_extensions=""
+for ext in ${file_extensions[@]}
+do
+ find_extensions="$find_extensions -o -name '*.$ext'"
+done
+find_extensions="$(echo "$find_extensions" | sed -r 's/ -o //')"
+find_command="find \""$directory"\" -type f -a \( $find_extensions \) -print"
+
+files="$(bash -c "$find_command")"
+
+replacements=""
+for class in ${old_classes[@]}
+do
+ replacements="$replacements $class $(new_class_name $class)"
+done
+for enum in ${old_enums[@]}
+do
+ replacements="$replacements $enum $(new_enum_name $enum)"
+done
+
+for file in $files
+do
+ replace $replacements -- "$file"
+done
diff --git a/external/Qt-Color-Widgets/resources/QtColorWidgets/CMakeLists.txt b/external/Qt-Color-Widgets/resources/QtColorWidgets/CMakeLists.txt
new file mode 100644
index 00000000..ee533e5e
--- /dev/null
+++ b/external/Qt-Color-Widgets/resources/QtColorWidgets/CMakeLists.txt
@@ -0,0 +1,16 @@
+set (SOURCES
+ alphaback.png
+ color_widgets.qrc
+ )
+
+file(RELATIVE_PATH
+ PREFIX
+ ${PROJECT_SOURCE_DIR}
+ ${CMAKE_CURRENT_LIST_DIR})
+
+
+foreach (SOURCE IN LISTS SOURCES)
+ target_sources (${TARGET_NAME}
+ PRIVATE
+ $)
+endforeach (SOURCE IN SOURCES)
diff --git a/external/Qt-Color-Widgets/resources/QtColorWidgets/alphaback.png b/external/Qt-Color-Widgets/resources/QtColorWidgets/alphaback.png
new file mode 100644
index 00000000..b3634a5a
Binary files /dev/null and b/external/Qt-Color-Widgets/resources/QtColorWidgets/alphaback.png differ
diff --git a/external/Qt-Color-Widgets/src/color_widgets.qrc b/external/Qt-Color-Widgets/resources/QtColorWidgets/color_widgets.qrc
similarity index 100%
rename from external/Qt-Color-Widgets/src/color_widgets.qrc
rename to external/Qt-Color-Widgets/resources/QtColorWidgets/color_widgets.qrc
diff --git a/external/Qt-Color-Widgets/src/QtColorWidgets/CMakeLists.txt b/external/Qt-Color-Widgets/src/QtColorWidgets/CMakeLists.txt
new file mode 100644
index 00000000..f1a6c1ba
--- /dev/null
+++ b/external/Qt-Color-Widgets/src/QtColorWidgets/CMakeLists.txt
@@ -0,0 +1,37 @@
+set (SOURCES
+abstract_widget_list.cpp
+bound_color_selector.cpp
+color_2d_slider.cpp
+color_delegate.cpp
+color_dialog.cpp
+color_dialog.ui
+color_line_edit.cpp
+color_list_widget.cpp
+color_names.cpp
+color_palette.cpp
+color_palette_model.cpp
+color_palette_widget.cpp
+color_palette_widget.ui
+color_preview.cpp
+color_selector.cpp
+color_utils.cpp
+color_wheel.cpp
+gradient_slider.cpp
+hue_slider.cpp
+swatch.cpp
+gradient_editor.cpp
+harmony_color_wheel.cpp
+gradient_list_model.cpp
+)
+
+file(RELATIVE_PATH
+ PREFIX
+ ${PROJECT_SOURCE_DIR}
+ ${CMAKE_CURRENT_LIST_DIR})
+
+
+foreach (SOURCE IN LISTS SOURCES)
+ target_sources (${TARGET_NAME}
+ PRIVATE
+ $)
+endforeach (SOURCE IN SOURCES)
diff --git a/external/Qt-Color-Widgets/src/QtColorWidgets/abstract_widget_list.cpp b/external/Qt-Color-Widgets/src/QtColorWidgets/abstract_widget_list.cpp
new file mode 100644
index 00000000..7512d0a5
--- /dev/null
+++ b/external/Qt-Color-Widgets/src/QtColorWidgets/abstract_widget_list.cpp
@@ -0,0 +1,175 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "QtColorWidgets/abstract_widget_list.hpp"
+#include
+#include
+#include
+#include
+
+class AbstractWidgetList::Private
+{
+public:
+ QList widgets;
+ QSignalMapper mapper_up;
+ QSignalMapper mapper_down;
+ QSignalMapper mapper_remove;
+ QTableWidget *table;
+};
+
+AbstractWidgetList::AbstractWidgetList(QWidget *parent) :
+ QWidget(parent), p(new Private)
+{
+ connect(&p->mapper_up,SIGNAL(mapped(QWidget*)),SLOT(up_clicked(QWidget*)));
+ connect(&p->mapper_down,SIGNAL(mapped(QWidget*)),SLOT(down_clicked(QWidget*)));
+ connect(&p->mapper_remove,SIGNAL(mapped(QWidget*)),SLOT(remove_clicked(QWidget*)));
+
+
+ QVBoxLayout *verticalLayout = new QVBoxLayout(this);
+ verticalLayout->setContentsMargins(0, 0, 0, 0);
+ p->table = new QTableWidget(this);
+ verticalLayout->addWidget(p->table);
+
+
+ p->table->insertColumn(0);
+ p->table->insertColumn(1);
+ p->table->insertColumn(2);
+ p->table->insertColumn(3);
+
+ p->table->setColumnWidth(0,128);
+ p->table->setColumnWidth(1,24);
+ p->table->setColumnWidth(2,24);
+ p->table->setColumnWidth(3,24);
+
+ p->table->horizontalHeader()->hide();
+ p->table->verticalHeader()->hide();
+ p->table->setShowGrid(false);
+
+ QPushButton* add_button = new QPushButton(QIcon::fromTheme(QStringLiteral("list-add")),
+ tr("Add New"));
+
+ verticalLayout->addWidget(add_button);
+ connect(add_button,&QAbstractButton::clicked,this, &AbstractWidgetList::append);
+
+}
+
+AbstractWidgetList::~AbstractWidgetList()
+{
+ delete p;
+}
+
+int AbstractWidgetList::count() const
+{
+ return p->widgets.size();
+}
+
+void AbstractWidgetList::setRowHeight(int row, int height)
+{
+ p->table->setRowHeight(row,height);
+}
+
+void AbstractWidgetList::clear()
+{
+ p->widgets.clear();
+ while(p->table->rowCount() > 0)
+ p->table->removeRow(0);
+}
+
+
+void AbstractWidgetList::remove(int i)
+{
+ if ( isValidRow(i) )
+ {
+ p->widgets.removeAt(i);
+ p->table->removeRow(i);
+ if ( i == 0 && !p->widgets.isEmpty() )
+ p->table->cellWidget(0,1)->setEnabled(false);
+ else if ( i != 0 && i == count() )
+ p->table->cellWidget(count()-1,2)->setEnabled(false);
+
+ Q_EMIT removed(i);
+ }
+}
+
+
+void AbstractWidgetList::appendWidget(QWidget *w)
+{
+ int row = count();
+ p->table->insertRow(row);
+
+ QWidget* b_up = create_button(w,&p->mapper_up,QStringLiteral("go-up"),tr("Move Up"));
+ QWidget* b_down = create_button(w,&p->mapper_down,QStringLiteral("go-down"),tr("Move Down"));
+ QWidget* b_remove = create_button(w,&p->mapper_remove,QStringLiteral("list-remove"),tr("Remove"));
+ if ( row == 0 )
+ b_up->setEnabled(false);
+ else
+ p->table->cellWidget(row-1,2)->setEnabled(true);
+ b_down->setEnabled(false);
+
+ p->table->setCellWidget(row,0,w);
+ p->table->setCellWidget(row,1,b_up);
+ p->table->setCellWidget(row,2,b_down);
+ p->table->setCellWidget(row,3,b_remove);
+
+ p->widgets.push_back(w);
+}
+
+QWidget *AbstractWidgetList::widget(int i)
+{
+ if ( isValidRow(i) )
+ return p->widgets[i];
+ return 0;
+}
+
+
+QWidget *AbstractWidgetList::create_button(QWidget *data, QSignalMapper *mapper,
+ QString icon_name,
+ QString text, QString tooltip) const
+{
+
+ QToolButton* btn = new QToolButton;
+ btn->setIcon(QIcon::fromTheme(icon_name));
+ btn->setText(text);
+ btn->setToolTip(tooltip.isNull() ? btn->text() : tooltip );
+ connect(btn,SIGNAL(clicked()),mapper,SLOT(map()));
+ mapper->setMapping(btn,data);
+ return btn;
+}
+
+void AbstractWidgetList::remove_clicked(QWidget *w)
+{
+ int row = p->widgets.indexOf(w);
+ remove(row);
+}
+
+void AbstractWidgetList::up_clicked(QWidget *w)
+{
+ int row = p->widgets.indexOf(w);
+ if ( row > 0 )
+ swap(row,row-1);
+}
+
+void AbstractWidgetList::down_clicked(QWidget *w)
+{
+ int row = p->widgets.indexOf(w);
+ if ( row+1 < count() )
+ swap(row,row+1);
+}
diff --git a/external/Qt-Color-Widgets/src/QtColorWidgets/bound_color_selector.cpp b/external/Qt-Color-Widgets/src/QtColorWidgets/bound_color_selector.cpp
new file mode 100644
index 00000000..abb801d9
--- /dev/null
+++ b/external/Qt-Color-Widgets/src/QtColorWidgets/bound_color_selector.cpp
@@ -0,0 +1,38 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "QtColorWidgets/bound_color_selector.hpp"
+
+namespace color_widgets {
+
+BoundColorSelector::BoundColorSelector(QColor* reference, QWidget *parent) :
+ ColorSelector(parent), ref(reference)
+{
+ setColor(*reference);
+ connect(this,&ColorPreview::colorChanged,this, &BoundColorSelector::update_reference);
+}
+
+void BoundColorSelector::update_reference(QColor c)
+{
+ *ref = c;
+}
+
+} // namespace color_widgets
diff --git a/external/Qt-Color-Widgets/src/QtColorWidgets/color_2d_slider.cpp b/external/Qt-Color-Widgets/src/QtColorWidgets/color_2d_slider.cpp
new file mode 100644
index 00000000..892765fb
--- /dev/null
+++ b/external/Qt-Color-Widgets/src/QtColorWidgets/color_2d_slider.cpp
@@ -0,0 +1,267 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "QtColorWidgets/color_2d_slider.hpp"
+#include "QtColorWidgets/color_utils.hpp"
+#include
+#include
+#include
+#include
+
+namespace color_widgets {
+
+static const double selector_radius = 6;
+
+class Color2DSlider::Private
+{
+public:
+ qreal hue = 1, sat = 1, val = 1;
+ Component comp_x = Saturation;
+ Component comp_y = Value;
+ QImage square;
+
+ qreal PixHue(float x, float y)
+ {
+ if ( comp_x == Hue )
+ return x;
+ if ( comp_y == Hue )
+ return y;
+ return hue;
+ }
+
+ qreal PixSat(float x, float y)
+ {
+ if ( comp_x == Saturation )
+ return x;
+ if ( comp_y == Saturation )
+ return y;
+ return sat;
+ }
+
+ qreal PixVal(float x, float y)
+ {
+ if ( comp_x == Value )
+ return x;
+ if ( comp_y == Value )
+ return y;
+ return val;
+ }
+
+ void renderSquare(const QSize& size)
+ {
+ square = QImage(size, QImage::Format_RGB32);
+
+ for ( int y = 0; y < size.height(); ++y )
+ {
+ qreal yfloat = 1 - qreal(y) / size.height();
+ for ( int x = 0; x < size.width(); ++x )
+ {
+ qreal xfloat = qreal(x) / size.width();
+ square.setPixel( x, y, QColor::fromHsvF(
+ PixHue(xfloat, yfloat),
+ PixSat(xfloat, yfloat),
+ PixVal(xfloat, yfloat)
+ ).rgb());
+ }
+ }
+ }
+
+ QPointF selectorPos(const QSize& size)
+ {
+ QPointF pt;
+ switch ( comp_x )
+ {
+ case Hue: pt.setX(size.width()*hue); break;
+ case Saturation:pt.setX(size.width()*sat); break;
+ case Value: pt.setX(size.width()*val); break;
+ }
+ switch ( comp_y )
+ {
+ case Hue: pt.setY(size.height()*(1-hue)); break;
+ case Saturation:pt.setY(size.height()*(1-sat)); break;
+ case Value: pt.setY(size.height()*(1-val)); break;
+ }
+ return pt;
+ }
+
+ void setColorFromPos(const QPoint& pt, const QSize& size)
+ {
+ QPointF ptfloat(
+ qBound(0.0, qreal(pt.x()) / size.width(), 1.0),
+ qBound(0.0, 1 - qreal(pt.y()) / size.height(), 1.0)
+ );
+ switch ( comp_x )
+ {
+ case Hue: hue = ptfloat.x(); break;
+ case Saturation:sat = ptfloat.x(); break;
+ case Value: val = ptfloat.x(); break;
+ }
+ switch ( comp_y )
+ {
+ case Hue: hue = ptfloat.y(); break;
+ case Saturation:sat = ptfloat.y(); break;
+ case Value: val = ptfloat.y(); break;
+ }
+ }
+};
+
+Color2DSlider::Color2DSlider(QWidget* parent)
+ : QWidget(parent), p(new Private)
+{
+ setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+}
+
+Color2DSlider::~Color2DSlider()
+{
+ delete p;
+}
+
+QColor Color2DSlider::color() const
+{
+ return QColor::fromHsvF(p->hue, p->sat, p->val);
+}
+
+QSize Color2DSlider::sizeHint() const
+{
+ return {128, 128};
+}
+
+qreal Color2DSlider::hue() const
+{
+ return p->hue;
+}
+
+qreal Color2DSlider::saturation() const
+{
+ return p->sat;
+}
+
+qreal Color2DSlider::value() const
+{
+ return p->val;
+}
+
+Color2DSlider::Component Color2DSlider::componentX() const
+{
+ return p->comp_x;
+}
+
+Color2DSlider::Component Color2DSlider::componentY() const
+{
+ return p->comp_y;
+}
+
+void Color2DSlider::setColor(const QColor& c)
+{
+ p->hue = c.hsvHueF();
+ p->sat = c.saturationF();
+ p->val = c.valueF();
+ p->renderSquare(size());
+ update();
+ Q_EMIT colorChanged(color());
+}
+
+void Color2DSlider::setHue(qreal h)
+{
+ p->hue = h;
+ p->renderSquare(size());
+ update();
+ Q_EMIT colorChanged(color());
+}
+
+void Color2DSlider::setSaturation(qreal s)
+{
+ p->sat = s;
+ p->renderSquare(size());
+ update();
+ Q_EMIT colorChanged(color());
+}
+
+void Color2DSlider::setValue(qreal v)
+{
+ p->val = v;
+ p->renderSquare(size());
+ update();
+ Q_EMIT colorChanged(color());
+}
+
+void Color2DSlider::setComponentX(Color2DSlider::Component componentX)
+{
+ if ( componentX != p->comp_x )
+ {
+ p->comp_x = componentX;
+ p->renderSquare(size());
+ update();
+ Q_EMIT componentXChanged(p->comp_x);
+ }
+}
+
+void Color2DSlider::setComponentY(Color2DSlider::Component componentY)
+{
+ if ( componentY != p->comp_y )
+ {
+ p->comp_y = componentY;
+ p->renderSquare(size());
+ update();
+ Q_EMIT componentXChanged(p->comp_y);
+ }
+}
+
+void Color2DSlider::paintEvent(QPaintEvent*)
+{
+ QPainter painter(this);
+ painter.setRenderHint(QPainter::Antialiasing);
+ painter.drawImage(0,0,p->square);
+
+ painter.setPen(QPen(p->val > 0.5 ? Qt::black : Qt::white, 3));
+ painter.setBrush(Qt::NoBrush);
+ painter.drawEllipse(p->selectorPos(size()), selector_radius, selector_radius);
+}
+
+void Color2DSlider::mousePressEvent(QMouseEvent* event)
+{
+ p->setColorFromPos(event->pos(), size());
+ Q_EMIT colorChanged(color());
+ update();
+}
+
+void Color2DSlider::mouseMoveEvent(QMouseEvent* event)
+{
+ p->setColorFromPos(event->pos(), size());
+ Q_EMIT colorChanged(color());
+ update();
+}
+
+void Color2DSlider::mouseReleaseEvent(QMouseEvent* event)
+{
+ p->setColorFromPos(event->pos(), size());
+ Q_EMIT colorChanged(color());
+ update();
+}
+
+void Color2DSlider::resizeEvent(QResizeEvent* event)
+{
+ p->renderSquare(event->size());
+ update();
+}
+
+
+} // namespace color_widgets
diff --git a/external/Qt-Color-Widgets/src/QtColorWidgets/color_delegate.cpp b/external/Qt-Color-Widgets/src/QtColorWidgets/color_delegate.cpp
new file mode 100644
index 00000000..3c1bccc3
--- /dev/null
+++ b/external/Qt-Color-Widgets/src/QtColorWidgets/color_delegate.cpp
@@ -0,0 +1,171 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "QtColorWidgets/color_delegate.hpp"
+#include "QtColorWidgets/color_selector.hpp"
+#include "QtColorWidgets/color_dialog.hpp"
+#include
+#include
+#include
+
+
+void color_widgets::ReadOnlyColorDelegate::paintItem(
+ QPainter* painter,
+ const QStyleOptionViewItem& option,
+ const QModelIndex& index,
+ const QBrush& brush
+) const
+{
+ QStyleOptionViewItem opt = option;
+ initStyleOption(&opt, index);
+ const QWidget* widget = option.widget;
+ opt.showDecorationSelected = true;
+ QStyle *style = widget ? widget->style() : QApplication::style();
+ QRect geom = style->subElementRect(QStyle::SE_ItemViewItemText, &opt, widget);
+ opt.text = "";
+
+ QStyleOptionFrame panel;
+ panel.initFrom(option.widget);
+ if (option.widget->isEnabled())
+ panel.state = QStyle::State_Enabled;
+ panel.rect = geom;
+ panel.lineWidth = 2;
+ panel.midLineWidth = 0;
+ panel.state |= QStyle::State_Sunken;
+
+ style->drawControl(QStyle::CE_ItemViewItem, &opt, painter, widget);
+ style->drawPrimitive(QStyle::PE_Frame, &panel, painter, nullptr);
+ QRect r = style->subElementRect(QStyle::SE_FrameContents, &panel, nullptr);
+ painter->fillRect(r, brush);
+}
+
+
+
+void color_widgets::ReadOnlyColorDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const
+{
+ if ( index.data().type() == QVariant::Color )
+ {
+ paintItem(painter, option, index, index.data().value());
+ }
+ else
+ {
+ QStyledItemDelegate::paint(painter, option, index);
+ }
+}
+
+QSize color_widgets::ReadOnlyColorDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
+{
+ if ( index.data().type() == QVariant::Color )
+ return size_hint;
+ return QStyledItemDelegate::sizeHint(option, index);
+}
+
+void color_widgets::ReadOnlyColorDelegate::setSizeHintForColor(const QSize& size_hint)
+{
+ this->size_hint = size_hint;
+}
+
+const QSize& color_widgets::ReadOnlyColorDelegate::sizeHintForColor() const
+{
+ return size_hint;
+}
+
+
+QWidget *color_widgets::ColorDelegate::createEditor(
+ QWidget *parent,
+ const QStyleOptionViewItem &option,
+ const QModelIndex &index) const
+{
+ if ( index.data().type() == QVariant::Color )
+ {
+ ColorDialog *editor = new ColorDialog(const_cast(parent));
+ connect(editor, &QDialog::accepted, this, &ColorDelegate::close_editor);
+ connect(editor, &ColorDialog::colorSelected, this, &ColorDelegate::color_changed);
+ return editor;
+ }
+
+ return QStyledItemDelegate::createEditor(parent, option, index);
+}
+
+void color_widgets::ColorDelegate::color_changed()
+{
+ ColorDialog *editor = qobject_cast(sender());
+ emit commitData(editor);
+}
+
+void color_widgets::ColorDelegate::close_editor()
+{
+ ColorDialog *editor = qobject_cast(sender());
+ emit closeEditor(editor);
+}
+
+void color_widgets::ColorDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
+{
+
+ if ( index.data().type() == QVariant::Color )
+ {
+ ColorDialog *selector = qobject_cast(editor);
+ selector->setColor(qvariant_cast(index.data()));
+ return;
+ }
+
+ QStyledItemDelegate::setEditorData(editor, index);
+}
+
+void color_widgets::ColorDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
+ const QModelIndex &index) const
+{
+ if ( index.data().type() == QVariant::Color )
+ {
+ ColorDialog *selector = qobject_cast(editor);
+ model->setData(index, QVariant::fromValue(selector->color()));
+ return;
+ }
+
+ QStyledItemDelegate::setModelData(editor, model, index);
+}
+
+void color_widgets::ColorDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const
+{
+ if ( index.data().type() == QVariant::Color )
+ {
+ return;
+ }
+
+
+ QStyledItemDelegate::updateEditorGeometry(editor, option, index);
+
+}
+
+bool color_widgets::ColorDelegate::eventFilter(QObject * watched, QEvent * event)
+{
+ if ( event->type() == QEvent::Hide )
+ {
+ if ( auto editor = qobject_cast(watched) )
+ {
+ emit closeEditor(editor, QAbstractItemDelegate::NoHint);
+ return false;
+ }
+ }
+ return QStyledItemDelegate::eventFilter(watched, event);
+}
diff --git a/external/Qt-Color-Widgets/src/QtColorWidgets/color_dialog.cpp b/external/Qt-Color-Widgets/src/QtColorWidgets/color_dialog.cpp
new file mode 100644
index 00000000..9b35dd6b
--- /dev/null
+++ b/external/Qt-Color-Widgets/src/QtColorWidgets/color_dialog.cpp
@@ -0,0 +1,413 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ * \copyright Copyright (C) 2014 Calle Laakkonen
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "QtColorWidgets/color_dialog.hpp"
+#include "ui_color_dialog.h"
+
+#include
+#include
+#include
+#include
+#include
+
+#include "QtColorWidgets/color_utils.hpp"
+
+#include
+namespace color_widgets {
+
+class ColorDialog::Private
+{
+public:
+ Ui_ColorDialog ui;
+ ButtonMode button_mode;
+ bool pick_from_screen;
+ bool alpha_enabled;
+ QColor color;
+
+ Private() : pick_from_screen(false), alpha_enabled(true)
+ {}
+
+#ifdef Q_OS_ANDROID
+ void screen_rotation()
+ {
+ auto scr = QApplication::primaryScreen();
+ if ( scr->size().height() > scr->size().width() )
+ ui.layout_main->setDirection(QBoxLayout::TopToBottom);
+ else
+ ui.layout_main->setDirection(QBoxLayout::LeftToRight);
+ }
+#endif
+};
+
+ColorDialog::ColorDialog(QWidget *parent, Qt::WindowFlags f) :
+ QDialog(parent, f), p(new Private)
+{
+ p->ui.setupUi(this);
+
+ setAcceptDrops(true);
+
+#ifdef Q_OS_ANDROID
+ connect(
+ QGuiApplication::primaryScreen(),
+ &QScreen::primaryOrientationChanged,
+ this,
+ [this]{p->screen_rotation();}
+ );
+ p->ui.wheel->setWheelWidth(50);
+ p->screen_rotation();
+#else
+ // Add "pick color" button
+ QPushButton *pickButton = p->ui.buttonBox->addButton(tr("Pick"), QDialogButtonBox::ActionRole);
+ pickButton->setIcon(QIcon::fromTheme(QStringLiteral("color-picker")));
+#endif
+
+ setButtonMode(OkApplyCancel);
+
+ connect(p->ui.wheel, &ColorWheel::colorSpaceChanged, this, &ColorDialog::colorSpaceChanged);
+ connect(p->ui.wheel, &ColorWheel::selectorShapeChanged, this, &ColorDialog::wheelShapeChanged);
+ connect(p->ui.wheel, &ColorWheel::rotatingSelectorChanged, this, &ColorDialog::wheelRotatingChanged);
+
+}
+
+ColorDialog::~ColorDialog()
+{
+ delete p;
+}
+
+QSize ColorDialog::sizeHint() const
+{
+ return QSize(400,0);
+}
+
+QColor ColorDialog::color() const
+{
+ QColor col = p->color;
+ if ( !p->alpha_enabled )
+ col.setAlpha(255);
+ return col;
+}
+
+void ColorDialog::setColor(const QColor &c)
+{
+ p->ui.preview->setComparisonColor(c);
+ p->ui.edit_hex->setModified(false);
+ setColorInternal(c);
+}
+
+void ColorDialog::showColor(const QColor &c)
+{
+ setColor(c);
+ show();
+}
+
+void ColorDialog::setPreviewDisplayMode(ColorPreview::DisplayMode mode)
+{
+ p->ui.preview->setDisplayMode(mode);
+}
+
+ColorPreview::DisplayMode ColorDialog::previewDisplayMode() const
+{
+ return p->ui.preview->displayMode();
+}
+
+void ColorDialog::setAlphaEnabled(bool a)
+{
+ if ( a != p->alpha_enabled )
+ {
+ p->alpha_enabled = a;
+
+ p->ui.edit_hex->setShowAlpha(a);
+ p->ui.line_alpha->setVisible(a);
+ p->ui.label_alpha->setVisible(a);
+ p->ui.slide_alpha->setVisible(a);
+ p->ui.spin_alpha->setVisible(a);
+
+ Q_EMIT alphaEnabledChanged(a);
+ }
+}
+
+bool ColorDialog::alphaEnabled() const
+{
+ return p->alpha_enabled;
+}
+
+void ColorDialog::setButtonMode(ButtonMode mode)
+{
+ p->button_mode = mode;
+ QDialogButtonBox::StandardButtons btns;
+ switch(mode) {
+ case OkCancel: btns = QDialogButtonBox::Ok | QDialogButtonBox::Cancel; break;
+ case OkApplyCancel: btns = QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Apply | QDialogButtonBox::Reset; break;
+ case Close: btns = QDialogButtonBox::Close;
+ }
+ p->ui.buttonBox->setStandardButtons(btns);
+}
+
+ColorDialog::ButtonMode ColorDialog::buttonMode() const
+{
+ return p->button_mode;
+}
+
+void ColorDialog::setColorInternal(const QColor &col)
+{
+ /**
+ * \note Unlike setColor, this is used to update the current color which
+ * migth differ from the final selected color
+ */
+ p->ui.wheel->setColor(col);
+
+ p->color = col;
+
+ bool blocked = signalsBlocked();
+ blockSignals(true);
+ Q_FOREACH(QWidget* w, findChildren())
+ w->blockSignals(true);
+
+
+ p->ui.slide_red->setValue(col.red());
+ p->ui.spin_red->setValue(p->ui.slide_red->value());
+ p->ui.slide_red->setFirstColor(QColor(0,col.green(),col.blue()));
+ p->ui.slide_red->setLastColor(QColor(255,col.green(),col.blue()));
+
+ p->ui.slide_green->setValue(col.green());
+ p->ui.spin_green->setValue(p->ui.slide_green->value());
+ p->ui.slide_green->setFirstColor(QColor(col.red(),0,col.blue()));
+ p->ui.slide_green->setLastColor(QColor(col.red(),255,col.blue()));
+
+ p->ui.slide_blue->setValue(col.blue());
+ p->ui.spin_blue->setValue(p->ui.slide_blue->value());
+ p->ui.slide_blue->setFirstColor(QColor(col.red(),col.green(),0));
+ p->ui.slide_blue->setLastColor(QColor(col.red(),col.green(),255));
+
+ p->ui.slide_hue->setValue(qRound(p->ui.wheel->hue()*360.0));
+ p->ui.slide_hue->setColorSaturation(p->ui.wheel->saturation());
+ p->ui.slide_hue->setColorValue(p->ui.wheel->value());
+ p->ui.spin_hue->setValue(p->ui.slide_hue->value());
+
+ p->ui.slide_saturation->setValue(qRound(p->ui.wheel->saturation()*255.0));
+ p->ui.spin_saturation->setValue(p->ui.slide_saturation->value());
+ p->ui.slide_saturation->setFirstColor(QColor::fromHsvF(p->ui.wheel->hue(),0,p->ui.wheel->value()));
+ p->ui.slide_saturation->setLastColor(QColor::fromHsvF(p->ui.wheel->hue(),1,p->ui.wheel->value()));
+
+ p->ui.slide_value->setValue(qRound(p->ui.wheel->value()*255.0));
+ p->ui.spin_value->setValue(p->ui.slide_value->value());
+ p->ui.slide_value->setFirstColor(QColor::fromHsvF(p->ui.wheel->hue(), p->ui.wheel->saturation(),0));
+ p->ui.slide_value->setLastColor(QColor::fromHsvF(p->ui.wheel->hue(), p->ui.wheel->saturation(),1));
+
+
+ QColor apha_color = col;
+ apha_color.setAlpha(0);
+ p->ui.slide_alpha->setFirstColor(apha_color);
+ apha_color.setAlpha(255);
+ p->ui.slide_alpha->setLastColor(apha_color);
+ p->ui.spin_alpha->setValue(col.alpha());
+ p->ui.slide_alpha->setValue(col.alpha());
+
+ if ( !p->ui.edit_hex->isModified() )
+ p->ui.edit_hex->setColor(col);
+
+ p->ui.preview->setColor(col);
+
+ blockSignals(blocked);
+ Q_FOREACH(QWidget* w, findChildren())
+ w->blockSignals(false);
+
+ Q_EMIT colorChanged(col);
+}
+
+void ColorDialog::set_hsv()
+{
+ if ( !signalsBlocked() )
+ {
+ QColor col = QColor::fromHsv(
+ p->ui.slide_hue->value(),
+ p->ui.slide_saturation->value(),
+ p->ui.slide_value->value(),
+ p->ui.slide_alpha->value()
+ );
+ p->ui.wheel->setColor(col);
+ setColorInternal(col);
+ }
+}
+
+void ColorDialog::set_alpha()
+{
+ if ( !signalsBlocked() )
+ {
+ QColor col = p->color;
+ col.setAlpha(p->ui.slide_alpha->value());
+ setColorInternal(col);
+ }
+}
+
+void ColorDialog::set_rgb()
+{
+ if ( !signalsBlocked() )
+ {
+ QColor col(
+ p->ui.slide_red->value(),
+ p->ui.slide_green->value(),
+ p->ui.slide_blue->value(),
+ p->ui.slide_alpha->value()
+ );
+ if (col.saturation() == 0)
+ col = QColor::fromHsv(p->ui.slide_hue->value(), 0, col.value());
+ p->ui.wheel->setColor(col);
+ setColorInternal(col);
+ }
+}
+
+void ColorDialog::on_edit_hex_colorChanged(const QColor& color)
+{
+ setColorInternal(color);
+}
+
+void ColorDialog::on_edit_hex_colorEditingFinished(const QColor& color)
+{
+ p->ui.edit_hex->setModified(false);
+ setColorInternal(color);
+}
+
+void ColorDialog::on_buttonBox_clicked(QAbstractButton *btn)
+{
+ QDialogButtonBox::ButtonRole role = p->ui.buttonBox->buttonRole(btn);
+
+ switch(role) {
+ case QDialogButtonBox::AcceptRole:
+ case QDialogButtonBox::ApplyRole:
+ // Explicitly select the color
+ p->ui.preview->setComparisonColor(color());
+ Q_EMIT colorSelected(color());
+ break;
+
+ case QDialogButtonBox::ActionRole:
+ // Currently, the only action button is the "pick color" button
+ grabMouse(Qt::CrossCursor);
+ p->pick_from_screen = true;
+ break;
+
+ case QDialogButtonBox::ResetRole:
+ // Restore old color
+ setColorInternal(p->ui.preview->comparisonColor());
+ break;
+
+ default: break;
+ }
+}
+
+void ColorDialog::dragEnterEvent(QDragEnterEvent *event)
+{
+ if ( event->mimeData()->hasColor() ||
+ ( event->mimeData()->hasText() && QColor(event->mimeData()->text()).isValid() ) )
+ event->acceptProposedAction();
+}
+
+
+void ColorDialog::dropEvent(QDropEvent *event)
+{
+ if ( event->mimeData()->hasColor() )
+ {
+ setColorInternal(event->mimeData()->colorData().value());
+ event->accept();
+ }
+ else if ( event->mimeData()->hasText() )
+ {
+ QColor col(event->mimeData()->text());
+ if ( col.isValid() )
+ {
+ setColorInternal(col);
+ event->accept();
+ }
+ }
+}
+
+void ColorDialog::mouseReleaseEvent(QMouseEvent *event)
+{
+ if (p->pick_from_screen)
+ {
+ setColorInternal(utils::get_screen_color(event->globalPos()));
+ p->pick_from_screen = false;
+ releaseMouse();
+ }
+}
+
+void ColorDialog::mouseMoveEvent(QMouseEvent *event)
+{
+ if (p->pick_from_screen)
+ {
+ setColorInternal(utils::get_screen_color(event->globalPos()));
+ }
+}
+
+void ColorDialog::keyReleaseEvent(QKeyEvent *ev)
+{
+ QDialog::keyReleaseEvent(ev);
+
+#ifdef Q_OS_ANDROID
+ if ( ev->key() == Qt::Key_Back )
+ {
+ reject();
+ ev->accept();
+ }
+#endif
+}
+
+void ColorDialog::setWheelShape(ColorWheel::ShapeEnum shape)
+{
+ p->ui.wheel->setSelectorShape(shape);
+}
+
+ColorWheel::ShapeEnum ColorDialog::wheelShape() const
+{
+ return p->ui.wheel->selectorShape();
+}
+
+void ColorDialog::setColorSpace(ColorWheel::ColorSpaceEnum space)
+{
+ p->ui.wheel->setColorSpace(space);
+}
+
+ColorWheel::ColorSpaceEnum ColorDialog::colorSpace() const
+{
+ return p->ui.wheel->colorSpace();
+}
+
+void ColorDialog::setWheelRotating(bool rotating)
+{
+ p->ui.wheel->setRotatingSelector(rotating);
+}
+
+bool ColorDialog::wheelRotating() const
+{
+ return p->ui.wheel->rotatingSelector();
+}
+
+int ColorDialog::exec()
+{
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_FAKE)
+ showMaximized();
+ setFocus();
+#endif
+ return QDialog::exec();
+}
+
+} // namespace color_widgets
diff --git a/external/Qt-Color-Widgets/src/QtColorWidgets/color_dialog.ui b/external/Qt-Color-Widgets/src/QtColorWidgets/color_dialog.ui
new file mode 100644
index 00000000..f6538ade
--- /dev/null
+++ b/external/Qt-Color-Widgets/src/QtColorWidgets/color_dialog.ui
@@ -0,0 +1,695 @@
+
+
+ ColorDialog
+
+
+
+ 0
+ 0
+ 491
+ 380
+
+
+
+ Select Color
+
+
+
+ . .
+
+
+ -
+
+ -
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+
+
+ -
+
+ -
+
+
+ 255
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Saturation
+
+
+
+ -
+
+
+ Hue
+
+
+
+ -
+
+
+ 255
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Hex
+
+
+
+ -
+
+
+ Blue
+
+
+
+ -
+
+
+ 255
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ 255
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ 255
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Value
+
+
+
+ -
+
+
+ Green
+
+
+
+ -
+
+
+ Alpha
+
+
+
+ -
+
+
+ Red
+
+
+
+ -
+
+
+ 255
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ true
+
+
+ 359
+
+
+
+ -
+
+
+ 255
+
+
+
+ -
+
+
+ 255
+
+
+
+ -
+
+
+ 255
+
+
+
+ -
+
+
+ 255
+
+
+
+ -
+
+
+ 255
+
+
+
+ -
+
+
+ 255
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ 0
+
+
+ 359
+
+
+
+ -
+
+
+
+ Monospace
+
+
+
+ true
+
+
+
+
+
+
+
+ -
+
+
+ QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Reset
+
+
+
+
+
+
+
+
+ color_widgets::ColorPreview
+ QWidget
+ QtColorWidgets/color_preview.hpp
+ 1
+
+
+ color_widgets::ColorWheel
+ QWidget
+ QtColorWidgets/color_wheel.hpp
+ 1
+
+ colorSelected(QColor)
+ setColor(QColor)
+
+
+
+ color_widgets::GradientSlider
+ QSlider
+ QtColorWidgets/gradient_slider.hpp
+
+
+ color_widgets::HueSlider
+ color_widgets::GradientSlider
+ QtColorWidgets/hue_slider.hpp
+
+
+ color_widgets::ColorLineEdit
+ QLineEdit
+ QtColorWidgets/color_line_edit.hpp
+
+
+
+
+
+ slide_saturation
+ valueChanged(int)
+ ColorDialog
+ set_hsv()
+
+
+ 416
+ 71
+
+
+ 537
+ 54
+
+
+
+
+ slide_value
+ valueChanged(int)
+ ColorDialog
+ set_hsv()
+
+
+ 416
+ 109
+
+
+ 537
+ 88
+
+
+
+
+ slide_red
+ valueChanged(int)
+ ColorDialog
+ set_rgb()
+
+
+ 416
+ 156
+
+
+ 557
+ 142
+
+
+
+
+ slide_green
+ valueChanged(int)
+ ColorDialog
+ set_rgb()
+
+
+ 416
+ 194
+
+
+ 538
+ 166
+
+
+
+
+ slide_blue
+ valueChanged(int)
+ ColorDialog
+ set_rgb()
+
+
+ 416
+ 232
+
+
+ 537
+ 205
+
+
+
+
+ slide_alpha
+ valueChanged(int)
+ ColorDialog
+ set_alpha()
+
+
+ 416
+ 279
+
+
+ 531
+ 251
+
+
+
+
+ wheel
+ colorSelected(QColor)
+ ColorDialog
+ setColorInternal(QColor)
+
+
+ 175
+ 101
+
+
+ 568
+ 106
+
+
+
+
+ slide_saturation
+ valueChanged(int)
+ spin_saturation
+ setValue(int)
+
+
+ 416
+ 71
+
+
+ 480
+ 62
+
+
+
+
+ spin_saturation
+ valueChanged(int)
+ slide_saturation
+ setValue(int)
+
+
+ 461
+ 55
+
+
+ 416
+ 71
+
+
+
+
+ slide_value
+ valueChanged(int)
+ spin_value
+ setValue(int)
+
+
+ 416
+ 109
+
+
+ 480
+ 91
+
+
+
+
+ spin_value
+ valueChanged(int)
+ slide_value
+ setValue(int)
+
+
+ 480
+ 91
+
+
+ 416
+ 109
+
+
+
+
+ slide_red
+ valueChanged(int)
+ spin_red
+ setValue(int)
+
+
+ 416
+ 156
+
+
+ 482
+ 162
+
+
+
+
+ spin_red
+ valueChanged(int)
+ slide_red
+ setValue(int)
+
+
+ 482
+ 162
+
+
+ 416
+ 156
+
+
+
+
+ slide_green
+ valueChanged(int)
+ spin_green
+ setValue(int)
+
+
+ 416
+ 194
+
+
+ 482
+ 200
+
+
+
+
+ spin_green
+ valueChanged(int)
+ slide_green
+ setValue(int)
+
+
+ 482
+ 200
+
+
+ 416
+ 194
+
+
+
+
+ slide_alpha
+ valueChanged(int)
+ spin_alpha
+ setValue(int)
+
+
+ 416
+ 279
+
+
+ 482
+ 285
+
+
+
+
+ spin_alpha
+ valueChanged(int)
+ slide_alpha
+ setValue(int)
+
+
+ 482
+ 285
+
+
+ 416
+ 279
+
+
+
+
+ slide_blue
+ valueChanged(int)
+ spin_blue
+ setValue(int)
+
+
+ 416
+ 232
+
+
+ 482
+ 238
+
+
+
+
+ spin_blue
+ valueChanged(int)
+ slide_blue
+ setValue(int)
+
+
+ 482
+ 238
+
+
+ 416
+ 232
+
+
+
+
+ slide_hue
+ valueChanged(int)
+ spin_hue
+ setValue(int)
+
+
+ 405
+ 20
+
+
+ 462
+ 26
+
+
+
+
+ spin_hue
+ valueChanged(int)
+ slide_hue
+ setValue(int)
+
+
+ 448
+ 18
+
+
+ 388
+ 24
+
+
+
+
+ slide_hue
+ valueChanged(int)
+ ColorDialog
+ set_hsv()
+
+
+ 361
+ 17
+
+
+ 363
+ 8
+
+
+
+
+ buttonBox
+ accepted()
+ ColorDialog
+ accept()
+
+
+ 250
+ 373
+
+
+ 430
+ 267
+
+
+
+
+ buttonBox
+ rejected()
+ ColorDialog
+ reject()
+
+
+ 183
+ 373
+
+
+ 294
+ 323
+
+
+
+
+
+ colorChanged(QColor)
+ set_rgb()
+ set_hsv()
+ setColor(QColor)
+ setColorInternal(QColor)
+ set_alpha()
+
+
diff --git a/external/Qt-Color-Widgets/src/QtColorWidgets/color_line_edit.cpp b/external/Qt-Color-Widgets/src/QtColorWidgets/color_line_edit.cpp
new file mode 100644
index 00000000..2847d40d
--- /dev/null
+++ b/external/Qt-Color-Widgets/src/QtColorWidgets/color_line_edit.cpp
@@ -0,0 +1,211 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ * \copyright Copyright (C) 2017 caryoscelus
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "QtColorWidgets/color_line_edit.hpp"
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "QtColorWidgets/color_utils.hpp"
+#include "QtColorWidgets/color_names.hpp"
+
+namespace color_widgets {
+
+
+class ColorLineEdit::Private
+{
+public:
+ QColor color;
+ bool show_alpha = false;
+ bool preview_color = false;
+ QBrush background;
+
+ bool customAlpha()
+ {
+ return preview_color && show_alpha && color.alpha() < 255;
+ }
+
+ void setPalette(const QColor& color, ColorLineEdit* parent)
+ {
+ if ( preview_color )
+ {
+ QColor bg = customAlpha() ? Qt::transparent : color;
+ QColor text = utils::color_lumaF(color) > 0.5 || color.alphaF() < 0.2 ? Qt::black : Qt::white;
+ parent->setStyleSheet(
+ QString("background-color: %1; color: %2;")
+ .arg(bg.name()).arg(text.name())
+ );
+ }
+ }
+};
+
+ColorLineEdit::ColorLineEdit(QWidget* parent)
+ : QLineEdit(parent), p(new Private)
+{
+ p->background.setTexture(QPixmap(QStringLiteral(":/color_widgets/alphaback.png")));
+ setColor(Qt::white);
+ /// \todo determine if having this connection might be useful
+ /*connect(this, &QLineEdit::textChanged, [this](const QString& text){
+ QColor color = p->colorFromString(text);
+ if ( color.isValid() )
+ Q_EMIT colorChanged(color);
+ });*/
+ connect(this, &QLineEdit::textEdited, [this](const QString& text){
+ QColor color = color_widgets::colorFromString(text, p->show_alpha);
+ if ( color.isValid() )
+ {
+ p->color = color;
+ p->setPalette(color, this);
+ Q_EMIT colorEdited(color);
+ Q_EMIT colorChanged(color);
+ }
+ });
+ connect(this, &QLineEdit::editingFinished, [this](){
+ QColor color = color_widgets::colorFromString(text(), p->show_alpha);
+ if ( color.isValid() )
+ {
+ p->color = color;
+ Q_EMIT colorEditingFinished(color);
+ Q_EMIT colorChanged(color);
+ }
+ else
+ {
+ setText(color_widgets::stringFromColor(p->color, p->show_alpha));
+ Q_EMIT colorEditingFinished(p->color);
+ Q_EMIT colorChanged(color);
+ }
+ p->setPalette(p->color, this);
+ });
+}
+
+ColorLineEdit::~ColorLineEdit()
+{
+ delete p;
+}
+
+QColor ColorLineEdit::color() const
+{
+ return p->color;
+}
+
+void ColorLineEdit::setColor(const QColor& color)
+{
+ if ( color != p->color )
+ {
+ p->color = color;
+ p->setPalette(p->color, this);
+ setText(color_widgets::stringFromColor(p->color, p->show_alpha));
+ Q_EMIT colorChanged(p->color);
+ }
+}
+
+void ColorLineEdit::setShowAlpha(bool showAlpha)
+{
+ if ( p->show_alpha != showAlpha )
+ {
+ p->show_alpha = showAlpha;
+ p->setPalette(p->color, this);
+ setText(color_widgets::stringFromColor(p->color, p->show_alpha));
+ Q_EMIT showAlphaChanged(p->show_alpha);
+ }
+}
+
+bool ColorLineEdit::showAlpha() const
+{
+ return p->show_alpha;
+}
+
+void ColorLineEdit::dragEnterEvent(QDragEnterEvent *event)
+{
+ if ( isReadOnly() )
+ return;
+
+ if ( event->mimeData()->hasColor() ||
+ ( event->mimeData()->hasText() &&
+ color_widgets::colorFromString(event->mimeData()->text(), p->show_alpha).isValid() ) )
+ {
+ event->acceptProposedAction();
+ }
+}
+
+
+void ColorLineEdit::dropEvent(QDropEvent *event)
+{
+ if ( isReadOnly() )
+ return;
+
+ if ( event->mimeData()->hasColor() )
+ {
+ setColor(event->mimeData()->colorData().value());
+ event->accept();
+ }
+ else if ( event->mimeData()->hasText() )
+ {
+ QColor col = color_widgets::colorFromString(event->mimeData()->text(), p->show_alpha);
+ if ( col.isValid() )
+ {
+ setColor(col);
+ event->accept();
+ }
+ }
+}
+
+bool ColorLineEdit::previewColor() const
+{
+ return p->preview_color;
+}
+
+void ColorLineEdit::setPreviewColor(bool previewColor)
+{
+ if ( previewColor != p->preview_color )
+ {
+ p->preview_color = previewColor;
+
+ if ( p->preview_color )
+ p->setPalette(p->color, this);
+ else
+ setPalette(QApplication::palette());
+
+ Q_EMIT previewColorChanged(p->preview_color);
+ }
+}
+
+void ColorLineEdit::paintEvent(QPaintEvent* event)
+{
+ if ( p->customAlpha() )
+ {
+ QPainter painter(this);
+ QStyleOptionFrame panel;
+ initStyleOption(&panel);
+ QRect r = style()->subElementRect(QStyle::SE_LineEditContents, &panel, nullptr);
+ painter.fillRect(r, p->background);
+ painter.fillRect(r, p->color);
+ }
+
+ QLineEdit::paintEvent(event);
+}
+
+} // namespace color_widgets
diff --git a/external/Qt-Color-Widgets/src/QtColorWidgets/color_list_widget.cpp b/external/Qt-Color-Widgets/src/QtColorWidgets/color_list_widget.cpp
new file mode 100644
index 00000000..79f88df1
--- /dev/null
+++ b/external/Qt-Color-Widgets/src/QtColorWidgets/color_list_widget.cpp
@@ -0,0 +1,149 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "QtColorWidgets/color_list_widget.hpp"
+#include "QtColorWidgets/color_selector.hpp"
+
+namespace color_widgets {
+
+class ColorListWidget::Private
+{
+public:
+ QList colors;
+ QSignalMapper mapper;
+ ColorWheel::ShapeEnum wheel_shape = ColorWheel::ShapeTriangle;
+ ColorWheel::ColorSpaceEnum color_space = ColorWheel::ColorHSV;
+ bool wheel_rotating = true;
+};
+
+ColorListWidget::ColorListWidget(QWidget *parent)
+ : AbstractWidgetList(parent), p(new Private)
+{
+ connect(this, &AbstractWidgetList::removed, this, &ColorListWidget::handle_removed);
+ connect(&p->mapper, SIGNAL(mapped(int)), SLOT(color_changed(int)));
+}
+
+ColorListWidget::~ColorListWidget()
+{
+ delete p;
+}
+
+QList ColorListWidget::colors() const
+{
+ return p->colors;
+}
+
+void ColorListWidget::setColors(const QList &colors)
+{
+ clear();
+ p->colors = colors;
+ for(int i = 0;i < colors.size();i++ )
+ append_widget(i);
+ Q_EMIT colorsChanged(colors);
+}
+
+void ColorListWidget::swap(int a, int b)
+{
+ ColorSelector* sa = widget_cast(a);
+ ColorSelector* sb = widget_cast(b);
+ if ( sa && sb )
+ {
+ QColor ca = sa->color();
+ sa->setColor(sb->color());
+ sb->setColor(ca);
+ Q_EMIT colorsChanged(p->colors);
+ }
+}
+
+void ColorListWidget::append()
+{
+ p->colors.push_back(Qt::black);
+ append_widget(p->colors.size()-1);
+ Q_EMIT colorsChanged(p->colors);
+}
+
+void ColorListWidget::emit_changed()
+{
+ Q_EMIT colorsChanged(p->colors);
+}
+
+void ColorListWidget::handle_removed(int i)
+{
+ p->colors.removeAt(i);
+ Q_EMIT colorsChanged(p->colors);
+}
+
+void ColorListWidget::color_changed(int row)
+{
+ ColorSelector *cs = widget_cast(row);
+ if ( cs )
+ {
+ p->colors[row] = cs->color();
+ Q_EMIT colorsChanged(p->colors);
+ }
+}
+
+void ColorListWidget::append_widget(int col)
+{
+ ColorSelector* cbs = new ColorSelector;
+ cbs->setDisplayMode(ColorPreview::AllAlpha);
+ cbs->setColor(p->colors[col]);
+ //connect(cbs,SIGNAL(colorChanged(QColor)),SLOT(emit_changed()));
+ p->mapper.setMapping(cbs,col);
+ connect(cbs,SIGNAL(colorChanged(QColor)),&p->mapper,SLOT(map()));
+ connect(this, &ColorListWidget::wheelRotatingChanged, cbs, &ColorSelector::setWheelRotating);
+ connect(this, &ColorListWidget::wheelShapeChanged, cbs, &ColorSelector::setWheelShape);
+ connect(this, &ColorListWidget::colorSpaceChanged, cbs, &ColorSelector::setColorSpace);
+ appendWidget(cbs);
+ setRowHeight(count()-1,22);
+}
+
+void ColorListWidget::setWheelShape(ColorWheel::ShapeEnum shape)
+{
+ Q_EMIT wheelShapeChanged(p->wheel_shape = shape);
+}
+
+ColorWheel::ShapeEnum ColorListWidget::wheelShape() const
+{
+ return p->wheel_shape;
+}
+
+void ColorListWidget::setColorSpace(ColorWheel::ColorSpaceEnum space)
+{
+ Q_EMIT colorSpaceChanged(p->color_space = space);
+}
+
+ColorWheel::ColorSpaceEnum ColorListWidget::colorSpace() const
+{
+ return p->color_space;
+}
+
+void ColorListWidget::setWheelRotating(bool rotating)
+{
+ Q_EMIT wheelRotatingChanged(p->wheel_rotating = rotating);
+}
+
+bool ColorListWidget::wheelRotating() const
+{
+ return p->wheel_rotating;
+}
+
+} // namespace color_widgets
diff --git a/external/Qt-Color-Widgets/src/QtColorWidgets/color_names.cpp b/external/Qt-Color-Widgets/src/QtColorWidgets/color_names.cpp
new file mode 100644
index 00000000..07d7d225
--- /dev/null
+++ b/external/Qt-Color-Widgets/src/QtColorWidgets/color_names.cpp
@@ -0,0 +1,89 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "QtColorWidgets/color_names.hpp"
+#include
+
+static QRegularExpression regex_qcolor (QStringLiteral("^(?:(?:#[[:xdigit:]]{3})|(?:#[[:xdigit:]]{6})|(?:[[:alpha:]]+))$"));
+static QRegularExpression regex_func_rgb (QStringLiteral(R"(^rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)$)"));
+static QRegularExpression regex_hex_rgba (QStringLiteral("^#[[:xdigit:]]{8}$"));
+static QRegularExpression regex_func_rgba (QStringLiteral(R"(^rgba?\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)$)"));
+
+namespace color_widgets {
+
+
+QString stringFromColor(const QColor& color, bool alpha)
+{
+ if ( !alpha || color.alpha() == 255 )
+ return color.name();
+ return color.name()+QStringLiteral("%1").arg(color.alpha(), 2, 16, QChar('0'));
+}
+
+QColor colorFromString(const QString& string, bool alpha)
+{
+ QString xs = string.trimmed();
+ QRegularExpressionMatch match;
+
+ match = regex_qcolor.match(xs);
+ if ( match.hasMatch() )
+ {
+ return QColor(xs);
+ }
+
+ match = regex_func_rgb.match(xs);
+ if ( match.hasMatch() )
+ {
+ return QColor(
+ match.captured(1).toInt(),
+ match.captured(2).toInt(),
+ match.captured(3).toInt()
+ );
+ }
+
+ if ( alpha )
+ {
+ match = regex_hex_rgba.match(xs);
+ if ( match.hasMatch() )
+ {
+ return QColor(
+ xs.mid(1,2).toInt(nullptr,16),
+ xs.mid(3,2).toInt(nullptr,16),
+ xs.mid(5,2).toInt(nullptr,16),
+ xs.mid(7,2).toInt(nullptr,16)
+ );
+ }
+
+ match = regex_func_rgba.match(xs);
+ if ( match.hasMatch() )
+ {
+ return QColor(
+ match.captured(1).toInt(),
+ match.captured(2).toInt(),
+ match.captured(3).toInt(),
+ match.captured(4).toInt()
+ );
+ }
+ }
+
+ return QColor();
+}
+
+} // namespace color_widgets
diff --git a/external/Qt-Color-Widgets/src/QtColorWidgets/color_palette.cpp b/external/Qt-Color-Widgets/src/QtColorWidgets/color_palette.cpp
new file mode 100644
index 00000000..dbb9605e
--- /dev/null
+++ b/external/Qt-Color-Widgets/src/QtColorWidgets/color_palette.cpp
@@ -0,0 +1,498 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "QtColorWidgets/color_palette.hpp"
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace color_widgets {
+
+class ColorPalette::Private
+{
+public:
+ QVector > colors;
+ int columns;
+ QString name;
+ QString fileName;
+ bool dirty;
+
+ bool valid_index(int index)
+ {
+ return index >= 0 && index < colors.size();
+ }
+};
+
+ColorPalette::ColorPalette(const QVector& colors,
+ const QString& name,
+ int columns)
+ : p ( new Private )
+{
+ setName(name);
+ setColumns(columns);
+ setColors(colors);
+}
+
+ColorPalette::ColorPalette(const QString& name)
+ : p ( new Private )
+{
+ setName(name);
+ p->columns = 0;
+ p->dirty = false;
+}
+
+ColorPalette::ColorPalette(const QVector >& colors,
+ const QString& name,
+ int columns)
+{
+ setName(name);
+ setColumns(columns);
+ setColors(colors);
+ p->dirty = false;
+}
+
+ColorPalette::ColorPalette(const ColorPalette& other)
+ : QObject(), p ( new Private(*other.p) )
+{
+}
+
+ColorPalette& ColorPalette::operator=(const ColorPalette& other)
+{
+ *p = *other.p;
+ emitUpdate();
+ return *this;
+}
+
+ColorPalette::~ColorPalette()
+{
+ delete p;
+}
+
+ColorPalette::ColorPalette(ColorPalette&& other)
+ : QObject(), p ( other.p )
+{
+ other.p = nullptr;
+}
+ColorPalette& ColorPalette::operator=(ColorPalette&& other)
+{
+ std::swap(p, other.p);
+ emitUpdate();
+ return *this;
+}
+
+void ColorPalette::emitUpdate()
+{
+ Q_EMIT colorsChanged(p->colors);
+ Q_EMIT columnsChanged(p->columns);
+ Q_EMIT nameChanged(p->name);
+ Q_EMIT fileNameChanged(p->fileName);
+ Q_EMIT dirtyChanged(p->dirty);
+}
+
+QColor ColorPalette::colorAt(int index) const
+{
+ return p->valid_index(index) ? p->colors[index].first : QColor();
+}
+
+QString ColorPalette::nameAt(int index) const
+{
+ return p->valid_index(index) ? p->colors[index].second : QString();
+}
+
+QVector > ColorPalette::colors() const
+{
+ return p->colors;
+}
+
+int ColorPalette::count() const
+{
+ return p->colors.size();
+}
+
+int ColorPalette::columns()
+{
+ return p->columns;
+}
+
+QString ColorPalette::name() const
+{
+ return p->name;
+}
+
+void ColorPalette::loadColorTable(const QVector& color_table)
+{
+ p->colors.clear();
+ p->colors.reserve(color_table.size());
+ for ( QRgb c : color_table )
+ {
+ QColor color ( c );
+ color.setAlpha(255);
+ p->colors.push_back(qMakePair(color,QString()));
+ }
+ Q_EMIT colorsChanged(p->colors);
+ setDirty(true);
+}
+
+bool ColorPalette::loadImage(const QImage& image)
+{
+ if ( image.isNull() )
+ return false;
+ setColumns(image.width());
+
+ p->colors.clear();
+ p->colors.reserve(image.width()*image.height());
+ for ( int y = 0; y < image.height(); y++ )
+ {
+ for ( int x = 0; x < image.width(); x++ )
+ {
+ QColor color ( image.pixel(x, y) );
+ color.setAlpha(255);
+ p->colors.push_back(qMakePair(color,QString()));
+ }
+ }
+ Q_EMIT colorsChanged(p->colors);
+ setDirty(true);
+ return true;
+}
+
+ColorPalette ColorPalette::fromImage(const QImage& image)
+{
+ ColorPalette p;
+ p.loadImage(image);
+ return p;
+}
+
+bool ColorPalette::load(const QString& name)
+{
+ p->fileName = name;
+ p->colors.clear();
+ p->columns = 0;
+ p->dirty = false;
+ p->name = QFileInfo(name).baseName();
+
+ QFile file(name);
+
+ if ( !file.open(QFile::ReadOnly|QFile::Text) )
+ {
+ emitUpdate();
+ return false;
+ }
+
+ QTextStream stream( &file );
+
+ if ( stream.readLine() != QLatin1String("GIMP Palette") )
+ {
+ emitUpdate();
+ return false;
+ }
+
+ QString line;
+
+ // parse properties
+ QHash properties;
+ while( !stream.atEnd() )
+ {
+ line = stream.readLine();
+ if ( line.isEmpty() )
+ continue;
+ if ( line[0] == '#' )
+ break;
+ int colon = line.indexOf(':');
+ if ( colon == -1 )
+ break;
+ properties[line.left(colon).toLower()] =
+ line.right(line.size() - colon - 1).trimmed();
+ }
+ /// \todo Store extra properties in the palette object
+ setName(properties[QStringLiteral("name")]);
+ setColumns(properties[QStringLiteral("columns")].toInt());
+
+ // Skip comments
+ if ( !stream.atEnd() && line[0] == '#' )
+ while( !stream.atEnd() )
+ {
+ qint64 pos = stream.pos();
+ line = stream.readLine();
+ if ( !line.isEmpty() && line[0] != '#' )
+ {
+ stream.seek(pos);
+ break;
+ }
+ }
+
+ while( !stream.atEnd() )
+ {
+ int r = 0, g = 0, b = 0;
+ stream >> r >> g >> b;
+ line = stream.readLine().trimmed();
+ p->colors.push_back(qMakePair(QColor(r, g, b), line));
+ }
+
+ Q_EMIT colorsChanged(p->colors);
+ setDirty(false);
+
+ return true;
+}
+
+ColorPalette ColorPalette::fromFile(const QString& name)
+{
+ ColorPalette p;
+ p.load(name);
+ return p;
+}
+
+bool ColorPalette::save(const QString& filename)
+{
+ setFileName(filename);
+ return save();
+}
+
+bool ColorPalette::save()
+{
+ QString filename = p->fileName;
+ if ( filename.isEmpty() )
+ {
+ filename = unnamed(p->name)+".gpl";
+ }
+
+ QFile file(filename);
+ if ( !file.open(QFile::Text|QFile::WriteOnly) )
+ return false;
+
+ QTextStream stream(&file);
+
+ stream << "GIMP Palette\n";
+ stream << "Name: " << unnamed(p->name) << '\n';
+ if ( p->columns )
+ stream << "Columns: " << p->columns << '\n';
+ /// \todo Options to add comments
+ stream << "#\n";
+
+ for ( int i = 0; i < p->colors.size(); i++ )
+ {
+ stream << qSetFieldWidth(3) << p->colors[i].first.red() << qSetFieldWidth(0) << ' '
+ << qSetFieldWidth(3) << p->colors[i].first.green() << qSetFieldWidth(0) << ' '
+ << qSetFieldWidth(3) << p->colors[i].first.blue() << qSetFieldWidth(0) << '\t'
+ << unnamed(p->colors[i].second) << '\n';
+ }
+
+ if ( !file.error() )
+ {
+ setDirty(false);
+ return true;
+ }
+
+ return false;
+}
+
+
+QString ColorPalette::fileName() const
+{
+ return p->fileName;
+}
+
+
+void ColorPalette::setColumns(int columns)
+{
+ if ( columns <= 0 )
+ columns = 0;
+
+ if ( columns != p->columns )
+ {
+ setDirty(true);
+ Q_EMIT columnsChanged( p->columns = columns );
+ }
+}
+
+void ColorPalette::setColors(const QVector& colors)
+{
+ p->colors.clear();
+ Q_FOREACH(const QColor& col, colors)
+ p->colors.push_back(qMakePair(col,QString()));
+ setDirty(true);
+ Q_EMIT colorsChanged(p->colors);
+}
+
+void ColorPalette::setColors(const QVector >& colors)
+{
+ p->colors = colors;
+ setDirty(true);
+ Q_EMIT colorsChanged(p->colors);
+}
+
+
+void ColorPalette::setColorAt(int index, const QColor& color)
+{
+ if ( !p->valid_index(index) )
+ return;
+
+ p->colors[index].first = color;
+
+ setDirty(true);
+ Q_EMIT colorChanged(index);
+ Q_EMIT colorsUpdated(p->colors);
+}
+
+void ColorPalette::setColorAt(int index, const QColor& color, const QString& name)
+{
+ if ( !p->valid_index(index) )
+ return;
+
+ p->colors[index].first = color;
+ p->colors[index].second = name;
+ setDirty(true);
+ Q_EMIT colorChanged(index);
+ Q_EMIT colorsUpdated(p->colors);
+}
+
+void ColorPalette::setNameAt(int index, const QString& name)
+{
+ if ( !p->valid_index(index) )
+ return;
+
+ p->colors[index].second = name;
+
+ setDirty(true);
+ Q_EMIT colorChanged(index);
+ Q_EMIT colorsUpdated(p->colors);
+}
+
+
+void ColorPalette::appendColor(const QColor& color, const QString& name)
+{
+ p->colors.push_back(qMakePair(color,name));
+ setDirty(true);
+ Q_EMIT colorAdded(p->colors.size()-1);
+ Q_EMIT colorsUpdated(p->colors);
+}
+
+void ColorPalette::insertColor(int index, const QColor& color, const QString& name)
+{
+ if ( index < 0 || index > p->colors.size() )
+ return;
+
+ p->colors.insert(index, qMakePair(color, name));
+
+ setDirty(true);
+ Q_EMIT colorAdded(index);
+ Q_EMIT colorsUpdated(p->colors);
+}
+
+void ColorPalette::eraseColor(int index)
+{
+ if ( !p->valid_index(index) )
+ return;
+
+ p->colors.remove(index);
+
+ setDirty(true);
+ Q_EMIT colorRemoved(index);
+ Q_EMIT colorsUpdated(p->colors);
+}
+
+void ColorPalette::setName(const QString& name)
+{
+ setDirty(true);
+ p->name = name;
+}
+
+void ColorPalette::setFileName(const QString& name)
+{
+ setDirty(true);
+ p->fileName = name;
+}
+
+QString ColorPalette::unnamed(const QString& name) const
+{
+ return name.isEmpty() ? tr("Unnamed") : name;
+}
+
+
+QPixmap ColorPalette::preview(const QSize& size, const QColor& background) const
+{
+ if ( !size.isValid() || p->colors.empty() )
+ return QPixmap();
+
+ QPixmap out( size );
+ out.fill(background);
+ QPainter painter(&out);
+
+ int count = p->colors.size();
+ int columns = p->columns;
+ if ( !columns )
+ columns = std::ceil( std::sqrt( count * float(size.width()) / size.height() ) );
+ int rows = std::ceil( float(count) / columns );
+ QSizeF color_size(float(size.width()) / columns, float(size.height()) / rows);
+
+ for ( int y = 0, i = 0; y < rows && i < count; y++ )
+ {
+ for ( int x = 0; x < columns && i < count; x++, i++ )
+ {
+ painter.fillRect(QRectF(x*color_size.width(), y*color_size.height(),
+ color_size.width(), color_size.height()),
+ p->colors[i].first
+ );
+ }
+ }
+
+ return out;
+}
+
+bool ColorPalette::dirty() const
+{
+ return p->dirty;
+}
+
+void ColorPalette::setDirty(bool dirty)
+{
+ if ( dirty != p->dirty )
+ Q_EMIT dirtyChanged( p->dirty = dirty );
+}
+
+QVector ColorPalette::onlyColors() const
+{
+ QVector out;
+ out.reserve(p->colors.size());
+ for ( int i = 0; i < p->colors.size(); i++ )
+ out.push_back(p->colors[i].first);
+ return out;
+}
+
+QVector ColorPalette::colorTable() const
+{
+ QVector out;
+ out.reserve(p->colors.size());
+ for ( const auto& color_pair : p->colors )
+ out.push_back(color_pair.first.rgba());
+ return out;
+}
+
+ColorPalette ColorPalette::fromColorTable(const QVector& table)
+{
+ ColorPalette palette;
+ palette.loadColorTable(table);
+ return palette;
+}
+
+} // namespace color_widgets
diff --git a/external/Qt-Color-Widgets/src/QtColorWidgets/color_palette_model.cpp b/external/Qt-Color-Widgets/src/QtColorWidgets/color_palette_model.cpp
new file mode 100644
index 00000000..ec58f53b
--- /dev/null
+++ b/external/Qt-Color-Widgets/src/QtColorWidgets/color_palette_model.cpp
@@ -0,0 +1,331 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "QtColorWidgets/color_palette_model.hpp"
+#include
+#include
+#include
+
+namespace color_widgets {
+
+class ColorPaletteModel::Private
+{
+public:
+ /// \todo Keep sorted by name (?)
+ QList palettes;
+ QSize icon_size;
+ QStringList search_paths;
+ QString save_path;
+
+ Private()
+ : icon_size(32, 32)
+ {}
+
+ bool acceptable(const QModelIndex& index) const
+ {
+ return acceptable(index.row());
+ }
+
+ bool acceptable(int row) const
+ {
+ return row >= 0 && row <= palettes.count();
+ }
+
+ QList::iterator find(const QString& name)
+ {
+ return std::find_if(palettes.begin(), palettes.end(),
+ [&name](const ColorPalette& palette) {
+ return palette.name() == name;
+ });
+ }
+
+ bool attemptSave(ColorPalette& palette, const QString& filename)
+ {
+ if ( filename.isEmpty() )
+ return false;
+ return palette.save(filename);
+ }
+
+ void fixUnnamed(ColorPalette& palette)
+ {
+ if ( palette.name().isEmpty() )
+ palette.setName(ColorPaletteModel::tr("Unnamed"));
+ }
+
+ bool save(ColorPalette& palette, const QString& suggested_filename = QString())
+ {
+ // Attempt to save with the existing file names
+ if ( !suggested_filename.isEmpty() && attemptSave(palette, suggested_filename) )
+ return true;
+ if ( attemptSave(palette, palette.fileName()) )
+ return true;
+
+ // Set up the save directory
+ QDir save_dir(save_path);
+ if ( !save_dir.exists() && !QDir().mkdir(save_path) )
+ return false;
+
+ // Attempt to save as (Name).gpl
+ QString filename = palette.name()+".gpl";
+ if ( !save_dir.exists(filename) &&
+ attemptSave(palette, save_dir.absoluteFilePath(filename)) )
+ return true;
+
+ // Get all of the files matching the pattern *.gpl
+ save_dir.setNameFilters(QStringList() << QStringLiteral("*.gpl"));
+ save_dir.setFilter(QDir::Files);
+ QStringList existing_files = save_dir.entryList();
+
+ // For all the files that match (Name)(Number).gpl, find the maximum (Number)
+ QRegularExpression name_regex(QRegularExpression::escape(palette.name())+"([0-9]+)\\.gpl");
+ int max = 0;
+ for ( const auto& existing_file : existing_files )
+ {
+ QRegularExpressionMatch match = name_regex.match(existing_file);
+ if ( match.hasMatch() )
+ {
+ int num = match.captured(1).toInt();
+ if ( num > max )
+ max = num;
+ }
+ }
+
+ return attemptSave(palette,
+ save_dir.absoluteFilePath(QStringLiteral("%1%2.gpl").arg(palette.name()).arg(max+1))
+ );
+ }
+};
+
+ColorPaletteModel::ColorPaletteModel()
+ : p ( new Private )
+ {}
+
+ColorPaletteModel::~ColorPaletteModel()
+{
+ delete p;
+}
+
+int ColorPaletteModel::rowCount(const QModelIndex &) const
+{
+ return count();
+}
+
+QVariant ColorPaletteModel::data(const QModelIndex &index, int role) const
+{
+ if ( !p->acceptable(index) )
+ return QVariant();
+
+ const ColorPalette& palette = p->palettes[index.row()];
+ switch( role )
+ {
+ case Qt::DisplayRole:
+ return palette.name();
+ case Qt::DecorationRole:
+ return palette.preview(p->icon_size);
+ case Qt::ToolTipRole:
+ return tr("%1 (%2 colors)").arg(palette.name()).arg(palette.count());
+ }
+
+ return QVariant();
+}
+
+bool ColorPaletteModel::removeRows(int row, int count, const QModelIndex & parent)
+{
+ Q_UNUSED(parent)
+
+ if ( !p->acceptable(row) || count <= 0 )
+ return false;
+
+ auto begin = p->palettes.begin() + row;
+ auto end = row + count >= p->palettes.size() ? p->palettes.end() : begin + count;
+ for ( auto it = begin; it != end; ++it )
+ {
+ if ( !it->fileName().isEmpty() )
+ {
+ QFileInfo file(it->fileName());
+ if ( file.isWritable() && file.isFile() )
+ QFile::remove(it->fileName());
+ }
+ }
+
+ p->palettes.erase(begin, end);
+
+ return true;
+}
+
+QSize ColorPaletteModel::iconSize() const
+{
+ return p->icon_size;
+}
+
+void ColorPaletteModel::setIconSize(const QSize& iconSize)
+{
+ if ( p->icon_size != iconSize )
+ Q_EMIT iconSizeChanged( p->icon_size = iconSize );
+}
+
+QString ColorPaletteModel::savePath() const
+{
+ return p->save_path;
+}
+
+QStringList ColorPaletteModel::searchPaths() const
+{
+ return p->search_paths;
+}
+
+void ColorPaletteModel::setSavePath(const QString& savePath)
+{
+ if ( p->save_path != savePath )
+ Q_EMIT savePathChanged( p->save_path = savePath );
+}
+
+void ColorPaletteModel::setSearchPaths(const QStringList& searchPaths)
+{
+ if ( p->search_paths != searchPaths )
+ Q_EMIT searchPathsChanged( p->search_paths = searchPaths );
+}
+
+void ColorPaletteModel::addSearchPath(const QString& path)
+{
+ /// \todo Should compare canonical paths
+ /// and these checks should also be made in setSearchPaths
+ if ( !p->search_paths.contains(path) )
+ {
+ p->search_paths.push_back(path);
+ Q_EMIT searchPathsChanged( p->search_paths );
+ }
+}
+
+void ColorPaletteModel::load()
+{
+ beginResetModel();
+ p->palettes.clear();
+ QStringList filters;
+ filters << QStringLiteral("*.gpl");
+ for ( const QString& directory_name : p->search_paths )
+ {
+ QDir directory(directory_name);
+ directory.setNameFilters(filters);
+ directory.setFilter(QDir::Files|QDir::Readable);
+ directory.setSorting(QDir::Name);
+ for ( const QFileInfo& file : directory.entryInfoList() )
+ {
+ ColorPalette palette;
+ if ( palette.load(file.absoluteFilePath()) )
+ {
+ p->palettes.push_back(palette);
+ }
+ }
+ }
+ endResetModel();
+}
+
+bool ColorPaletteModel::hasPalette(const QString& name) const
+{
+ return p->find(name) != p->palettes.end();
+}
+
+int ColorPaletteModel::count() const
+{
+ return p->palettes.size();
+}
+
+const ColorPalette& ColorPaletteModel::palette(const QString& name) const
+{
+ return *p->find(name);
+}
+
+const ColorPalette& ColorPaletteModel::palette(int index) const
+{
+ return p->palettes[index];
+}
+
+bool ColorPaletteModel::updatePalette(int index, const ColorPalette& palette, bool save)
+{
+ if ( !p->acceptable(index) )
+ return false;
+
+ // Store the old file name
+ QString filename = p->palettes[index].fileName();
+ // Update the palette
+ ColorPalette& local_palette = p->palettes[index] = palette;
+ p->fixUnnamed(local_palette);
+
+ Q_EMIT dataChanged(this->index(index), this->index(index));
+
+ if ( save )
+ return p->save(local_palette, filename);
+
+ return true;
+}
+
+bool ColorPaletteModel::removePalette(int index, bool remove_file)
+{
+ if ( !p->acceptable(index) )
+ return false;
+
+ QString file_name = p->palettes[index].fileName();
+
+ beginRemoveRows(QModelIndex(), index, index);
+ p->palettes.removeAt(index);
+ endRemoveRows();
+
+ if ( !file_name.isEmpty() && remove_file )
+ {
+ QFileInfo file(file_name);
+ if ( file.isWritable() && file.isFile() )
+ return QFile::remove(file_name);
+ return false;
+ }
+
+ return true;
+}
+
+bool ColorPaletteModel::addPalette(const ColorPalette& palette, bool save)
+{
+ beginInsertRows(QModelIndex(), p->palettes.size(), p->palettes.size());
+ p->palettes.push_back(palette);
+ p->fixUnnamed(p->palettes.back());
+ endInsertRows();
+
+ if ( save )
+ return p->save(p->palettes.back());
+
+ return true;
+}
+
+
+int ColorPaletteModel::indexFromFile(const QString& filename) const
+{
+ QString canonical = QFileInfo(filename).canonicalFilePath();
+ int i = 0;
+ for ( const auto& pal : p->palettes )
+ {
+ if ( !pal.fileName().isEmpty() &&
+ QFileInfo(pal.fileName()).canonicalFilePath() == canonical )
+ return i;
+ i++;
+ }
+ return -1;
+}
+
+} // namespace color_widgets
diff --git a/external/Qt-Color-Widgets/src/QtColorWidgets/color_palette_widget.cpp b/external/Qt-Color-Widgets/src/QtColorWidgets/color_palette_widget.cpp
new file mode 100644
index 00000000..2c195265
--- /dev/null
+++ b/external/Qt-Color-Widgets/src/QtColorWidgets/color_palette_widget.cpp
@@ -0,0 +1,451 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "QtColorWidgets/color_palette_widget.hpp"
+#include "ui_color_palette_widget.h"
+#include "QtColorWidgets/color_dialog.hpp"
+#include
+#include
+#include
+#include
+
+namespace color_widgets {
+
+class ColorPaletteWidget::Private : public Ui::ColorPaletteWidget
+{
+public:
+ ColorPaletteModel* model = nullptr;
+ bool read_only = false;
+ QColor default_color;
+
+ bool hasSelectedPalette()
+ {
+ return model && palette_list->currentIndex() != -1;
+ }
+
+ const ColorPalette& selectedPalette()
+ {
+ return model->palette(palette_list->currentIndex());
+ }
+
+ void addPalette(ColorPalette& palette)
+ {
+ bool save = false;
+ // Save palettes in the savePath
+ /// \todo This currently breaks opening the right directory
+ /// ie: the one containing the original file.
+ if ( !palette.fileName().isEmpty() )
+ {
+ QFileInfo file(palette.fileName());
+ if ( file.dir().canonicalPath() != QDir(model->savePath()).canonicalPath() )
+ {
+ palette.setFileName(QString());
+ save = true;
+ }
+ }
+ model->addPalette(palette, save);
+ palette_list->setCurrentIndex(model->count()-1);
+ }
+
+ bool openImage(const QString& file)
+ {
+ QImage image(file);
+ if ( !image.isNull() )
+ {
+ ColorPalette palette;
+ palette.loadImage(image);
+ palette.setName(QFileInfo(file).baseName());
+ palette.setFileName(file+".gpl");
+ addPalette(palette);
+ return true;
+ }
+ return false;
+ }
+
+ bool openGpl(const QString& file)
+ {
+ int existing = model->indexFromFile(file);
+ if ( existing != -1 )
+ {
+ palette_list->setCurrentIndex(existing);
+ return true;
+ }
+
+ ColorPalette palette;
+ if ( palette.load(file) )
+ {
+ addPalette(palette);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool openPalette(const QString& file, int type)
+ {
+ if ( type == 1 )
+ return openImage(file);
+ return openGpl(file);
+ }
+};
+
+
+ColorPaletteWidget::ColorPaletteWidget(QWidget* parent)
+ : QWidget(parent), p(new Private)
+{
+ p->setupUi(this);
+
+ // Connext Swatch signals
+ connect(p->swatch, &Swatch::colorSizeChanged, this, &ColorPaletteWidget::colorSizeChanged);
+ connect(p->swatch, &Swatch::colorSizePolicyChanged, this, &ColorPaletteWidget::colorSizePolicyChanged);
+ connect(p->swatch, &Swatch::forcedRowsChanged, this, &ColorPaletteWidget::forcedRowsChanged);
+ connect(p->swatch, &Swatch::forcedColumnsChanged, this, &ColorPaletteWidget::forcedColumnsChanged);
+ connect(p->swatch, &Swatch::colorSelected,
+ this, (void (ColorPaletteWidget::*)(const QColor&)) &ColorPaletteWidget::currentColorChanged);
+ connect(p->swatch, &Swatch::selectedChanged,
+ this, (void (ColorPaletteWidget::*)(int)) &ColorPaletteWidget::currentColorChanged);
+ connect(p->swatch, &Swatch::borderChanged, this, &ColorPaletteWidget::borderChanged);
+ connect(p->swatch, &Swatch::paletteChanged, this, &ColorPaletteWidget::currentPaletteChanged);
+
+ connect(&p->swatch->palette(), &ColorPalette::dirtyChanged, p->button_palette_save, &QWidget::setEnabled);
+ connect(&p->swatch->palette(), &ColorPalette::dirtyChanged, p->button_palette_revert, &QWidget::setEnabled);
+
+ connect(p->palette_list, (void (QComboBox::*)(int))&QComboBox::currentIndexChanged,
+ this, &ColorPaletteWidget::currentRowChanged);
+
+ // Buttons changing the colors in the current palette
+ connect(p->button_color_add, &QAbstractButton::clicked, [this](){
+ if ( !p->read_only && p->hasSelectedPalette() )
+ {
+ if ( p->default_color.isValid() )
+ {
+ p->swatch->palette().appendColor(p->default_color);
+ p->swatch->setSelected(p->swatch->palette().count()-1);
+ }
+ else
+ {
+ ColorDialog dialog(this);
+ dialog.setAlphaEnabled(false);
+ if ( p->swatch->selected() != -1 )
+ dialog.setColor(p->swatch->selectedColor());
+ if ( dialog.exec() )
+ {
+ p->swatch->palette().appendColor(dialog.color());
+ p->swatch->setSelected(p->swatch->palette().count()-1);
+ }
+ }
+ }
+ });
+ connect(p->button_color_remove, &QAbstractButton::clicked, p->swatch, &Swatch::removeSelected);
+
+ // Buttons modifying the current palette file
+ connect(p->button_palette_delete, &QAbstractButton::clicked, [this]() {
+ if ( !p->read_only && p->hasSelectedPalette() )
+ p->model->removePalette(p->palette_list->currentIndex());
+ });
+ connect(p->button_palette_save, &QAbstractButton::clicked, [this](){
+ if ( !p->read_only && p->hasSelectedPalette() && p->swatch->palette().dirty() )
+ if ( p->model->updatePalette( p->palette_list->currentIndex(), p->swatch->palette() ) )
+ {
+ p->swatch->palette().setDirty(false);
+ }
+ /// \todo else ask for a file name (?)
+ });
+ connect(p->button_palette_revert, &QAbstractButton::clicked, [this](){
+ if ( p->hasSelectedPalette() )
+ {
+ p->swatch->setPalette(p->selectedPalette());
+ }
+ });
+
+ // Buttons creating new palettes
+ connect(p->button_palette_duplicate, &QAbstractButton::clicked, [this](){
+ if ( p->hasSelectedPalette() )
+ {
+ ColorPalette new_palette = p->selectedPalette();
+ new_palette.setFileName(QString());
+ bool ok = false;
+ QString name = QInputDialog::getText(this, tr("New Palette"),
+ tr("Name"), QLineEdit::Normal, new_palette.name(), &ok);
+ if ( ok )
+ {
+ new_palette.setName(name);
+ p->model->addPalette(new_palette);
+ p->palette_list->setCurrentIndex(p->model->count()-1);
+ }
+ }
+ });
+ /// \todo Show a dialog that asks for the number of columns (?)
+ connect(p->button_palette_new, &QAbstractButton::clicked, [this](){
+ if ( p->model )
+ {
+ bool ok = false;
+ QString name = QInputDialog::getText(this, tr("New Palette"),
+ tr("Name"), QLineEdit::Normal, QString(), &ok);
+ if ( ok )
+ {
+ ColorPalette new_palette(name);
+ p->model->addPalette(new_palette);
+ p->palette_list->setCurrentIndex(p->model->count()-1);
+ }
+ }
+ });
+
+ QString image_formats;
+ Q_FOREACH(QByteArray ba, QImageReader::supportedImageFormats())
+ image_formats += " *."+QString(ba);
+
+ connect(p->button_palette_open, &QAbstractButton::clicked, [this, image_formats](){
+ if ( p->model )
+ {
+ QString default_dir;
+ if ( p->hasSelectedPalette() )
+ {
+ const ColorPalette& palette = p->selectedPalette();
+ if ( !palette.fileName().isEmpty() )
+ default_dir = QFileInfo(palette.fileName()).dir().path();
+ }
+
+ QStringList file_formats = QStringList()
+ << tr("GIMP Palettes (*.gpl)")
+ << tr("Palette Image (%1)").arg(image_formats)
+ << tr("All Files (*)");
+ QFileDialog open_dialog(this, tr("Open Palette"), default_dir);
+ open_dialog.setFileMode(QFileDialog::ExistingFile);
+ open_dialog.setAcceptMode(QFileDialog::AcceptOpen);
+ open_dialog.setNameFilters(file_formats);
+
+ if ( !open_dialog.exec() )
+ return;
+
+ int type = file_formats.indexOf(open_dialog.selectedNameFilter());
+ QString file_name = open_dialog.selectedFiles()[0];
+
+ if ( !p->openPalette( file_name, type ) )
+ {
+ QMessageBox::warning(this, tr("Open Palette"),
+ tr("Failed to load the palette file\n%1").arg(file_name));
+ }
+ }
+ });
+}
+
+ColorPaletteWidget::~ColorPaletteWidget() = default;
+
+ColorPaletteModel* ColorPaletteWidget::model() const
+{
+ return p->model;
+}
+
+const ColorPalette& ColorPaletteWidget::currentPalette() const
+{
+ return p->swatch->palette();
+}
+
+QSize ColorPaletteWidget::colorSize() const
+{
+ return p->swatch->colorSize();
+}
+
+Swatch::ColorSizePolicy ColorPaletteWidget::colorSizePolicy() const
+{
+ return p->swatch->colorSizePolicy();
+}
+
+QPen ColorPaletteWidget::border() const
+{
+ return p->swatch->border();
+}
+
+int ColorPaletteWidget::forcedRows() const
+{
+ return p->swatch->forcedRows();
+}
+int ColorPaletteWidget::forcedColumns() const
+{
+ return p->swatch->forcedColumns();
+}
+
+bool ColorPaletteWidget::readOnly() const
+{
+ return p->read_only;
+}
+
+QColor ColorPaletteWidget::currentColor() const
+{
+ return p->swatch->selectedColor();
+}
+
+void ColorPaletteWidget::setModel(ColorPaletteModel* model)
+{
+ if ( model == p->model )
+ return;
+
+ if ( p->model )
+ {
+ disconnect(model, &QAbstractItemModel::dataChanged, this, nullptr);
+ }
+
+ p->model = model;
+ p->swatch->setPalette(ColorPalette());
+ p->palette_list->setModel(model);
+
+ if ( model )
+ {
+ connect(model, &QAbstractItemModel::dataChanged, this, [this](const QModelIndex &index){
+ if ( index.row() == p->palette_list->currentIndex() )
+ p->swatch->setPalette(p->model->palette(index.row()));
+ });
+ }
+}
+
+void ColorPaletteWidget::setColorSize(const QSize& colorSize)
+{
+ p->swatch->setColorSize(colorSize);
+}
+
+void ColorPaletteWidget::setColorSizePolicy(Swatch::ColorSizePolicy colorSizePolicy)
+{
+ p->swatch->setColorSizePolicy(colorSizePolicy);
+}
+
+void ColorPaletteWidget::setBorder(const QPen& border)
+{
+ p->swatch->setBorder(border);
+}
+
+void ColorPaletteWidget::setForcedRows(int forcedRows)
+{
+ p->swatch->setForcedRows(forcedRows);
+}
+
+void ColorPaletteWidget::setForcedColumns(int forcedColumns)
+{
+ p->swatch->setForcedColumns(forcedColumns);
+}
+
+void ColorPaletteWidget::setReadOnly(bool readOnly)
+{
+ if ( readOnly == p->read_only )
+ return;
+
+ p->swatch->setReadOnly(readOnly);
+ p->group_edit_list->setVisible(!readOnly);
+ p->group_edit_palette->setVisible(!readOnly);
+ Q_EMIT readOnlyChanged(p->read_only = readOnly);
+}
+
+bool ColorPaletteWidget::setCurrentColor(const QColor& color)
+{
+ QColor rgb = color.toRgb();
+ const auto& palette = p->swatch->palette();
+ for ( int i = 0; i < palette.count(); i++ )
+ {
+ if ( palette.colorAt(i).toRgb() == rgb )
+ {
+ p->swatch->setSelected(i);
+ return true;
+ }
+ }
+
+ p->swatch->clearSelection();
+ return false;
+}
+
+bool ColorPaletteWidget::setCurrentColor(const QString& name)
+{
+ const auto& palette = p->swatch->palette();
+ for ( int i = 0; i < palette.count(); i++ )
+ {
+ if ( palette.nameAt(i) == name )
+ {
+ p->swatch->setSelected(i);
+ return true;
+ }
+ }
+
+ p->swatch->clearSelection();
+ return false;
+}
+
+bool ColorPaletteWidget::setCurrentColor(int index)
+{
+ const auto& palette = p->swatch->palette();
+ if ( index >= 0 && index < palette.count() )
+ {
+ p->swatch->setSelected(index);
+ return true;
+ }
+
+ p->swatch->clearSelection();
+ return false;
+}
+
+
+void ColorPaletteWidget::on_palette_list_currentIndexChanged(int index)
+{
+ if ( !p->model )
+ p->swatch->setPalette(ColorPalette());
+ else
+ p->swatch->setPalette(p->model->palette(index));
+
+ p->swatch->palette().setDirty(false);
+}
+
+void ColorPaletteWidget::on_swatch_doubleClicked(int index)
+{
+ if ( !p->read_only )
+ {
+ ColorDialog dialog(this);
+ dialog.setAlphaEnabled(false);
+ dialog.setColor(p->swatch->palette().colorAt(index));
+ if ( dialog.exec() )
+ p->swatch->palette().setColorAt(index, dialog.color());
+ }
+}
+
+int ColorPaletteWidget::currentRow() const
+{
+ return p->palette_list->currentIndex();
+}
+
+void ColorPaletteWidget::setCurrentRow(int row)
+{
+ p->palette_list->setCurrentIndex(row);
+}
+
+void ColorPaletteWidget::clearCurrentColor()
+{
+ p->swatch->clearSelection();
+}
+
+QColor ColorPaletteWidget::defaultColor() const
+{
+ return p->default_color;
+}
+
+
+void ColorPaletteWidget::setDefaultColor(const QColor& color)
+{
+ Q_EMIT(p->default_color = color);
+}
+
+} // namespace color_widgets
diff --git a/external/Qt-Color-Widgets/src/QtColorWidgets/color_palette_widget.ui b/external/Qt-Color-Widgets/src/QtColorWidgets/color_palette_widget.ui
new file mode 100644
index 00000000..f9bd2251
--- /dev/null
+++ b/external/Qt-Color-Widgets/src/QtColorWidgets/color_palette_widget.ui
@@ -0,0 +1,205 @@
+
+
+ color_widgets::ColorPaletteWidget
+
+
+
+ 0
+ 0
+ 227
+ 186
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+ Open a new palette from file
+
+
+
+
+
+
+
+
+ -
+
+
+ Create a new palette
+
+
+
+
+
+
+
+
+ -
+
+
+ Duplicate the current palette
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ -
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+ Delete the current palette
+
+
+
+
+
+
+
+
+ -
+
+
+ Revert changes to the current palette
+
+
+
+
+
+
+
+
+ -
+
+
+ Save changes to the current palette
+
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Add a color to the palette
+
+
+
+
+
+
+
+
+ -
+
+
+ Remove the selected color from the palette
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ color_widgets::Swatch
+ QWidget
+ QtColorWidgets/swatch.hpp
+
+
+
+
+
diff --git a/external/Qt-Color-Widgets/src/QtColorWidgets/color_preview.cpp b/external/Qt-Color-Widgets/src/QtColorWidgets/color_preview.cpp
new file mode 100644
index 00000000..e157902e
--- /dev/null
+++ b/external/Qt-Color-Widgets/src/QtColorWidgets/color_preview.cpp
@@ -0,0 +1,206 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ * \copyright Copyright (C) 2014 Calle Laakkonen
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "QtColorWidgets/color_preview.hpp"
+
+#include
+#include
+#include
+#include
+#include
+
+namespace color_widgets {
+
+class ColorPreview::Private
+{
+public:
+ QColor col; ///< color to be viewed
+ QColor comparison; ///< comparison color
+ QBrush back;///< Background brush, visible on a transparent color
+ DisplayMode display_mode; ///< How the color(s) are to be shown
+ bool draw_frame = true; ///< Whether to draw a frame around the color
+
+ Private() : col(Qt::red), back(Qt::darkGray, Qt::DiagCrossPattern), display_mode(NoAlpha)
+ {}
+};
+
+ColorPreview::ColorPreview(QWidget *parent) :
+ QWidget(parent), p(new Private)
+{
+ p->back.setTexture(QPixmap(QStringLiteral(":/color_widgets/alphaback.png")));
+}
+
+ColorPreview::~ColorPreview()
+{
+ delete p;
+}
+
+void ColorPreview::setBackground(const QBrush &bk)
+{
+ p->back = bk;
+ update();
+ Q_EMIT backgroundChanged(bk);
+}
+
+QBrush ColorPreview::background() const
+{
+ return p->back;
+}
+
+ColorPreview::DisplayMode ColorPreview::displayMode() const
+{
+ return p->display_mode;
+}
+
+void ColorPreview::setDisplayMode(DisplayMode m)
+{
+ p->display_mode = m;
+ update();
+ Q_EMIT displayModeChanged(m);
+}
+
+QColor ColorPreview::color() const
+{
+ return p->col;
+}
+
+QColor ColorPreview::comparisonColor() const
+{
+ return p->comparison;
+}
+
+QSize ColorPreview::sizeHint() const
+{
+ int width = style()->pixelMetric(QStyle::PM_IndicatorWidth, nullptr, nullptr);
+ int height = style()->pixelMetric(QStyle::PM_IndicatorHeight, nullptr, nullptr);
+ return QSize(qMax(24, width), qMax(24, height));
+}
+
+void ColorPreview::paint(QPainter &painter, QRect rect) const
+{
+ QColor c1, c2;
+ switch(p->display_mode) {
+ case DisplayMode::NoAlpha:
+ c1 = c2 = p->col.rgb();
+ break;
+ case DisplayMode::AllAlpha:
+ c1 = c2 = p->col;
+ break;
+ case DisplayMode::SplitAlpha:
+ c1 = p->col.rgb();
+ c2 = p->col;
+ break;
+ case DisplayMode::SplitColor:
+ c1 = p->comparison;
+ c2 = p->col;
+ break;
+ case DisplayMode::SplitColorReverse:
+ c1 = p->col;
+ c2 = p->comparison;
+ break;
+ }
+
+ if ( p->draw_frame )
+ {
+ QStyleOptionFrame panel;
+ panel.initFrom(this);
+ panel.lineWidth = 2;
+ panel.midLineWidth = 0;
+ panel.state |= QStyle::State_Sunken;
+ style()->drawPrimitive(QStyle::PE_Frame, &panel, &painter, this);
+ QRect r = style()->subElementRect(QStyle::SE_FrameContents, &panel, this);
+ painter.setClipRect(r);
+ }
+
+ if ( c1.alpha() < 255 || c2.alpha() < 255 )
+ painter.fillRect(0, 0, rect.width(), rect.height(), p->back);
+
+ int w = rect.width() / 2;
+ int h = rect.height();
+ painter.fillRect(0, 0, w, h, c1);
+ painter.fillRect(w, 0, w, h, c2);
+}
+
+void ColorPreview::setColor(const QColor &c)
+{
+ p->col = c;
+ update();
+ Q_EMIT colorChanged(c);
+}
+
+void ColorPreview::setComparisonColor(const QColor &c)
+{
+ p->comparison = c;
+ update();
+ Q_EMIT comparisonColorChanged(c);
+}
+
+void ColorPreview::paintEvent(QPaintEvent *)
+{
+ QStylePainter painter(this);
+
+ paint(painter, geometry());
+}
+
+void ColorPreview::resizeEvent(QResizeEvent *)
+{
+ update();
+}
+
+void ColorPreview::mouseReleaseEvent(QMouseEvent * ev)
+{
+ if ( QRect(QPoint(0,0),size()).contains(ev->pos()) )
+ Q_EMIT clicked();
+}
+
+void ColorPreview::mouseMoveEvent(QMouseEvent *ev)
+{
+
+ if ( ev->buttons() &Qt::LeftButton && !QRect(QPoint(0,0),size()).contains(ev->pos()) )
+ {
+ QMimeData *data = new QMimeData;
+
+ data->setColorData(p->col);
+
+ QDrag* drag = new QDrag(this);
+ drag->setMimeData(data);
+
+ QPixmap preview(24,24);
+ preview.fill(p->col);
+ drag->setPixmap(preview);
+
+ drag->exec();
+ }
+}
+
+bool ColorPreview::drawFrame() const
+{
+ return p->draw_frame;
+}
+
+void ColorPreview::setDrawFrame(bool draw)
+{
+ Q_EMIT drawFrameChanged(p->draw_frame = draw);
+ update();
+}
+
+} // namespace color_widgets
diff --git a/external/Qt-Color-Widgets/src/QtColorWidgets/color_selector.cpp b/external/Qt-Color-Widgets/src/QtColorWidgets/color_selector.cpp
new file mode 100644
index 00000000..09cd43fe
--- /dev/null
+++ b/external/Qt-Color-Widgets/src/QtColorWidgets/color_selector.cpp
@@ -0,0 +1,188 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "QtColorWidgets/color_selector.hpp"
+#include "QtColorWidgets/color_dialog.hpp"
+#include
+#include
+#include
+
+namespace color_widgets {
+
+class ColorSelector::Private
+{
+public:
+ UpdateMode update_mode;
+ ColorDialog *dialog;
+ QColor old_color;
+
+ Private(QWidget *widget) : dialog(new ColorDialog(widget))
+ {
+ dialog->setButtonMode(ColorDialog::OkCancel);
+ }
+};
+
+ColorSelector::ColorSelector(QWidget *parent) :
+ ColorPreview(parent), p(new Private(this))
+{
+ setUpdateMode(Continuous);
+ p->old_color = color();
+
+ connect(this,&ColorPreview::clicked,this,&ColorSelector::showDialog);
+ connect(this,SIGNAL(colorChanged(QColor)),this,SLOT(update_old_color(QColor)));
+ connect(p->dialog,&QDialog::rejected,this,&ColorSelector::reject_dialog);
+ connect(p->dialog,&ColorDialog::colorSelected, this, &ColorSelector::accept_dialog);
+
+ connect(p->dialog, &ColorDialog::wheelRotatingChanged, this, &ColorSelector::wheelRotatingChanged);
+ connect(p->dialog, &ColorDialog::wheelShapeChanged, this, &ColorSelector::wheelShapeChanged);
+ connect(p->dialog, &ColorDialog::colorSpaceChanged, this, &ColorSelector::colorSpaceChanged);
+
+ setAcceptDrops(true);
+}
+
+ColorSelector::~ColorSelector()
+{
+ delete p;
+}
+
+ColorSelector::UpdateMode ColorSelector::updateMode() const
+{
+ return p->update_mode;
+}
+
+void ColorSelector::setUpdateMode(UpdateMode m)
+{
+ p->update_mode = m;
+ Q_EMIT updateModeChanged(m);
+}
+
+Qt::WindowModality ColorSelector::dialogModality() const
+{
+ return p->dialog->windowModality();
+}
+
+void ColorSelector::setDialogModality(Qt::WindowModality m)
+{
+ p->dialog->setWindowModality(m);
+ Q_EMIT dialogModalityChanged(m);
+}
+
+void ColorSelector::setWheelShape(ColorWheel::ShapeEnum shape)
+{
+ p->dialog->setWheelShape(shape);
+}
+
+ColorWheel::ShapeEnum ColorSelector::wheelShape() const
+{
+ return p->dialog->wheelShape();
+}
+
+void ColorSelector::setColorSpace(ColorWheel::ColorSpaceEnum space)
+{
+ p->dialog->setColorSpace(space);
+}
+
+ColorWheel::ColorSpaceEnum ColorSelector::colorSpace() const
+{
+ return p->dialog->colorSpace();
+}
+
+void ColorSelector::setWheelRotating(bool rotating)
+{
+ p->dialog->setWheelRotating(rotating);
+}
+
+bool ColorSelector::wheelRotating() const
+{
+ return p->dialog->wheelRotating();
+}
+
+void ColorSelector::showDialog()
+{
+ p->old_color = color();
+ p->dialog->setColor(color());
+ connect_dialog();
+#ifdef Q_OS_ANDROID
+ p->dialog->showMaximized();
+#else
+ p->dialog->show();
+#endif
+}
+
+
+void ColorSelector::connect_dialog()
+{
+ if (p->update_mode == Continuous)
+ connect(p->dialog, SIGNAL(colorChanged(QColor)), this, SLOT(setColor(QColor)), Qt::UniqueConnection);
+ else
+ disconnect_dialog();
+}
+
+void ColorSelector::disconnect_dialog()
+{
+ disconnect(p->dialog, SIGNAL(colorChanged(QColor)), this, SLOT(setColor(QColor)));
+}
+
+void ColorSelector::accept_dialog()
+{
+ setColor(p->dialog->color());
+ p->old_color = color();
+ Q_EMIT colorSelected(color());
+}
+
+void ColorSelector::reject_dialog()
+{
+ setColor(p->old_color);
+}
+
+void ColorSelector::update_old_color(const QColor &c)
+{
+ if (!p->dialog->isVisible())
+ p->old_color = c;
+}
+
+void ColorSelector::dragEnterEvent(QDragEnterEvent *event)
+{
+ if ( event->mimeData()->hasColor() ||
+ ( event->mimeData()->hasText() && QColor(event->mimeData()->text()).isValid() ) )
+ event->acceptProposedAction();
+}
+
+
+void ColorSelector::dropEvent(QDropEvent *event)
+{
+ if ( event->mimeData()->hasColor() )
+ {
+ setColor(event->mimeData()->colorData().value());
+ event->accept();
+ }
+ else if ( event->mimeData()->hasText() )
+ {
+ QColor col(event->mimeData()->text());
+ if ( col.isValid() )
+ {
+ setColor(col);
+ event->accept();
+ }
+ }
+}
+
+} // namespace color_widgets
diff --git a/external/Qt-Color-Widgets/src/QtColorWidgets/color_utils.cpp b/external/Qt-Color-Widgets/src/QtColorWidgets/color_utils.cpp
new file mode 100644
index 00000000..dfabb284
--- /dev/null
+++ b/external/Qt-Color-Widgets/src/QtColorWidgets/color_utils.cpp
@@ -0,0 +1,98 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "QtColorWidgets/color_utils.hpp"
+
+#include
+#include
+#include
+
+
+QColor color_widgets::utils::color_from_lch(qreal hue, qreal chroma, qreal luma, qreal alpha )
+{
+ qreal h1 = hue*6;
+ qreal x = chroma*(1-qAbs(std::fmod(h1,2)-1));
+ QColor col;
+ if ( h1 >= 0 && h1 < 1 )
+ col = QColor::fromRgbF(chroma,x,0);
+ else if ( h1 < 2 )
+ col = QColor::fromRgbF(x,chroma,0);
+ else if ( h1 < 3 )
+ col = QColor::fromRgbF(0,chroma,x);
+ else if ( h1 < 4 )
+ col = QColor::fromRgbF(0,x,chroma);
+ else if ( h1 < 5 )
+ col = QColor::fromRgbF(x,0,chroma);
+ else if ( h1 < 6 )
+ col = QColor::fromRgbF(chroma,0,x);
+
+ qreal m = luma - color_lumaF(col);
+
+ return QColor::fromRgbF(
+ qBound(0.0,col.redF()+m,1.0),
+ qBound(0.0,col.greenF()+m,1.0),
+ qBound(0.0,col.blueF()+m,1.0),
+ alpha);
+}
+
+QColor color_widgets::utils::color_from_hsl(qreal hue, qreal sat, qreal lig, qreal alpha )
+{
+ qreal chroma = (1 - qAbs(2*lig-1))*sat;
+ qreal h1 = hue*6;
+ qreal x = chroma*(1-qAbs(std::fmod(h1,2)-1));
+ QColor col;
+ if ( h1 >= 0 && h1 < 1 )
+ col = QColor::fromRgbF(chroma,x,0);
+ else if ( h1 < 2 )
+ col = QColor::fromRgbF(x,chroma,0);
+ else if ( h1 < 3 )
+ col = QColor::fromRgbF(0,chroma,x);
+ else if ( h1 < 4 )
+ col = QColor::fromRgbF(0,x,chroma);
+ else if ( h1 < 5 )
+ col = QColor::fromRgbF(x,0,chroma);
+ else if ( h1 < 6 )
+ col = QColor::fromRgbF(chroma,0,x);
+
+ qreal m = lig-chroma/2;
+
+ return QColor::fromRgbF(
+ qBound(0.0,col.redF()+m,1.0),
+ qBound(0.0,col.greenF()+m,1.0),
+ qBound(0.0,col.blueF()+m,1.0),
+ alpha);
+}
+
+
+QColor color_widgets::utils::get_screen_color(const QPoint &global_pos)
+{
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
+ QScreen *screen = QApplication::screenAt(global_pos);
+#else
+ int screenNum = QApplication::desktop()->screenNumber(global_pos);
+ QScreen *screen = QApplication::screens().at(screenNum);
+#endif
+
+ WId wid = QApplication::desktop()->winId();
+ QImage img = screen->grabWindow(wid, global_pos.x(), global_pos.y(), 1, 1).toImage();
+
+ return img.pixel(0,0);
+}
diff --git a/external/Qt-Color-Widgets/src/QtColorWidgets/color_wheel.cpp b/external/Qt-Color-Widgets/src/QtColorWidgets/color_wheel.cpp
new file mode 100644
index 00000000..bca13dc0
--- /dev/null
+++ b/external/Qt-Color-Widgets/src/QtColorWidgets/color_wheel.cpp
@@ -0,0 +1,366 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "QtColorWidgets/color_wheel.hpp"
+#include "QtColorWidgets/color_wheel_private.hpp"
+
+#include
+#include
+#include
+#include
+
+namespace color_widgets {
+
+
+static const double selector_radius = 6;
+
+
+ColorWheel::ColorWheel(QWidget *parent, Private* data) :
+ QWidget(parent), p(data)
+{
+ p->setup();
+ setAcceptDrops(true);
+}
+
+
+ColorWheel::ColorWheel(QWidget *parent) :
+ ColorWheel(parent, new Private(this))
+{
+
+}
+
+
+ColorWheel::~ColorWheel()
+{
+ delete p;
+}
+
+QColor ColorWheel::color() const
+{
+ return p->color_from(p->hue, p->sat, p->val, 1);
+}
+
+QSize ColorWheel::sizeHint() const
+{
+ return QSize(p->wheel_width*5, p->wheel_width*5);
+}
+
+qreal ColorWheel::hue() const
+{
+ if ( p->color_space == ColorLCH && p->sat > 0.01 )
+ return color().hueF();
+ return p->hue;
+}
+
+qreal ColorWheel::saturation() const
+{
+ return color().hsvSaturationF();
+}
+
+qreal ColorWheel::value() const
+{
+ return color().valueF();
+}
+
+unsigned int ColorWheel::wheelWidth() const
+{
+ return p->wheel_width;
+}
+
+void ColorWheel::setWheelWidth(unsigned int w)
+{
+ p->wheel_width = w;
+ p->render_inner_selector();
+ update();
+ Q_EMIT wheelWidthChanged(w);
+}
+
+void ColorWheel::paintEvent(QPaintEvent * )
+{
+ QPainter painter(this);
+ painter.setRenderHint(QPainter::Antialiasing);
+ painter.translate(geometry().width()/2,geometry().height()/2);
+
+ // hue wheel
+ if(p->hue_ring.isNull())
+ p->render_ring();
+
+ painter.drawPixmap(-p->outer_radius(), -p->outer_radius(), p->hue_ring);
+
+ // hue selector
+ p->draw_ring_editor(p->hue, painter, Qt::black);
+
+ // lum-sat square
+ if(p->inner_selector.isNull())
+ p->render_inner_selector();
+
+ painter.rotate(p->selector_image_angle());
+ painter.translate(p->selector_image_offset());
+
+ QPointF selector_position;
+ if ( p->selector_shape == ShapeSquare )
+ {
+ qreal side = p->square_size();
+ selector_position = QPointF(p->sat*side, p->val*side);
+ }
+ else if ( p->selector_shape == ShapeTriangle )
+ {
+ qreal side = p->triangle_side();
+ qreal height = p->triangle_height();
+ qreal slice_h = side * p->val;
+ qreal ymin = side/2-slice_h/2;
+
+ selector_position = QPointF(p->val*height, ymin + p->sat*slice_h);
+ QPolygonF triangle;
+ triangle.append(QPointF(0,side/2));
+ triangle.append(QPointF(height,0));
+ triangle.append(QPointF(height,side));
+ QPainterPath clip;
+ clip.addPolygon(triangle);
+ painter.setClipPath(clip);
+ }
+
+ painter.drawImage(QRectF(QPointF(0, 0), p->selector_size()), p->inner_selector);
+ painter.setClipping(false);
+
+ // lum-sat selector
+ // we define the color of the selecto based on the background color of the widget
+ // in order to improve to contrast
+ if (p->backgroundIsDark)
+ {
+ bool isWhite = (p->val < 0.65 || p->sat > 0.43);
+ painter.setPen(QPen(isWhite ? Qt::white : Qt::black, 3));
+ }
+ else
+ {
+ painter.setPen(QPen(p->val > 0.5 ? Qt::black : Qt::white, 3));
+ }
+ painter.setBrush(Qt::NoBrush);
+ painter.drawEllipse(selector_position, selector_radius, selector_radius);
+
+}
+
+void ColorWheel::mouseMoveEvent(QMouseEvent *ev)
+{
+ if (p->mouse_status == DragCircle )
+ {
+ auto hue = p->line_to_point(ev->pos()).angle()/360.0;
+ p->hue = hue;
+ p->render_inner_selector();
+
+ Q_EMIT colorSelected(color());
+ Q_EMIT colorChanged(color());
+ update();
+ }
+ else if(p->mouse_status == DragSquare)
+ {
+ QLineF glob_mouse_ln = p->line_to_point(ev->pos());
+ QLineF center_mouse_ln ( QPointF(0,0),
+ glob_mouse_ln.p2() - glob_mouse_ln.p1() );
+
+ center_mouse_ln.setAngle(center_mouse_ln.angle()+p->selector_image_angle());
+ center_mouse_ln.setP2(center_mouse_ln.p2()-p->selector_image_offset());
+
+ if ( p->selector_shape == ShapeSquare )
+ {
+ p->sat = qBound(0.0, center_mouse_ln.x2()/p->square_size(), 1.0);
+ p->val = qBound(0.0, center_mouse_ln.y2()/p->square_size(), 1.0);
+ }
+ else if ( p->selector_shape == ShapeTriangle )
+ {
+ QPointF pt = center_mouse_ln.p2();
+
+ qreal side = p->triangle_side();
+ p->val = qBound(0.0, pt.x() / p->triangle_height(), 1.0);
+ qreal slice_h = side * p->val;
+
+ qreal ycenter = side/2;
+ qreal ymin = ycenter-slice_h/2;
+
+ if ( slice_h > 0 )
+ p->sat = qBound(0.0, (pt.y()-ymin)/slice_h, 1.0);
+ }
+
+ Q_EMIT colorSelected(color());
+ Q_EMIT colorChanged(color());
+ update();
+ }
+}
+
+void ColorWheel::mousePressEvent(QMouseEvent *ev)
+{
+ if ( ev->buttons() & Qt::LeftButton )
+ {
+ setFocus();
+ QLineF ray = p->line_to_point(ev->pos());
+ if ( ray.length() <= p->inner_radius() )
+ p->mouse_status = DragSquare;
+ else if ( ray.length() <= p->outer_radius() )
+ p->mouse_status = DragCircle;
+
+ // Update the color
+ mouseMoveEvent(ev);
+ }
+}
+
+void ColorWheel::mouseReleaseEvent(QMouseEvent *ev)
+{
+ mouseMoveEvent(ev);
+ p->mouse_status = Nothing;
+ if ( ev->button() == Qt::LeftButton )
+ Q_EMIT editingFinished();
+}
+
+void ColorWheel::resizeEvent(QResizeEvent *)
+{
+ p->render_ring();
+ p->render_inner_selector();
+}
+
+void ColorWheel::setColor(QColor c)
+{
+ qreal oldh = p->hue;
+ p->set_color(c);
+ if (!qFuzzyCompare(oldh+1, p->hue+1))
+ p->render_inner_selector();
+ update();
+ Q_EMIT colorChanged(c);
+}
+
+void ColorWheel::setHue(qreal h)
+{
+ p->hue = qBound(0.0, h, 1.0);
+ p->render_inner_selector();
+ update();
+}
+
+void ColorWheel::setSaturation(qreal s)
+{
+ p->sat = qBound(0.0, s, 1.0);
+ update();
+}
+
+void ColorWheel::setValue(qreal v)
+{
+ p->val = qBound(0.0, v, 1.0);
+ update();
+}
+
+color_widgets::ColorWheel::ColorSpaceEnum ColorWheel::colorSpace() const
+{
+ return p->color_space;
+}
+
+bool ColorWheel::rotatingSelector() const
+{
+ return p->rotating_selector;
+}
+
+color_widgets::ColorWheel::ShapeEnum ColorWheel::selectorShape() const
+{
+ return p->selector_shape;
+}
+
+
+void ColorWheel::setColorSpace(color_widgets::ColorWheel::ColorSpaceEnum space)
+{
+ if ( p->color_space != space )
+ {
+ p->color_space = space;
+
+ QColor old_col = color();
+
+ switch ( space )
+ {
+ case ColorHSL:
+ p->hue = old_col.hueF();
+ p->sat = utils::color_HSL_saturationF(old_col);
+ p->val = utils::color_lightnessF(old_col);
+ p->color_from = &utils::color_from_hsl;
+ p->rainbow_from_hue = &utils::rainbow_hsv;
+ break;
+ case ColorHSV:
+ p->hue = old_col.hsvHueF();
+ p->sat = old_col.hsvSaturationF();
+ p->val = old_col.valueF();
+ p->color_from = &QColor::fromHsvF;
+ p->rainbow_from_hue = &utils::rainbow_hsv;
+ break;
+ case ColorLCH:
+ p->hue = old_col.hueF();
+ p->sat = utils::color_chromaF(old_col);
+ p->val = utils::color_lumaF(old_col);
+ p->color_from = &utils::color_from_lch;
+ p->rainbow_from_hue = &utils::rainbow_lch;
+ break;
+ }
+
+ p->render_ring();
+ p->render_inner_selector();
+ update();
+ Q_EMIT colorSpaceChanged(space);
+ }
+}
+
+void ColorWheel::setRotatingSelector(bool rotating)
+{
+ p->rotating_selector = rotating;
+ update();
+ Q_EMIT rotatingSelectorChanged(rotating);
+}
+
+void ColorWheel::setSelectorShape(color_widgets::ColorWheel::ShapeEnum shape)
+{
+ if ( shape != p->selector_shape )
+ {
+ p->selector_shape = shape;
+ update();
+ p->render_inner_selector();
+ Q_EMIT selectorShapeChanged(shape);
+ }
+}
+
+void ColorWheel::dragEnterEvent(QDragEnterEvent* event)
+{
+ if ( event->mimeData()->hasColor() ||
+ ( event->mimeData()->hasText() && QColor(event->mimeData()->text()).isValid() ) )
+ event->acceptProposedAction();
+}
+
+void ColorWheel::dropEvent(QDropEvent* event)
+{
+ if ( event->mimeData()->hasColor() )
+ {
+ setColor(event->mimeData()->colorData().value());
+ event->accept();
+ }
+ else if ( event->mimeData()->hasText() )
+ {
+ QColor col(event->mimeData()->text());
+ if ( col.isValid() )
+ {
+ setColor(col);
+ event->accept();
+ }
+ }
+}
+
+} // namespace color_widgets
diff --git a/external/Qt-Color-Widgets/src/QtColorWidgets/gradient_editor.cpp b/external/Qt-Color-Widgets/src/QtColorWidgets/gradient_editor.cpp
new file mode 100644
index 00000000..9b2642fb
--- /dev/null
+++ b/external/Qt-Color-Widgets/src/QtColorWidgets/gradient_editor.cpp
@@ -0,0 +1,620 @@
+/**
+ * \file gradient_editor.cpp
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "QtColorWidgets/gradient_editor.hpp"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "QtColorWidgets/gradient_helper.hpp"
+#include "QtColorWidgets/color_dialog.hpp"
+
+namespace color_widgets {
+
+class GradientEditor::Private
+{
+public:
+ QGradientStops stops;
+ QBrush back;
+ Qt::Orientation orientation;
+ int highlighted = -1;
+ QLinearGradient gradient;
+ int selected = -1;
+ int drop_index = -1;
+ QColor drop_color;
+ qreal drop_pos = 0;
+ ColorDialog color_dialog;
+ int dialog_selected = -1;
+
+ Private() :
+ back(Qt::darkGray, Qt::DiagCrossPattern)
+ {
+ back.setTexture(QPixmap(QStringLiteral(":/color_widgets/alphaback.png")));
+ gradient.setCoordinateMode(QGradient::StretchToDeviceMode);
+ gradient.setSpread(QGradient::RepeatSpread);
+ }
+
+ void refresh_gradient()
+ {
+ gradient.setStops(stops);
+ }
+
+ qreal paint_pos(const QGradientStop& stop, const GradientEditor* owner)
+ {
+ return 2.5 + stop.first * (owner->geometry().width() - 5);
+ }
+
+ int closest(const QPoint& p, GradientEditor* owner)
+ {
+ if ( stops.empty() )
+ return -1;
+ if ( stops.size() == 1 || owner->geometry().width() <= 5 )
+ return 0;
+ qreal pos = move_pos(p, owner);
+
+ int i = 1;
+ for ( ; i < stops.size()-1; i++ )
+ if ( stops[i].first >= pos )
+ break;
+
+ if ( stops[i].first - pos < pos - stops[i-1].first )
+ return i;
+ return i-1;
+ }
+
+ qreal move_pos(const QPoint& p, GradientEditor* owner)
+ {
+ int width;
+ qreal x;
+ if ( orientation == Qt::Horizontal )
+ {
+ width = owner->geometry().width();
+ x = p.x();
+ }
+ else
+ {
+ width = owner->geometry().height();
+ x = p.y();
+ }
+ return (width > 5) ? qMax(qMin((x - 2.5) / (width - 5), 1.0), 0.0) : 0;
+ }
+
+ void drop_event(QDropEvent* event, GradientEditor* owner)
+ {
+ drop_index = closest(event->pos(), owner);
+ drop_pos = move_pos(event->pos(), owner);
+ if ( drop_index == -1 )
+ drop_index = stops.size();
+
+ // Gather up the color
+ if ( event->mimeData()->hasColor() )
+ drop_color = event->mimeData()->colorData().value();
+ else if ( event->mimeData()->hasText() )
+ drop_color = QColor(event->mimeData()->text());
+
+ owner->update();
+ }
+
+ void clear_drop(GradientEditor* owner)
+ {
+ drop_index = -1;
+ drop_color = QColor();
+ owner->update();
+ }
+
+ void add_stop_data(int& index, qreal& pos, QColor& color)
+ {
+ if ( stops.empty() )
+ {
+ index = 0;
+ pos = 0;
+ color = Qt::black;
+ return;
+ }
+ if ( stops.size() == 1 )
+ {
+ color = stops[0].second;
+ if ( stops[0].first == 1 )
+ {
+ index = 0;
+ pos = 0.5;
+ }
+ else
+ {
+ index = 1;
+ pos = (stops[0].first + 1) / 2;
+ }
+ return;
+ }
+
+ int i_before = selected;
+ if ( i_before == -1 )
+ i_before = stops.size() - 1;
+
+ if ( i_before == stops.size() - 1 )
+ {
+ if ( stops[i_before].first < 1 )
+ {
+ color = stops[i_before].second;
+ pos = (stops[i_before].first + 1) / 2;
+ index = stops.size();
+ return;
+ }
+ i_before--;
+ }
+
+ index = i_before + 1;
+ pos = (stops[i_before].first + stops[i_before+1].first) / 2;
+ color = blendColors(stops[i_before].second, stops[i_before+1].second, 0.5);
+ }
+
+ void add_color_mouse(QMouseEvent* ev, GradientEditor* parent)
+ {
+ qreal pos = move_pos(ev->pos(), parent);
+ auto info = gradientBlendedColorInsert(stops, pos);
+ stops.insert(info.first, info.second);
+ selected = highlighted = info.first;
+ refresh_gradient();
+ }
+
+ void show_dialog_highlighted()
+ {
+ if ( highlighted == -1 )
+ return;
+
+ dialog_selected = highlighted;
+ color_dialog.setColor(stops[highlighted].second);
+ color_dialog.show();
+ }
+};
+
+GradientEditor::GradientEditor(QWidget *parent) :
+ GradientEditor(Qt::Horizontal, parent)
+{}
+
+GradientEditor::GradientEditor(Qt::Orientation orientation, QWidget *parent) :
+ QWidget(parent), p(new Private)
+{
+ p->orientation = orientation;
+ setMouseTracking(true);
+ resize(sizeHint());
+ setAcceptDrops(true);
+
+ p->color_dialog.setParent(this);
+ p->color_dialog.setWindowFlags(Qt::Dialog);
+ p->color_dialog.setWindowModality(Qt::WindowModal);
+
+ connect(&p->color_dialog, &ColorDialog::colorSelected, this, &GradientEditor::dialogUpdate);
+}
+
+GradientEditor::~GradientEditor()
+{
+ p->color_dialog.setParent(nullptr);
+ delete p;
+}
+
+void GradientEditor::dialogUpdate(const QColor& c)
+{
+ if ( p->dialog_selected != -1 )
+ {
+ p->stops[p->dialog_selected].second = c;
+ p->dialog_selected = -1;
+ p->refresh_gradient();
+ Q_EMIT stopsChanged(p->stops);
+ update();
+ }
+}
+
+void GradientEditor::mouseDoubleClickEvent(QMouseEvent *ev)
+{
+ if ( ev->button() == Qt::LeftButton )
+ {
+ ev->accept();
+ if ( p->highlighted != -1 )
+ {
+ qreal highlighted_pos = p->paint_pos(p->stops[p->highlighted], this);
+ qreal mouse_pos = orientation() == Qt::Vertical ? ev->pos().y() : ev->pos().x();
+ qreal tolerance = 4;
+ if ( qAbs(mouse_pos - highlighted_pos) <= tolerance )
+ {
+ p->show_dialog_highlighted();
+ return;
+ }
+ }
+
+ p->add_color_mouse(ev, this);
+ Q_EMIT selectedStopChanged(p->selected);
+ update();
+ }
+ else
+ {
+ QWidget::mousePressEvent(ev);
+ }
+}
+
+void GradientEditor::mousePressEvent(QMouseEvent *ev)
+{
+ if ( ev->button() == Qt::LeftButton )
+ {
+ ev->accept();
+ p->selected = p->highlighted = p->closest(ev->pos(), this);
+ emit selectedStopChanged(p->selected);
+ update();
+ }
+ else
+ {
+ QWidget::mousePressEvent(ev);
+ }
+}
+
+void GradientEditor::mouseMoveEvent(QMouseEvent *ev)
+{
+ if ( ev->buttons() & Qt::LeftButton && p->selected != -1 )
+ {
+ ev->accept();
+ qreal pos = p->move_pos(ev->pos(), this);
+ if ( p->selected > 0 && pos < p->stops[p->selected-1].first )
+ {
+ std::swap(p->stops[p->selected], p->stops[p->selected-1]);
+ p->selected--;
+ Q_EMIT selectedStopChanged(p->selected);
+ }
+ else if ( p->selected < p->stops.size()-1 && pos > p->stops[p->selected+1].first )
+ {
+ std::swap(p->stops[p->selected], p->stops[p->selected+1]);
+ p->selected++;
+ Q_EMIT selectedStopChanged(p->selected);
+ }
+ p->highlighted = p->selected;
+ p->stops[p->selected].first = pos;
+ p->refresh_gradient();
+ update();
+ }
+ else
+ {
+ p->highlighted = p->closest(ev->pos(), this);
+ update();
+ }
+}
+
+void GradientEditor::mouseReleaseEvent(QMouseEvent *ev)
+{
+ if ( ev->button() == Qt::LeftButton && p->selected != -1 )
+ {
+ ev->accept();
+ QRect bound_rect = rect();
+ QPoint localpt = ev->localPos().toPoint();
+ const int w_margin = 24;
+ const int h_margin = 8;
+ bool x_out = localpt.x() < -w_margin || localpt.x() > bound_rect.width() + w_margin;
+ bool y_out = localpt.y() < -h_margin || localpt.y() > bound_rect.height() + h_margin;
+
+ if ( p->stops.size() > 1 && (
+ (orientation() == Qt::Horizontal && !x_out && y_out) ||
+ (orientation() == Qt::Vertical && x_out && !y_out)
+ ))
+ {
+ p->stops.remove(p->selected);
+ p->highlighted = p->selected = p->dialog_selected = -1;
+ p->refresh_gradient();
+ Q_EMIT selectedStopChanged(p->selected);
+ }
+
+ Q_EMIT stopsChanged(p->stops);
+ update();
+ }
+ else if ( ev->button() == Qt::RightButton )
+ {
+ QMenu menu(this);
+ menu.addAction(QIcon::fromTheme("list-add"), tr("Add Color"), this, [this, ev]{
+ p->add_color_mouse(ev, this);
+ Q_EMIT selectedStopChanged(p->selected);
+ Q_EMIT stopsChanged(p->stops);
+ update();
+ });
+ if ( p->highlighted != -1 )
+ {
+ int h = p->highlighted; // leaveEvent resets it when showing the menu
+ menu.addAction(QIcon::fromTheme("list-remove"), tr("Remove Color"), this, [this, h]{
+ p->stops.remove(h);
+ p->highlighted = -1;
+ p->refresh_gradient();
+ Q_EMIT selectedStopChanged(p->selected);
+ Q_EMIT stopsChanged(p->stops);
+ update();
+ });
+ menu.addAction(QIcon::fromTheme("document-edit"), tr("Edit Color..."), this, [this, h]{
+ p->highlighted = h;
+ p->show_dialog_highlighted();
+ });
+ }
+
+ menu.exec(ev->globalPos());
+ }
+ else
+ {
+ QWidget::mousePressEvent(ev);
+ }
+}
+
+void GradientEditor::leaveEvent(QEvent*)
+{
+ p->highlighted = -1;
+ update();
+}
+
+
+QBrush GradientEditor::background() const
+{
+ return p->back;
+}
+
+void GradientEditor::setBackground(const QBrush &bg)
+{
+ p->back = bg;
+ update();
+ Q_EMIT backgroundChanged(bg);
+}
+
+QGradientStops GradientEditor::stops() const
+{
+ return p->stops;
+}
+
+void GradientEditor::setStops(const QGradientStops &colors)
+{
+ p->selected = p->highlighted = p->dialog_selected = -1;
+ p->stops = colors;
+ p->refresh_gradient();
+ emit selectedStopChanged(p->selected);
+ emit stopsChanged(p->stops);
+ update();
+}
+
+QLinearGradient GradientEditor::gradient() const
+{
+ return p->gradient;
+}
+
+void GradientEditor::setGradient(const QLinearGradient &gradient)
+{
+ setStops(gradient.stops());
+}
+
+Qt::Orientation GradientEditor::orientation() const
+{
+ return p->orientation;
+}
+
+void GradientEditor::setOrientation(Qt::Orientation orientation)
+{
+ p->orientation = orientation;
+ update();
+}
+
+
+void GradientEditor::paintEvent(QPaintEvent *)
+{
+ QPainter painter(this);
+
+ QStyleOptionFrame panel;
+ panel.initFrom(this);
+ panel.lineWidth = 1;
+ panel.midLineWidth = 0;
+ panel.state |= QStyle::State_Sunken;
+ style()->drawPrimitive(QStyle::PE_Frame, &panel, &painter, this);
+ QRect r = style()->subElementRect(QStyle::SE_FrameContents, &panel, this);
+ painter.setClipRect(r);
+
+
+ if(orientation() == Qt::Horizontal)
+ p->gradient.setFinalStop(1, 0);
+ else
+ p->gradient.setFinalStop(0, -1);
+
+ painter.setPen(Qt::NoPen);
+ painter.setBrush(p->back);
+ painter.drawRect(1,1,geometry().width()-2,geometry().height()-2);
+ painter.setBrush(p->gradient);
+ painter.drawRect(1,1,geometry().width()-2,geometry().height()-2);
+
+ /// \todo Take orientation into account
+ int i = 0;
+ for ( const QGradientStop& stop : p->stops )
+ {
+ QColor color = stop.second;
+ Qt::GlobalColor border_color = Qt::black;
+ Qt::GlobalColor core_color = Qt::white;
+
+ if ( color.valueF() <= 0.5 && color.alphaF() >= 0.5 )
+ std::swap(core_color, border_color);
+
+ QPointF p1 = QPointF(p->paint_pos(stop, this), 2.5);
+ QPointF p2 = p1 + QPointF(0, geometry().height() - 5);
+ if ( i == p->selected )
+ {
+ painter.setPen(QPen(border_color, 5));
+ painter.drawLine(p1, p2);
+ painter.setPen(QPen(core_color, 3));
+ painter.drawLine(p1, p2);
+ }
+ else if ( i == p->highlighted )
+ {
+ painter.setPen(QPen(border_color, 3));
+ painter.drawLine(p1, p2);
+ painter.setPen(QPen(core_color, 1));
+ painter.drawLine(p1, p2);
+ }
+ else
+ {
+ painter.setPen(QPen(border_color, 3));
+ painter.drawLine(p1, p2);
+ }
+
+ i++;
+ }
+
+ if ( p->drop_index != -1 && p->drop_color.isValid() )
+ {
+ qreal pos = p->drop_pos * (geometry().width() - 5);
+ painter.setPen(QPen(p->drop_color, 3));
+ QPointF p1 = QPointF(2.5, 2.5) + QPointF(pos, 0);
+ QPointF p2 = p1 + QPointF(0, geometry().height() - 5);
+ painter.drawLine(p1, p2);
+ }
+
+}
+
+QSize GradientEditor::sizeHint() const
+{
+ QStyleOptionSlider opt;
+ opt.orientation = p->orientation;
+
+ int w = style()->pixelMetric(QStyle::PM_SliderThickness, &opt, this);
+ int h = std::max(84, style()->pixelMetric(QStyle::PM_SliderLength, &opt, this));
+ if ( p->orientation == Qt::Horizontal )
+ {
+ std::swap(w, h);
+ }
+ QSlider s;
+ return style()->sizeFromContents(QStyle::CT_Slider, &opt, QSize(w, h), &s)
+ .expandedTo(QApplication::globalStrut());
+}
+
+int GradientEditor::selectedStop() const
+{
+ return p->selected;
+}
+
+void GradientEditor::setSelectedStop(int stop)
+{
+ if ( stop >= -1 && stop < p->stops.size() )
+ {
+ p->selected = stop;
+ emit selectedStopChanged(p->selected);
+ }
+}
+
+QColor GradientEditor::selectedColor() const
+{
+ if ( p->selected != -1 )
+ return p->stops[p->selected].second;
+ return {};
+}
+
+void GradientEditor::setSelectedColor(const QColor& color)
+{
+ if ( p->selected != -1 )
+ {
+ p->stops[p->selected].second = color;
+ p->refresh_gradient();
+ update();
+ }
+}
+
+
+void GradientEditor::dragEnterEvent(QDragEnterEvent *event)
+{
+ p->drop_event(event, this);
+
+ if ( p->drop_color.isValid() && p->drop_index != -1 )
+ {
+ event->setDropAction(Qt::CopyAction);
+ event->accept();
+ }
+}
+
+void GradientEditor::dragMoveEvent(QDragMoveEvent* event)
+{
+ p->drop_event(event, this);
+}
+
+void GradientEditor::dragLeaveEvent(QDragLeaveEvent *)
+{
+ p->clear_drop(this);
+}
+
+void GradientEditor::dropEvent(QDropEvent *event)
+{
+ p->drop_event(event, this);
+
+ if ( !p->drop_color.isValid() || p->drop_index == -1 )
+ return;
+
+ p->stops.insert(p->drop_index, {p->drop_pos, p->drop_color});
+ p->refresh_gradient();
+ p->selected = p->drop_index;
+ event->accept();
+ p->clear_drop(this);
+ emit selectedStopChanged(p->selected);
+}
+
+void GradientEditor::addStop()
+{
+ int index = -1;
+ qreal pos = 0;
+ QColor color;
+ p->add_stop_data(index, pos, color);
+ p->stops.insert(index, {pos, color});
+ p->selected = p->highlighted = index;
+ p->refresh_gradient();
+ update();
+ emit selectedStopChanged(p->selected);
+}
+
+void GradientEditor::removeStop()
+{
+ if ( p->stops.size() < 2 )
+ return;
+
+ int selected = p->selected;
+ if ( selected == -1 )
+ selected = p->stops.size() - 1;
+ p->stops.remove(selected);
+ p->refresh_gradient();
+
+ if ( p->selected != -1 )
+ {
+ p->selected = -1;
+ emit selectedStopChanged(p->selected);
+ }
+
+ p->dialog_selected = -1;
+
+ update();
+
+}
+
+ColorDialog * GradientEditor::dialog() const
+{
+ return &p->color_dialog;
+}
+
+
+} // namespace color_widgets
diff --git a/external/Qt-Color-Widgets/src/QtColorWidgets/gradient_list_model.cpp b/external/Qt-Color-Widgets/src/QtColorWidgets/gradient_list_model.cpp
new file mode 100644
index 00000000..afe9dd6a
--- /dev/null
+++ b/external/Qt-Color-Widgets/src/QtColorWidgets/gradient_list_model.cpp
@@ -0,0 +1,317 @@
+/**
+ * \file
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+#include "QtColorWidgets/gradient_list_model.hpp"
+
+#include
+#include
+#include
+
+class color_widgets::GradientListModel::Private
+{
+public:
+ struct Gradient
+ {
+ QLinearGradient gradient;
+ QString name;
+ };
+
+ QVector gradients;
+ QSize icon_size{48, 32};
+ QBrush background;
+ ItemEditMode edit_mode = EditNone;
+
+ Private()
+ {
+ background.setTexture(QPixmap(QStringLiteral(":/color_widgets/alphaback.png")));
+ }
+
+ int find(const QString& name)
+ {
+ for ( int i = 0; i < gradients.size(); i++ )
+ if ( gradients[0].name == name )
+ return i;
+ return -1;
+ }
+
+ bool contains(const QString& name)
+ {
+ return find(name) != -1;
+ }
+
+ bool acceptable(const QModelIndex& index) const
+ {
+ return acceptable(index.row());
+ }
+
+ bool acceptable(int row) const
+ {
+ return row >= 0 && row < gradients.size();
+ }
+
+ QPixmap preview(const QLinearGradient& grad)
+ {
+ QPixmap out (icon_size);
+ QPainter painter(&out);
+ QRect r({0, 0}, icon_size);
+ painter.fillRect(r, background);
+ painter.fillRect(r, grad);
+ return out;
+ }
+
+ QLinearGradient make_gradient(const QGradientStops& gradient_stops)
+ {
+ QLinearGradient gradient(0, 0, 1, 0);
+ gradient.setCoordinateMode(QGradient::StretchToDeviceMode);
+ gradient.setSpread(QGradient::RepeatSpread);
+ gradient.setStops(gradient_stops);
+ return gradient;
+ }
+};
+
+color_widgets::GradientListModel::GradientListModel(QObject *parent)
+ : QAbstractListModel(parent), d(new Private())
+{
+}
+
+color_widgets::GradientListModel::~GradientListModel() = default;
+
+
+int color_widgets::GradientListModel::count() const
+{
+ return d->gradients.size();
+}
+
+void color_widgets::GradientListModel::clear()
+{
+ beginResetModel();
+ d->gradients.clear();
+ endResetModel();
+}
+
+QSize color_widgets::GradientListModel::iconSize() const
+{
+ return d->icon_size;
+}
+
+void color_widgets::GradientListModel::setIconSize ( const QSize& iconSize )
+{
+ d->icon_size = iconSize;
+ Q_EMIT iconSizeChanged(d->icon_size);
+}
+
+int color_widgets::GradientListModel::setGradient ( const QString& name, const QGradient& gradient )
+{
+ return setGradient(name, gradient.stops());
+}
+
+
+int color_widgets::GradientListModel::setGradient ( const QString& name, const QGradientStops& gradient_stops )
+{
+ int index = d->find(name);
+ if ( index != -1 )
+ {
+ return setGradient(index, gradient_stops);
+ }
+
+ index = d->gradients.size();
+ beginInsertRows(QModelIndex(), index, index);
+ d->gradients.push_back({d->make_gradient(gradient_stops), name});
+ endInsertRows();
+ return index;
+}
+
+bool color_widgets::GradientListModel::setGradient(int index, const QGradient& gradient)
+{
+ return setGradient(index, gradient.stops());
+}
+
+bool color_widgets::GradientListModel::setGradient(int index, const QGradientStops& gradient_stops)
+{
+ if ( index < 0 || index > d->gradients.size() )
+ return false;
+
+ d->gradients[index].gradient.setStops(gradient_stops);
+ QModelIndex mindex = createIndex(index, 0);
+ Q_EMIT dataChanged(mindex, mindex, {Qt::DecorationRole, Qt::ToolTipRole});
+ return true;
+}
+
+
+
+QGradientStops color_widgets::GradientListModel::gradientStops ( const QString& name ) const
+{
+ auto iter = d->find(name);
+ if ( iter != -1 )
+ return d->gradients[iter].gradient.stops();
+ return {};
+}
+
+QGradientStops color_widgets::GradientListModel::gradientStops ( int index ) const
+{
+ if ( d->acceptable(index) )
+ return d->gradients[index].gradient.stops();
+ return {};
+}
+
+const QLinearGradient & color_widgets::GradientListModel::gradient ( int index ) const
+{
+ return d->gradients[index].gradient;
+}
+
+const QLinearGradient & color_widgets::GradientListModel::gradient ( const QString& name ) const
+{
+ return d->gradients[d->find(name)].gradient;
+}
+
+int color_widgets::GradientListModel::indexFromName ( const QString& name ) const
+{
+ return d->find(name);
+}
+
+int color_widgets::GradientListModel::rowCount ( const QModelIndex& ) const
+{
+ return d->gradients.size();
+}
+
+bool color_widgets::GradientListModel::hasGradient ( const QString& name ) const
+{
+ return d->contains(name);
+}
+
+bool color_widgets::GradientListModel::removeGradient ( int index )
+{
+ if ( !d->acceptable(index) )
+ return false;
+
+ beginRemoveRows(QModelIndex{}, index, index);
+ d->gradients.erase(d->gradients.begin() + index);
+ endRemoveRows();
+ return true;
+}
+
+bool color_widgets::GradientListModel::removeGradient ( const QString& name )
+{
+ return removeGradient(d->find(name));
+}
+
+QVariant color_widgets::GradientListModel::data ( const QModelIndex& index, int role ) const
+{
+ if ( !d->acceptable(index) )
+ return QVariant();
+
+
+ const auto& gradient = d->gradients[index.row()];
+ switch( role )
+ {
+ case Qt::DisplayRole:
+ return gradient.name;
+ case Qt::DecorationRole:
+ return d->preview(gradient.gradient);
+ case Qt::ToolTipRole:
+ return tr("%1 (%2 colors)").arg(gradient.name).arg(gradient.gradient.stops().size());
+ case Qt::EditRole:
+ if ( d->edit_mode == EditGradient )
+ return QBrush(gradient.gradient);
+ else if ( d->edit_mode == EditName )
+ return gradient.name;
+ return {};
+ }
+
+ return QVariant();
+}
+
+bool color_widgets::GradientListModel::rename(int index, const QString& new_name)
+{
+ if ( !d->acceptable(index) || d->contains(new_name) )
+ return false;
+
+ QModelIndex mindex = createIndex(index, 0);
+ d->gradients[index].name = new_name;
+ Q_EMIT dataChanged(mindex, mindex, {Qt::DisplayRole, Qt::ToolTipRole});
+ return true;
+}
+
+bool color_widgets::GradientListModel::rename(const QString& old_name, const QString& new_name)
+{
+ return rename(d->find(old_name), new_name);
+}
+
+Qt::ItemFlags color_widgets::GradientListModel::flags(const QModelIndex& index) const
+{
+ auto flags = QAbstractListModel::flags(index);
+ if ( d->edit_mode )
+ flags |= Qt::ItemIsEditable;
+ return flags;
+}
+
+bool color_widgets::GradientListModel::setData(const QModelIndex& index, const QVariant& value, int role)
+{
+ if ( !d->acceptable(index) )
+ return false;
+
+ if ( role == Qt::DisplayRole )
+ {
+ return rename(index.row(), value.toString());
+ }
+ else if ( role == Qt::EditRole )
+ {
+ if ( d->edit_mode == EditName )
+ return rename(index.row(), value.toString());
+
+ if ( d->edit_mode == EditGradient )
+ {
+ const QGradient* grad = value.value().gradient();
+ if ( !grad )
+ return false;
+ return setGradient(index.row(), *grad);
+ }
+ }
+
+ return false;
+}
+
+color_widgets::GradientListModel::ItemEditMode color_widgets::GradientListModel::editMode() const
+{
+ return d->edit_mode;
+}
+
+void color_widgets::GradientListModel::setEditMode(color_widgets::GradientListModel::ItemEditMode mode)
+{
+ d->edit_mode = mode;
+ Q_EMIT editModeChanged(mode);
+}
+
+QBrush color_widgets::GradientListModel::gradientBrush(int index) const
+{
+ if ( d->acceptable(index) )
+ return QBrush(d->gradients[index].gradient);
+ return {};
+}
+
+QString color_widgets::GradientListModel::nameFromIndex(int index) const
+{
+ if ( d->acceptable(index) )
+ return d->gradients[index].name;
+ return {};
+}
+
diff --git a/external/Qt-Color-Widgets/src/QtColorWidgets/gradient_slider.cpp b/external/Qt-Color-Widgets/src/QtColorWidgets/gradient_slider.cpp
new file mode 100644
index 00000000..44f378dd
--- /dev/null
+++ b/external/Qt-Color-Widgets/src/QtColorWidgets/gradient_slider.cpp
@@ -0,0 +1,276 @@
+/**
+ * \file gradient_slider.cpp
+ *
+ * \author Mattia Basaglia
+ *
+ * \copyright Copyright (C) 2013-2020 Mattia Basaglia
+ * \copyright Copyright (C) 2014 Calle Laakkonen
+ * \copyright Copyright (C) 2017 caryoscelus
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#include "QtColorWidgets/gradient_slider.hpp"
+
+#include
+#include
+#include
+#include
+#include
+
+static void loadResource()
+{
+ static bool loaded = false;
+ if ( !loaded )
+ {
+ Q_INIT_RESOURCE(color_widgets);
+ loaded = true;
+ }
+}
+
+namespace color_widgets {
+
+class GradientSlider::Private
+{
+public:
+ QLinearGradient gradient;
+ QBrush back;
+
+ Private() :
+ back(Qt::darkGray, Qt::DiagCrossPattern)
+ {
+ loadResource();
+ back.setTexture(QPixmap(QStringLiteral(":/color_widgets/alphaback.png")));
+ gradient.setCoordinateMode(QGradient::StretchToDeviceMode);
+ gradient.setSpread(QGradient::RepeatSpread);
+ }
+
+ void mouse_event(QMouseEvent *ev, GradientSlider* owner)
+ {
+ qreal pos = (owner->geometry().width() > 5) ?
+ static_cast(ev->pos().x() - 2.5) / (owner->geometry().width() - 5) : 0;
+ pos = qMax(qMin(pos, 1.0), 0.0);
+ owner->setSliderPosition(qRound(owner->minimum() +
+ pos * (owner->maximum() - owner->minimum())));
+ }
+
+};
+
+GradientSlider::GradientSlider(QWidget *parent) :
+ GradientSlider(Qt::Horizontal, parent)
+{}
+
+GradientSlider::GradientSlider(Qt::Orientation orientation, QWidget *parent) :
+ QSlider(orientation, parent), p(new Private)
+{
+ setTickPosition(NoTicks);
+}
+
+GradientSlider::~GradientSlider()
+{
+ delete p;
+}
+
+void GradientSlider::mousePressEvent(QMouseEvent *ev)
+{
+ if ( ev->button() == Qt::LeftButton )
+ {
+ ev->accept();
+ setSliderDown(true);
+ p->mouse_event(ev, this);
+ update();
+ }
+ else
+ {
+ QSlider::mousePressEvent(ev);
+ }
+}
+
+void GradientSlider::mouseMoveEvent(QMouseEvent *ev)
+{
+ if ( ev->buttons() & Qt::LeftButton )
+ {
+ ev->accept();
+ p->mouse_event(ev, this);
+ update();
+ }
+ else
+ {
+ QSlider::mouseMoveEvent(ev);
+ }
+}
+
+void GradientSlider::mouseReleaseEvent(QMouseEvent *ev)
+{
+ if ( ev->button() == Qt::LeftButton )
+ {
+ ev->accept();
+ setSliderDown(false);
+ update();
+ }
+ else
+ {
+ QSlider::mousePressEvent(ev);
+ }
+}
+
+QBrush GradientSlider::background() const
+{
+ return p->back;
+}
+
+void GradientSlider::setBackground(const QBrush &bg)
+{
+ p->back = bg;
+ update();
+ Q_EMIT backgroundChanged(bg);
+}
+
+QGradientStops GradientSlider::colors() const
+{
+ return p->gradient.stops();
+}
+
+void GradientSlider::setColors(const QGradientStops &colors)
+{
+ p->gradient.setStops(colors);
+ update();
+}
+
+QLinearGradient GradientSlider::gradient() const
+{
+ return p->gradient;
+}
+
+void GradientSlider::setGradient(const QLinearGradient &gradient)
+{
+ p->gradient = gradient;
+ update();
+}
+
+void GradientSlider::setColors(const QVector &colors)
+{
+ QGradientStops stops;
+ stops.reserve(colors.size());
+
+ double c = colors.size() - 1;
+ if(c==0) {
+ stops.append(QGradientStop(0, colors.at(0)));
+
+ } else {
+ for(int i=0;i